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 
86  STD_REGIONS_EXPORT StdPyrExp(const LibUtilities::BasisKey &Ba,
87  const LibUtilities::BasisKey &Bb,
88  const LibUtilities::BasisKey &Bc);
89 
90  STD_REGIONS_EXPORT StdPyrExp(const LibUtilities::BasisKey &Ba,
91  const LibUtilities::BasisKey &Bb,
92  const LibUtilities::BasisKey &Bc,
93  NekDouble *coeffs,
94  NekDouble *phys);
95 
96  STD_REGIONS_EXPORT StdPyrExp(const StdPyrExp &T);
97 
98  STD_REGIONS_EXPORT ~StdPyrExp();
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);
122  STD_REGIONS_EXPORT void v_MultiplyByStdQuadratureMetric(
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);
132  STD_REGIONS_EXPORT virtual void v_BwdTrans_SumFac(
133  const Array<OneD, const NekDouble> &inarray,
134  Array<OneD, NekDouble> &outarray);
135  STD_REGIONS_EXPORT virtual void v_BwdTrans_SumFacKernel(
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  //---------------------------------------
152  STD_REGIONS_EXPORT virtual void v_IProductWRTBase(
153  const Array<OneD, const NekDouble> &inarray,
154  Array<OneD, NekDouble> &outarray);
155  STD_REGIONS_EXPORT virtual void v_IProductWRTBase_SumFac(
156  const Array<OneD, const NekDouble> &inarray,
157  Array<OneD, NekDouble> &outarray,
158  bool multiplybyweights = true);
159  STD_REGIONS_EXPORT virtual void v_IProductWRTBase_SumFacKernel(
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);
169  STD_REGIONS_EXPORT virtual void v_IProductWRTDerivBase(
170  const int dir,
171  const Array<OneD, const NekDouble>& inarray,
172  Array<OneD, NekDouble>& outarray);
173  STD_REGIONS_EXPORT virtual void v_IProductWRTDerivBase_SumFac(
174  const int dir,
175  const Array<OneD, const NekDouble>& inarray,
176  Array<OneD, NekDouble>& outarray);
177 
178  //---------------------------------------
179  // Evaluation functions
180  //---------------------------------------
181  STD_REGIONS_EXPORT virtual void v_LocCoordToLocCollapsed(
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);
191  STD_REGIONS_EXPORT virtual void v_GetFaceNumModes(
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;
203  STD_REGIONS_EXPORT virtual LibUtilities::ShapeType v_DetShapeType() 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;
210  STD_REGIONS_EXPORT virtual int v_CalcNumberOfCoefficients(
211  const std::vector<unsigned int> &nummodes,
212  int &modes_offset);
214  v_DetFaceBasisKey(const int i, const int k) const;
215  STD_REGIONS_EXPORT virtual LibUtilities::BasisType v_GetEdgeBasisType(
216  const int i) const;
217 
218  //---------------------------------------
219  // Mappings
220  //---------------------------------------
221  STD_REGIONS_EXPORT virtual void v_GetFaceToElementMap(
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);
228  STD_REGIONS_EXPORT virtual int v_GetVertexMap(
229  int localVertexId,
230  bool useCoeffPacking = false);
231  STD_REGIONS_EXPORT virtual void v_GetEdgeInteriorMap(
232  const int eid,
233  const Orientation edgeOrient,
234  Array<OneD, unsigned int> &maparray,
235  Array<OneD, int> &signarray);
236  STD_REGIONS_EXPORT virtual void v_GetFaceInteriorMap(
237  const int fid,
238  const Orientation faceOrient,
239  Array<OneD, unsigned int> &maparray,
240  Array<OneD, int> &signarray);
241  STD_REGIONS_EXPORT virtual void v_GetInteriorMap(
242  Array<OneD, unsigned int> &outarray);
243  STD_REGIONS_EXPORT virtual void v_GetBoundaryMap(
244  Array<OneD, unsigned int> &outarray);
245 
246  //---------------------------------------
247  // Wrapper functions
248  //---------------------------------------
249  STD_REGIONS_EXPORT virtual DNekMatSharedPtr v_GenMatrix(
250  const StdMatrixKey &mkey);
251  STD_REGIONS_EXPORT virtual DNekMatSharedPtr v_CreateStdMatrix(
252  const StdMatrixKey &mkey);
253 
254  STD_REGIONS_EXPORT virtual void v_SVVLaplacianFilter(Array<OneD, NekDouble> &array,
255  const StdMatrixKey &mkey);
256 
257  //---------------------------------------
258  // Method for applying sensors
259  //---------------------------------------
260  STD_REGIONS_EXPORT virtual void v_ReduceOrderCoeffs(
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
std::tuple< unsigned int, unsigned int, unsigned int, unsigned int > Mode
Definition: StdPyrExp.h:48
std::shared_ptr< DNekMat > DNekMatSharedPtr
Definition: NekTypeDefs.hpp:69
bool operator()(Mode const &a, Mode const &b) const
Definition: StdPyrExp.h:52
double NekDouble
#define STD_REGIONS_EXPORT
Describes the specification for a Basis.
Definition: Basis.h:49
std::shared_ptr< StdPyrExp > StdPyrExpSharedPtr
Definition: StdPyrExp.h:270