Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ExpListHomogeneous1D.h
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File ExpListHomogeneous1D.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 1
33 // direction
34 //
35 ///////////////////////////////////////////////////////////////////////////////
36 
37 #ifndef EXPLISTHOMO1D_H
38 #define EXPLISTHOMO1D_H
40 #include <vector>
42 #include <MultiRegions/ExpList.h>
45 
46 namespace Nektar
47 {
48  namespace MultiRegions
49  {
50 
52  {
57  };
58 
59  /// A map between homo matrix keys and their associated block
60  /// matrices.
61  typedef std::map< Homogeneous1DMatType, DNekBlkMatSharedPtr> Homo1DBlockMatrixMap;
62  /// A shared pointer to a BlockMatrixMap.
63  typedef boost::shared_ptr<Homo1DBlockMatrixMap> Homo1DBlockMatrixMapShPtr;
64 
65  // Forward declaration for typedefs
67 
68  /// Shared pointer to an ExpList3DHomogeneous1D object.
69  typedef boost::shared_ptr<ExpListHomogeneous1D> ExpListHomogeneous1DSharedPtr;
70  /// Vector of pointers to ExpList3DHomogeneous1D objects.
71  typedef std::vector< ExpListHomogeneous1DSharedPtr > ExpListHomogeneous1DVector;
72  /// Iterator for the vector of ExpList3DHomogeneous1D pointers.
74 
75  /// Abstraction of a two-dimensional multi-elemental expansion which
76  /// is merely a collection of local expansions.
78  {
79  public:
80  /// Default constructor.
82 
83  MULTI_REGIONS_EXPORT ExpListHomogeneous1D(const LibUtilities::SessionReaderSharedPtr &pSession,const LibUtilities::BasisKey &HomoBasis, const NekDouble lz, const bool useFFT, const bool dealiasing);
84 
85  /// Copy constructor.
86  MULTI_REGIONS_EXPORT ExpListHomogeneous1D(const ExpListHomogeneous1D &In);
87 
88  MULTI_REGIONS_EXPORT ExpListHomogeneous1D(const ExpListHomogeneous1D &In,
89  const std::vector<unsigned int> &eIDs);
90 
91  /// Destructor.
93 
95  Array<OneD, NekDouble> &outarray,
96  bool IsForwards,
97 
98  CoeffState coeffstate = eLocal,
99  bool Shuff = true,
100  bool UnShuff = true);
101 
102  inline void HomogeneousFwdTrans(const Array<OneD, const NekDouble> &inarray,
103  Array<OneD, NekDouble> &outarray,
104 
105  CoeffState coeffstate = eLocal,
106  bool Shuff = true,
107  bool UnShuff = true);
108 
109  inline void HomogeneousBwdTrans(const Array<OneD, const NekDouble> &inarray,
110  Array<OneD, NekDouble> &outarray,
111  CoeffState coeffstate = eLocal,
112  bool Shuff = true,
113  bool UnShuff = true);
114 
115  inline void DealiasedProd(const Array<OneD, NekDouble> &inarray1,
116  const Array<OneD, NekDouble> &inarray2,
117  Array<OneD, NekDouble> &outarray,
118  CoeffState coeffstate = eLocal);
119 
121  {
122  return m_homogeneousBasis;
123  }
124 
126  Array<OneD, NekDouble> &out_d0,
127  Array<OneD, NekDouble> &out_d1,
128  Array<OneD, NekDouble> &out_d2);
129 
131  const Array<OneD, const NekDouble> &inarray,
132  Array<OneD, NekDouble> &out_d);
133 
135  {
136  return m_planes[n];
137  }
138 
141  protected:
142 
143  /// FFT variables
144  bool m_useFFT;
146 
148 
151 
152  /// Definition of the total number of degrees of freedom and
153  /// quadrature points. Sets up the storage for \a m_coeff and \a
154  /// m_phys.
156  NekDouble m_lhom; ///< Width of homogeneous direction
157  Homo1DBlockMatrixMapShPtr m_homogeneous1DBlockMat;
159 
160  boost::unordered_map<int, int> m_zIdToPlane;
161 
163 
165 
166 
168  {
169  NekDouble returnval = 0.0;
170 
171  if(m_specVanVisc.num_elements())
172  {
173  returnval = m_specVanVisc[k];
174  }
175 
176  return returnval;
177  }
178 
179  // virtual functions
181  {
182  m_specVanVisc = visc;
183  }
184 
185  virtual int v_GetNumElmts(void)
186  {
187  return m_planes[0]->GetExpSize();
188  }
189 
191  {
192  return GetHomogeneousBasis();
193  }
194 
195  virtual void v_FwdTrans(const Array<OneD,const NekDouble> &inarray,
196  Array<OneD, NekDouble> &outarray,
197  CoeffState coeffstate);
198 
199  virtual void v_FwdTrans_IterPerExp(const Array<OneD,const NekDouble> &inarray,
200  Array<OneD, NekDouble> &outarray);
201 
202  virtual void v_BwdTrans(const Array<OneD,const NekDouble> &inarray,
203  Array<OneD, NekDouble> &outarray,
204  CoeffState coeffstate);
205 
206  virtual void v_BwdTrans_IterPerExp(const Array<OneD,const NekDouble> &inarray,
207  Array<OneD, NekDouble> &outarray);
208 
209  virtual void v_IProductWRTBase(const Array<OneD, const NekDouble> &inarray,
210  Array<OneD, NekDouble> &outarray,
211  CoeffState coeffstate);
212 
213  virtual void v_IProductWRTBase_IterPerExp(const Array<OneD, const NekDouble> &inarray,
214  Array<OneD, NekDouble> &outarray);
215 
216  virtual std::vector<LibUtilities::FieldDefinitionsSharedPtr> v_GetFieldDefinitions(void);
217 
218  virtual void v_GetFieldDefinitions(std::vector<LibUtilities::FieldDefinitionsSharedPtr> &fielddef);
219 
220  virtual void v_AppendFieldData(LibUtilities::FieldDefinitionsSharedPtr &fielddef, std::vector<NekDouble> &fielddata);
221 
222  virtual void v_AppendFieldData(LibUtilities::FieldDefinitionsSharedPtr &fielddef, std::vector<NekDouble> &fielddata, Array<OneD, NekDouble> &coeffs);
223 
224  virtual void v_ExtractDataToCoeffs(LibUtilities::FieldDefinitionsSharedPtr &fielddef, std::vector<NekDouble> &fielddata, std::string &field, Array<OneD, NekDouble> &coeffs);
225 
226  virtual void v_ExtractCoeffsToCoeffs(
227  const boost::shared_ptr<ExpList> &fromExpList, const Array<OneD, const NekDouble> &fromCoeffs, Array<OneD, NekDouble> &toCoeffs);
228 
229  virtual void v_WriteVtkPieceData(std::ostream &outfile, int expansion,
230  std::string var);
231 
232  virtual void v_PhysInterp1DScaled(const NekDouble scale, const Array<OneD, NekDouble> &inarray, Array<OneD, NekDouble> &outarray);
233 
234  virtual void v_PhysGalerkinProjection1DScaled(const NekDouble scale, const Array<OneD, NekDouble> &inarray, Array<OneD, NekDouble> &outarray);
235 
236 
237  virtual void v_HomogeneousFwdTrans(const Array<OneD, const NekDouble> &inarray,
238  Array<OneD, NekDouble> &outarray,
239  CoeffState coeffstate = eLocal,
240  bool Shuff = true,
241  bool UnShuff = true);
242 
243  virtual void v_HomogeneousBwdTrans(const Array<OneD, const NekDouble> &inarray,
244  Array<OneD, NekDouble> &outarray,
245  CoeffState coeffstate = eLocal,
246  bool Shuff = true,
247  bool UnShuff = true);
248 
249  virtual void v_DealiasedProd(const Array<OneD, NekDouble> &inarray1,
250  const Array<OneD, NekDouble> &inarray2,
251  Array<OneD, NekDouble> &outarray,
252  CoeffState coeffstate = eLocal);
253 
254  virtual void v_PhysDeriv(const Array<OneD, const NekDouble> &inarray,
255  Array<OneD, NekDouble> &out_d0,
256  Array<OneD, NekDouble> &out_d1,
257  Array<OneD, NekDouble> &out_d2);
258 
259  virtual void v_PhysDeriv(Direction edir,
260  const Array<OneD, const NekDouble> &inarray,
261  Array<OneD, NekDouble> &out_d);
262 
264 
266 
267  virtual ExpListSharedPtr &v_GetPlane(int n)
268  {
269  return GetPlane(n);
270  }
271 
272  virtual NekDouble v_GetHomoLen(void);
273 
274  private:
275 
276  //Padding operations variables
279 
280  /// Spectral vanishing Viscosity coefficient for stabilisation
282  };
283 
285  Array<OneD, NekDouble> &outarray,
286  CoeffState coeffstate,
287  bool Shuff,
288  bool UnShuff)
289  {
290  v_HomogeneousFwdTrans(inarray,outarray,coeffstate,Shuff,UnShuff);
291  }
292 
294  Array<OneD, NekDouble> &outarray,
295  CoeffState coeffstate,
296  bool Shuff,
297  bool UnShuff)
298  {
299  v_HomogeneousBwdTrans(inarray,outarray,coeffstate,Shuff,UnShuff);
300  }
301 
303  const Array<OneD, NekDouble> &inarray2,
304  Array<OneD, NekDouble> &outarray,
305  CoeffState coeffstate)
306  {
307  v_DealiasedProd(inarray1,inarray2,outarray,coeffstate);
308  }
309 
310  } //end of namespace
311 } //end of namespace
312 
313 #endif//EXPLISTHOMO1D_H
314 
315 /**
316 * $Log: v $
317 *
318 **/
319 
Abstraction of a two-dimensional multi-elemental expansion which is merely a collection of local expa...
void HomogeneousBwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate=eLocal, bool Shuff=true, bool UnShuff=true)
virtual void v_FwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate)
virtual ExpListSharedPtr & v_GetPlane(int n)
void DealiasedProd(const Array< OneD, NekDouble > &inarray1, const Array< OneD, NekDouble > &inarray2, Array< OneD, NekDouble > &outarray, CoeffState coeffstate=eLocal)
DNekBlkMatSharedPtr GetHomogeneous1DBlockMatrix(Homogeneous1DMatType mattype, CoeffState coeffstate=eLocal) const
virtual void v_PhysGalerkinProjection1DScaled(const NekDouble scale, const Array< OneD, NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
boost::shared_ptr< Transposition > TranspositionSharedPtr
Local coefficients.
std::vector< ExpListHomogeneous1DSharedPtr >::iterator ExpListHomogeneous1DVectorIter
Iterator for the vector of ExpList3DHomogeneous1D pointers.
LibUtilities::TranspositionSharedPtr m_transposition
virtual void v_WriteVtkPieceData(std::ostream &outfile, int expansion, std::string var)
virtual void v_PhysInterp1DScaled(const NekDouble scale, const Array< OneD, NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
std::vector< ExpListHomogeneous1DSharedPtr > ExpListHomogeneous1DVector
Vector of pointers to ExpList3DHomogeneous1D objects.
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_ExtractCoeffsToCoeffs(const boost::shared_ptr< ExpList > &fromExpList, const Array< OneD, const NekDouble > &fromCoeffs, Array< OneD, NekDouble > &toCoeffs)
boost::shared_ptr< FieldDefinitions > FieldDefinitionsSharedPtr
Definition: FieldIO.h:118
LibUtilities::NektarFFTSharedPtr m_FFT_deal
#define MULTI_REGIONS_EXPORT
NekDouble m_lhom
Width of homogeneous direction.
virtual void v_HomogeneousFwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate=eLocal, bool Shuff=true, bool UnShuff=true)
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
Definition: MeshPartition.h:51
virtual LibUtilities::TranspositionSharedPtr v_GetTransposition(void)
virtual void v_AppendFieldData(LibUtilities::FieldDefinitionsSharedPtr &fielddef, std::vector< NekDouble > &fielddata)
Array< OneD, NekDouble > m_specVanVisc
Spectral vanishing Viscosity coefficient for stabilisation.
virtual void v_IProductWRTBase(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate)
LibUtilities::BasisSharedPtr m_homogeneousBasis
Definition of the total number of degrees of freedom and quadrature points. Sets up the storage for m...
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
boost::unordered_map< int, int > m_zIdToPlane
boost::shared_ptr< Homo1DBlockMatrixMap > Homo1DBlockMatrixMapShPtr
A shared pointer to a BlockMatrixMap.
virtual void v_BwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate)
boost::shared_ptr< ExpListHomogeneous1D > ExpListHomogeneous1DSharedPtr
Shared pointer to an ExpList3DHomogeneous1D object.
boost::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
virtual void v_BwdTrans_IterPerExp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Array< OneD, ExpListSharedPtr > m_planes
double NekDouble
void HomogeneousFwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate=eLocal, bool Shuff=true, bool UnShuff=true)
virtual void v_FwdTrans_IterPerExp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
virtual void v_HomogeneousBwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate=eLocal, bool Shuff=true, bool UnShuff=true)
virtual Array< OneD, const unsigned int > v_GetZIDs(void)
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< DNekBlkMat > DNekBlkMatSharedPtr
Definition: NekTypeDefs.hpp:72
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator
virtual void v_DealiasedProd(const Array< OneD, NekDouble > &inarray1, const Array< OneD, NekDouble > &inarray2, Array< OneD, NekDouble > &outarray, CoeffState coeffstate=eLocal)
void Homogeneous1DTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, bool IsForwards, CoeffState coeffstate=eLocal, bool Shuff=true, bool UnShuff=true)
virtual std::vector< LibUtilities::FieldDefinitionsSharedPtr > v_GetFieldDefinitions(void)
DNekBlkMatSharedPtr GenHomogeneous1DBlockMatrix(Homogeneous1DMatType mattype, CoeffState coeffstate=eLocal) const
virtual void v_IProductWRTBase_IterPerExp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
std::map< Homogeneous1DMatType, DNekBlkMatSharedPtr > Homo1DBlockMatrixMap
A map between homo matrix keys and their associated block matrices.
boost::shared_ptr< Basis > BasisSharedPtr
LibUtilities::BasisSharedPtr GetHomogeneousBasis(void)
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)
virtual void v_SetHomo1DSpecVanVisc(Array< OneD, NekDouble > visc)
Describes the specification for a Basis.
Definition: Basis.h:50
virtual LibUtilities::BasisSharedPtr v_GetHomogeneousBasis(void)
boost::shared_ptr< NektarFFT > NektarFFTSharedPtr
Definition: NektarFFT.h:56
LibUtilities::NektarFFTSharedPtr m_FFT