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 
86  const LibUtilities::BasisKey &HomoBasis_y,
87  const LibUtilities::BasisKey &HomoBasis_z,
88  const NekDouble ly,
89  const NekDouble lz,
90  const bool useFFT,
91  const bool dealiasing);
92 
93  /// Copy constructor.
95 
97  const std::vector<unsigned int> &eIDs);
98  /// Destructor.
100 
102  Array<OneD, NekDouble> &outarray,
103  bool IsForwards,
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  bool Shuff = true,
110  bool UnShuff = true);
111 
112  inline void HomogeneousBwdTrans(const Array<OneD, const NekDouble> &inarray,
113  Array<OneD, NekDouble> &outarray,
114  bool Shuff = true,
115  bool UnShuff = true);
116 
118 
120  Array<OneD, NekDouble> &out_d0,
121  Array<OneD, NekDouble> &out_d1,
122  Array<OneD, NekDouble> &out_d2);
123 
125  const Array<OneD, const NekDouble> &inarray,
126  Array<OneD, NekDouble> &out_d);
127 
128  /// FFT variables
129  bool m_useFFT;
134 
138 
139  protected:
140 
141  /// Definition of the total number of degrees of freedom and
142  /// quadrature points. Sets up the storage for \a m_coeff and \a
143  /// m_phys.
144  LibUtilities::BasisSharedPtr m_homogeneousBasis_y; ///< Base expansion in y direction
145  LibUtilities::BasisSharedPtr m_homogeneousBasis_z; ///< Base expansion in z direction
146  LibUtilities::BasisSharedPtr m_paddingBasis_y; ///< Base expansion in y direction
147  LibUtilities::BasisSharedPtr m_paddingBasis_z; ///< Base expansion in z direction
148  NekDouble m_lhom_y; ///< Width of homogeneous direction y
149  NekDouble m_lhom_z; ///< Width of homogeneous direction z
151  Array<OneD, ExpListSharedPtr> 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 
158 
159  // virtual functions
160  virtual int v_GetNumElmts(void)
161  {
162  return m_lines[0]->GetExpSize();
163  }
164 
165  virtual void v_FwdTrans(const Array<OneD,const NekDouble> &inarray,
166  Array<OneD, NekDouble> &outarray);
167 
168  virtual void v_FwdTrans_IterPerExp(const Array<OneD,const NekDouble> &inarray, Array<OneD, NekDouble> &outarray);
169 
170  virtual void v_BwdTrans(const Array<OneD,const NekDouble> &inarray,
171  Array<OneD, NekDouble> &outarray);
172 
173 
174  virtual void v_BwdTrans_IterPerExp(const Array<OneD,const NekDouble> &inarray, Array<OneD, NekDouble> &outarray);
175 
176  virtual void v_IProductWRTBase(const Array<OneD, const NekDouble> &inarray, Array<OneD, NekDouble> &outarray);
177 
179 
180  virtual std::vector<LibUtilities::FieldDefinitionsSharedPtr> v_GetFieldDefinitions(void);
181 
182  virtual void v_GetFieldDefinitions(std::vector<LibUtilities::FieldDefinitionsSharedPtr> &fielddef);
183 
184  virtual void v_AppendFieldData(LibUtilities::FieldDefinitionsSharedPtr &fielddef, std::vector<NekDouble> &fielddata);
185 
186  virtual void v_AppendFieldData(LibUtilities::FieldDefinitionsSharedPtr &fielddef, std::vector<NekDouble> &fielddata, Array<OneD, NekDouble> &coeffs);
187 
188  virtual void v_ExtractDataToCoeffs(LibUtilities::FieldDefinitionsSharedPtr &fielddef, std::vector<NekDouble> &fielddata, std::string &field, Array<OneD, NekDouble> &coeffs);
189 
190  virtual void v_WriteVtkPieceData(std::ostream &outfile, int expansion,
191  std::string var);
192 
193  virtual void v_HomogeneousFwdTrans(const Array<OneD, const NekDouble> &inarray,
194  Array<OneD, NekDouble> &outarray,
195  bool Shuff = true,
196  bool UnShuff = true);
197 
198  virtual void v_HomogeneousBwdTrans(const Array<OneD, const NekDouble> &inarray,
199  Array<OneD, NekDouble> &outarray,
200  bool Shuff = true,
201  bool UnShuff = true);
202 
203  virtual void v_DealiasedProd(const Array<OneD, NekDouble> &inarray1,
204  const Array<OneD, NekDouble> &inarray2,
205  Array<OneD, NekDouble> &outarray);
206 
207  virtual void v_DealiasedDotProd(
208  const Array<OneD, Array<OneD, NekDouble> > &inarray1,
209  const Array<OneD, Array<OneD, NekDouble> > &inarray2,
210  Array<OneD, Array<OneD, NekDouble> > &outarray);
211 
212  virtual void v_PhysDeriv(const Array<OneD, const NekDouble> &inarray,
213  Array<OneD, NekDouble> &out_d0,
214  Array<OneD, NekDouble> &out_d1,
215  Array<OneD, NekDouble> &out_d2);
216 
217  virtual void v_PhysDeriv(Direction edir,
218  const Array<OneD, const NekDouble> &inarray,
219  Array<OneD, NekDouble> &out_d);
220 
221  private:
222 
223  //Padding operations variables
229  };
230 
232  Array<OneD, NekDouble> &outarray,
233  bool Shuff,
234  bool UnShuff)
235  {
236  v_HomogeneousFwdTrans(inarray,outarray,Shuff,UnShuff);
237  }
238 
240  Array<OneD, NekDouble> &outarray,
241  bool Shuff,
242  bool UnShuff)
243  {
244  v_HomogeneousBwdTrans(inarray,outarray,Shuff,UnShuff);
245  }
246 
247  } //end of namespace
248 } //end of namespace
249 
250 #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_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.
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_z
Base expansion in z direction.
virtual void v_BwdTrans_IterPerExp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
DNekBlkMatSharedPtr GetHomogeneous2DBlockMatrix(Homogeneous2DMatType mattype) const
LibUtilities::BasisSharedPtr m_paddingBasis_y
Base expansion in y direction.
virtual void v_IProductWRTBase_IterPerExp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
NekDouble m_lhom_y
Width of homogeneous direction y.
virtual void v_BwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
virtual void v_FwdTrans_IterPerExp(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:107
std::shared_ptr< Basis > BasisSharedPtr
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< FieldDefinitions > FieldDefinitionsSharedPtr
Definition: FieldIO.h:179
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:71
std::shared_ptr< DNekMat > DNekMatSharedPtr
Definition: NekTypeDefs.hpp:69
double NekDouble