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  //---------------------------------------
185  const Array<OneD, const NekDouble>& eta,
187  STD_REGIONS_EXPORT virtual void v_GetCoords(
188  Array<OneD, NekDouble> & xi_x,
189  Array<OneD, NekDouble> & xi_y,
190  Array<OneD, NekDouble> & xi_z);
191  STD_REGIONS_EXPORT virtual void v_FillMode(
192  const int mode,
193  Array<OneD, NekDouble> &outarray);
195  const int fid,
196  int &numModes0,
197  int &numModes1,
199 
201  const Array<OneD, const NekDouble>& coords,
202  int mode) final;
203 
204 
205  //---------------------------------------
206  // Helper functions
207  //---------------------------------------
208  STD_REGIONS_EXPORT virtual int v_GetNverts() const;
209  STD_REGIONS_EXPORT virtual int v_GetNedges() const;
210  STD_REGIONS_EXPORT virtual int v_GetNtraces() const;
212  STD_REGIONS_EXPORT virtual int v_NumBndryCoeffs() const;
213  STD_REGIONS_EXPORT virtual int v_NumDGBndryCoeffs() const;
214  STD_REGIONS_EXPORT virtual int v_GetTraceNcoeffs(const int i) const;
215  STD_REGIONS_EXPORT virtual int v_GetTraceIntNcoeffs(const int i) const;
216  STD_REGIONS_EXPORT virtual int v_GetTraceNumPoints(const int i) const;
217 
218  STD_REGIONS_EXPORT virtual int v_GetEdgeNcoeffs(const int i) const;
220  const std::vector<unsigned int> &nummodes,
221  int &modes_offset);
223  v_GetTraceBasisKey(const int i, const int k) const;
224 
225  //---------------------------------------
226  // Mappings
227  //---------------------------------------
229  int localVertexId,
230  bool useCoeffPacking = false);
232  Array<OneD, unsigned int> &outarray);
234  Array<OneD, unsigned int> &outarray);
236  (const int fid,
237  Array<OneD, unsigned int> &maparray,
238  Array<OneD, int> &signarray,
239  Orientation faceOrient,
240  int P,
241  int Q);
243  const int tid,
244  Array<OneD, unsigned int> &maparray,
245  Array<OneD, int> &signarray,
246  const Orientation traceOrient = eDir1FwdDir1_Dir2FwdDir2);
247 
249  const int tid,
250  Array<OneD, unsigned int> &maparray,
251  Array<OneD, int> &signarray,
252  const Orientation traceOrient = eDir1FwdDir1_Dir2FwdDir2);
253 
254  //---------------------------------------
255  // Wrapper functions
256  //---------------------------------------
258  const StdMatrixKey &mkey);
260  const StdMatrixKey &mkey);
261 
263  const StdMatrixKey &mkey);
264 
265  //---------------------------------------
266  // Method for applying sensors
267  //---------------------------------------
269  int numMin,
270  const Array<OneD, const NekDouble> &inarray,
271  Array<OneD, NekDouble> &outarray);
272  private:
273  //---------------------------------------
274  // Private helper functions
275  //---------------------------------------
276  STD_REGIONS_EXPORT int GetMode(int I, int J, int K);
277  };
278  typedef std::shared_ptr<StdPyrExp> StdPyrExpSharedPtr;
279  } //end of namespace
280 } //end of namespace
281 
282 #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:1144
void v_MultiplyByStdQuadratureMetric(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Definition: StdPyrExp.cpp:1924
virtual void v_GetCoords(Array< OneD, NekDouble > &xi_x, Array< OneD, NekDouble > &xi_y, Array< OneD, NekDouble > &xi_z)
Definition: StdPyrExp.cpp:752
virtual void v_GetTraceNumModes(const int fid, int &numModes0, int &numModes1, Orientation faceOrient=eDir1FwdDir1_Dir2FwdDir2)
Definition: StdPyrExp.cpp:787
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 int v_GetTraceNumPoints(const int i) const
Definition: StdPyrExp.cpp:995
virtual void v_IProductWRTDerivBase_SumFac(const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Definition: StdPyrExp.cpp:584
NekDouble v_PhysEvaluateBasis(const Array< OneD, const NekDouble > &coords, int mode) final
Definition: StdPyrExp.cpp:827
virtual const LibUtilities::BasisKey v_GetTraceBasisKey(const int i, const int k) const
Definition: StdPyrExp.cpp:1034
virtual void v_LocCoordToLocCollapsed(const Array< OneD, const NekDouble > &xi, Array< OneD, NekDouble > &eta)
Definition: StdPyrExp.cpp:722
virtual DNekMatSharedPtr v_GenMatrix(const StdMatrixKey &mkey)
Definition: StdPyrExp.cpp:1860
virtual void v_IProductWRTDerivBase(const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Definition: StdPyrExp.cpp:570
virtual int v_GetEdgeNcoeffs(const int i) const
Definition: StdPyrExp.cpp:1016
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:445
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:1072
virtual int v_GetNverts() const
Definition: StdPyrExp.cpp:891
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_GetTraceToElementMap(const int fid, Array< OneD, unsigned int > &maparray, Array< OneD, int > &signarray, Orientation faceOrient, int P, int Q)
Definition: StdPyrExp.cpp:1245
virtual int v_GetTraceNcoeffs(const int i) const
Definition: StdPyrExp.cpp:953
virtual void v_GetBoundaryMap(Array< OneD, unsigned int > &outarray)
Definition: StdPyrExp.cpp:1184
virtual int v_NumDGBndryCoeffs() const
Definition: StdPyrExp.cpp:931
virtual LibUtilities::ShapeType v_DetShapeType() const
Definition: StdPyrExp.cpp:906
int GetMode(int I, int J, int K)
Compute the mode number in the expansion for a particular tensorial combination.
Definition: StdPyrExp.cpp:1895
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:480
virtual int v_NumBndryCoeffs() const
Definition: StdPyrExp.cpp:911
virtual void v_FillMode(const int mode, Array< OneD, NekDouble > &outarray)
Definition: StdPyrExp.cpp:780
virtual int v_GetTraceIntNcoeffs(const int i) const
Definition: StdPyrExp.cpp:973
virtual DNekMatSharedPtr v_CreateStdMatrix(const StdMatrixKey &mkey)
Definition: StdPyrExp.cpp:1865
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:429
virtual void v_ReduceOrderCoeffs(int numMin, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Definition: StdPyrExp.cpp:2117
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:393
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:896
virtual void v_GetTraceInteriorToElementMap(const int tid, Array< OneD, unsigned int > &maparray, Array< OneD, int > &signarray, const Orientation traceOrient=eDir1FwdDir1_Dir2FwdDir2)
Definition: StdPyrExp.cpp:1676
virtual int v_GetVertexMap(int localVertexId, bool useCoeffPacking=false)
Definition: StdPyrExp.cpp:1085
virtual void v_GetEdgeInteriorToElementMap(const int tid, Array< OneD, unsigned int > &maparray, Array< OneD, int > &signarray, const Orientation traceOrient=eDir1FwdDir1_Dir2FwdDir2)
Definition: StdPyrExp.cpp:1577
virtual void v_SVVLaplacianFilter(Array< OneD, NekDouble > &array, const StdMatrixKey &mkey)
Definition: StdPyrExp.cpp:1982
StdPyrExp(const LibUtilities::BasisKey &Ba, const LibUtilities::BasisKey &Bb, const LibUtilities::BasisKey &Bc, NekDouble *coeffs, NekDouble *phys)
virtual int v_GetNtraces() const
Definition: StdPyrExp.cpp:901
virtual void v_LocCollapsedToLocCoord(const Array< OneD, const NekDouble > &eta, Array< OneD, NekDouble > &xi)
Definition: StdPyrExp.cpp:743
std::tuple< unsigned int, unsigned int, unsigned int, unsigned int > Mode
Definition: StdPyrExp.h:48
std::shared_ptr< StdPyrExp > StdPyrExpSharedPtr
Definition: StdPyrExp.h:278
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:1
std::shared_ptr< DNekMat > DNekMatSharedPtr
Definition: NekTypeDefs.hpp:69
double NekDouble
P
Definition: main.py:133
bool operator()(Mode const &a, Mode const &b) const
Definition: StdPyrExp.h:52