Nektar++
NodalTriExp.h
Go to the documentation of this file.
1///////////////////////////////////////////////////////////////////////////////
2//
3// File: NodalTriExp.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 for NodalTriExp routines
32//
33///////////////////////////////////////////////////////////////////////////////
34
35#ifndef NODALTRIEXP_H
36#define NODALTRIEXP_H
37
40
44
46{
47
48class NodalTriExp final : virtual public StdRegions::StdNodalTriExp,
49 virtual public Expansion2D
50{
51public:
52 /** \brief Constructor using BasisKey class for quadrature
53 points and order definition */
56 const LibUtilities::PointsType Ntype,
58
59 /// Copy Constructor
61
62 /// Destructor
63 LOCAL_REGIONS_EXPORT ~NodalTriExp() override = default;
64
69 const Array<OneD, const NekDouble> &Lcoords,
71
72 //----------------------------
73 // Integration Methods
74 //----------------------------
75
76 /// \brief Integrate the physical point list \a inarray over region
79
80 /** \brief Inner product of \a inarray over region with respect to the
81 expansion basis (this)->_Base[0] and return in \a outarray */
83 Array<OneD, NekDouble> &outarray)
84 {
85 NodalTriExp::IProductWRTBase_SumFac(inarray, outarray);
86 }
87
88 void IProductWRTDerivBase(const int dir,
89 const Array<OneD, const NekDouble> &inarray,
90 Array<OneD, NekDouble> &outarray)
91 {
92 NodalTriExp::IProductWRTDerivBase_SumFac(dir, inarray, outarray);
93 }
94
95 //-----------------------------
96 // Differentiation Methods
97 //-----------------------------
98
100 const Array<OneD, const NekDouble> &inarray,
103
104 //----------------------------
105 // Evaluations Methods
106 //---------------------------
107
108 /** \brief Forward transform from physical quadrature space
109 stored in \a inarray and evaluate the expansion coefficients and
110 store in \a (this)->_coeffs */
112 const Array<OneD, const NekDouble> &inarray,
113 Array<OneD, NekDouble> &outarray);
114
117 const Array<OneD, const NekDouble> &physvals);
118
120 Array<OneD, NekDouble> &outarray,
121 const StdRegions::StdMatrixKey &mkey)
122 {
123 StdExpansion::MassMatrixOp_MatFree(inarray, outarray, mkey);
124 }
125
128 const Array<OneD, const NekDouble> &inarray,
129 std::array<NekDouble, 3> &firstOrderDerivs) final;
130
132 Array<OneD, NekDouble> &outarray,
133 const StdRegions::StdMatrixKey &mkey)
134 {
135 StdExpansion::LaplacianMatrixOp_MatFree_GenericImpl(inarray, outarray,
136 mkey);
137 }
138
139 void LaplacianMatrixOp(const int k1, const int k2,
140 const Array<OneD, const NekDouble> &inarray,
141 Array<OneD, NekDouble> &outarray,
142 const StdRegions::StdMatrixKey &mkey)
143 {
144 StdExpansion::LaplacianMatrixOp_MatFree(k1, k2, inarray, outarray,
145 mkey);
146 }
147
148 void WeakDerivMatrixOp(const int i,
149 const Array<OneD, const NekDouble> &inarray,
150 Array<OneD, NekDouble> &outarray,
151 const StdRegions::StdMatrixKey &mkey)
152 {
153 StdExpansion::WeakDerivMatrixOp_MatFree(i, inarray, outarray, mkey);
154 }
155
157 Array<OneD, NekDouble> &outarray,
158 const StdRegions::StdMatrixKey &mkey)
159 {
160 StdExpansion::HelmholtzMatrixOp_MatFree_GenericImpl(inarray, outarray,
161 mkey);
162 }
163
164protected:
166
168 Array<OneD, NekDouble> &outarray,
169 bool multiplybyweights = true);
171 Array<OneD, NekDouble> &outarray);
172
174 const int dir, const Array<OneD, const NekDouble> &inarray,
175 Array<OneD, NekDouble> &outarray);
176 void IProductWRTDerivBase_MatOp(const int dir,
177 const Array<OneD, const NekDouble> &inarray,
178 Array<OneD, NekDouble> &outarray);
179
181 Array<OneD, NekDouble> &outarray,
182 const StdRegions::StdMatrixKey &mkey);
183
185
187
189
190private:
195
197 Array<OneD, NekDouble> &coords_0,
199 Array<OneD, NekDouble> &coords_2 = NullNekDouble1DArray) override
200 {
201 GetCoords(coords_0, coords_1, coords_2);
202 }
203
205 Array<OneD, NekDouble> &coord) override
206 {
207 GetCoord(lcoord, coord);
208 }
209
210 /** \brief Virtual call to integrate the physical point list \a inarray
211 over region (see SegExp::Integral) */
213 {
214 return Integral(inarray);
215 }
216
217 /** \brief Virtual call to TriExp::IProduct_WRT_B */
219 Array<OneD, NekDouble> &outarray) override
220 {
221 IProductWRTBase(inarray, outarray);
222 }
223
224 void v_IProductWRTDerivBase(const int dir,
225 const Array<OneD, const NekDouble> &inarray,
226 Array<OneD, NekDouble> &outarray) override
227 {
228 IProductWRTDerivBase(dir, inarray, outarray);
229 }
230
232 const Array<OneD, const NekDouble> &inarray,
235 {
236 StdTriExp::v_PhysDeriv(inarray, out_d0, out_d1, out_d2);
237 }
238
242 [[maybe_unused]] Array<OneD, NekDouble> &out_d2 =
243 NullNekDouble1DArray) override
244 {
245 PhysDeriv(inarray, out_d0, out_d1);
246 }
247
248 void v_PhysDeriv(const int dir, const Array<OneD, const NekDouble> &inarray,
249 Array<OneD, NekDouble> &outarray) override
250 {
252 switch (dir)
253 {
254 case 0:
255 {
256 PhysDeriv(inarray, outarray, tmp);
257 }
258 break;
259 case 1:
260 {
261 PhysDeriv(inarray, tmp, outarray);
262 }
263 break;
264 default:
265 {
266 ASSERTL1(dir >= 0 && dir < 2, "input dir is out of range");
267 }
268 break;
269 }
270 }
271
272 /// Virtual call to SegExp::FwdTrans
274 Array<OneD, NekDouble> &outarray) override
275 {
276 FwdTrans(inarray, outarray);
277 }
278
279 /// Virtual call to TriExp::Evaluate
281 const Array<OneD, const NekDouble> &coord,
282 const Array<OneD, const NekDouble> &physvals) override
283 {
284 return PhysEvaluate(coord, physvals);
285 }
286
288 const StdRegions::StdMatrixKey &mkey) override
289 {
290 return CreateStdMatrix(mkey);
291 }
292
294 {
295 return m_matrixManager[mkey];
296 }
297
298 void v_DropLocMatrix(const MatrixKey &mkey) override
299 {
300 m_matrixManager.DeleteObject(mkey);
301 }
302
304 const MatrixKey &mkey) override
305 {
306 return m_staticCondMatrixManager[mkey];
307 }
308
310 Array<OneD, NekDouble> &outarray) override
311 {
312 StdNodalTriExp::v_BwdTrans_SumFac(inarray, outarray);
313 }
314
316 const Array<OneD, const NekDouble> &inarray,
317 Array<OneD, NekDouble> &outarray,
318 [[maybe_unused]] bool multiplybyweights = true) override
319 {
320 IProductWRTBase_SumFac(inarray, outarray);
321 }
322
324 const int dir, const Array<OneD, const NekDouble> &inarray,
325 Array<OneD, NekDouble> &outarray) override
326 {
327 IProductWRTDerivBase_SumFac(dir, inarray, outarray);
328 }
329
331 const int dir, const Array<OneD, const NekDouble> &inarray,
332 Array<OneD, Array<OneD, NekDouble>> &outarray) override;
333
335 Array<OneD, NekDouble> &outarray,
336 const StdRegions::StdMatrixKey &mkey) override
337 {
338 MassMatrixOp(inarray, outarray, mkey);
339 }
340
342 Array<OneD, NekDouble> &outarray,
343 const StdRegions::StdMatrixKey &mkey) override
344 {
345 LaplacianMatrixOp(inarray, outarray, mkey);
346 }
347
348 void v_LaplacianMatrixOp(const int k1, const int k2,
349 const Array<OneD, const NekDouble> &inarray,
350 Array<OneD, NekDouble> &outarray,
351 const StdRegions::StdMatrixKey &mkey) override
352 {
353 LaplacianMatrixOp(k1, k2, inarray, outarray, mkey);
354 }
355
356 void v_WeakDerivMatrixOp(const int i,
357 const Array<OneD, const NekDouble> &inarray,
358 Array<OneD, NekDouble> &outarray,
359 const StdRegions::StdMatrixKey &mkey) override
360 {
361 WeakDerivMatrixOp(i, inarray, outarray, mkey);
362 }
363
365 Array<OneD, NekDouble> &outarray,
366 const StdRegions::StdMatrixKey &mkey) override
367 {
368 HelmholtzMatrixOp(inarray, outarray, mkey);
369 }
370
371 void v_ComputeTraceNormal(const int edge) override;
372};
373
374typedef std::shared_ptr<NodalTriExp> NodalTriExpSharedPtr;
375typedef std::vector<NodalTriExpSharedPtr> NodalTriExpVector;
376
377} // namespace Nektar::LocalRegions
378
379#endif // NODALTRIEXP_H
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
Definition: ErrorUtil.hpp:242
#define LOCAL_REGIONS_EXPORT
Describes the specification for a Basis.
Definition: Basis.h:45
LibUtilities::NekManager< MatrixKey, DNekScalMat, MatrixKey::opLess > m_matrixManager
Definition: NodalTriExp.h:192
void v_IProductWRTDerivBase_SumFac(const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
Definition: NodalTriExp.h:323
void v_PhysDeriv(const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
Calculate the derivative of the physical points in a given direction.
Definition: NodalTriExp.h:248
void v_PhysDeriv(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &out_d0, Array< OneD, NekDouble > &out_d1, Array< OneD, NekDouble > &out_d2=NullNekDouble1DArray) override
Calculate the derivative of the physical points.
Definition: NodalTriExp.h:239
void GetCoord(const Array< OneD, const NekDouble > &Lcoords, Array< OneD, NekDouble > &coords)
~NodalTriExp() override=default
Destructor.
void PhysDeriv(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &out_d0, Array< OneD, NekDouble > &out_d1, Array< OneD, NekDouble > &out_d2=NullNekDouble1DArray)
Differentiation Methods.
NekDouble v_PhysEvaluate(const Array< OneD, const NekDouble > &coord, const Array< OneD, const NekDouble > &physvals) override
Virtual call to TriExp::Evaluate.
Definition: NodalTriExp.h:280
void v_StdPhysDeriv(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &out_d0, Array< OneD, NekDouble > &out_d1, Array< OneD, NekDouble > &out_d2=NullNekDouble1DArray) override
Definition: NodalTriExp.h:231
DNekMatSharedPtr CreateStdMatrix(const StdRegions::StdMatrixKey &mkey)
void v_IProductWRTBase(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
Virtual call to TriExp::IProduct_WRT_B.
Definition: NodalTriExp.h:218
DNekMatSharedPtr v_GenMatrix(const StdRegions::StdMatrixKey &mkey) override
NekDouble v_PhysEvaluate(const Array< OneD, NekDouble > &coord, const Array< OneD, const NekDouble > &inarray, std::array< NekDouble, 3 > &firstOrderDerivs) final
void LaplacianMatrixOp(const int k1, const int k2, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey)
Definition: NodalTriExp.h:139
void v_AlignVectorToCollapsedDir(const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray) override
NekDouble v_Integral(const Array< OneD, const NekDouble > &inarray) override
Virtual call to integrate the physical point list inarray over region (see SegExp::Integral)
Definition: NodalTriExp.h:212
void WeakDerivMatrixOp(const int i, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey)
Definition: NodalTriExp.h:148
void GetCoords(Array< OneD, NekDouble > &coords_1, Array< OneD, NekDouble > &coords_2, Array< OneD, NekDouble > &coords_3=NullNekDouble1DArray)
void GeneralMatrixOp_MatOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey)
void v_LaplacianMatrixOp(const int k1, const int k2, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey) override
Definition: NodalTriExp.h:348
void IProductWRTBase(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Inner product of inarray over region with respect to the expansion basis (this)->_Base[0] and return ...
Definition: NodalTriExp.h:82
void IProductWRTDerivBase_MatOp(const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
LibUtilities::NekManager< MatrixKey, DNekScalBlkMat, MatrixKey::opLess > m_staticCondMatrixManager
Definition: NodalTriExp.h:194
void FwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Forward transform from physical quadrature space stored in inarray and evaluate the expansion coeffic...
void LaplacianMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey)
Definition: NodalTriExp.h:131
void v_MassMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey) override
Definition: NodalTriExp.h:334
void v_HelmholtzMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey) override
Definition: NodalTriExp.h:364
void IProductWRTDerivBase_SumFac(const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
void IProductWRTDerivBase(const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Definition: NodalTriExp.h:88
NekDouble PhysEvaluate(const Array< OneD, const NekDouble > &coord, const Array< OneD, const NekDouble > &physvals)
void v_FwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
Virtual call to SegExp::FwdTrans.
Definition: NodalTriExp.h:273
StdRegions::StdExpansionSharedPtr v_GetStdExp(void) const override
NekDouble Integral(const Array< OneD, const NekDouble > &inarray)
Integrate the physical point list inarray over region.
Definition: NodalTriExp.cpp:90
void IProductWRTBase_SumFac(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, bool multiplybyweights=true)
void MassMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey)
Definition: NodalTriExp.h:119
void v_GetCoords(Array< OneD, NekDouble > &coords_0, Array< OneD, NekDouble > &coords_1=NullNekDouble1DArray, Array< OneD, NekDouble > &coords_2=NullNekDouble1DArray) override
Definition: NodalTriExp.h:196
void v_DropLocMatrix(const MatrixKey &mkey) override
Definition: NodalTriExp.h:298
void v_LaplacianMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey) override
Definition: NodalTriExp.h:341
void v_WeakDerivMatrixOp(const int i, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey) override
Definition: NodalTriExp.h:356
void v_IProductWRTDerivBase(const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
Definition: NodalTriExp.h:224
DNekScalMatSharedPtr v_GetLocMatrix(const MatrixKey &mkey) override
Definition: NodalTriExp.h:293
void IProductWRTBase_MatOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
StdRegions::StdExpansionSharedPtr v_GetLinStdExp(void) const override
void v_BwdTrans_SumFac(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
Definition: NodalTriExp.h:309
NodalTriExp(const LibUtilities::BasisKey &Ba, const LibUtilities::BasisKey &Bb, const LibUtilities::PointsType Ntype, const SpatialDomains::TriGeomSharedPtr &geom)
Constructor using BasisKey class for quadrature points and order definition.
Definition: NodalTriExp.cpp:42
DNekScalBlkMatSharedPtr v_GetLocStaticCondMatrix(const MatrixKey &mkey) override
Definition: NodalTriExp.h:303
void v_IProductWRTBase_SumFac(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, bool multiplybyweights=true) override
Definition: NodalTriExp.h:315
void HelmholtzMatrixOp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, const StdRegions::StdMatrixKey &mkey)
Definition: NodalTriExp.h:156
DNekMatSharedPtr v_CreateStdMatrix(const StdRegions::StdMatrixKey &mkey) override
Definition: NodalTriExp.h:287
void v_ComputeTraceNormal(const int edge) override
void v_GetCoord(const Array< OneD, const NekDouble > &lcoord, Array< OneD, NekDouble > &coord) override
Definition: NodalTriExp.h:204
std::shared_ptr< NodalTriExp > NodalTriExpSharedPtr
Definition: NodalTriExp.h:374
std::vector< NodalTriExpSharedPtr > NodalTriExpVector
Definition: NodalTriExp.h:375
std::shared_ptr< TriGeom > TriGeomSharedPtr
Definition: TriGeom.h:56
std::shared_ptr< StdExpansion > StdExpansionSharedPtr
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