Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties 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  MULTI_REGIONS_EXPORT ExpListHomogeneous2D(const ExpListHomogeneous2D &In,
99  const std::vector<unsigned int> &eIDs);
100  /// Destructor.
102 
104  Array<OneD, NekDouble> &outarray,
105  bool IsForwards,
106  CoeffState coeffstate = eLocal,
107  bool Shuff = true,
108  bool UnShuff = true);
109 
110  inline void HomogeneousFwdTrans(const Array<OneD, const NekDouble> &inarray,
111  Array<OneD, NekDouble> &outarray,
112  CoeffState coeffstate = eLocal,
113  bool Shuff = true,
114  bool UnShuff = true);
115 
116  inline void HomogeneousBwdTrans(const Array<OneD, const NekDouble> &inarray,
117  Array<OneD, NekDouble> &outarray,
118  CoeffState coeffstate = eLocal,
119  bool Shuff = true,
120  bool UnShuff = true);
121 
123 
125  Array<OneD, NekDouble> &out_d0,
126  Array<OneD, NekDouble> &out_d1,
127  Array<OneD, NekDouble> &out_d2);
128 
130  const Array<OneD, const NekDouble> &inarray,
131  Array<OneD, NekDouble> &out_d);
132 
133  /// FFT variables
134  bool m_useFFT;
139 
143 
144  protected:
145 
146  /// Definition of the total number of degrees of freedom and
147  /// quadrature points. Sets up the storage for \a m_coeff and \a
148  /// m_phys.
149  LibUtilities::BasisSharedPtr m_homogeneousBasis_y; ///< Base expansion in y direction
150  LibUtilities::BasisSharedPtr m_homogeneousBasis_z; ///< Base expansion in z direction
151  LibUtilities::BasisSharedPtr m_paddingBasis_y; ///< Base expansion in y direction
152  LibUtilities::BasisSharedPtr m_paddingBasis_z; ///< Base expansion in z direction
153  NekDouble m_lhom_y; ///< Width of homogeneous direction y
154  NekDouble m_lhom_z; ///< Width of homogeneous direction z
155  Homo2DBlockMatrixMapShPtr m_homogeneous2DBlockMat;
156  Array<OneD, ExpListSharedPtr> m_lines; ///< Vector of ExpList, will be filled with ExpList1D
157  int m_ny; ///< Number of modes = number of poitns in y direction
158  int m_nz; ///< Number of modes = number of poitns in z direction
159 
161 
163 
164  // virtual functions
165  virtual int v_GetNumElmts(void)
166  {
167  return m_lines[0]->GetExpSize();
168  }
169 
170  virtual void v_FwdTrans(const Array<OneD,const NekDouble> &inarray,
171  Array<OneD, NekDouble> &outarray,
172  CoeffState coeffstate);
173 
174  virtual void v_FwdTrans_IterPerExp(const Array<OneD,const NekDouble> &inarray, Array<OneD, NekDouble> &outarray);
175 
176  virtual void v_BwdTrans(const Array<OneD,const NekDouble> &inarray,
177  Array<OneD, NekDouble> &outarray,
178  CoeffState coeffstate);
179 
180 
181  virtual void v_BwdTrans_IterPerExp(const Array<OneD,const NekDouble> &inarray, Array<OneD, NekDouble> &outarray);
182 
183  virtual void v_IProductWRTBase(const Array<OneD, const NekDouble> &inarray, Array<OneD, NekDouble> &outarray, CoeffState coeffstate);
184 
186 
187  virtual std::vector<LibUtilities::FieldDefinitionsSharedPtr> v_GetFieldDefinitions(void);
188 
189  virtual void v_GetFieldDefinitions(std::vector<LibUtilities::FieldDefinitionsSharedPtr> &fielddef);
190 
191  virtual void v_AppendFieldData(LibUtilities::FieldDefinitionsSharedPtr &fielddef, std::vector<NekDouble> &fielddata);
192 
193  virtual void v_AppendFieldData(LibUtilities::FieldDefinitionsSharedPtr &fielddef, std::vector<NekDouble> &fielddata, Array<OneD, NekDouble> &coeffs);
194 
195  virtual void v_ExtractDataToCoeffs(LibUtilities::FieldDefinitionsSharedPtr &fielddef, std::vector<NekDouble> &fielddata, std::string &field, Array<OneD, NekDouble> &coeffs);
196 
197  virtual void v_WriteVtkPieceData(std::ostream &outfile, int expansion,
198  std::string var);
199 
200  virtual void v_HomogeneousFwdTrans(const Array<OneD, const NekDouble> &inarray,
201  Array<OneD, NekDouble> &outarray,
202  CoeffState coeffstate = eLocal,
203  bool Shuff = true,
204  bool UnShuff = true);
205 
206  virtual void v_HomogeneousBwdTrans(const Array<OneD, const NekDouble> &inarray,
207  Array<OneD, NekDouble> &outarray,
208  CoeffState coeffstate = eLocal,
209  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  CoeffState coeffstate = eLocal);
216 
217  virtual void v_DealiasedDotProd(
218  const Array<OneD, Array<OneD, NekDouble> > &inarray1,
219  const Array<OneD, Array<OneD, NekDouble> > &inarray2,
220  Array<OneD, Array<OneD, NekDouble> > &outarray,
221  CoeffState coeffstate = eLocal);
222 
223  virtual void v_PhysDeriv(const Array<OneD, const NekDouble> &inarray,
224  Array<OneD, NekDouble> &out_d0,
225  Array<OneD, NekDouble> &out_d1,
226  Array<OneD, NekDouble> &out_d2);
227 
228  virtual void v_PhysDeriv(Direction edir,
229  const Array<OneD, const NekDouble> &inarray,
230  Array<OneD, NekDouble> &out_d);
231 
232  private:
233 
234  //Padding operations variables
240  };
241 
243  Array<OneD, NekDouble> &outarray,
244  CoeffState coeffstate,
245  bool Shuff,
246  bool UnShuff)
247  {
248  v_HomogeneousFwdTrans(inarray,outarray,coeffstate,Shuff,UnShuff);
249  }
250 
252  Array<OneD, NekDouble> &outarray,
253  CoeffState coeffstate,
254  bool Shuff,
255  bool UnShuff)
256  {
257  v_HomogeneousBwdTrans(inarray,outarray,coeffstate,Shuff,UnShuff);
258  }
259 
260  } //end of namespace
261 } //end of namespace
262 
263 #endif//EXPLISTHOMO2D_H
264 
265 /**
266 * $Log: v $
267 *
268 **/
269 
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:181
#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
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:55
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_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.
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