Nektar++
Loading...
Searching...
No Matches
FwdTransBCOp.hpp
Go to the documentation of this file.
1///////////////////////////////////////////////////////////////////////////////
2//
3// File: FwdTransBCOp.hpp
4//
5// For more information, please see: http://www.nektar.info
6//
7// The MIT License
8//
9// Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
10// Department of Aeronautics, Imperial College London (UK), and Scientific
11// Computing and Imaging Institute, University of Utah (USA).
12//
13// Permission is hereby granted, free of charge, to any person obtaining a
14// copy of this software and associated documentation files (the "Software"),
15// to deal in the Software without restriction, including without limitation
16// the rights to use, copy, modify, merge, publish, distribute, sublicense,
17// and/or sell copies of the Software, and to permit persons to whom the
18// Software is furnished to do so, subject to the following conditions:
19//
20// The above copyright notice and this permission notice shall be included
21// in all copies or substantial portions of the Software.
22//
23// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29// DEALINGS IN THE SOFTWARE.
30//
31// Description:
32//
33///////////////////////////////////////////////////////////////////////////////
34
35#pragma once
36
39
41
43{
44
45// FwdTransBC base class
46// Defines the apply operator to enforce apply parameter types
47template <typename TData> class FwdTransBCOp : public Operator<TData>
48{
49public:
50 static std::shared_ptr<FwdTransBCOp<TData>> Create(
51 const MultiRegions::ExpListSharedPtr &expansionList,
52 const std::vector<std::string> &components,
53 const std::string &execStr = "")
54 {
55 auto session = expansionList->GetSession();
56
57 std::string execStr0 = (execStr == "")
59 : execStr;
60
61 auto op = Operator<TData>::template Create<FwdTransBCOp>(
62 expansionList, components, execStr0);
63
64 auto blockAttr =
65 MultiRegions::GetBlockAttributes<TData, FieldState::Coeff>(
66 expansionList,
67 MultiRegions::UnitInterleaveWidths(expansionList));
68
69 // Loop over the blocks.
70 for (unsigned int block_idx = 0; block_idx < blockAttr.size();
71 block_idx++)
72 {
73 const auto exp_idx =
74 MultiRegions::GetCollection(expansionList, block_idx)
75 .GetExpVector()[0]
76 ->GetElmtId();
77 const auto exp = expansionList->GetExp(exp_idx);
78 op->m_blockOp.push_back(FwdTransBCBlockOp<TData>::Create(
79 block_idx, exp, expansionList->GetDataWarehouseSharedPtr(),
80 execStr0));
81
82 std::vector<TData> dmat;
83 const auto nmInt = exp->GetNcoeffs() - exp->NumBndryCoeffs();
84 const auto deformed =
85 exp->GetGeomFactors()->GetGtype() == SpatialDomains::eDeformed;
86 const auto nelmt = blockAttr[block_idx].GetNumElements();
87 const auto nelmtPad =
88 blockAttr[block_idx].GetNumElementsWithPadding();
89 const auto shapeType = exp->DetShapeType();
90
91 if (deformed)
92 {
93 dmat.resize(nelmtPad * nmInt * nmInt);
94 auto dmatptr = dmat.data();
95 for (size_t e = 0; e < nelmt; ++e)
96 {
97 const auto expe = expansionList->GetExp(exp_idx + e);
98
99 // Get statically condensed matrix system for interior
100 // matrix
102 shapeType, *expe);
103 const auto &InvIntMass =
104 expe->GetLocStaticCondMatrix(masskey)->GetBlock(1, 1);
105 std::copy_n(InvIntMass->GetRawPtr(), nmInt * nmInt,
106 dmatptr);
107 dmatptr += nmInt * nmInt;
108 }
109 }
110
111 op->m_blockOp[block_idx]->SetInvMassMatrix(dmat);
112 }
113
114 return op;
115 }
116
117 static inline const std::string name = "FwdTransBC";
118
124
130
131protected:
132 std::vector<std::shared_ptr<FwdTransBCBlockOp<TData>>> m_blockOp;
133
135 const std::vector<std::string> &components)
136 : Operator<TData>(expansionList, components)
137 {
138 }
139
140 ~FwdTransBCOp() override = default;
141
142 virtual void v_Apply(
145};
146
147} // namespace Nektar::MultiRegions
Whole-field operator base class and factory machinery shared by every operator family in the MultiReg...
LibUtilities::SessionReaderSharedPtr session
std::vector< LocalRegions::ExpansionSharedPtr > & GetExpVector()
Definition Collection.h:102
A Field represents expansion data to be operated on.
std::vector< std::shared_ptr< FwdTransBCBlockOp< TData > > > m_blockOp
FwdTransBCOp(const MultiRegions::ExpListSharedPtr &expansionList, const std::vector< std::string > &components)
void Apply(LibUtilities::Field< TData, FieldState::Phys > &in, LibUtilities::Field< TData, FieldState::Coeff > &out)
static std::shared_ptr< FwdTransBCOp< TData > > Create(const MultiRegions::ExpListSharedPtr &expansionList, const std::vector< std::string > &components, const std::string &execStr="")
virtual void v_Apply(LibUtilities::Field< TData, FieldState::Phys > &in, LibUtilities::Field< TData, FieldState::Coeff > &out)=0
void operator()(LibUtilities::Field< TData, FieldState::Phys > &in, LibUtilities::Field< TData, FieldState::Coeff > &out)
static const std::string name
Common base class of the operator family interfaces: holds the expansion list, component names and da...
Definition Operator.hpp:100
std::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
Collections::Collection GetCollection(MultiRegions::ExpListSharedPtr expansionList, unsigned int block_idx)
@ eDeformed
Geometry is curved or has non-constant factors.