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 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 
101  MULTI_REGIONS_EXPORT void Homogeneous2DTrans(const Array<OneD, const NekDouble> &inarray,
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 
127  MULTI_REGIONS_EXPORT void PhysDeriv(const Array<OneD, const NekDouble> &inarray,
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;
140  Array<OneD,NekDouble> m_tmpIN;
141  Array<OneD,NekDouble> m_tmpOUT;
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
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 
188  virtual void v_IProductWRTBase_IterPerExp(const Array<OneD, const NekDouble> &inarray, Array<OneD, NekDouble> &outarray);
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_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_PhysDeriv(const Array<OneD, const NekDouble> &inarray,
218  Array<OneD, NekDouble> &out_d0,
219  Array<OneD, NekDouble> &out_d1,
220  Array<OneD, NekDouble> &out_d2);
221 
222  virtual void v_PhysDeriv(Direction edir,
223  const Array<OneD, const NekDouble> &inarray,
224  Array<OneD, NekDouble> &out_d);
225 
226  private:
227 
228  //Padding operations variables
234  };
235 
236  inline void ExpListHomogeneous2D::HomogeneousFwdTrans(const Array<OneD, const NekDouble> &inarray,
237  Array<OneD, NekDouble> &outarray,
238  CoeffState coeffstate,
239  bool Shuff,
240  bool UnShuff)
241  {
242  v_HomogeneousFwdTrans(inarray,outarray,coeffstate,Shuff,UnShuff);
243  }
244 
245  inline void ExpListHomogeneous2D::HomogeneousBwdTrans(const Array<OneD, const NekDouble> &inarray,
246  Array<OneD, NekDouble> &outarray,
247  CoeffState coeffstate,
248  bool Shuff,
249  bool UnShuff)
250  {
251  v_HomogeneousBwdTrans(inarray,outarray,coeffstate,Shuff,UnShuff);
252  }
253 
254  inline void ExpListHomogeneous2D::DealiasedProd(const Array<OneD, NekDouble> &inarray1,
255  const Array<OneD, NekDouble> &inarray2,
256  Array<OneD, NekDouble> &outarray,
257  CoeffState coeffstate)
258  {
259  v_DealiasedProd(inarray1,inarray2,outarray,coeffstate);
260  }
261 
262  } //end of namespace
263 } //end of namespace
264 
265 #endif//EXPLISTHOMO2D_H
266 
267 /**
268 * $Log: v $
269 *
270 **/
271