Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 // 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: Header field for pyramidic routines built upon
33 // StdExpansion3D
34 //
35 ///////////////////////////////////////////////////////////////////////////////
36 
37 #ifndef NEKTAR_LIBS_STDREGIONS_STDPYREXP_H
38 #define NEKTAR_LIBS_STDREGIONS_STDPYREXP_H
39 
42 #include <boost/tuple/tuple.hpp>
43 
44 namespace Nektar
45 {
46  namespace StdRegions
47  {
48  typedef boost::tuple<
49  unsigned int, unsigned int, unsigned int, unsigned int> Mode;
50 
51  struct cmpop
52  {
53  bool operator()(Mode const &a, Mode const &b) const
54  {
55  if (a.get<0>() < b.get<0>())
56  {
57  return true;
58  }
59  if (a.get<0>() > b.get<0>())
60  {
61  return false;
62  }
63 
64  if (a.get<1>() < b.get<1>())
65  {
66  return true;
67  }
68  if (a.get<1>() > b.get<1>())
69  {
70  return false;
71  }
72 
73  if (a.get<2>() < b.get<2>())
74  {
75  return true;
76  }
77 
78  return false;
79  }
80  };
81 
82  class StdPyrExp : virtual public StdExpansion3D
83  {
84  public:
86 
88  const LibUtilities::BasisKey &Bb,
89  const LibUtilities::BasisKey &Bc);
90 
92  const LibUtilities::BasisKey &Bb,
93  const LibUtilities::BasisKey &Bc,
94  NekDouble *coeffs,
95  NekDouble *phys);
96 
97  STD_REGIONS_EXPORT StdPyrExp(const StdPyrExp &T);
98 
100 
101  STD_REGIONS_EXPORT int GetTetMode(int I, int J, int K);
102 
103  protected:
104  //---------------------------------------
105  // Differentiation/integration Methods
106  //---------------------------------------
107  STD_REGIONS_EXPORT virtual void v_PhysDeriv(
108  const Array<OneD, const NekDouble> &inarray,
109  Array<OneD, NekDouble> &out_d0,
110  Array<OneD, NekDouble> &out_d1,
111  Array<OneD, NekDouble> &out_d2);
112  STD_REGIONS_EXPORT virtual void v_PhysDeriv(
113  const int dir,
114  const Array<OneD, const NekDouble> &inarray,
115  Array<OneD, NekDouble> &outarray);
116  STD_REGIONS_EXPORT virtual void v_StdPhysDeriv(
117  const Array<OneD, const NekDouble> &inarray,
118  Array<OneD, NekDouble> &out_d0,
119  Array<OneD, NekDouble> &out_d1,
120  Array<OneD, NekDouble> &out_d2);
121  STD_REGIONS_EXPORT virtual void v_StdPhysDeriv(
122  const int dir,
123  const Array<OneD, const NekDouble> &inarray,
124  Array<OneD, NekDouble> &outarray);
126  const Array<OneD, const NekDouble> &inarray,
127  Array<OneD, NekDouble> &outarray);
128 
129  //---------------------------------------
130  // Transforms
131  //---------------------------------------
132  STD_REGIONS_EXPORT virtual void v_BwdTrans(
133  const Array<OneD, const NekDouble>& inarray,
134  Array<OneD, NekDouble> &outarray);
136  const Array<OneD, const NekDouble> &inarray,
137  Array<OneD, NekDouble> &outarray);
139  const Array<OneD, const NekDouble> &base0,
140  const Array<OneD, const NekDouble> &base1,
141  const Array<OneD, const NekDouble> &base2,
142  const Array<OneD, const NekDouble> &inarray,
143  Array<OneD, NekDouble> &outarray,
145  bool doCheckCollDir0,
146  bool doCheckCollDir1,
147  bool doCheckCollDir2);
148  STD_REGIONS_EXPORT virtual void v_FwdTrans(
149  const Array<OneD, const NekDouble>& inarray,
150  Array<OneD, NekDouble> &outarray);
151 
152  //---------------------------------------
153  // Inner product functions
154  //---------------------------------------
156  const Array<OneD, const NekDouble> &inarray,
157  Array<OneD, NekDouble> &outarray);
159  const Array<OneD, const NekDouble> &inarray,
160  Array<OneD, NekDouble> &outarray,
161  bool multiplybyweights = true);
163  const Array<OneD, const NekDouble> &base0,
164  const Array<OneD, const NekDouble> &base1,
165  const Array<OneD, const NekDouble> &base2,
166  const Array<OneD, const NekDouble> &inarray,
167  Array<OneD, NekDouble> &outarray,
169  bool doCheckCollDir0,
170  bool doCheckCollDir1,
171  bool doCheckCollDir2);
173  const int dir,
174  const Array<OneD, const NekDouble>& inarray,
175  Array<OneD, NekDouble>& outarray);
177  const int dir,
178  const Array<OneD, const NekDouble>& inarray,
179  Array<OneD, NekDouble>& outarray);
180 
181  //---------------------------------------
182  // Evaluation functions
183  //---------------------------------------
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  const Orientation faceOrient,
197  int &numModes0,
198  int &numModes1);
199 
200  //---------------------------------------
201  // Helper functions
202  //---------------------------------------
203  STD_REGIONS_EXPORT virtual int v_GetNverts() const;
204  STD_REGIONS_EXPORT virtual int v_GetNedges() const;
205  STD_REGIONS_EXPORT virtual int v_GetNfaces() const;
207  STD_REGIONS_EXPORT virtual int v_NumBndryCoeffs() const;
208  STD_REGIONS_EXPORT virtual int v_GetEdgeNcoeffs(const int i) const;
209  STD_REGIONS_EXPORT virtual int v_GetFaceNcoeffs(const int i) const;
210  STD_REGIONS_EXPORT virtual int v_GetFaceIntNcoeffs(const int i) const;
211  STD_REGIONS_EXPORT virtual int v_GetFaceNumPoints(const int i) const;
213  const std::vector<unsigned int> &nummodes,
214  int &modes_offset);
216  v_DetFaceBasisKey(const int i, const int k) const;
218  const int i) const;
219 
220  //---------------------------------------
221  // Mappings
222  //---------------------------------------
224  const int fid,
225  const Orientation faceOrient,
226  Array<OneD, unsigned int> &maparray,
227  Array<OneD, int> &signarray,
228  int nummodesA=-1,
229  int nummodesB=-1);
231  int localVertexId,
232  bool useCoeffPacking = false);
234  const int eid,
235  const Orientation edgeOrient,
236  Array<OneD, unsigned int> &maparray,
237  Array<OneD, int> &signarray);
239  const int fid,
240  const Orientation faceOrient,
241  Array<OneD, unsigned int> &maparray,
242  Array<OneD, int> &signarray);
244  Array<OneD, unsigned int> &outarray);
246  Array<OneD, unsigned int> &outarray);
247 
248  //---------------------------------------
249  // Wrapper functions
250  //---------------------------------------
252  const StdMatrixKey &mkey);
254  const StdMatrixKey &mkey);
255 
256  private:
257  //---------------------------------------
258  // Private helper functions
259  //---------------------------------------
260  std::map<Mode, unsigned int, cmpop> m_map;
261  std::map<int, std::map<int, std::map<int, std::pair<int, int> > > > m_idxMap;
262  };
263  typedef boost::shared_ptr<StdPyrExp> StdPyrExpSharedPtr;
264  } //end of namespace
265 } //end of namespace
266 
267 #endif //STDPYREXP_H
virtual LibUtilities::ShapeType v_DetShapeType() const
Definition: StdPyrExp.cpp:930
bool operator()(Mode const &a, Mode const &b) const
Definition: StdPyrExp.h:53
virtual void v_GetFaceInteriorMap(const int fid, const Orientation faceOrient, Array< OneD, unsigned int > &maparray, Array< OneD, int > &signarray)
Definition: StdPyrExp.cpp:1730
virtual int v_GetEdgeNcoeffs(const int i) const
Definition: StdPyrExp.cpp:955
virtual void v_GetCoords(Array< OneD, NekDouble > &xi_x, Array< OneD, NekDouble > &xi_y, Array< OneD, NekDouble > &xi_z)
Definition: StdPyrExp.cpp:836
void v_MultiplyByStdQuadratureMetric(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Definition: StdPyrExp.cpp:1981
virtual const LibUtilities::BasisKey v_DetFaceBasisKey(const int i, const int k) const
Definition: StdPyrExp.cpp:1037
virtual void v_FillMode(const int mode, Array< OneD, NekDouble > &outarray)
Definition: StdPyrExp.cpp:864
virtual int v_GetNedges() const
Definition: StdPyrExp.cpp:920
virtual DNekMatSharedPtr v_GenMatrix(const StdMatrixKey &mkey)
Definition: StdPyrExp.cpp:1947
virtual void v_GetEdgeInteriorMap(const int eid, const Orientation edgeOrient, Array< OneD, unsigned int > &maparray, Array< OneD, int > &signarray)
Definition: StdPyrExp.cpp:1653
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:501
boost::shared_ptr< StdPyrExp > StdPyrExpSharedPtr
Definition: StdPyrExp.h:263
virtual void v_IProductWRTDerivBase(const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Definition: StdPyrExp.cpp:670
boost::shared_ptr< DNekMat > DNekMatSharedPtr
Definition: NekTypeDefs.hpp:70
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:253
virtual int v_GetFaceNcoeffs(const int i) const
Definition: StdPyrExp.cpp:973
virtual int v_CalcNumberOfCoefficients(const std::vector< unsigned int > &nummodes, int &modes_offset)
Definition: StdPyrExp.cpp:1075
virtual void v_IProductWRTBase_SumFac(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, bool multiplybyweights=true)
Definition: StdPyrExp.cpp:552
virtual int v_GetNfaces() const
Definition: StdPyrExp.cpp:925
virtual void v_GetBoundaryMap(Array< OneD, unsigned int > &outarray)
Definition: StdPyrExp.cpp:1923
virtual int v_GetFaceIntNcoeffs(const int i) const
Definition: StdPyrExp.cpp:993
virtual void v_LocCoordToLocCollapsed(const Array< OneD, const NekDouble > &xi, Array< OneD, NekDouble > &eta)
Definition: StdPyrExp.cpp:816
boost::tuple< unsigned int, unsigned int, unsigned int, unsigned int > Mode
Definition: StdPyrExp.h:49
virtual void v_BwdTrans_SumFac(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Definition: StdPyrExp.cpp:390
virtual int v_GetVertexMap(int localVertexId, bool useCoeffPacking=false)
Definition: StdPyrExp.cpp:1644
virtual int v_NumBndryCoeffs() const
Definition: StdPyrExp.cpp:935
double NekDouble
virtual void v_GetInteriorMap(Array< OneD, unsigned int > &outarray)
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:581
virtual void v_GetFaceNumModes(const int fid, const Orientation faceOrient, int &numModes0, int &numModes1)
Definition: StdPyrExp.cpp:871
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:402
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:1110
std::map< Mode, unsigned int, cmpop > m_map
Definition: StdPyrExp.h:260
virtual DNekMatSharedPtr v_CreateStdMatrix(const StdMatrixKey &mkey)
Definition: StdPyrExp.cpp:1952
int GetTetMode(int I, int J, int K)
Number tetrahedral modes in r-direction. Much the same as StdTetExp::GetTetMode but slightly simplifi...
Definition: StdPyrExp.cpp:1962
virtual int v_GetFaceNumPoints(const int i) const
Definition: StdPyrExp.cpp:1015
#define STD_REGIONS_EXPORT
virtual LibUtilities::BasisType v_GetEdgeBasisType(const int i) const
Definition: StdPyrExp.cpp:1088
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(),m_base[1]->GetBdata(), m_base[2]->GetBdata() and return in outarray.
Definition: StdPyrExp.cpp:536
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:329
virtual void v_IProductWRTDerivBase_SumFac(const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Definition: StdPyrExp.cpp:684
virtual int v_GetNverts() const
Definition: StdPyrExp.cpp:915
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:369
Describes the specification for a Basis.
Definition: Basis.h:50
std::map< int, std::map< int, std::map< int, std::pair< int, int > > > > m_idxMap
Definition: StdPyrExp.h:261