Nektar++
ExpListHomogeneous2D.h
Go to the documentation of this file.
1///////////////////////////////////////////////////////////////////////////////
2//
3// File: ExpListHomogeneous2D.h
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: Base class for expansions which are homogeneous in 2
32// directions
33//
34///////////////////////////////////////////////////////////////////////////////
35
36#ifndef EXPLISTHOMO2D_H
37#define EXPLISTHOMO2D_H
43#include <vector>
44
45namespace Nektar
46{
47namespace MultiRegions
48{
49
51{
60};
61
62/// A map between homo matrix keys and their associated block
63/// matrices.
64typedef std::map<Homogeneous2DMatType, DNekBlkMatSharedPtr>
66/// A shared pointer to a BlockMatrixMap.
67typedef std::shared_ptr<Homo2DBlockMatrixMap> Homo2DBlockMatrixMapShPtr;
68
69// Forward declaration for typedefs
71
72/// Shared pointer to an ExpList3DHomogeneous2D object.
73typedef std::shared_ptr<ExpListHomogeneous2D> ExpListHomogeneous2DSharedPtr;
74/// Vector of pointers to ExpList3DHomogeneous2D objects.
75typedef std::vector<ExpListHomogeneous2DSharedPtr> ExpListHomogeneous2DVector;
76
77/// Abstraction of a two-dimensional multi-elemental expansion which
78/// is merely a collection of local expansions.
80{
81public:
82 /// Default constructor.
84
86 const ExpansionType type,
88 const LibUtilities::BasisKey &HomoBasis_y,
89 const LibUtilities::BasisKey &HomoBasis_z, const NekDouble ly,
90 const NekDouble lz, const bool useFFT, const bool dealiasing);
91
92 /// Copy constructor.
94
96 const ExpListHomogeneous2D &In, const std::vector<unsigned int> &eIDs);
97 /// Destructor.
99
101 const int npts, const Array<OneD, const NekDouble> &inarray,
102 Array<OneD, NekDouble> &outarray, bool IsForwards, bool Shuff = true,
103 bool UnShuff = true);
104
106
108 const Array<OneD, const NekDouble> &inarray,
110 Array<OneD, NekDouble> &out_d2);
111
113 Direction edir, const Array<OneD, const NekDouble> &inarray,
115
116 /// FFT variables
122
126
127protected:
128 /// Definition of the total number of degrees of freedom and
129 /// quadrature points. Sets up the storage for \a m_coeff and \a
130 /// m_phys.
132 m_homogeneousBasis_y; ///< Base expansion in y direction
134 m_homogeneousBasis_z; ///< Base expansion in z direction
136 m_paddingBasis_y; ///< Base expansion in y direction
138 m_paddingBasis_z; ///< Base expansion in z direction
139 NekDouble m_lhom_y; ///< Width of homogeneous direction y
140 NekDouble m_lhom_z; ///< Width of homogeneous direction z
143 m_lines; ///< Vector of ExpList, will be filled with ExpList1D
144 int m_ny; ///< Number of modes = number of poitns in y direction
145 int m_nz; ///< Number of modes = number of poitns in z direction
146
148 Homogeneous2DMatType mattype) const;
149
151 Homogeneous2DMatType mattype) const;
152
153 // virtual functions
154 virtual size_t v_GetNumElmts(void) override
155 {
156 return m_lines[0]->GetExpSize();
157 }
158
159 virtual void v_FwdTrans(const Array<OneD, const NekDouble> &inarray,
160 Array<OneD, NekDouble> &outarray) override;
161
162 virtual void v_FwdTransLocalElmt(
163 const Array<OneD, const NekDouble> &inarray,
164 Array<OneD, NekDouble> &outarray) override;
165
166 virtual void v_FwdTransBndConstrained(
167 const Array<OneD, const NekDouble> &inarray,
168 Array<OneD, NekDouble> &outarray) override;
169
170 virtual void v_BwdTrans(const Array<OneD, const NekDouble> &inarray,
171 Array<OneD, NekDouble> &outarray) override;
172
173 virtual void v_IProductWRTBase(const Array<OneD, const NekDouble> &inarray,
174 Array<OneD, NekDouble> &outarray) override;
175
176 virtual std::vector<LibUtilities::FieldDefinitionsSharedPtr>
177 v_GetFieldDefinitions(void) override;
178
179 virtual void v_GetFieldDefinitions(
180 std::vector<LibUtilities::FieldDefinitionsSharedPtr> &fielddef)
181 override;
182
183 virtual void v_AppendFieldData(
185 std::vector<NekDouble> &fielddata) override;
186
187 virtual void v_AppendFieldData(
189 std::vector<NekDouble> &fielddata,
190 Array<OneD, NekDouble> &coeffs) override;
191
192 virtual void v_ExtractDataToCoeffs(
194 std::vector<NekDouble> &fielddata, std::string &field,
196 std::unordered_map<int, int> zIdToPlane) override;
197
198 virtual void v_WriteVtkPieceData(std::ostream &outfile, int expansion,
199 std::string var) override;
200
201 virtual void v_HomogeneousFwdTrans(
202 const int npts, const Array<OneD, const NekDouble> &inarray,
203 Array<OneD, NekDouble> &outarray, bool Shuff = true,
204 bool UnShuff = true) override;
205
206 virtual void v_HomogeneousBwdTrans(
207 const int npts, const Array<OneD, const NekDouble> &inarray,
208 Array<OneD, NekDouble> &outarray, bool Shuff = true,
209 bool UnShuff = true) override;
210
211 virtual void v_DealiasedProd(const int num_dofs,
212 const Array<OneD, NekDouble> &inarray1,
213 const Array<OneD, NekDouble> &inarray2,
214 Array<OneD, NekDouble> &outarray) override;
215
216 virtual void v_DealiasedDotProd(
217 const int num_dofs, const Array<OneD, Array<OneD, NekDouble>> &inarray1,
218 const Array<OneD, Array<OneD, NekDouble>> &inarray2,
219 Array<OneD, Array<OneD, NekDouble>> &outarray) override;
220
221 virtual void v_PhysDeriv(const Array<OneD, const NekDouble> &inarray,
224 Array<OneD, NekDouble> &out_d2) override;
225
226 virtual void v_PhysDeriv(Direction edir,
227 const Array<OneD, const NekDouble> &inarray,
228 Array<OneD, NekDouble> &out_d) override;
229
230private:
231 // Padding operations variables
237};
238
239} // namespace MultiRegions
240} // namespace Nektar
241
242#endif // EXPLISTHOMO2D_H
#define MULTI_REGIONS_EXPORT
Describes the specification for a Basis.
Definition: Basis.h:47
Abstraction of a two-dimensional multi-elemental expansion which is merely a collection of local expa...
virtual void v_DealiasedProd(const int num_dofs, const Array< OneD, NekDouble > &inarray1, const Array< OneD, NekDouble > &inarray2, Array< OneD, NekDouble > &outarray) override
virtual void v_FwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
virtual void v_DealiasedDotProd(const int num_dofs, const Array< OneD, Array< OneD, NekDouble > > &inarray1, const Array< OneD, Array< OneD, NekDouble > > &inarray2, Array< OneD, Array< OneD, NekDouble > > &outarray) override
virtual void v_FwdTransLocalElmt(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
virtual std::vector< LibUtilities::FieldDefinitionsSharedPtr > v_GetFieldDefinitions(void) override
DNekBlkMatSharedPtr GenHomogeneous2DBlockMatrix(Homogeneous2DMatType mattype) const
virtual void v_FwdTransBndConstrained(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
LibUtilities::NektarFFTSharedPtr m_FFT_y
ExpListHomogeneous2D(const ExpansionType type)
Default constructor.
int m_nz
Number of modes = number of poitns in z direction.
LibUtilities::NektarFFTSharedPtr m_FFT_z
LibUtilities::BasisSharedPtr m_homogeneousBasis_y
Definition of the total number of degrees of freedom and quadrature points. Sets up the storage for m...
NekDouble m_lhom_z
Width of homogeneous direction z.
int m_ny
Number of modes = number of poitns in y direction.
void PhysDeriv(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &out_d0, Array< OneD, NekDouble > &out_d1, Array< OneD, NekDouble > &out_d2)
virtual void v_HomogeneousFwdTrans(const int npts, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, bool Shuff=true, bool UnShuff=true) override
virtual void v_IProductWRTBase(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
virtual void v_WriteVtkPieceData(std::ostream &outfile, int expansion, std::string var) override
LibUtilities::TranspositionSharedPtr m_transposition
Array< OneD, ExpListSharedPtr > m_lines
Vector of ExpList, will be filled with ExpList1D.
LibUtilities::BasisSharedPtr m_homogeneousBasis_z
Base expansion in z direction.
LibUtilities::BasisSharedPtr m_paddingBasis_z
Base expansion in z direction.
virtual void v_AppendFieldData(LibUtilities::FieldDefinitionsSharedPtr &fielddef, std::vector< NekDouble > &fielddata) override
virtual void v_ExtractDataToCoeffs(LibUtilities::FieldDefinitionsSharedPtr &fielddef, std::vector< NekDouble > &fielddata, std::string &field, Array< OneD, NekDouble > &coeffs, std::unordered_map< int, int > zIdToPlane) override
Extract data from raw field data into expansion list.
void Homogeneous2DTrans(const int npts, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, bool IsForwards, bool Shuff=true, bool UnShuff=true)
DNekBlkMatSharedPtr GetHomogeneous2DBlockMatrix(Homogeneous2DMatType mattype) const
virtual void v_BwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
LibUtilities::BasisSharedPtr m_paddingBasis_y
Base expansion in y direction.
virtual void v_PhysDeriv(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &out_d0, Array< OneD, NekDouble > &out_d1, Array< OneD, NekDouble > &out_d2) override
NekDouble m_lhom_y
Width of homogeneous direction y.
virtual void v_HomogeneousBwdTrans(const int npts, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, bool Shuff=true, bool UnShuff=true) override
Base class for all multi-elemental spectral/hp expansions.
Definition: ExpList.h:102
std::shared_ptr< Basis > BasisSharedPtr
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< FieldDefinitions > FieldDefinitionsSharedPtr
Definition: FieldIO.h:186
std::shared_ptr< NektarFFT > NektarFFTSharedPtr
Definition: NektarFFT.h:58
std::shared_ptr< Transposition > TranspositionSharedPtr
std::shared_ptr< Comm > CommSharedPtr
Pointer to a Communicator object.
Definition: Comm.h:57
std::map< Homogeneous2DMatType, DNekBlkMatSharedPtr > Homo2DBlockMatrixMap
A map between homo matrix keys and their associated block matrices.
std::vector< ExpListHomogeneous2DSharedPtr > ExpListHomogeneous2DVector
Vector of pointers to ExpList3DHomogeneous2D objects.
std::shared_ptr< ExpListHomogeneous2D > ExpListHomogeneous2DSharedPtr
Shared pointer to an ExpList3DHomogeneous2D object.
std::shared_ptr< Homo2DBlockMatrixMap > Homo2DBlockMatrixMapShPtr
A shared pointer to a BlockMatrixMap.
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:2
std::shared_ptr< DNekBlkMat > DNekBlkMatSharedPtr
Definition: NekTypeDefs.hpp:77
std::shared_ptr< DNekMat > DNekMatSharedPtr
Definition: NekTypeDefs.hpp:75
double NekDouble