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 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  /// Destructor.
90 
91  MULTI_REGIONS_EXPORT void Homogeneous1DTrans(const Array<OneD, const NekDouble> &inarray,
92  Array<OneD, NekDouble> &outarray,
93  bool IsForwards,
94 
95  CoeffState coeffstate = eLocal,
96  bool Shuff = true,
97  bool UnShuff = true);
98 
99  inline void HomogeneousFwdTrans(const Array<OneD, const NekDouble> &inarray,
100  Array<OneD, NekDouble> &outarray,
101 
102  CoeffState coeffstate = eLocal,
103  bool Shuff = true,
104  bool UnShuff = true);
105 
106  inline void HomogeneousBwdTrans(const Array<OneD, const NekDouble> &inarray,
107  Array<OneD, NekDouble> &outarray,
108  CoeffState coeffstate = eLocal,
109  bool Shuff = true,
110  bool UnShuff = true);
111 
112  inline void DealiasedProd(const Array<OneD, NekDouble> &inarray1,
113  const Array<OneD, NekDouble> &inarray2,
114  Array<OneD, NekDouble> &outarray,
115  CoeffState coeffstate = eLocal);
116 
118  {
119  return m_homogeneousBasis;
120  }
121 
122  MULTI_REGIONS_EXPORT void PhysDeriv(const Array<OneD, const NekDouble> &inarray,
123  Array<OneD, NekDouble> &out_d0,
124  Array<OneD, NekDouble> &out_d1,
125  Array<OneD, NekDouble> &out_d2);
126 
128  const Array<OneD, const NekDouble> &inarray,
129  Array<OneD, NekDouble> &out_d);
130 
132  {
133  return m_planes[n];
134  }
135 
137 
138  protected:
139 
140  /// FFT variables
141  bool m_useFFT;
143 
145 
146  Array<OneD,NekDouble> m_tmpIN;
147  Array<OneD,NekDouble> m_tmpOUT;
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.
153  NekDouble m_lhom; ///< Width of homogeneous direction
155  Array<OneD, ExpListSharedPtr> m_planes;
156 
158 
160 
161 
163  {
164  NekDouble returnval = 0.0;
165 
166  if(m_specVanVisc.num_elements())
167  {
168  returnval = m_specVanVisc[k];
169  }
170 
171  return returnval;
172  }
173 
174  // virtual functions
175  virtual void v_SetHomo1DSpecVanVisc(Array<OneD, NekDouble> visc)
176  {
177  m_specVanVisc = visc;
178  }
179 
180  virtual int v_GetNumElmts(void)
181  {
182  return m_planes[0]->GetExpSize();
183  }
184 
186  {
187  return GetHomogeneousBasis();
188  }
189 
190  virtual void v_FwdTrans(const Array<OneD,const NekDouble> &inarray,
191  Array<OneD, NekDouble> &outarray,
192  CoeffState coeffstate);
193 
194  virtual void v_FwdTrans_IterPerExp(const Array<OneD,const NekDouble> &inarray,
195  Array<OneD, NekDouble> &outarray);
196 
197  virtual void v_BwdTrans(const Array<OneD,const NekDouble> &inarray,
198  Array<OneD, NekDouble> &outarray,
199  CoeffState coeffstate);
200 
201  virtual void v_BwdTrans_IterPerExp(const Array<OneD,const NekDouble> &inarray,
202  Array<OneD, NekDouble> &outarray);
203 
204  virtual void v_IProductWRTBase(const Array<OneD, const NekDouble> &inarray,
205  Array<OneD, NekDouble> &outarray,
206  CoeffState coeffstate);
207 
208  virtual void v_IProductWRTBase_IterPerExp(const Array<OneD, const NekDouble> &inarray,
209  Array<OneD, NekDouble> &outarray);
210 
211  virtual std::vector<LibUtilities::FieldDefinitionsSharedPtr> v_GetFieldDefinitions(void);
212 
213  virtual void v_GetFieldDefinitions(std::vector<LibUtilities::FieldDefinitionsSharedPtr> &fielddef);
214 
215  virtual void v_AppendFieldData(LibUtilities::FieldDefinitionsSharedPtr &fielddef, std::vector<NekDouble> &fielddata);
216 
217  virtual void v_AppendFieldData(LibUtilities::FieldDefinitionsSharedPtr &fielddef, std::vector<NekDouble> &fielddata, Array<OneD, NekDouble> &coeffs);
218 
219  virtual void v_ExtractDataToCoeffs(LibUtilities::FieldDefinitionsSharedPtr &fielddef, std::vector<NekDouble> &fielddata, std::string &field, Array<OneD, NekDouble> &coeffs);
220 
221  virtual void v_ExtractCoeffsToCoeffs(
222  const boost::shared_ptr<ExpList> &fromExpList, const Array<OneD, const NekDouble> &fromCoeffs, Array<OneD, NekDouble> &toCoeffs);
223 
224  virtual void v_WriteVtkPieceData(std::ostream &outfile, int expansion,
225  std::string var);
226 
227  virtual void v_PhysInterp1DScaled(const NekDouble scale, const Array<OneD, NekDouble> &inarray, Array<OneD, NekDouble> &outarray);
228 
229  virtual void v_PhysGalerkinProjection1DScaled(const NekDouble scale, const Array<OneD, NekDouble> &inarray, Array<OneD, NekDouble> &outarray);
230 
231 
232  virtual void v_HomogeneousFwdTrans(const Array<OneD, const NekDouble> &inarray,
233  Array<OneD, NekDouble> &outarray,
234  CoeffState coeffstate = eLocal,
235  bool Shuff = true,
236  bool UnShuff = true);
237 
238  virtual void v_HomogeneousBwdTrans(const Array<OneD, const NekDouble> &inarray,
239  Array<OneD, NekDouble> &outarray,
240  CoeffState coeffstate = eLocal,
241  bool Shuff = true,
242  bool UnShuff = true);
243 
244  virtual void v_DealiasedProd(const Array<OneD, NekDouble> &inarray1,
245  const Array<OneD, NekDouble> &inarray2,
246  Array<OneD, NekDouble> &outarray,
247  CoeffState coeffstate = eLocal);
248 
249  virtual void v_PhysDeriv(const Array<OneD, const NekDouble> &inarray,
250  Array<OneD, NekDouble> &out_d0,
251  Array<OneD, NekDouble> &out_d1,
252  Array<OneD, NekDouble> &out_d2);
253 
254  virtual void v_PhysDeriv(Direction edir,
255  const Array<OneD, const NekDouble> &inarray,
256  Array<OneD, NekDouble> &out_d);
257 
259 
260  virtual Array<OneD, const unsigned int> v_GetZIDs(void);
261 
262  virtual ExpListSharedPtr &v_GetPlane(int n)
263  {
264  return GetPlane(n);
265  }
266 
267  virtual NekDouble v_GetHomoLen(void);
268 
269  private:
270 
271  //Padding operations variables
274 
275  /// Spectral vanishing Viscosity coefficient for stabilisation
276  Array<OneD, NekDouble> m_specVanVisc;
277  };
278 
279  inline void ExpListHomogeneous1D::HomogeneousFwdTrans(const Array<OneD, const NekDouble> &inarray,
280  Array<OneD, NekDouble> &outarray,
281  CoeffState coeffstate,
282  bool Shuff,
283  bool UnShuff)
284  {
285  v_HomogeneousFwdTrans(inarray,outarray,coeffstate,Shuff,UnShuff);
286  }
287 
288  inline void ExpListHomogeneous1D::HomogeneousBwdTrans(const Array<OneD, const NekDouble> &inarray,
289  Array<OneD, NekDouble> &outarray,
290  CoeffState coeffstate,
291  bool Shuff,
292  bool UnShuff)
293  {
294  v_HomogeneousBwdTrans(inarray,outarray,coeffstate,Shuff,UnShuff);
295  }
296 
297  inline void ExpListHomogeneous1D::DealiasedProd(const Array<OneD, NekDouble> &inarray1,
298  const Array<OneD, NekDouble> &inarray2,
299  Array<OneD, NekDouble> &outarray,
300  CoeffState coeffstate)
301  {
302  v_DealiasedProd(inarray1,inarray2,outarray,coeffstate);
303  }
304 
305  } //end of namespace
306 } //end of namespace
307 
308 #endif//EXPLISTHOMO1D_H
309 
310 /**
311 * $Log: v $
312 *
313 **/
314