Nektar++
SegExp.h
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File SegExp.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 file for SegExp routines
32 //
33 ///////////////////////////////////////////////////////////////////////////////
34 
35 #ifndef SEGEXP_H
36 #define SEGEXP_H
37 
40 #include <LocalRegions/MatrixKey.h>
42 #include <StdRegions/StdSegExp.h>
43 
44 //#include <fstream>
45 
46 namespace Nektar
47 {
48 namespace LocalRegions
49 {
50 
51 class SegExp : virtual public StdRegions::StdSegExp, virtual public Expansion1D
52 {
53 
54 public:
56  const LibUtilities::BasisKey &Ba,
58 
60 
62 
63 protected:
64  //----------------------------
65  // Integration Methods
66  //----------------------------
68  const Array<OneD, const NekDouble> &inarray) override;
69 
70  //-----------------------------
71  // Differentiation Methods
72  //-----------------------------
73  LOCAL_REGIONS_EXPORT virtual void v_PhysDeriv(
74  const Array<OneD, const NekDouble> &inarray,
75  Array<OneD, NekDouble> &out_d0,
77  Array<OneD, NekDouble> &out_d2 = NullNekDouble1DArray) override;
78 
79  LOCAL_REGIONS_EXPORT virtual void v_PhysDeriv(
80  const int dir, const Array<OneD, const NekDouble> &inarray,
81  Array<OneD, NekDouble> &outarray) override;
82 
84  const Array<OneD, const NekDouble> &inarray,
85  Array<OneD, NekDouble> &out_ds) override;
86 
88  const Array<OneD, const NekDouble> &inarray,
89  Array<OneD, NekDouble> &out_dn) override;
90 
91  //-----------------------------
92  // Transforms
93  //-----------------------------
94  LOCAL_REGIONS_EXPORT virtual void v_FwdTrans(
95  const Array<OneD, const NekDouble> &inarray,
96  Array<OneD, NekDouble> &outarray) override;
97 
99  const Array<OneD, const NekDouble> &inarray,
100  Array<OneD, NekDouble> &outarray) override;
101 
102  //-----------------------------
103  // Inner product functions
104  //-----------------------------
106  const Array<OneD, const NekDouble> &inarray,
107  Array<OneD, NekDouble> &outarray) override;
108 
110  const Array<OneD, const NekDouble> &base,
111  const Array<OneD, const NekDouble> &inarray,
112  Array<OneD, NekDouble> &outarray, int coll_check) override;
113 
115  const int dir, const Array<OneD, const NekDouble> &inarray,
116  Array<OneD, NekDouble> &outarray) override;
117 
121  Array<OneD, NekDouble> &outarray) override;
122 
124  const Array<OneD, const Array<OneD, NekDouble>> &Fvec,
125  Array<OneD, NekDouble> &outarray) override;
126 
127  //-----------------------------
128  // Evaluation functions
129  //-----------------------------
131  const Array<OneD, const NekDouble> &Lcoord,
132  const Array<OneD, const NekDouble> &physvals) override;
133 
135  const Array<OneD, const NekDouble> &coord,
136  const Array<OneD, const NekDouble> &physvals) override;
137 
138  LOCAL_REGIONS_EXPORT virtual void v_GetCoord(
139  const Array<OneD, const NekDouble> &Lcoords,
140  Array<OneD, NekDouble> &coords) override;
141 
142  LOCAL_REGIONS_EXPORT virtual void v_GetCoords(
143  Array<OneD, NekDouble> &coords_1, Array<OneD, NekDouble> &coords_2,
144  Array<OneD, NekDouble> &coords_3) override;
145 
147  const int vertex, const Array<OneD, const NekDouble> &inarray,
148  NekDouble &outarray) override;
149 
151  const int vertex, const NekDouble &inarray,
152  Array<OneD, NekDouble> &outarray);
153 
155  const int edge, const StdRegions::StdExpansionSharedPtr &EdgeExp,
156  const Array<OneD, const NekDouble> &inarray,
157  Array<OneD, NekDouble> &outarray,
158  StdRegions::Orientation orient) override;
159 
161  const int vertex, Array<OneD, int> &map) override;
162  //-----------------------------
163  // Helper functions
164  //-----------------------------
166  void) const override;
167 
169  void) const override;
170 
171  LOCAL_REGIONS_EXPORT virtual int v_GetCoordim() override;
172 
175  Array<OneD, NekDouble> &outarray) override;
176 
177  LOCAL_REGIONS_EXPORT virtual int v_GetNumPoints(const int dir) const;
178 
179  LOCAL_REGIONS_EXPORT virtual int v_GetNcoeffs(void) const;
180 
182  int dir) const;
183 
184  LOCAL_REGIONS_EXPORT virtual int v_NumBndryCoeffs() const override;
185 
186  LOCAL_REGIONS_EXPORT virtual int v_NumDGBndryCoeffs() const override;
187 
189  const int vertex) override;
190 
192 
194  const NekDouble *data, const std::vector<unsigned int> &nummodes,
195  const int mode_offset, NekDouble *coeffs,
196  std::vector<LibUtilities::BasisType> &fromType) override;
197 
199  &v_GetPhysNormals(void) override;
200 
201  //-----------------------------
202  // Operator creation functions
203  //-----------------------------
205  const Array<OneD, const NekDouble> &inarray,
206  Array<OneD, NekDouble> &outarray,
207  const StdRegions::StdMatrixKey &mkey) override;
208 
210  const Array<OneD, const NekDouble> &inarray,
211  Array<OneD, NekDouble> &outarray,
212  const StdRegions::StdMatrixKey &mkey) override;
213 
214  //-----------------------------
215  // Matrix creation functions
216  //-----------------------------
217 
219  const StdRegions::StdMatrixKey &mkey) override;
220 
222  CreateMatrix(const MatrixKey &mkey);
223 
225  const StdRegions::StdMatrixKey &mkey) override;
226 
228  const MatrixKey &mkey) override;
229 
231  const MatrixKey &mkey) override;
232 
234  const MatrixKey &mkey) override;
235 
236 private:
241 
243 
245  const Array<OneD, NekDouble> &inarray,
246  Array<OneD, NekDouble> &outarray);
247 
248  /// \todo Same method exists in ExpList and everyone references
249  /// ExpList::MultiplyByElmtInvMass. Remove this one?
251  const Array<OneD, const NekDouble> &inarray,
252  Array<OneD, NekDouble> &outarray);
253 };
254 
255 typedef std::shared_ptr<SegExp> SegExpSharedPtr;
256 typedef std::vector<SegExpSharedPtr> SegExpVector;
257 } // namespace LocalRegions
258 } // namespace Nektar
259 
260 #endif // SEGEXP_H
#define LOCAL_REGIONS_EXPORT
Describes the specification for a Basis.
Definition: Basis.h:50
virtual void v_LaplacianMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey) override
Definition: SegExp.cpp:922
virtual 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: SegExp.cpp:357
virtual StdRegions::StdExpansionSharedPtr v_GetLinStdExp(void) const override
Definition: SegExp.cpp:759
virtual void v_GetTracePhysVals(const int edge, const StdRegions::StdExpansionSharedPtr &EdgeExp, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, StdRegions::Orientation orient) override
Definition: SegExp.cpp:706
virtual void v_PhysDeriv_s(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &out_ds) override
Evaluate the derivative along a line: . The derivative is calculated performing the product .
Definition: SegExp.cpp:212
virtual int v_GetNumPoints(const int dir) const
Definition: SegExp.cpp:783
virtual void v_GetVertexPhysVals(const int vertex, const Array< OneD, const NekDouble > &inarray, NekDouble &outarray) override
Definition: SegExp.cpp:638
virtual NekDouble v_StdPhysEvaluate(const Array< OneD, const NekDouble > &Lcoord, const Array< OneD, const NekDouble > &physvals) override
Definition: SegExp.cpp:596
void ReverseCoeffsAndSign(const Array< OneD, NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Reverse the coefficients in a boundary interior expansion this routine is of use when we need the seg...
Definition: SegExp.cpp:1367
virtual void v_NormVectorIProductWRTBase(const Array< OneD, const NekDouble > &Fx, const Array< OneD, const NekDouble > &Fy, Array< OneD, NekDouble > &outarray) override
Definition: SegExp.cpp:562
DNekScalMatSharedPtr CreateMatrix(const MatrixKey &mkey)
Definition: SegExp.cpp:1136
virtual int v_GetCoordim() override
Definition: SegExp.cpp:767
virtual StdRegions::StdExpansionSharedPtr v_GetStdExp(void) const override
Definition: SegExp.cpp:753
virtual void v_FwdTransBndConstrained(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
Definition: SegExp.cpp:380
virtual 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 (this)->_Base[0] and return ...
Definition: SegExp.cpp:483
virtual DNekMatSharedPtr v_GenMatrix(const StdRegions::StdMatrixKey &mkey) override
Definition: SegExp.cpp:1337
LibUtilities::NekManager< MatrixKey, DNekScalBlkMat, MatrixKey::opLess > m_staticCondMatrixManager
Definition: SegExp.h:240
virtual NekDouble v_Integral(const Array< OneD, const NekDouble > &inarray) override
Integrate the physical point list inarray over region and return the value.
Definition: SegExp.cpp:109
virtual void v_HelmholtzMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey) override
Definition: SegExp.cpp:1013
virtual void v_PhysDeriv_n(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &out_dn) override
Evaluate the derivative normal to a line: . The derivative is calculated performing the product .
Definition: SegExp.cpp:251
virtual void v_ExtractDataToCoeffs(const NekDouble *data, const std::vector< unsigned int > &nummodes, const int mode_offset, NekDouble *coeffs, std::vector< LibUtilities::BasisType > &fromType) override
Unpack data from input file assuming it comes from.
Definition: SegExp.cpp:810
virtual void v_PhysDeriv(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &out_d0, Array< OneD, NekDouble > &out_d1=NullNekDouble1DArray, Array< OneD, NekDouble > &out_d2=NullNekDouble1DArray) override
Evaluate the derivative at the physical quadrature points given by inarray and return in outarray.
Definition: SegExp.cpp:156
virtual void v_GetCoords(Array< OneD, NekDouble > &coords_1, Array< OneD, NekDouble > &coords_2, Array< OneD, NekDouble > &coords_3) override
Definition: SegExp.cpp:630
virtual DNekScalBlkMatSharedPtr v_GetLocStaticCondMatrix(const MatrixKey &mkey) override
Definition: SegExp.cpp:1112
void MultiplyByElmtInvMass(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Definition: SegExp.cpp:1408
virtual int v_NumBndryCoeffs() const override
Definition: SegExp.cpp:798
LibUtilities::NekManager< MatrixKey, DNekScalMat, MatrixKey::opLess > m_matrixManager
Definition: SegExp.h:238
virtual NekDouble v_PhysEvaluate(const Array< OneD, const NekDouble > &coord, const Array< OneD, const NekDouble > &physvals) override
Definition: SegExp.cpp:604
virtual void v_GetTracePhysMap(const int vertex, Array< OneD, int > &map) override
Definition: SegExp.cpp:719
virtual int v_NumDGBndryCoeffs() const override
Definition: SegExp.cpp:803
virtual DNekMatSharedPtr v_CreateStdMatrix(const StdRegions::StdMatrixKey &mkey) override
Definition: SegExp.cpp:1127
virtual void v_SetCoeffsToOrientation(StdRegions::Orientation dir, Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
Definition: SegExp.cpp:734
void v_DropLocStaticCondMatrix(const MatrixKey &mkey) override
Definition: SegExp.cpp:1117
virtual DNekScalMatSharedPtr v_GetLocMatrix(const MatrixKey &mkey) override
Definition: SegExp.cpp:1122
virtual void v_GetCoord(const Array< OneD, const NekDouble > &Lcoords, Array< OneD, NekDouble > &coords) override
Definition: SegExp.cpp:615
virtual void v_AddVertexPhysVals(const int vertex, const NekDouble &inarray, Array< OneD, NekDouble > &outarray)
Definition: SegExp.cpp:673
virtual int v_GetNcoeffs(void) const
Definition: SegExp.cpp:788
virtual const LibUtilities::BasisSharedPtr & v_GetBasis(int dir) const
Definition: SegExp.cpp:793
virtual SpatialDomains::GeomType v_MetricInfoType()
Definition: SegExp.cpp:778
virtual void v_ComputeTraceNormal(const int vertex) override
Definition: SegExp.cpp:854
virtual const Array< OneD, const NekDouble > & v_GetPhysNormals(void) override
Definition: SegExp.cpp:772
virtual void v_IProductWRTDerivBase(const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
Definition: SegExp.cpp:536
Class representing a segment element in reference space.
Definition: StdSegExp.h:54
std::shared_ptr< Basis > BasisSharedPtr
std::vector< SegExpSharedPtr > SegExpVector
Definition: SegExp.h:256
std::shared_ptr< SegExp > SegExpSharedPtr
Definition: SegExp.h:255
GeomType
Indicates the type of element geometry.
std::shared_ptr< Geometry1D > Geometry1DSharedPtr
Definition: Geometry.h:63
std::shared_ptr< StdExpansion > StdExpansionSharedPtr
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:1
std::shared_ptr< DNekScalMat > DNekScalMatSharedPtr
std::shared_ptr< DNekScalBlkMat > DNekScalBlkMatSharedPtr
Definition: NekTypeDefs.hpp:79
static Array< OneD, NekDouble > NullNekDouble1DArray
std::shared_ptr< DNekMat > DNekMatSharedPtr
Definition: NekTypeDefs.hpp:75
double NekDouble