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 
61  LOCAL_REGIONS_EXPORT virtual ~SegExp() override = default;
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 
139  const Array<OneD, NekDouble> &coord,
140  const Array<OneD, const NekDouble> &inarray,
141  std::array<NekDouble, 3> &firstOrderDerivs) override;
142 
144  const Array<OneD, NekDouble> &coord,
145  const Array<OneD, const NekDouble> &inarray,
146  std::array<NekDouble, 3> &firstOrderDerivs,
147  std::array<NekDouble, 6> &secondOrderDerivs) override;
148 
149  LOCAL_REGIONS_EXPORT virtual void v_GetCoord(
150  const Array<OneD, const NekDouble> &Lcoords,
151  Array<OneD, NekDouble> &coords) override;
152 
153  LOCAL_REGIONS_EXPORT virtual void v_GetCoords(
154  Array<OneD, NekDouble> &coords_1, Array<OneD, NekDouble> &coords_2,
155  Array<OneD, NekDouble> &coords_3) override;
156 
158  const int vertex, const Array<OneD, const NekDouble> &inarray,
159  NekDouble &outarray) override;
160 
162  const int edge, 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, Array<OneD, int> &map) override;
169  //-----------------------------
170  // Helper functions
171  //-----------------------------
173  void) const override;
174 
176  void) const override;
177 
180  Array<OneD, NekDouble> &outarray) override;
181 
182  LOCAL_REGIONS_EXPORT virtual int v_NumBndryCoeffs() const override;
183 
184  LOCAL_REGIONS_EXPORT virtual int v_NumDGBndryCoeffs() const override;
185 
187  const int vertex) override;
188 
190  const NekDouble *data, const std::vector<unsigned int> &nummodes,
191  const int mode_offset, NekDouble *coeffs,
192  std::vector<LibUtilities::BasisType> &fromType) override;
193 
195  &v_GetPhysNormals() override;
196 
197  //-----------------------------
198  // Operator creation functions
199  //-----------------------------
201  const Array<OneD, const NekDouble> &inarray,
202  Array<OneD, NekDouble> &outarray,
203  const StdRegions::StdMatrixKey &mkey) override;
204 
206  const Array<OneD, const NekDouble> &inarray,
207  Array<OneD, NekDouble> &outarray,
208  const StdRegions::StdMatrixKey &mkey) override;
209 
210  //-----------------------------
211  // Matrix creation functions
212  //-----------------------------
213 
215  const StdRegions::StdMatrixKey &mkey) override;
216 
218  CreateMatrix(const MatrixKey &mkey);
219 
221  const StdRegions::StdMatrixKey &mkey) override;
222 
224  const MatrixKey &mkey) override;
225 
226  LOCAL_REGIONS_EXPORT void v_DropLocMatrix(const MatrixKey &mkey) override;
227 
229  const MatrixKey &mkey) override;
230 
232  const MatrixKey &mkey) override;
233 
234 private:
239 
241  const Array<OneD, NekDouble> &inarray,
242  Array<OneD, NekDouble> &outarray);
243 
244  /// \todo Same method exists in ExpList and everyone references
245  /// ExpList::MultiplyByElmtInvMass. Remove this one?
247  const Array<OneD, const NekDouble> &inarray,
248  Array<OneD, NekDouble> &outarray);
249 };
250 
251 typedef std::shared_ptr<SegExp> SegExpSharedPtr;
252 typedef std::vector<SegExpSharedPtr> SegExpVector;
253 } // namespace LocalRegions
254 } // namespace Nektar
255 
256 #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:879
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:350
void v_DropLocMatrix(const MatrixKey &mkey) override
Definition: SegExp.cpp:1084
virtual StdRegions::StdExpansionSharedPtr v_GetLinStdExp(void) const override
Definition: SegExp.cpp:741
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:688
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:205
virtual void v_GetVertexPhysVals(const int vertex, const Array< OneD, const NekDouble > &inarray, NekDouble &outarray) override
Definition: SegExp.cpp:653
virtual NekDouble v_StdPhysEvaluate(const Array< OneD, const NekDouble > &Lcoord, const Array< OneD, const NekDouble > &physvals) override
Definition: SegExp.cpp:589
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:1329
SegExp(const LibUtilities::BasisKey &Ba, const SpatialDomains::Geometry1DSharedPtr &geom)
Constructor using BasisKey class for quadrature points and order definition.
Definition: SegExp.cpp:59
virtual void v_NormVectorIProductWRTBase(const Array< OneD, const NekDouble > &Fx, const Array< OneD, const NekDouble > &Fy, Array< OneD, NekDouble > &outarray) override
Definition: SegExp.cpp:555
virtual ~SegExp() override=default
DNekScalMatSharedPtr CreateMatrix(const MatrixKey &mkey)
Definition: SegExp.cpp:1098
virtual StdRegions::StdExpansionSharedPtr v_GetStdExp(void) const override
Definition: SegExp.cpp:735
virtual void v_FwdTransBndConstrained(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
Definition: SegExp.cpp:373
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:476
virtual DNekMatSharedPtr v_GenMatrix(const StdRegions::StdMatrixKey &mkey) override
Definition: SegExp.cpp:1299
LibUtilities::NekManager< MatrixKey, DNekScalBlkMat, MatrixKey::opLess > m_staticCondMatrixManager
Definition: SegExp.h:238
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:102
virtual void v_HelmholtzMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey) override
Definition: SegExp.cpp:970
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:244
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:767
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:149
virtual void v_GetCoords(Array< OneD, NekDouble > &coords_1, Array< OneD, NekDouble > &coords_2, Array< OneD, NekDouble > &coords_3) override
Definition: SegExp.cpp:645
virtual DNekScalBlkMatSharedPtr v_GetLocStaticCondMatrix(const MatrixKey &mkey) override
Definition: SegExp.cpp:1069
void MultiplyByElmtInvMass(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Definition: SegExp.cpp:1370
virtual int v_NumBndryCoeffs() const override
Definition: SegExp.cpp:755
LibUtilities::NekManager< MatrixKey, DNekScalMat, MatrixKey::opLess > m_matrixManager
Definition: SegExp.h:236
virtual NekDouble v_PhysEvaluate(const Array< OneD, const NekDouble > &coord, const Array< OneD, const NekDouble > &physvals) override
Definition: SegExp.cpp:597
virtual void v_GetTracePhysMap(const int vertex, Array< OneD, int > &map) override
Definition: SegExp.cpp:701
virtual int v_NumDGBndryCoeffs() const override
Definition: SegExp.cpp:760
virtual DNekMatSharedPtr v_CreateStdMatrix(const StdRegions::StdMatrixKey &mkey) override
Definition: SegExp.cpp:1089
virtual void v_SetCoeffsToOrientation(StdRegions::Orientation dir, Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
Definition: SegExp.cpp:716
virtual void v_DropLocStaticCondMatrix(const MatrixKey &mkey) override
Definition: SegExp.cpp:1074
virtual const Array< OneD, const NekDouble > & v_GetPhysNormals() override
Definition: SegExp.cpp:749
virtual DNekScalMatSharedPtr v_GetLocMatrix(const MatrixKey &mkey) override
Definition: SegExp.cpp:1079
virtual void v_GetCoord(const Array< OneD, const NekDouble > &Lcoords, Array< OneD, NekDouble > &coords) override
Definition: SegExp.cpp:630
virtual void v_ComputeTraceNormal(const int vertex) override
Definition: SegExp.cpp:811
virtual void v_IProductWRTDerivBase(const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
Definition: SegExp.cpp:529
Class representing a segment element in reference space All interface of this class sits in StdExpans...
Definition: StdSegExp.h:48
std::vector< SegExpSharedPtr > SegExpVector
Definition: SegExp.h:252
std::shared_ptr< SegExp > SegExpSharedPtr
Definition: SegExp.h:251
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:2
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