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
39 #include <vector>
41 #include <MultiRegions/ExpList.h>
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> Homo2DBlockMatrixMap;
65  /// A shared pointer to a BlockMatrixMap.
66  typedef std::shared_ptr<Homo2DBlockMatrixMap> Homo2DBlockMatrixMapShPtr;
67 
68  // Forward declaration for typedefs
70 
71  /// Shared pointer to an ExpList3DHomogeneous2D object.
72  typedef std::shared_ptr<ExpListHomogeneous2D> ExpListHomogeneous2DSharedPtr;
73  /// Vector of pointers to ExpList3DHomogeneous2D objects.
74  typedef std::vector< ExpListHomogeneous2DSharedPtr > ExpListHomogeneous2DVector;
75 
76  /// Abstraction of a two-dimensional multi-elemental expansion which
77  /// is merely a collection of local expansions.
79  {
80  public:
81  /// Default constructor.
83 
85  const LibUtilities::BasisKey &HomoBasis_y,
86  const LibUtilities::BasisKey &HomoBasis_z,
87  const NekDouble ly,
88  const NekDouble lz,
89  const bool useFFT,
90  const bool dealiasing);
91 
92  /// Copy constructor.
93  MULTI_REGIONS_EXPORT ExpListHomogeneous2D(const ExpListHomogeneous2D &In);
94 
95  MULTI_REGIONS_EXPORT ExpListHomogeneous2D(const ExpListHomogeneous2D &In,
96  const std::vector<unsigned int> &eIDs);
97  /// Destructor.
99 
101  Array<OneD, NekDouble> &outarray,
102  bool IsForwards,
103  CoeffState coeffstate = eLocal,
104  bool Shuff = true,
105  bool UnShuff = true);
106 
107  inline void HomogeneousFwdTrans(const Array<OneD, const NekDouble> &inarray,
108  Array<OneD, NekDouble> &outarray,
109  CoeffState coeffstate = eLocal,
110  bool Shuff = true,
111  bool UnShuff = true);
112 
113  inline void HomogeneousBwdTrans(const Array<OneD, const NekDouble> &inarray,
114  Array<OneD, NekDouble> &outarray,
115  CoeffState coeffstate = eLocal,
116  bool Shuff = true,
117  bool UnShuff = true);
118 
120 
122  Array<OneD, NekDouble> &out_d0,
123  Array<OneD, NekDouble> &out_d1,
124  Array<OneD, NekDouble> &out_d2);
125 
127  const Array<OneD, const NekDouble> &inarray,
128  Array<OneD, NekDouble> &out_d);
129 
130  /// FFT variables
131  bool m_useFFT;
136 
140 
141  protected:
142 
143  /// Definition of the total number of degrees of freedom and
144  /// quadrature points. Sets up the storage for \a m_coeff and \a
145  /// m_phys.
146  LibUtilities::BasisSharedPtr m_homogeneousBasis_y; ///< Base expansion in y direction
147  LibUtilities::BasisSharedPtr m_homogeneousBasis_z; ///< Base expansion in z direction
148  LibUtilities::BasisSharedPtr m_paddingBasis_y; ///< Base expansion in y direction
149  LibUtilities::BasisSharedPtr m_paddingBasis_z; ///< Base expansion in z direction
150  NekDouble m_lhom_y; ///< Width of homogeneous direction y
151  NekDouble m_lhom_z; ///< Width of homogeneous direction z
152  Homo2DBlockMatrixMapShPtr m_homogeneous2DBlockMat;
153  Array<OneD, ExpListSharedPtr> m_lines; ///< Vector of ExpList, will be filled with ExpList1D
154  int m_ny; ///< Number of modes = number of poitns in y direction
155  int m_nz; ///< Number of modes = number of poitns in z direction
156 
158 
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  CoeffState coeffstate);
170 
171  virtual void v_FwdTrans_IterPerExp(const Array<OneD,const NekDouble> &inarray, Array<OneD, NekDouble> &outarray);
172 
173  virtual void v_BwdTrans(const Array<OneD,const NekDouble> &inarray,
174  Array<OneD, NekDouble> &outarray,
175  CoeffState coeffstate);
176 
177 
178  virtual void v_BwdTrans_IterPerExp(const Array<OneD,const NekDouble> &inarray, Array<OneD, NekDouble> &outarray);
179 
180  virtual void v_IProductWRTBase(const Array<OneD, const NekDouble> &inarray, Array<OneD, NekDouble> &outarray, CoeffState coeffstate);
181 
183 
184  virtual std::vector<LibUtilities::FieldDefinitionsSharedPtr> v_GetFieldDefinitions(void);
185 
186  virtual void v_GetFieldDefinitions(std::vector<LibUtilities::FieldDefinitionsSharedPtr> &fielddef);
187 
188  virtual void v_AppendFieldData(LibUtilities::FieldDefinitionsSharedPtr &fielddef, std::vector<NekDouble> &fielddata);
189 
190  virtual void v_AppendFieldData(LibUtilities::FieldDefinitionsSharedPtr &fielddef, std::vector<NekDouble> &fielddata, Array<OneD, NekDouble> &coeffs);
191 
192  virtual void v_ExtractDataToCoeffs(LibUtilities::FieldDefinitionsSharedPtr &fielddef, std::vector<NekDouble> &fielddata, std::string &field, Array<OneD, NekDouble> &coeffs);
193 
194  virtual void v_WriteVtkPieceData(std::ostream &outfile, int expansion,
195  std::string var);
196 
197  virtual void v_HomogeneousFwdTrans(const Array<OneD, const NekDouble> &inarray,
198  Array<OneD, NekDouble> &outarray,
199  CoeffState coeffstate = eLocal,
200  bool Shuff = true,
201  bool UnShuff = true);
202 
203  virtual void v_HomogeneousBwdTrans(const Array<OneD, const NekDouble> &inarray,
204  Array<OneD, NekDouble> &outarray,
205  CoeffState coeffstate = eLocal,
206  bool Shuff = true,
207  bool UnShuff = true);
208 
209  virtual void v_DealiasedProd(const Array<OneD, NekDouble> &inarray1,
210  const Array<OneD, NekDouble> &inarray2,
211  Array<OneD, NekDouble> &outarray,
212  CoeffState coeffstate = eLocal);
213 
214  virtual void v_DealiasedDotProd(
215  const Array<OneD, Array<OneD, NekDouble> > &inarray1,
216  const Array<OneD, Array<OneD, NekDouble> > &inarray2,
217  Array<OneD, Array<OneD, NekDouble> > &outarray,
218  CoeffState coeffstate = eLocal);
219 
220  virtual void v_PhysDeriv(const Array<OneD, const NekDouble> &inarray,
221  Array<OneD, NekDouble> &out_d0,
222  Array<OneD, NekDouble> &out_d1,
223  Array<OneD, NekDouble> &out_d2);
224 
225  virtual void v_PhysDeriv(Direction edir,
226  const Array<OneD, const NekDouble> &inarray,
227  Array<OneD, NekDouble> &out_d);
228 
229  private:
230 
231  //Padding operations variables
237  };
238 
240  Array<OneD, NekDouble> &outarray,
241  CoeffState coeffstate,
242  bool Shuff,
243  bool UnShuff)
244  {
245  v_HomogeneousFwdTrans(inarray,outarray,coeffstate,Shuff,UnShuff);
246  }
247 
249  Array<OneD, NekDouble> &outarray,
250  CoeffState coeffstate,
251  bool Shuff,
252  bool UnShuff)
253  {
254  v_HomogeneousBwdTrans(inarray,outarray,coeffstate,Shuff,UnShuff);
255  }
256 
257  } //end of namespace
258 } //end of namespace
259 
260 #endif//EXPLISTHOMO2D_H
Abstraction of a two-dimensional multi-elemental expansion which is merely a collection of local expa...
LibUtilities::TranspositionSharedPtr m_transposition
void HomogeneousFwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate=eLocal, bool Shuff=true, bool UnShuff=true)
Local coefficients.
std::vector< ExpListHomogeneous2DSharedPtr > ExpListHomogeneous2DVector
Vector of pointers to ExpList3DHomogeneous2D objects.
virtual std::vector< LibUtilities::FieldDefinitionsSharedPtr > v_GetFieldDefinitions(void)
LibUtilities::BasisSharedPtr m_paddingBasis_z
Base expansion in z direction.
std::shared_ptr< Comm > CommSharedPtr
Pointer to a Communicator object.
Definition: Comm.h:53
#define MULTI_REGIONS_EXPORT
LibUtilities::NektarFFTSharedPtr m_FFT_z
std::shared_ptr< DNekMat > DNekMatSharedPtr
Definition: NekTypeDefs.hpp:69
NekDouble m_lhom_z
Width of homogeneous direction z.
virtual void v_DealiasedProd(const Array< OneD, NekDouble > &inarray1, const Array< OneD, NekDouble > &inarray2, Array< OneD, NekDouble > &outarray, CoeffState coeffstate=eLocal)
std::shared_ptr< Basis > BasisSharedPtr
void PhysDeriv(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &out_d0, Array< OneD, NekDouble > &out_d1, Array< OneD, NekDouble > &out_d2)
std::shared_ptr< DNekBlkMat > DNekBlkMatSharedPtr
Definition: NekTypeDefs.hpp:71
virtual void v_BwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate)
Array< OneD, ExpListSharedPtr > m_lines
Vector of ExpList, will be filled with ExpList1D.
virtual void v_IProductWRTBase_IterPerExp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Base class for all multi-elemental spectral/hp expansions.
Definition: ExpList.h:103
LibUtilities::BasisSharedPtr m_homogeneousBasis_z
Base expansion in z direction.
virtual void v_DealiasedDotProd(const Array< OneD, Array< OneD, NekDouble > > &inarray1, const Array< OneD, Array< OneD, NekDouble > > &inarray2, Array< OneD, Array< OneD, NekDouble > > &outarray, CoeffState coeffstate=eLocal)
virtual void v_HomogeneousFwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate=eLocal, bool Shuff=true, bool UnShuff=true)
NekDouble m_lhom_y
Width of homogeneous direction y.
double NekDouble
virtual void v_IProductWRTBase(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate)
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)
int m_ny
Number of modes = number of poitns in y direction.
std::shared_ptr< ExpListHomogeneous2D > ExpListHomogeneous2DSharedPtr
Shared pointer to an ExpList3DHomogeneous2D object.
LibUtilities::BasisSharedPtr m_homogeneousBasis_y
Definition of the total number of degrees of freedom and quadrature points. Sets up the storage for m...
void Homogeneous2DTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, bool IsForwards, CoeffState coeffstate=eLocal, bool Shuff=true, bool UnShuff=true)
std::map< Homogeneous2DMatType, DNekBlkMatSharedPtr > Homo2DBlockMatrixMap
A map between homo matrix keys and their associated block matrices.
int m_nz
Number of modes = number of poitns in z direction.
LibUtilities::BasisSharedPtr m_paddingBasis_y
Base expansion in y direction.
virtual void v_BwdTrans_IterPerExp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
std::shared_ptr< Homo2DBlockMatrixMap > Homo2DBlockMatrixMapShPtr
A shared pointer to a BlockMatrixMap.
std::shared_ptr< FieldDefinitions > FieldDefinitionsSharedPtr
Definition: FieldIO.h:179
LibUtilities::NektarFFTSharedPtr m_FFT_y
DNekBlkMatSharedPtr GenHomogeneous2DBlockMatrix(Homogeneous2DMatType mattype, CoeffState coeffstate=eLocal) const
virtual void v_FwdTrans_IterPerExp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
virtual void v_WriteVtkPieceData(std::ostream &outfile, int expansion, std::string var)
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.
std::shared_ptr< Transposition > TranspositionSharedPtr
std::shared_ptr< NektarFFT > NektarFFTSharedPtr
Definition: NektarFFT.h:55
virtual void v_HomogeneousBwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate=eLocal, bool Shuff=true, bool UnShuff=true)
DNekBlkMatSharedPtr GetHomogeneous2DBlockMatrix(Homogeneous2DMatType mattype, CoeffState coeffstate=eLocal) const
Describes the specification for a Basis.
Definition: Basis.h:49
std::shared_ptr< SessionReader > SessionReaderSharedPtr
virtual void v_FwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate)
virtual void v_AppendFieldData(LibUtilities::FieldDefinitionsSharedPtr &fielddef, std::vector< NekDouble > &fielddata)
void HomogeneousBwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate=eLocal, bool Shuff=true, bool UnShuff=true)