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 
38 #include <StdRegions/StdSegExp.h>
40 #include <LocalRegions/MatrixKey.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  //----------------------------
66  // Integration Methods
67  //----------------------------
69  const Array<OneD, const NekDouble>& inarray) override;
70 
71  //-----------------------------
72  // Differentiation Methods
73  //-----------------------------
74  LOCAL_REGIONS_EXPORT virtual void v_PhysDeriv(
75  const Array<OneD, const NekDouble>& inarray,
76  Array<OneD,NekDouble> &out_d0,
78  Array<OneD,NekDouble> &out_d2 = NullNekDouble1DArray) override;
79 
80  LOCAL_REGIONS_EXPORT virtual void v_PhysDeriv(const int dir,
81  const Array<OneD, const NekDouble>& inarray,
82  Array<OneD, NekDouble> &outarray) override;
83 
85  const Array<OneD, const NekDouble>& inarray,
86  Array<OneD, NekDouble> &out_ds) override;
87 
89  const Array<OneD, const NekDouble>& inarray,
90  Array<OneD, NekDouble>& out_dn) override;
91 
92  //-----------------------------
93  // Transforms
94  //-----------------------------
95  LOCAL_REGIONS_EXPORT virtual void v_FwdTrans(
96  const Array<OneD, const NekDouble>& inarray,
97  Array<OneD,NekDouble> &outarray) override;
98 
100  const Array<OneD, const NekDouble>& inarray,
101  Array<OneD, NekDouble> &outarray) override;
102 
103  //-----------------------------
104  // Inner product functions
105  //-----------------------------
107  const Array<OneD, const NekDouble>& inarray,
108  Array<OneD, NekDouble> &outarray) override;
109 
111  const Array<OneD, const NekDouble>& base,
112  const Array<OneD, const NekDouble>& inarray,
113  Array<OneD, NekDouble> &outarray,
114  int coll_check) override;
115 
117  const int dir,
118  const Array<OneD, const NekDouble>& inarray,
119  Array<OneD, NekDouble> & outarray) override;
120 
124  Array<OneD, NekDouble> &outarray) override;
125 
127  const Array<OneD, const Array<OneD, NekDouble> > &Fvec,
128  Array<OneD, NekDouble> &outarray) override;
129 
130  //-----------------------------
131  // Evaluation functions
132  //-----------------------------
134  const Array<OneD, const NekDouble> &Lcoord,
135  const Array<OneD, const NekDouble> &physvals) override;
136 
138  const Array<OneD, const NekDouble>& coord,
139  const Array<OneD, const NekDouble> & physvals) override;
140 
141  LOCAL_REGIONS_EXPORT virtual void v_GetCoord(
142  const Array<OneD, const NekDouble>& Lcoords,
143  Array<OneD,NekDouble> &coords) override;
144 
145  LOCAL_REGIONS_EXPORT virtual void v_GetCoords(
146  Array<OneD, NekDouble> &coords_1,
147  Array<OneD, NekDouble> &coords_2,
148  Array<OneD, NekDouble> &coords_3) override;
149 
151  const int vertex,
152  const Array<OneD, const NekDouble> &inarray,
153  NekDouble &outarray) override;
154 
156  const int vertex,
157  const NekDouble &inarray,
158  Array<OneD, NekDouble> &outarray);
159 
161  const int edge,
162  const StdRegions::StdExpansionSharedPtr &EdgeExp,
163  const Array<OneD, const NekDouble> &inarray,
164  Array<OneD, NekDouble> &outarray,
165  StdRegions::Orientation orient) override;
166 
168  const int vertex,
169  Array<OneD, int> &map) override;
170  //-----------------------------
171  // Helper functions
172  //-----------------------------
173  LOCAL_REGIONS_EXPORT virtual
174  StdRegions::StdExpansionSharedPtr v_GetStdExp(void) const override;
175 
176  LOCAL_REGIONS_EXPORT virtual
178 
179  LOCAL_REGIONS_EXPORT virtual int v_GetCoordim() override;
180 
184  Array<OneD, NekDouble> &outarray) override;
185 
186  LOCAL_REGIONS_EXPORT virtual int v_GetNumPoints(const int dir) const;
187 
188  LOCAL_REGIONS_EXPORT virtual int v_GetNcoeffs(void) const;
189 
190  LOCAL_REGIONS_EXPORT virtual const
192 
193  LOCAL_REGIONS_EXPORT virtual int v_NumBndryCoeffs() const override;
194 
195  LOCAL_REGIONS_EXPORT virtual int v_NumDGBndryCoeffs() const override;
196 
198  const int vertex) override;
199 
202 
204  const NekDouble *data,
205  const std::vector<unsigned int > &nummodes,
206  const int mode_offset,
207  NekDouble *coeffs,
208  std::vector<LibUtilities::BasisType> &fromType) override;
209 
210  LOCAL_REGIONS_EXPORT virtual const
212  v_GetPhysNormals(void) override;
213 
214  //-----------------------------
215  // Operator creation functions
216  //-----------------------------
218  const Array<OneD, const NekDouble> &inarray,
219  Array<OneD, NekDouble> &outarray,
220  const StdRegions::StdMatrixKey &mkey) override;
221 
223  const Array<OneD, const NekDouble> &inarray,
224  Array<OneD, NekDouble> &outarray,
225  const StdRegions::StdMatrixKey &mkey) override;
226 
227  //-----------------------------
228  // Matrix creation functions
229  //-----------------------------
230 
232  v_GenMatrix(const StdRegions::StdMatrixKey &mkey) override;
233 
235 
237  v_CreateStdMatrix(const StdRegions::StdMatrixKey &mkey) override;
238 
240  const MatrixKey &mkey);
241 
243  v_GetLocMatrix(const MatrixKey &mkey) override;
244 
246  v_GetLocStaticCondMatrix(const MatrixKey &mkey) override;
247 
249  const MatrixKey &mkey) override;
250 
251  private:
256 
258 
260  const Array<OneD,NekDouble> &inarray,
261  Array<OneD,NekDouble> &outarray);
262 
263 
264  /// \todo Same method exists in ExpList and everyone references
265  /// ExpList::MultiplyByElmtInvMass. Remove this one?
267  const Array<OneD, const NekDouble>& inarray,
268  Array<OneD,NekDouble> &outarray);
269 
270  };
271 
272  typedef std::shared_ptr<SegExp> SegExpSharedPtr;
273  typedef std::vector< SegExpSharedPtr > SegExpVector;
274  } //end of namespace
275 } //end of namespace
276 
277 #endif // SEGEXP_H
#define LOCAL_REGIONS_EXPORT
Describes the specification for a Basis.
Definition: Basis.h:50
DNekScalBlkMatSharedPtr CreateStaticCondMatrix(const MatrixKey &mkey)
Definition: SegExp.cpp:1503
virtual void v_LaplacianMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey) override
Definition: SegExp.cpp:1018
virtual void v_FwdTrans_BndConstrained(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
Definition: SegExp.cpp:401
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:377
virtual StdRegions::StdExpansionSharedPtr v_GetLinStdExp(void) const override
Definition: SegExp.cpp:837
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:778
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:229
virtual int v_GetNumPoints(const int dir) const
Definition: SegExp.cpp:862
virtual void v_GetVertexPhysVals(const int vertex, const Array< OneD, const NekDouble > &inarray, NekDouble &outarray) override
Definition: SegExp.cpp:706
virtual NekDouble v_StdPhysEvaluate(const Array< OneD, const NekDouble > &Lcoord, const Array< OneD, const NekDouble > &physvals) override
Definition: SegExp.cpp:660
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:1650
virtual void v_NormVectorIProductWRTBase(const Array< OneD, const NekDouble > &Fx, const Array< OneD, const NekDouble > &Fy, Array< OneD, NekDouble > &outarray) override
Definition: SegExp.cpp:624
DNekScalMatSharedPtr CreateMatrix(const MatrixKey &mkey)
Definition: SegExp.cpp:1269
virtual int v_GetCoordim() override
Definition: SegExp.cpp:846
virtual StdRegions::StdExpansionSharedPtr v_GetStdExp(void) const override
Definition: SegExp.cpp:831
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:506
virtual DNekMatSharedPtr v_GenMatrix(const StdRegions::StdMatrixKey &mkey) override
Definition: SegExp.cpp:1479
LibUtilities::NekManager< MatrixKey, DNekScalBlkMat, MatrixKey::opLess > m_staticCondMatrixManager
Definition: SegExp.h:255
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:118
virtual void v_HelmholtzMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey) override
Definition: SegExp.cpp:1126
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:269
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:892
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:166
virtual void v_GetCoords(Array< OneD, NekDouble > &coords_1, Array< OneD, NekDouble > &coords_2, Array< OneD, NekDouble > &coords_3) override
Definition: SegExp.cpp:697
virtual DNekScalBlkMatSharedPtr v_GetLocStaticCondMatrix(const MatrixKey &mkey) override
Definition: SegExp.cpp:1241
void MultiplyByElmtInvMass(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Definition: SegExp.cpp:1692
virtual int v_NumBndryCoeffs() const override
Definition: SegExp.cpp:878
LibUtilities::NekManager< MatrixKey, DNekScalMat, MatrixKey::opLess > m_matrixManager
Definition: SegExp.h:253
virtual NekDouble v_PhysEvaluate(const Array< OneD, const NekDouble > &coord, const Array< OneD, const NekDouble > &physvals) override
Definition: SegExp.cpp:668
virtual void v_GetTracePhysMap(const int vertex, Array< OneD, int > &map) override
Definition: SegExp.cpp:793
virtual int v_NumDGBndryCoeffs() const override
Definition: SegExp.cpp:884
virtual DNekMatSharedPtr v_CreateStdMatrix(const StdRegions::StdMatrixKey &mkey) override
Definition: SegExp.cpp:1258
virtual void v_SetCoeffsToOrientation(StdRegions::Orientation dir, Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
Definition: SegExp.cpp:811
void v_DropLocStaticCondMatrix(const MatrixKey &mkey) override
Definition: SegExp.cpp:1247
virtual DNekScalMatSharedPtr v_GetLocMatrix(const MatrixKey &mkey) override
Definition: SegExp.cpp:1252
virtual void v_GetCoord(const Array< OneD, const NekDouble > &Lcoords, Array< OneD, NekDouble > &coords) override
Definition: SegExp.cpp:681
virtual void v_AddVertexPhysVals(const int vertex, const NekDouble &inarray, Array< OneD, NekDouble > &outarray)
Definition: SegExp.cpp:742
virtual int v_GetNcoeffs(void) const
Definition: SegExp.cpp:867
virtual const LibUtilities::BasisSharedPtr & v_GetBasis(int dir) const
Definition: SegExp.cpp:872
virtual SpatialDomains::GeomType v_MetricInfoType()
Definition: SegExp.cpp:857
virtual void v_ComputeTraceNormal(const int vertex) override
Definition: SegExp.cpp:945
virtual const Array< OneD, const NekDouble > & v_GetPhysNormals(void) override
Definition: SegExp.cpp:851
virtual void v_IProductWRTDerivBase(const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
Definition: SegExp.cpp:565
Class representing a segment element in reference space.
Definition: StdSegExp.h:54
std::shared_ptr< Basis > BasisSharedPtr
std::shared_ptr< SegExp > SegExpSharedPtr
Definition: SegExp.h:272
std::vector< SegExpSharedPtr > SegExpVector
Definition: SegExp.h:273
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:73
static Array< OneD, NekDouble > NullNekDouble1DArray
std::shared_ptr< DNekMat > DNekMatSharedPtr
Definition: NekTypeDefs.hpp:69
double NekDouble