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
40 #include <MultiRegions/ExpList.h>
43 #include <vector>
44 
45 namespace Nektar
46 {
47 namespace MultiRegions
48 {
49 
51 {
60 };
61 
62 /// A map between homo matrix keys and their associated block
63 /// matrices.
64 typedef std::map<Homogeneous2DMatType, DNekBlkMatSharedPtr>
66 /// A shared pointer to a BlockMatrixMap.
67 typedef std::shared_ptr<Homo2DBlockMatrixMap> Homo2DBlockMatrixMapShPtr;
68 
69 // Forward declaration for typedefs
71 
72 /// Shared pointer to an ExpList3DHomogeneous2D object.
73 typedef std::shared_ptr<ExpListHomogeneous2D> ExpListHomogeneous2DSharedPtr;
74 /// Vector of pointers to ExpList3DHomogeneous2D objects.
75 typedef std::vector<ExpListHomogeneous2DSharedPtr> ExpListHomogeneous2DVector;
76 
77 /// Abstraction of a two-dimensional multi-elemental expansion which
78 /// is merely a collection of local expansions.
80 {
81 public:
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 Array<OneD, const NekDouble> &inarray,
102  Array<OneD, NekDouble> &outarray, bool IsForwards, bool Shuff = true,
103  bool UnShuff = true);
104 
105  inline void HomogeneousFwdTrans(const Array<OneD, const NekDouble> &inarray,
106  Array<OneD, NekDouble> &outarray,
107  bool Shuff = true, bool UnShuff = true);
108 
109  inline void HomogeneousBwdTrans(const Array<OneD, const NekDouble> &inarray,
110  Array<OneD, NekDouble> &outarray,
111  bool Shuff = true, bool UnShuff = true);
112 
114 
116  const Array<OneD, const NekDouble> &inarray,
118  Array<OneD, NekDouble> &out_d2);
119 
121  Direction edir, const Array<OneD, const NekDouble> &inarray,
122  Array<OneD, NekDouble> &out_d);
123 
124  /// FFT variables
125  bool m_useFFT;
130 
134 
135 protected:
136  /// Definition of the total number of degrees of freedom and
137  /// quadrature points. Sets up the storage for \a m_coeff and \a
138  /// m_phys.
140  m_homogeneousBasis_y; ///< Base expansion in y direction
142  m_homogeneousBasis_z; ///< Base expansion in z direction
144  m_paddingBasis_y; ///< Base expansion in y direction
146  m_paddingBasis_z; ///< Base expansion in z direction
147  NekDouble m_lhom_y; ///< Width of homogeneous direction y
148  NekDouble m_lhom_z; ///< Width of homogeneous direction z
151  m_lines; ///< Vector of ExpList, will be filled with ExpList1D
152  int m_ny; ///< Number of modes = number of poitns in y direction
153  int m_nz; ///< Number of modes = number of poitns in z direction
154 
156  Homogeneous2DMatType mattype) const;
157 
159  Homogeneous2DMatType mattype) const;
160 
161  // virtual functions
162  virtual int v_GetNumElmts(void)
163  {
164  return m_lines[0]->GetExpSize();
165  }
166 
167  virtual void v_FwdTrans(const Array<OneD, const NekDouble> &inarray,
168  Array<OneD, NekDouble> &outarray);
169 
170  virtual void v_FwdTransLocalElmt(
171  const Array<OneD, const NekDouble> &inarray,
172  Array<OneD, NekDouble> &outarray);
173 
174  virtual void v_BwdTrans(const Array<OneD, const NekDouble> &inarray,
175  Array<OneD, NekDouble> &outarray);
176 
177  virtual void v_IProductWRTBase(const Array<OneD, const NekDouble> &inarray,
178  Array<OneD, NekDouble> &outarray);
179 
180  virtual std::vector<LibUtilities::FieldDefinitionsSharedPtr>
181  v_GetFieldDefinitions(void);
182 
183  virtual void v_GetFieldDefinitions(
184  std::vector<LibUtilities::FieldDefinitionsSharedPtr> &fielddef);
185 
186  virtual void v_AppendFieldData(
188  std::vector<NekDouble> &fielddata);
189 
190  virtual void v_AppendFieldData(
192  std::vector<NekDouble> &fielddata, Array<OneD, NekDouble> &coeffs);
193 
194  virtual void v_ExtractDataToCoeffs(
196  std::vector<NekDouble> &fielddata, std::string &field,
197  Array<OneD, NekDouble> &coeffs);
198 
199  virtual void v_WriteVtkPieceData(std::ostream &outfile, int expansion,
200  std::string var);
201 
202  virtual void v_HomogeneousFwdTrans(
203  const Array<OneD, const NekDouble> &inarray,
204  Array<OneD, NekDouble> &outarray, bool Shuff = true,
205  bool UnShuff = true);
206 
207  virtual void v_HomogeneousBwdTrans(
208  const Array<OneD, const NekDouble> &inarray,
209  Array<OneD, NekDouble> &outarray, bool Shuff = true,
210  bool UnShuff = true);
211 
212  virtual void v_DealiasedProd(const Array<OneD, NekDouble> &inarray1,
213  const Array<OneD, NekDouble> &inarray2,
214  Array<OneD, NekDouble> &outarray);
215 
216  virtual void v_DealiasedDotProd(
217  const Array<OneD, Array<OneD, NekDouble>> &inarray1,
218  const Array<OneD, Array<OneD, NekDouble>> &inarray2,
219  Array<OneD, Array<OneD, NekDouble>> &outarray);
220 
221  virtual void v_PhysDeriv(const Array<OneD, const NekDouble> &inarray,
222  Array<OneD, NekDouble> &out_d0,
223  Array<OneD, NekDouble> &out_d1,
224  Array<OneD, NekDouble> &out_d2);
225 
226  virtual void v_PhysDeriv(Direction edir,
227  const Array<OneD, const NekDouble> &inarray,
228  Array<OneD, NekDouble> &out_d);
229 
230 private:
231  // Padding operations variables
237 };
238 
240  const Array<OneD, const NekDouble> &inarray,
241  Array<OneD, NekDouble> &outarray, bool Shuff, bool UnShuff)
242 {
243  v_HomogeneousFwdTrans(inarray, outarray, Shuff, UnShuff);
244 }
245 
247  const Array<OneD, const NekDouble> &inarray,
248  Array<OneD, NekDouble> &outarray, bool Shuff, bool UnShuff)
249 {
250  v_HomogeneousBwdTrans(inarray, outarray, Shuff, UnShuff);
251 }
252 
253 } // namespace MultiRegions
254 } // namespace Nektar
255 
256 #endif // EXPLISTHOMO2D_H
#define MULTI_REGIONS_EXPORT
Describes the specification for a Basis.
Definition: Basis.h:50
Abstraction of a two-dimensional multi-elemental expansion which is merely a collection of local expa...
virtual void v_FwdTransLocalElmt(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
virtual void v_HomogeneousFwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, bool Shuff=true, bool UnShuff=true)
DNekBlkMatSharedPtr GenHomogeneous2DBlockMatrix(Homogeneous2DMatType mattype) const
virtual std::vector< LibUtilities::FieldDefinitionsSharedPtr > v_GetFieldDefinitions(void)
LibUtilities::NektarFFTSharedPtr m_FFT_y
virtual void v_AppendFieldData(LibUtilities::FieldDefinitionsSharedPtr &fielddef, std::vector< NekDouble > &fielddata)
ExpListHomogeneous2D(const ExpansionType type)
Default constructor.
int m_nz
Number of modes = number of poitns in z direction.
virtual void v_ExtractDataToCoeffs(LibUtilities::FieldDefinitionsSharedPtr &fielddef, std::vector< NekDouble > &fielddata, std::string &field, Array< OneD, NekDouble > &coeffs)
Extract data from raw field data into expansion list.
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...
virtual void v_IProductWRTBase(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
NekDouble m_lhom_z
Width of homogeneous direction z.
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)
void HomogeneousBwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, bool Shuff=true, bool UnShuff=true)
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_FwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
void Homogeneous2DTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, bool IsForwards, bool Shuff=true, bool UnShuff=true)
virtual void v_WriteVtkPieceData(std::ostream &outfile, int expansion, std::string var)
virtual void v_DealiasedProd(const Array< OneD, NekDouble > &inarray1, const Array< OneD, NekDouble > &inarray2, Array< OneD, NekDouble > &outarray)
virtual void v_HomogeneousBwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, bool Shuff=true, bool UnShuff=true)
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.
DNekBlkMatSharedPtr GetHomogeneous2DBlockMatrix(Homogeneous2DMatType mattype) const
virtual void v_DealiasedDotProd(const Array< OneD, Array< OneD, NekDouble >> &inarray1, const Array< OneD, Array< OneD, NekDouble >> &inarray2, Array< OneD, Array< OneD, NekDouble >> &outarray)
LibUtilities::BasisSharedPtr m_paddingBasis_y
Base expansion in y direction.
NekDouble m_lhom_y
Width of homogeneous direction y.
virtual void v_BwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
void HomogeneousFwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, bool Shuff=true, bool UnShuff=true)
Base class for all multi-elemental spectral/hp expansions.
Definition: ExpList.h:101
std::shared_ptr< Basis > BasisSharedPtr
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< FieldDefinitions > FieldDefinitionsSharedPtr
Definition: FieldIO.h:177
std::shared_ptr< NektarFFT > NektarFFTSharedPtr
Definition: NektarFFT.h:55
std::shared_ptr< Transposition > TranspositionSharedPtr
std::shared_ptr< Comm > CommSharedPtr
Pointer to a Communicator object.
Definition: Comm.h:54
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:1
std::shared_ptr< DNekBlkMat > DNekBlkMatSharedPtr
Definition: NekTypeDefs.hpp:77
std::shared_ptr< DNekMat > DNekMatSharedPtr
Definition: NekTypeDefs.hpp:75
double NekDouble