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<unsigned int, unsigned int, unsigned int, unsigned int> Mode;
48 
49 struct cmpop
50 {
51  bool operator()(Mode const &a, Mode const &b) const
52  {
53  if (std::get<0>(a) < std::get<0>(b))
54  {
55  return true;
56  }
57  if (std::get<0>(a) > std::get<0>(b))
58  {
59  return false;
60  }
61 
62  if (std::get<1>(a) < std::get<1>(b))
63  {
64  return true;
65  }
66  if (std::get<1>(a) > std::get<1>(b))
67  {
68  return false;
69  }
70 
71  if (std::get<2>(a) < std::get<2>(b))
72  {
73  return true;
74  }
75 
76  return false;
77  }
78 };
79 
80 class StdPyrExp : virtual public StdExpansion3D
81 {
82 public:
84 
86  const LibUtilities::BasisKey &Bb,
87  const LibUtilities::BasisKey &Bc);
88 
90  const LibUtilities::BasisKey &Bb,
91  const LibUtilities::BasisKey &Bc,
92  NekDouble *coeffs, NekDouble *phys);
93 
95 
96  STD_REGIONS_EXPORT ~StdPyrExp() override = default;
97 
98 protected:
99  //---------------------------------------
100  // Differentiation/integration Methods
101  //---------------------------------------
103  const Array<OneD, const NekDouble> &inarray,
105  Array<OneD, NekDouble> &out_d2) override;
107  const int dir, const Array<OneD, const NekDouble> &inarray,
108  Array<OneD, NekDouble> &outarray) override;
110  const Array<OneD, const NekDouble> &inarray,
112  Array<OneD, NekDouble> &out_d2) override;
114  const int dir, const Array<OneD, const NekDouble> &inarray,
115  Array<OneD, NekDouble> &outarray) override;
117  const Array<OneD, const NekDouble> &inarray,
118  Array<OneD, NekDouble> &outarray) override;
119 
120  //---------------------------------------
121  // Transforms
122  //---------------------------------------
124  const Array<OneD, const NekDouble> &inarray,
125  Array<OneD, NekDouble> &outarray) override;
127  const Array<OneD, const NekDouble> &inarray,
128  Array<OneD, NekDouble> &outarray) override;
130  const Array<OneD, const NekDouble> &base0,
131  const Array<OneD, const NekDouble> &base1,
132  const Array<OneD, const NekDouble> &base2,
133  const Array<OneD, const NekDouble> &inarray,
135  bool doCheckCollDir0, bool doCheckCollDir1,
136  bool doCheckCollDir2) override;
138  const Array<OneD, const NekDouble> &inarray,
139  Array<OneD, NekDouble> &outarray) override;
140 
141  //---------------------------------------
142  // Inner product functions
143  //---------------------------------------
145  const Array<OneD, const NekDouble> &inarray,
146  Array<OneD, NekDouble> &outarray) override;
148  const Array<OneD, const NekDouble> &inarray,
149  Array<OneD, NekDouble> &outarray,
150  bool multiplybyweights = true) override;
152  const Array<OneD, const NekDouble> &base0,
153  const Array<OneD, const NekDouble> &base1,
154  const Array<OneD, const NekDouble> &base2,
155  const Array<OneD, const NekDouble> &inarray,
157  bool doCheckCollDir0, bool doCheckCollDir1,
158  bool doCheckCollDir2) override;
160  const int dir, const Array<OneD, const NekDouble> &inarray,
161  Array<OneD, NekDouble> &outarray) override;
163  const int dir, const Array<OneD, const NekDouble> &inarray,
164  Array<OneD, NekDouble> &outarray) override;
165 
166  //---------------------------------------
167  // Evaluation functions
168  //---------------------------------------
171  Array<OneD, NekDouble> &eta) override;
173  const Array<OneD, const NekDouble> &eta,
174  Array<OneD, NekDouble> &xi) override;
177  Array<OneD, NekDouble> &xi_z) override;
179  const int mode, Array<OneD, NekDouble> &outarray) override;
181  const int fid, int &numModes0, int &numModes1,
182  Orientation faceOrient = eDir1FwdDir1_Dir2FwdDir2) override;
183 
185  const Array<OneD, const NekDouble> &coords, int mode) final;
188  const Array<OneD, const NekDouble> &inarray,
189  std::array<NekDouble, 3> &firstOrderDerivs) override;
190 
191  //---------------------------------------
192  // Helper functions
193  //---------------------------------------
194  STD_REGIONS_EXPORT int v_GetNverts() const override;
195  STD_REGIONS_EXPORT int v_GetNedges() const override;
196  STD_REGIONS_EXPORT int v_GetNtraces() const override;
198  STD_REGIONS_EXPORT int v_NumBndryCoeffs() const override;
199  STD_REGIONS_EXPORT int v_NumDGBndryCoeffs() const override;
200  STD_REGIONS_EXPORT int v_GetTraceNcoeffs(const int i) const override;
201  STD_REGIONS_EXPORT int v_GetTraceIntNcoeffs(const int i) const override;
202  STD_REGIONS_EXPORT int v_GetTraceNumPoints(const int i) const override;
203 
204  STD_REGIONS_EXPORT int v_GetEdgeNcoeffs(const int i) const override;
206  const std::vector<unsigned int> &nummodes, int &modes_offset) override;
208  const int i, const int k) const override;
209 
210  //---------------------------------------
211  // Mappings
212  //---------------------------------------
214  int localVertexId, bool useCoeffPacking = false) override;
216  Array<OneD, unsigned int> &outarray) override;
218  Array<OneD, unsigned int> &outarray) override;
220  const unsigned int fid, Array<OneD, unsigned int> &maparray) override;
222  const unsigned int fid, Array<OneD, unsigned int> &maparray,
223  Array<OneD, int> &signarray, Orientation faceOrient, int P,
224  int Q) override;
226  const int tid, Array<OneD, unsigned int> &maparray,
227  Array<OneD, int> &signarray,
228  const Orientation traceOrient = eDir1FwdDir1_Dir2FwdDir2) override;
230  const int tid, Array<OneD, unsigned int> &maparray,
231  Array<OneD, int> &signarray,
232  const Orientation traceOrient = eDir1FwdDir1_Dir2FwdDir2) override;
233 
234  //---------------------------------------
235  // Wrapper functions
236  //---------------------------------------
238  v_GenMatrix(const StdMatrixKey &mkey) override;
240  v_CreateStdMatrix(const StdMatrixKey &mkey) override;
241 
243  Array<OneD, NekDouble> &array, const StdMatrixKey &mkey) override;
244 
245  //---------------------------------------
246  // Method for applying sensors
247  //---------------------------------------
249  int numMin, const Array<OneD, const NekDouble> &inarray,
250  Array<OneD, NekDouble> &outarray) override;
251 
252 private:
253  //---------------------------------------
254  // Private helper functions
255  //---------------------------------------
256  STD_REGIONS_EXPORT int GetMode(int I, int J, int K);
257 };
258 typedef std::shared_ptr<StdPyrExp> StdPyrExpSharedPtr;
259 } // namespace StdRegions
260 } // namespace Nektar
261 
262 #endif // STDPYREXP_H
#define STD_REGIONS_EXPORT
Describes the specification for a Basis.
Definition: Basis.h:50
void v_IProductWRTDerivBase_SumFac(const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
Definition: StdPyrExp.cpp:539
DNekMatSharedPtr v_GenMatrix(const StdMatrixKey &mkey) override
Definition: StdPyrExp.cpp:1883
int v_NumBndryCoeffs() const override
Definition: StdPyrExp.cpp:884
NekDouble v_PhysEvaluateBasis(const Array< OneD, const NekDouble > &coords, int mode) final
Definition: StdPyrExp.cpp:803
void v_ReduceOrderCoeffs(int numMin, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
Definition: StdPyrExp.cpp:2142
int v_NumDGBndryCoeffs() const override
Definition: StdPyrExp.cpp:903
void v_FwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
Forward transform from physical quadrature space stored in inarray and evaluate the expansion coeffic...
Definition: StdPyrExp.cpp:366
void v_GetElmtTraceToTraceMap(const unsigned int fid, Array< OneD, unsigned int > &maparray, Array< OneD, int > &signarray, Orientation faceOrient, int P, int Q) override
Definition: StdPyrExp.cpp:1323
int v_GetTraceNcoeffs(const int i) const override
Definition: StdPyrExp.cpp:924
void v_LocCollapsedToLocCoord(const Array< OneD, const NekDouble > &eta, Array< OneD, NekDouble > &xi) override
Definition: StdPyrExp.cpp:683
void v_SVVLaplacianFilter(Array< OneD, NekDouble > &array, const StdMatrixKey &mkey) override
Definition: StdPyrExp.cpp:2003
~StdPyrExp() override=default
int v_GetEdgeNcoeffs(const int i) const override
Definition: StdPyrExp.cpp:984
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) override
Definition: StdPyrExp.cpp:272
int v_GetNtraces() const override
Definition: StdPyrExp.cpp:874
void v_IProductWRTDerivBase(const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
Definition: StdPyrExp.cpp:526
void v_FillMode(const int mode, Array< OneD, NekDouble > &outarray) override
Definition: StdPyrExp.cpp:760
void v_IProductWRTBase_SumFac(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, bool multiplybyweights=true) override
Definition: StdPyrExp.cpp:415
int v_GetNedges() const override
Definition: StdPyrExp.cpp:869
int v_CalcNumberOfCoefficients(const std::vector< unsigned int > &nummodes, int &modes_offset) override
Definition: StdPyrExp.cpp:1036
int GetMode(int I, int J, int K)
Compute the mode number in the expansion for a particular tensorial combination.
Definition: StdPyrExp.cpp:1917
int v_GetVertexMap(int localVertexId, bool useCoeffPacking=false) override
Definition: StdPyrExp.cpp:1047
int v_GetTraceNumPoints(const int i) const override
Definition: StdPyrExp.cpp:966
void v_BwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
Backward transformation is evaluated at the quadrature points.
Definition: StdPyrExp.cpp:236
void v_GetBoundaryMap(Array< OneD, unsigned int > &outarray) override
Definition: StdPyrExp.cpp:1145
void v_IProductWRTBase(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
Inner product of inarray over region with respect to the expansion basis m_base[0]->GetBdata(),...
Definition: StdPyrExp.cpp:401
void v_GetInteriorMap(Array< OneD, unsigned int > &outarray) override
Definition: StdPyrExp.cpp:1106
void v_GetEdgeInteriorToElementMap(const int tid, Array< OneD, unsigned int > &maparray, Array< OneD, int > &signarray, const Orientation traceOrient=eDir1FwdDir1_Dir2FwdDir2) override
Definition: StdPyrExp.cpp:1603
void v_LocCoordToLocCollapsed(const Array< OneD, const NekDouble > &xi, Array< OneD, NekDouble > &eta) override
Definition: StdPyrExp.cpp:663
DNekMatSharedPtr v_CreateStdMatrix(const StdMatrixKey &mkey) override
Definition: StdPyrExp.cpp:1888
int v_GetNverts() const override
Definition: StdPyrExp.cpp:864
void v_MultiplyByStdQuadratureMetric(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
Definition: StdPyrExp.cpp:1945
void v_GetTraceInteriorToElementMap(const int tid, Array< OneD, unsigned int > &maparray, Array< OneD, int > &signarray, const Orientation traceOrient=eDir1FwdDir1_Dir2FwdDir2) override
Definition: StdPyrExp.cpp:1700
void v_BwdTrans_SumFac(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
Definition: StdPyrExp.cpp:255
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) override
Definition: StdPyrExp.cpp:445
StdPyrExp(const LibUtilities::BasisKey &Ba, const LibUtilities::BasisKey &Bb, const LibUtilities::BasisKey &Bc, NekDouble *coeffs, NekDouble *phys)
void v_StdPhysDeriv(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &out_d0, Array< OneD, NekDouble > &out_d1, Array< OneD, NekDouble > &out_d2) override
Definition: StdPyrExp.cpp:196
const LibUtilities::BasisKey v_GetTraceBasisKey(const int i, const int k) const override
Definition: StdPyrExp.cpp:1002
LibUtilities::ShapeType v_DetShapeType() const override
Definition: StdPyrExp.cpp:879
void v_PhysDeriv(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &out_d0, Array< OneD, NekDouble > &out_d1, Array< OneD, NekDouble > &out_d2) override
Calculate the derivative of the physical points.
Definition: StdPyrExp.cpp:91
void v_GetTraceNumModes(const int fid, int &numModes0, int &numModes1, Orientation faceOrient=eDir1FwdDir1_Dir2FwdDir2) override
Definition: StdPyrExp.cpp:767
NekDouble v_PhysEvaluate(const Array< OneD, NekDouble > &coord, const Array< OneD, const NekDouble > &inarray, std::array< NekDouble, 3 > &firstOrderDerivs) override
Definition: StdPyrExp.cpp:719
void v_GetTraceCoeffMap(const unsigned int fid, Array< OneD, unsigned int > &maparray) override
Definition: StdPyrExp.cpp:1206
void v_GetCoords(Array< OneD, NekDouble > &xi_x, Array< OneD, NekDouble > &xi_y, Array< OneD, NekDouble > &xi_z) override
Definition: StdPyrExp.cpp:691
int v_GetTraceIntNcoeffs(const int i) const override
Definition: StdPyrExp.cpp:944
std::tuple< unsigned int, unsigned int, unsigned int, unsigned int > Mode
Definition: StdPyrExp.h:47
std::shared_ptr< StdPyrExp > StdPyrExpSharedPtr
Definition: StdPyrExp.h:258
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:2
std::shared_ptr< DNekMat > DNekMatSharedPtr
Definition: NekTypeDefs.hpp:75
double NekDouble
bool operator()(Mode const &a, Mode const &b) const
Definition: StdPyrExp.h:51