Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator 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,
144  Array<OneD, NekDouble> &wsp,
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);
162  const Array<OneD, const NekDouble> &base0,
163  const Array<OneD, const NekDouble> &base1,
164  const Array<OneD, const NekDouble> &base2,
165  const Array<OneD, const NekDouble> &inarray,
166  Array<OneD, NekDouble> &outarray,
167  Array<OneD, NekDouble> &wsp,
168  bool doCheckCollDir0,
169  bool doCheckCollDir1,
170  bool doCheckCollDir2);
172  const int dir,
173  const Array<OneD, const NekDouble>& inarray,
174  Array<OneD, NekDouble>& outarray);
176  const int dir,
177  const Array<OneD, const NekDouble>& inarray,
178  Array<OneD, NekDouble>& outarray);
179 
180  //---------------------------------------
181  // Evaluation functions
182  //---------------------------------------
184  const Array<OneD, const NekDouble>& xi,
185  Array<OneD, NekDouble>& eta);
186  STD_REGIONS_EXPORT virtual void v_GetCoords(
187  Array<OneD, NekDouble> & xi_x,
188  Array<OneD, NekDouble> & xi_y,
189  Array<OneD, NekDouble> & xi_z);
190  STD_REGIONS_EXPORT virtual void v_FillMode(
191  const int mode,
192  Array<OneD, NekDouble> &outarray);
193 
194  //---------------------------------------
195  // Helper functions
196  //---------------------------------------
197  STD_REGIONS_EXPORT virtual int v_GetNverts() const;
198  STD_REGIONS_EXPORT virtual int v_GetNedges() const;
199  STD_REGIONS_EXPORT virtual int v_GetNfaces() const;
201  STD_REGIONS_EXPORT virtual int v_NumBndryCoeffs() const;
202  STD_REGIONS_EXPORT virtual int v_GetEdgeNcoeffs(const int i) const;
203  STD_REGIONS_EXPORT virtual int v_GetFaceNcoeffs(const int i) const;
204  STD_REGIONS_EXPORT virtual int v_GetFaceIntNcoeffs(const int i) const;
205  STD_REGIONS_EXPORT virtual int v_GetFaceNumPoints(const int i) const;
207  const std::vector<unsigned int> &nummodes,
208  int &modes_offset);
210  v_DetFaceBasisKey(const int i, const int k) const;
212  const int i) const;
213 
214  //---------------------------------------
215  // Mappings
216  //---------------------------------------
218  const int fid,
219  const Orientation faceOrient,
220  Array<OneD, unsigned int> &maparray,
221  Array<OneD, int> &signarray,
222  int nummodesA=-1,
223  int nummodesB=-1);
225  int localVertexId,
226  bool useCoeffPacking = false);
228  const int eid,
229  const Orientation edgeOrient,
230  Array<OneD, unsigned int> &maparray,
231  Array<OneD, int> &signarray);
233  const int fid,
234  const Orientation faceOrient,
235  Array<OneD, unsigned int> &maparray,
236  Array<OneD, int> &signarray);
238  Array<OneD, unsigned int> &outarray);
240  Array<OneD, unsigned int> &outarray);
241 
242  //---------------------------------------
243  // Wrapper functions
244  //---------------------------------------
246  const StdMatrixKey &mkey);
248  const StdMatrixKey &mkey);
249 
250  private:
251  //---------------------------------------
252  // Private helper functions
253  //---------------------------------------
254  map<Mode, unsigned int, cmpop> m_map;
255  map<int, map<int, map<int, pair<int, int> > > > m_idxMap;
256  };
257  typedef boost::shared_ptr<StdPyrExp> StdPyrExpSharedPtr;
258  } //end of namespace
259 } //end of namespace
260 
261 #endif //STDPYREXP_H