Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 // License for the specific language governing rights and limitations under
14 // Permission is hereby granted, free of charge, to any person obtaining a
15 // copy of this software and associated documentation files (the "Software"),
16 // to deal in the Software without restriction, including without limitation
17 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
18 // and/or sell copies of the Software, and to permit persons to whom the
19 // Software is furnished to do so, subject to the following conditions:
20 //
21 // The above copyright notice and this permission notice shall be included
22 // in all copies or substantial portions of the Software.
23 //
24 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
25 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
27 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
30 // DEALINGS IN THE SOFTWARE.
31 //
32 // Description: Base class for expansions which are homogeneous in 2
33 // directions
34 //
35 ///////////////////////////////////////////////////////////////////////////////
36 
37 #ifndef EXPLISTHOMO2D_H
38 #define EXPLISTHOMO2D_H
40 #include <vector>
42 #include <MultiRegions/ExpList.h>
45 
46 namespace Nektar
47 {
48  namespace MultiRegions
49  {
50 
52  {
61  };
62 
63  /// A map between homo matrix keys and their associated block
64  /// matrices.
65  typedef std::map< Homogeneous2DMatType, DNekBlkMatSharedPtr> Homo2DBlockMatrixMap;
66  /// A shared pointer to a BlockMatrixMap.
67  typedef boost::shared_ptr<Homo2DBlockMatrixMap> Homo2DBlockMatrixMapShPtr;
68 
69  // Forward declaration for typedefs
71 
72  /// Shared pointer to an ExpList3DHomogeneous2D object.
73  typedef boost::shared_ptr<ExpListHomogeneous2D> ExpListHomogeneous2DSharedPtr;
74  /// Vector of pointers to ExpList3DHomogeneous2D objects.
75  typedef std::vector< ExpListHomogeneous2DSharedPtr > ExpListHomogeneous2DVector;
76  /// Iterator for the vector of ExpList3DHomogeneous2D pointers.
78 
79  /// Abstraction of a two-dimensional multi-elemental expansion which
80  /// is merely a collection of local expansions.
82  {
83  public:
84  /// Default constructor.
86 
88  const LibUtilities::BasisKey &HomoBasis_y,
89  const LibUtilities::BasisKey &HomoBasis_z,
90  const NekDouble ly,
91  const NekDouble lz,
92  const bool useFFT,
93  const bool dealiasing);
94 
95  /// Copy constructor.
96  MULTI_REGIONS_EXPORT ExpListHomogeneous2D(const ExpListHomogeneous2D &In);
97 
98  /// Destructor.
100 
102  Array<OneD, NekDouble> &outarray,
103  bool IsForwards,
104  CoeffState coeffstate = eLocal,
105  bool Shuff = true,
106  bool UnShuff = true);
107 
108  inline void HomogeneousFwdTrans(const Array<OneD, const NekDouble> &inarray,
109  Array<OneD, NekDouble> &outarray,
110  CoeffState coeffstate = eLocal,
111  bool Shuff = true,
112  bool UnShuff = true);
113 
114  inline void HomogeneousBwdTrans(const Array<OneD, const NekDouble> &inarray,
115  Array<OneD, NekDouble> &outarray,
116  CoeffState coeffstate = eLocal,
117  bool Shuff = true,
118  bool UnShuff = true);
119 
120  inline void DealiasedProd(const Array<OneD, NekDouble> &inarray1,
121  const Array<OneD, NekDouble> &inarray2,
122  Array<OneD, NekDouble> &outarray,
123  CoeffState coeffstate = eLocal);
124 
126 
128  Array<OneD, NekDouble> &out_d0,
129  Array<OneD, NekDouble> &out_d1,
130  Array<OneD, NekDouble> &out_d2);
131 
133  const Array<OneD, const NekDouble> &inarray,
134  Array<OneD, NekDouble> &out_d);
135 
136  /// FFT variables
137  bool m_useFFT;
142 
146 
147  protected:
148 
149  /// Definition of the total number of degrees of freedom and
150  /// quadrature points. Sets up the storage for \a m_coeff and \a
151  /// m_phys.
152  LibUtilities::BasisSharedPtr m_homogeneousBasis_y; ///< Base expansion in y direction
153  LibUtilities::BasisSharedPtr m_homogeneousBasis_z; ///< Base expansion in z direction
154  LibUtilities::BasisSharedPtr m_paddingBasis_y; ///< Base expansion in y direction
155  LibUtilities::BasisSharedPtr m_paddingBasis_z; ///< Base expansion in z direction
156  NekDouble m_lhom_y; ///< Width of homogeneous direction y
157  NekDouble m_lhom_z; ///< Width of homogeneous direction z
158  Homo2DBlockMatrixMapShPtr m_homogeneous2DBlockMat;
159  Array<OneD, ExpListSharedPtr> m_lines; ///< Vector of ExpList, will be filled with ExpList1D
160  int m_ny; ///< Number of modes = number of poitns in y direction
161  int m_nz; ///< Number of modes = number of poitns in z direction
162 
164 
166 
167  // virtual functions
168  virtual int v_GetNumElmts(void)
169  {
170  return m_lines[0]->GetExpSize();
171  }
172 
173  virtual void v_FwdTrans(const Array<OneD,const NekDouble> &inarray,
174  Array<OneD, NekDouble> &outarray,
175  CoeffState coeffstate);
176 
177  virtual void v_FwdTrans_IterPerExp(const Array<OneD,const NekDouble> &inarray, Array<OneD, NekDouble> &outarray);
178 
179  virtual void v_BwdTrans(const Array<OneD,const NekDouble> &inarray,
180  Array<OneD, NekDouble> &outarray,
181  CoeffState coeffstate);
182 
183 
184  virtual void v_BwdTrans_IterPerExp(const Array<OneD,const NekDouble> &inarray, Array<OneD, NekDouble> &outarray);
185 
186  virtual void v_IProductWRTBase(const Array<OneD, const NekDouble> &inarray, Array<OneD, NekDouble> &outarray, CoeffState coeffstate);
187 
189 
190  virtual std::vector<LibUtilities::FieldDefinitionsSharedPtr> v_GetFieldDefinitions(void);
191 
192  virtual void v_GetFieldDefinitions(std::vector<LibUtilities::FieldDefinitionsSharedPtr> &fielddef);
193 
194  virtual void v_AppendFieldData(LibUtilities::FieldDefinitionsSharedPtr &fielddef, std::vector<NekDouble> &fielddata);
195 
196  virtual void v_AppendFieldData(LibUtilities::FieldDefinitionsSharedPtr &fielddef, std::vector<NekDouble> &fielddata, Array<OneD, NekDouble> &coeffs);
197 
198  virtual void v_ExtractDataToCoeffs(LibUtilities::FieldDefinitionsSharedPtr &fielddef, std::vector<NekDouble> &fielddata, std::string &field, Array<OneD, NekDouble> &coeffs);
199 
200  virtual void v_WriteVtkPieceData(std::ostream &outfile, int expansion,
201  std::string var);
202 
203  virtual void v_HomogeneousFwdTrans(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_HomogeneousBwdTrans(const Array<OneD, const NekDouble> &inarray,
210  Array<OneD, NekDouble> &outarray,
211  CoeffState coeffstate = eLocal,
212  bool Shuff = true,
213  bool UnShuff = true);
214 
215  virtual void v_DealiasedProd(const Array<OneD, NekDouble> &inarray1,
216  const Array<OneD, NekDouble> &inarray2,
217  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 
258  const Array<OneD, NekDouble> &inarray2,
259  Array<OneD, NekDouble> &outarray,
260  CoeffState coeffstate)
261  {
262  v_DealiasedProd(inarray1,inarray2,outarray,coeffstate);
263  }
264 
265  } //end of namespace
266 } //end of namespace
267 
268 #endif//EXPLISTHOMO2D_H
269 
270 /**
271 * $Log: v $
272 *
273 **/
274 
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)
boost::shared_ptr< Transposition > TranspositionSharedPtr
Local coefficients.
std::vector< ExpListHomogeneous2DSharedPtr > ExpListHomogeneous2DVector
Vector of pointers to ExpList3DHomogeneous2D objects.
DNekBlkMatSharedPtr GenHomogeneous2DBlockMatrix(Homogeneous2DMatType mattype, CoeffState coeffstate=eLocal) const
virtual std::vector< LibUtilities::FieldDefinitionsSharedPtr > v_GetFieldDefinitions(void)
LibUtilities::BasisSharedPtr m_paddingBasis_z
Base expansion in z direction.
boost::shared_ptr< FieldDefinitions > FieldDefinitionsSharedPtr
Definition: FieldIO.h:118
#define MULTI_REGIONS_EXPORT
LibUtilities::NektarFFTSharedPtr m_FFT_z
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)
void PhysDeriv(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &out_d0, Array< OneD, NekDouble > &out_d1, Array< OneD, NekDouble > &out_d2)
boost::shared_ptr< DNekMat > DNekMatSharedPtr
Definition: NekTypeDefs.hpp:70
void DealiasedProd(const Array< OneD, NekDouble > &inarray1, const Array< OneD, NekDouble > &inarray2, Array< OneD, NekDouble > &outarray, CoeffState coeffstate=eLocal)
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
Definition: MeshPartition.h:51
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:101
boost::shared_ptr< Comm > CommSharedPtr
Pointer to a Communicator object.
Definition: Comm.h:53
LibUtilities::BasisSharedPtr m_homogeneousBasis_z
Base expansion in z direction.
std::vector< ExpListHomogeneous2DSharedPtr >::iterator ExpListHomogeneous2DVectorIter
Iterator for the vector of ExpList3DHomogeneous2D pointers.
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.
boost::shared_ptr< Homo2DBlockMatrixMap > Homo2DBlockMatrixMapShPtr
A shared pointer to a BlockMatrixMap.
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.
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.
boost::shared_ptr< DNekBlkMat > DNekBlkMatSharedPtr
Definition: NekTypeDefs.hpp:72
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator
virtual void v_BwdTrans_IterPerExp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
boost::shared_ptr< ExpListHomogeneous2D > ExpListHomogeneous2DSharedPtr
Shared pointer to an ExpList3DHomogeneous2D object.
LibUtilities::NektarFFTSharedPtr m_FFT_y
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.
boost::shared_ptr< Basis > BasisSharedPtr
virtual void v_HomogeneousBwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate=eLocal, bool Shuff=true, bool UnShuff=true)
Describes the specification for a Basis.
Definition: Basis.h:50
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)
boost::shared_ptr< NektarFFT > NektarFFTSharedPtr
Definition: NektarFFT.h:56
DNekBlkMatSharedPtr GetHomogeneous2DBlockMatrix(Homogeneous2DMatType mattype, CoeffState coeffstate=eLocal) const