Nektar++
HexExp.h
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File HexExp.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 routines for Hex expansion
32 //
33 ///////////////////////////////////////////////////////////////////////////////
34 
35 #ifndef HEXEXP_H
36 #define HEXEXP_H
37 
38 #include <LibUtilities/BasicUtils/NekManager.hpp> // for NekManager
39 
41 #include <LocalRegions/MatrixKey.h>
43 #include <StdRegions/StdHexExp.h>
44 #include <SpatialDomains/HexGeom.h>
45 
46 namespace Nektar
47 {
48  namespace SpatialDomains
49  {
50  class HexGeom;
51  typedef std::shared_ptr<HexGeom> HexGeomSharedPtr;
52  }
53 
54  namespace LocalRegions
55  {
56  class HexExp;
57 
58  typedef std::shared_ptr<HexExp> HexExpSharedPtr;
59  typedef std::vector< HexExpSharedPtr > HexExpVector;
60 
61  class HexExp: virtual public StdRegions::StdHexExp, virtual public Expansion3D
62  {
63  public:
64 
66  const LibUtilities::BasisKey &Bb,
67  const LibUtilities::BasisKey &Bc,
69 
70  LOCAL_REGIONS_EXPORT HexExp( const HexExp &T );
71 
72  LOCAL_REGIONS_EXPORT ~HexExp();
73 
74  protected:
75  //------------------------------
76  // Integration Method
77  //------------------------------
78  LOCAL_REGIONS_EXPORT virtual NekDouble v_Integral(
79  const Array<OneD, const NekDouble> &inarray );
80 
81 
82  //-----------------------------
83  // Differentiation Methods
84  //-----------------------------
85  LOCAL_REGIONS_EXPORT virtual void v_PhysDeriv(
86  const Array<OneD, const NekDouble> &inarray,
87  Array<OneD, NekDouble> &out_d0,
88  Array<OneD, NekDouble> &out_d1,
89  Array<OneD, NekDouble> &out_d2);
90 
91  LOCAL_REGIONS_EXPORT virtual void v_PhysDeriv(const int dir,
92  const Array<OneD, const NekDouble>& inarray,
93  Array<OneD, NekDouble> &outarray);
94 
95  LOCAL_REGIONS_EXPORT void v_PhysDirectionalDeriv(
96  const Array<OneD, const NekDouble> &inarray,
97  const Array<OneD, const NekDouble> &direction,
99 
100 
101  //---------------------------------------
102  // Transforms
103  //---------------------------------------
104  LOCAL_REGIONS_EXPORT virtual void v_FwdTrans(
105  const Array<OneD, const NekDouble> & inarray,
106  Array<OneD,NekDouble> &outarray);
107 
108 
109  //---------------------------------------
110  // Inner product functions
111  //---------------------------------------
112  LOCAL_REGIONS_EXPORT virtual void v_IProductWRTBase(
113  const Array<OneD, const NekDouble> &inarray,
114  Array<OneD, NekDouble> &outarray);
115 
116  LOCAL_REGIONS_EXPORT virtual void v_IProductWRTBase_SumFac(
117  const Array<OneD, const NekDouble> &inarray,
118  Array<OneD, NekDouble> &outarray,
119  bool multiplybyweights = true);
120 
121  LOCAL_REGIONS_EXPORT virtual void v_IProductWRTDerivBase(
122  const int dir,
123  const Array<OneD, const NekDouble> &inarray,
124  Array<OneD, NekDouble> &outarray);
125 
126  LOCAL_REGIONS_EXPORT void IProductWRTDerivBase_SumFac(
127  const int dir,
128  const Array<OneD, const NekDouble> &inarray,
129  Array<OneD, NekDouble> &outarray);
130 
131  LOCAL_REGIONS_EXPORT void IProductWRTDerivBase_MatOp(
132  const int dir,
133  const Array<OneD, const NekDouble> &inarray,
134  Array<OneD, NekDouble> &outarray);
135 
137  const Array<OneD, const NekDouble>& direction,
138  const Array<OneD, const NekDouble> &inarray,
139  Array<OneD, NekDouble> &outarray)
140  {
141  IProductWRTDirectionalDerivBase_SumFac(direction, inarray,
142  outarray);
143  }
144 
145  LOCAL_REGIONS_EXPORT void IProductWRTDirectionalDerivBase_SumFac(
146  const Array<OneD, const NekDouble>& direction,
147  const Array<OneD, const NekDouble> &inarray,
148  Array<OneD, NekDouble> &outarray);
149 
150 
151  //---------------------------------------
152  // Evaluation functions
153  //---------------------------------------
154  LOCAL_REGIONS_EXPORT virtual NekDouble v_StdPhysEvaluate(
155  const Array<OneD, const NekDouble> &Lcoord,
156  const Array<OneD, const NekDouble> &physvals);
157 
158  LOCAL_REGIONS_EXPORT virtual NekDouble v_PhysEvaluate(
159  const Array<OneD, const NekDouble> &coords,
160  const Array<OneD, const NekDouble> & physvals);
161 
162  LOCAL_REGIONS_EXPORT virtual void v_GetCoord(
163  const Array<OneD, const NekDouble> &Lcoords,
164  Array<OneD,NekDouble> &coords);
165 
166  LOCAL_REGIONS_EXPORT virtual void v_GetCoords(
167  Array<OneD, NekDouble> &coords_1,
168  Array<OneD, NekDouble> &coords_2,
169  Array<OneD, NekDouble> &coords_3);
170 
171 
172  //---------------------------------------
173  // Helper functions
174  //---------------------------------------
175  LOCAL_REGIONS_EXPORT virtual
176  LibUtilities::ShapeType v_DetShapeType() const;
177 
178  LOCAL_REGIONS_EXPORT virtual
179  StdRegions::StdExpansionSharedPtr v_GetStdExp(void) const;
180 
181  LOCAL_REGIONS_EXPORT virtual
182  StdRegions::StdExpansionSharedPtr v_GetLinStdExp(void) const;
183 
184  LOCAL_REGIONS_EXPORT virtual void v_ExtractDataToCoeffs(
185  const NekDouble *data,
186  const std::vector<unsigned int > &nummodes,
187  const int mode_offset,
188  NekDouble * coeffs,
189  std::vector<LibUtilities::BasisType> &fromType);
190 
191  LOCAL_REGIONS_EXPORT virtual
192  bool v_GetFaceDGForwards(const int i) const;
193 
194  LOCAL_REGIONS_EXPORT virtual void v_GetFacePhysMap(
195  const int face,
196  Array<OneD, int> &outarray);
197 
198  LOCAL_REGIONS_EXPORT void v_ComputeFaceNormal(const int face);
199 
200  //---------------------------------------
201  // Operator creation functions
202  //---------------------------------------
203  LOCAL_REGIONS_EXPORT virtual void v_MassMatrixOp(
204  const Array<OneD, const NekDouble> &inarray,
205  Array<OneD,NekDouble> &outarray,
206  const StdRegions::StdMatrixKey &mkey);
207 
208  LOCAL_REGIONS_EXPORT virtual void v_LaplacianMatrixOp(
209  const Array<OneD, const NekDouble> &inarray,
210  Array<OneD,NekDouble> &outarray,
211  const StdRegions::StdMatrixKey &mkey);
212 
213  LOCAL_REGIONS_EXPORT virtual void v_LaplacianMatrixOp(
214  const int k1,
215  const int k2,
216  const Array<OneD, const NekDouble> &inarray,
217  Array<OneD,NekDouble> &outarray,
218  const StdRegions::StdMatrixKey &mkey);
219 
220  LOCAL_REGIONS_EXPORT virtual void v_WeakDerivMatrixOp(const int i,
221  const Array<OneD, const NekDouble> &inarray,
222  Array<OneD,NekDouble> &outarray,
223  const StdRegions::StdMatrixKey &mkey);
224 
225  LOCAL_REGIONS_EXPORT virtual void v_WeakDirectionalDerivMatrixOp(
226  const Array<OneD, const NekDouble> &inarray,
227  Array<OneD,NekDouble> &outarray,
228  const StdRegions::StdMatrixKey &mkey);
229 
230  LOCAL_REGIONS_EXPORT virtual void v_MassLevelCurvatureMatrixOp(
231  const Array<OneD, const NekDouble> &inarray,
232  Array<OneD,NekDouble> &outarray,
233  const StdRegions::StdMatrixKey &mkey);
234 
235  LOCAL_REGIONS_EXPORT virtual void v_HelmholtzMatrixOp(
236  const Array<OneD, const NekDouble> &inarray,
237  Array<OneD,NekDouble> &outarray,
238  const StdRegions::StdMatrixKey &mkey);
239 
240  LOCAL_REGIONS_EXPORT void v_GeneralMatrixOp_MatOp(
241  const Array<OneD, const NekDouble> &inarray,
242  Array<OneD,NekDouble> &outarray,
243  const StdRegions::StdMatrixKey &mkey);
244 
245  LOCAL_REGIONS_EXPORT virtual void v_ReduceOrderCoeffs(
246  int numMin,
247  const Array<OneD, const NekDouble> &inarray,
248  Array<OneD, NekDouble> &outarray);
249 
250  LOCAL_REGIONS_EXPORT virtual void v_SVVLaplacianFilter(
251  Array<OneD, NekDouble> &array,
252  const StdRegions::StdMatrixKey &mkey);
253 
254  //---------------------------------------
255  // Matrix creation functions
256  //---------------------------------------
257  LOCAL_REGIONS_EXPORT virtual DNekMatSharedPtr v_GenMatrix(
258  const StdRegions::StdMatrixKey &mkey);
259 
260  LOCAL_REGIONS_EXPORT virtual DNekMatSharedPtr v_CreateStdMatrix(
261  const StdRegions::StdMatrixKey &mkey);
262 
264  const MatrixKey &mkey);
265 
266  LOCAL_REGIONS_EXPORT DNekScalBlkMatSharedPtr CreateStaticCondMatrix(
267  const MatrixKey &mkey);
268 
269  LOCAL_REGIONS_EXPORT virtual DNekScalMatSharedPtr v_GetLocMatrix(
270  const MatrixKey &mkey);
271 
272  LOCAL_REGIONS_EXPORT virtual
273  DNekScalBlkMatSharedPtr v_GetLocStaticCondMatrix(
274  const MatrixKey &mkey);
275 
276  LOCAL_REGIONS_EXPORT void v_DropLocStaticCondMatrix(
277  const MatrixKey &mkey);
278 
279  LOCAL_REGIONS_EXPORT virtual void v_ComputeLaplacianMetric();
280 
281 
282  private:
285 
286  HexExp();
287 
288  virtual void v_LaplacianMatrixOp_MatFree_Kernel(
289  const Array<OneD, const NekDouble> &inarray,
290  Array<OneD, NekDouble> &outarray,
292  };
293 
294  } //end of namespace
295 } //end of namespace
296 
297 #endif //HEX_EXP_H
std::shared_ptr< DNekScalMat > DNekScalMatSharedPtr
std::shared_ptr< DNekScalBlkMat > DNekScalBlkMatSharedPtr
Definition: NekTypeDefs.hpp:73
std::shared_ptr< HexExp > HexExpSharedPtr
Definition: HexExp.h:56
std::shared_ptr< DNekMat > DNekMatSharedPtr
Definition: NekTypeDefs.hpp:69
LibUtilities::NekManager< MatrixKey, DNekScalBlkMat, MatrixKey::opLess > m_staticCondMatrixManager
Definition: HexExp.h:284
std::shared_ptr< StdExpansion > StdExpansionSharedPtr
Class representing a hexehedral element in reference space.
Definition: StdHexExp.h:47
double NekDouble
std::vector< HexExpSharedPtr > HexExpVector
Definition: HexExp.h:59
std::shared_ptr< HexGeom > HexGeomSharedPtr
Definition: HexGeom.h:90
LibUtilities::NekManager< MatrixKey, DNekScalMat, MatrixKey::opLess > m_matrixManager
Definition: HexExp.h:283
void v_IProductWRTDirectionalDerivBase(const Array< OneD, const NekDouble > &direction, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Definition: HexExp.h:136
#define LOCAL_REGIONS_EXPORT
Describes the specification for a Basis.
Definition: Basis.h:49