Nektar++
StdPyrExp.h
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File StdPyrExp.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 // Permission is hereby granted, free of charge, to any person obtaining a
14 // copy of this software and associated documentation files (the "Software"),
15 // to deal in the Software without restriction, including without limitation
16 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
17 // and/or sell copies of the Software, and to permit persons to whom the
18 // Software is furnished to do so, subject to the following conditions:
19 //
20 // The above copyright notice and this permission notice shall be included
21 // in all copies or substantial portions of the Software.
22 //
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29 // DEALINGS IN THE SOFTWARE.
30 //
31 // Description: Header field for pyramidic routines built upon
32 // StdExpansion3D
33 //
34 ///////////////////////////////////////////////////////////////////////////////
35 
36 #ifndef NEKTAR_LIBS_STDREGIONS_STDPYREXP_H
37 #define NEKTAR_LIBS_STDREGIONS_STDPYREXP_H
38 
41 #include <tuple>
42 
43 namespace Nektar
44 {
45  namespace StdRegions
46  {
47  typedef std::tuple<
48  unsigned int, unsigned int, unsigned int, unsigned int> Mode;
49 
50  struct cmpop
51  {
52  bool operator()(Mode const &a, Mode const &b) const
53  {
54  if (std::get<0>(a) < std::get<0>(b))
55  {
56  return true;
57  }
58  if (std::get<0>(a) > std::get<0>(b))
59  {
60  return false;
61  }
62 
63  if (std::get<1>(a) < std::get<1>(b))
64  {
65  return true;
66  }
67  if (std::get<1>(a) > std::get<1>(b))
68  {
69  return false;
70  }
71 
72  if (std::get<2>(a) < std::get<2>(b))
73  {
74  return true;
75  }
76 
77  return false;
78  }
79  };
80 
81  class StdPyrExp : virtual public StdExpansion3D
82  {
83  public:
85 
87  const LibUtilities::BasisKey &Bb,
88  const LibUtilities::BasisKey &Bc);
89 
91  const LibUtilities::BasisKey &Bb,
92  const LibUtilities::BasisKey &Bc,
93  NekDouble *coeffs,
94  NekDouble *phys);
95 
97 
99 
100  protected:
101  //---------------------------------------
102  // Differentiation/integration Methods
103  //---------------------------------------
104  STD_REGIONS_EXPORT virtual void v_PhysDeriv(
105  const Array<OneD, const NekDouble> &inarray,
106  Array<OneD, NekDouble> &out_d0,
107  Array<OneD, NekDouble> &out_d1,
108  Array<OneD, NekDouble> &out_d2);
109  STD_REGIONS_EXPORT virtual void v_PhysDeriv(
110  const int dir,
111  const Array<OneD, const NekDouble> &inarray,
112  Array<OneD, NekDouble> &outarray);
113  STD_REGIONS_EXPORT virtual void v_StdPhysDeriv(
114  const Array<OneD, const NekDouble> &inarray,
115  Array<OneD, NekDouble> &out_d0,
116  Array<OneD, NekDouble> &out_d1,
117  Array<OneD, NekDouble> &out_d2);
118  STD_REGIONS_EXPORT virtual void v_StdPhysDeriv(
119  const int dir,
120  const Array<OneD, const NekDouble> &inarray,
121  Array<OneD, NekDouble> &outarray);
123  const Array<OneD, const NekDouble> &inarray,
124  Array<OneD, NekDouble> &outarray);
125 
126  //---------------------------------------
127  // Transforms
128  //---------------------------------------
129  STD_REGIONS_EXPORT virtual void v_BwdTrans(
130  const Array<OneD, const NekDouble>& inarray,
131  Array<OneD, NekDouble> &outarray);
133  const Array<OneD, const NekDouble> &inarray,
134  Array<OneD, NekDouble> &outarray);
136  const Array<OneD, const NekDouble> &base0,
137  const Array<OneD, const NekDouble> &base1,
138  const Array<OneD, const NekDouble> &base2,
139  const Array<OneD, const NekDouble> &inarray,
140  Array<OneD, NekDouble> &outarray,
142  bool doCheckCollDir0,
143  bool doCheckCollDir1,
144  bool doCheckCollDir2);
145  STD_REGIONS_EXPORT virtual void v_FwdTrans(
146  const Array<OneD, const NekDouble>& inarray,
147  Array<OneD, NekDouble> &outarray);
148 
149  //---------------------------------------
150  // Inner product functions
151  //---------------------------------------
153  const Array<OneD, const NekDouble> &inarray,
154  Array<OneD, NekDouble> &outarray);
156  const Array<OneD, const NekDouble> &inarray,
157  Array<OneD, NekDouble> &outarray,
158  bool multiplybyweights = true);
160  const Array<OneD, const NekDouble> &base0,
161  const Array<OneD, const NekDouble> &base1,
162  const Array<OneD, const NekDouble> &base2,
163  const Array<OneD, const NekDouble> &inarray,
164  Array<OneD, NekDouble> &outarray,
166  bool doCheckCollDir0,
167  bool doCheckCollDir1,
168  bool doCheckCollDir2);
170  const int dir,
171  const Array<OneD, const NekDouble>& inarray,
172  Array<OneD, NekDouble>& outarray);
174  const int dir,
175  const Array<OneD, const NekDouble>& inarray,
176  Array<OneD, NekDouble>& outarray);
177 
178  //---------------------------------------
179  // Evaluation functions
180  //---------------------------------------
184  STD_REGIONS_EXPORT virtual void v_GetCoords(
185  Array<OneD, NekDouble> & xi_x,
186  Array<OneD, NekDouble> & xi_y,
187  Array<OneD, NekDouble> & xi_z);
188  STD_REGIONS_EXPORT virtual void v_FillMode(
189  const int mode,
190  Array<OneD, NekDouble> &outarray);
192  const int fid,
193  const Orientation faceOrient,
194  int &numModes0,
195  int &numModes1);
196 
197  //---------------------------------------
198  // Helper functions
199  //---------------------------------------
200  STD_REGIONS_EXPORT virtual int v_GetNverts() const;
201  STD_REGIONS_EXPORT virtual int v_GetNedges() const;
202  STD_REGIONS_EXPORT virtual int v_GetNfaces() const;
204  STD_REGIONS_EXPORT virtual int v_NumBndryCoeffs() const;
205  STD_REGIONS_EXPORT virtual int v_NumDGBndryCoeffs() const;
206  STD_REGIONS_EXPORT virtual int v_GetEdgeNcoeffs(const int i) const;
207  STD_REGIONS_EXPORT virtual int v_GetFaceNcoeffs(const int i) const;
208  STD_REGIONS_EXPORT virtual int v_GetFaceIntNcoeffs(const int i) const;
209  STD_REGIONS_EXPORT virtual int v_GetFaceNumPoints(const int i) const;
211  const std::vector<unsigned int> &nummodes,
212  int &modes_offset);
214  v_DetFaceBasisKey(const int i, const int k) const;
216  const int i) const;
217 
218  //---------------------------------------
219  // Mappings
220  //---------------------------------------
222  const int fid,
223  const Orientation faceOrient,
224  Array<OneD, unsigned int> &maparray,
225  Array<OneD, int> &signarray,
226  int nummodesA=-1,
227  int nummodesB=-1);
229  int localVertexId,
230  bool useCoeffPacking = false);
232  const int eid,
233  const Orientation edgeOrient,
234  Array<OneD, unsigned int> &maparray,
235  Array<OneD, int> &signarray);
237  const int fid,
238  const Orientation faceOrient,
239  Array<OneD, unsigned int> &maparray,
240  Array<OneD, int> &signarray);
242  Array<OneD, unsigned int> &outarray);
244  Array<OneD, unsigned int> &outarray);
245 
246  //---------------------------------------
247  // Wrapper functions
248  //---------------------------------------
250  const StdMatrixKey &mkey);
252  const StdMatrixKey &mkey);
253 
255  const StdMatrixKey &mkey);
256 
257  //---------------------------------------
258  // Method for applying sensors
259  //---------------------------------------
261  int numMin,
262  const Array<OneD, const NekDouble> &inarray,
263  Array<OneD, NekDouble> &outarray);
264  private:
265  //---------------------------------------
266  // Private helper functions
267  //---------------------------------------
268  STD_REGIONS_EXPORT int GetMode(int I, int J, int K);
269  };
270  typedef std::shared_ptr<StdPyrExp> StdPyrExpSharedPtr;
271  } //end of namespace
272 } //end of namespace
273 
274 #endif //STDPYREXP_H
#define STD_REGIONS_EXPORT
Describes the specification for a Basis.
Definition: Basis.h:50
virtual void v_GetInteriorMap(Array< OneD, unsigned int > &outarray)
Definition: StdPyrExp.cpp:1710
void v_MultiplyByStdQuadratureMetric(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Definition: StdPyrExp.cpp:1879
virtual void v_GetCoords(Array< OneD, NekDouble > &xi_x, Array< OneD, NekDouble > &xi_y, Array< OneD, NekDouble > &xi_z)
Definition: StdPyrExp.cpp:743
virtual void v_BwdTrans_SumFacKernel(const Array< OneD, const NekDouble > &base0, const Array< OneD, const NekDouble > &base1, const Array< OneD, const NekDouble > &base2, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, Array< OneD, NekDouble > &wsp, bool doCheckCollDir0, bool doCheckCollDir1, bool doCheckCollDir2)
Definition: StdPyrExp.cpp:293
virtual void v_IProductWRTDerivBase_SumFac(const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Definition: StdPyrExp.cpp:585
virtual void v_LocCoordToLocCollapsed(const Array< OneD, const NekDouble > &xi, Array< OneD, NekDouble > &eta)
Definition: StdPyrExp.cpp:723
virtual int v_GetFaceNcoeffs(const int i) const
Definition: StdPyrExp.cpp:901
virtual DNekMatSharedPtr v_GenMatrix(const StdMatrixKey &mkey)
Definition: StdPyrExp.cpp:1815
virtual void v_IProductWRTDerivBase(const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Definition: StdPyrExp.cpp:571
virtual void v_GetFaceToElementMap(const int fid, const Orientation faceOrient, Array< OneD, unsigned int > &maparray, Array< OneD, int > &signarray, int nummodesA=-1, int nummodesB=-1)
Definition: StdPyrExp.cpp:1038
virtual int v_GetEdgeNcoeffs(const int i) const
Definition: StdPyrExp.cpp:883
virtual void v_GetEdgeInteriorMap(const int eid, const Orientation edgeOrient, Array< OneD, unsigned int > &maparray, Array< OneD, int > &signarray)
Definition: StdPyrExp.cpp:1431
virtual void v_BwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Backward transformation is evaluated at the quadrature points.
Definition: StdPyrExp.cpp:252
virtual void v_IProductWRTBase_SumFac(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, bool multiplybyweights=true)
Definition: StdPyrExp.cpp:446
virtual LibUtilities::BasisType v_GetEdgeBasisType(const int i) const
Definition: StdPyrExp.cpp:1016
virtual void v_StdPhysDeriv(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &out_d0, Array< OneD, NekDouble > &out_d1, Array< OneD, NekDouble > &out_d2)
Definition: StdPyrExp.cpp:212
virtual int v_CalcNumberOfCoefficients(const std::vector< unsigned int > &nummodes, int &modes_offset)
Definition: StdPyrExp.cpp:1003
virtual int v_GetNverts() const
Definition: StdPyrExp.cpp:822
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)
Calculate the derivative of the physical points.
Definition: StdPyrExp.cpp:106
virtual void v_GetFaceNumModes(const int fid, const Orientation faceOrient, int &numModes0, int &numModes1)
Definition: StdPyrExp.cpp:778
virtual void v_GetBoundaryMap(Array< OneD, unsigned int > &outarray)
Definition: StdPyrExp.cpp:1750
virtual int v_NumDGBndryCoeffs() const
Definition: StdPyrExp.cpp:862
virtual LibUtilities::ShapeType v_DetShapeType() const
Definition: StdPyrExp.cpp:837
int GetMode(int I, int J, int K)
Compute the mode number in the expansion for a particular tensorial combination.
Definition: StdPyrExp.cpp:1850
virtual void v_IProductWRTBase_SumFacKernel(const Array< OneD, const NekDouble > &base0, const Array< OneD, const NekDouble > &base1, const Array< OneD, const NekDouble > &base2, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, Array< OneD, NekDouble > &wsp, bool doCheckCollDir0, bool doCheckCollDir1, bool doCheckCollDir2)
Definition: StdPyrExp.cpp:481
virtual int v_NumBndryCoeffs() const
Definition: StdPyrExp.cpp:842
virtual void v_FillMode(const int mode, Array< OneD, NekDouble > &outarray)
Definition: StdPyrExp.cpp:771
virtual void v_GetFaceInteriorMap(const int fid, const Orientation faceOrient, Array< OneD, unsigned int > &maparray, Array< OneD, int > &signarray)
Definition: StdPyrExp.cpp:1530
virtual const LibUtilities::BasisKey v_DetFaceBasisKey(const int i, const int k) const
Definition: StdPyrExp.cpp:965
virtual DNekMatSharedPtr v_CreateStdMatrix(const StdMatrixKey &mkey)
Definition: StdPyrExp.cpp:1820
virtual void v_IProductWRTBase(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Inner product of inarray over region with respect to the expansion basis m_base[0]->GetBdata(),...
Definition: StdPyrExp.cpp:430
virtual void v_ReduceOrderCoeffs(int numMin, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Definition: StdPyrExp.cpp:2072
virtual void v_FwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Forward transform from physical quadrature space stored in inarray and evaluate the expansion coeffic...
Definition: StdPyrExp.cpp:394
virtual void v_BwdTrans_SumFac(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Definition: StdPyrExp.cpp:273
virtual int v_GetNedges() const
Definition: StdPyrExp.cpp:827
virtual int v_GetVertexMap(int localVertexId, bool useCoeffPacking=false)
Definition: StdPyrExp.cpp:1370
virtual int v_GetFaceIntNcoeffs(const int i) const
Definition: StdPyrExp.cpp:921
virtual int v_GetFaceNumPoints(const int i) const
Definition: StdPyrExp.cpp:943
virtual void v_SVVLaplacianFilter(Array< OneD, NekDouble > &array, const StdMatrixKey &mkey)
Definition: StdPyrExp.cpp:1937
virtual int v_GetNfaces() const
Definition: StdPyrExp.cpp:832
StdPyrExp(const LibUtilities::BasisKey &Ba, const LibUtilities::BasisKey &Bb, const LibUtilities::BasisKey &Bc, NekDouble *coeffs, NekDouble *phys)
std::tuple< unsigned int, unsigned int, unsigned int, unsigned int > Mode
Definition: StdPyrExp.h:48
std::shared_ptr< StdPyrExp > StdPyrExpSharedPtr
Definition: StdPyrExp.h:270
std::shared_ptr< DNekMat > DNekMatSharedPtr
Definition: NekTypeDefs.hpp:69
double NekDouble
bool operator()(Mode const &a, Mode const &b) const
Definition: StdPyrExp.h:52