Nektar++
Loading...
Searching...
No Matches
StdNodalPrismExp.cpp
Go to the documentation of this file.
1///////////////////////////////////////////////////////////////////////////////
2//
3// File: StdNodalPrismExp.cpp
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: Nodal prismatic routines built upon StdExpansion3D
32//
33///////////////////////////////////////////////////////////////////////////////
34
35#include <LibUtilities/Foundations/ManagerAccess.h> // for PointsManager, etc
37
38namespace Nektar::StdRegions
39{
40
42 const LibUtilities::BasisKey &Bb,
43 const LibUtilities::BasisKey &Bc,
45 : StdExpansion(LibUtilities::StdPrismData::getNumberOfCoefficients(
46 Ba.GetNumModes(), Bb.GetNumModes(), Bc.GetNumModes()),
47 3, Ba, Bb, Bc),
48 StdExpansion3D(LibUtilities::StdPrismData::getNumberOfCoefficients(
49 Ba.GetNumModes(), Bb.GetNumModes(), Bc.GetNumModes()),
50 Ba, Bb, Bc),
51 StdPrismExp(Ba, Bb, Bc), m_nodalPointsKey(Ba.GetNumModes(), Ntype)
52{
53 ASSERTL0(Ba.GetNumModes() <= Bc.GetNumModes(),
54 "order in 'a' direction is higher than order "
55 "in 'c' direction");
56}
57
59{
60 return true;
61}
62
63//-------------------------------
64// Nodal basis specific routines
65//-------------------------------
66
79
80// Operate with transpose of NodalToModal transformation
94
96 Array<OneD, NekDouble> &outarray)
97{
101 DNekMatSharedPtr vdm = GetStdMatrix(Nkey);
102
103 // Multiply out matrix
104 NekVector<NekDouble> modal(m_ncoeffs, inarray, eWrapper);
105 NekVector<NekDouble> nodal(m_ncoeffs, outarray, eWrapper);
106 nodal = (*vdm) * modal;
107}
108
116
118{
119 int i, j;
123
125 GetNodalPoints(r, s, t);
126
127 // Store the values of m_phys in a temporary array
128 int nqtot = GetTotPoints();
129 Array<OneD, NekDouble> tmp_phys(nqtot);
130
131 for (i = 0; i < m_ncoeffs; ++i)
132 {
133 // fill physical space with mode i
134 StdPrismExp::v_FillMode(i, tmp_phys);
135
136 // interpolate mode i to the Nodal points 'j' and
137 // store in outarray
138 for (j = 0; j < m_ncoeffs; ++j)
139 {
140 c[0] = r[j];
141 c[1] = s[j];
142 c[2] = t[j];
143 (*Mat)(j, i) = StdExpansion3D::v_PhysEvaluate(c, tmp_phys);
144 }
145 }
146
147 return Mat;
148}
149
150//---------------------------------------
151// Transforms
152//---------------------------------------
153
155 Array<OneD, NekDouble> &outarray)
156{
158 NodalToModal(inarray, tmp);
159 StdPrismExp::v_BwdTrans(tmp, outarray);
160}
161
162//---------------------------------------
163// Inner product functions
164//---------------------------------------
165
167 const Array<OneD, const NekDouble> &inarray,
168 Array<OneD, NekDouble> &outarray)
169{
170 StdPrismExp::v_IProductWRTBase(inarray, outarray);
171 NodalToModalTranspose(outarray, outarray);
172}
173
175 const int dir, const Array<OneD, const NekDouble> &inarray,
176 Array<OneD, NekDouble> &outarray)
177{
178 StdPrismExp::v_IProductWRTDerivBase(dir, inarray, outarray);
179 NodalToModalTranspose(outarray, outarray);
180}
181
182//---------------------------------------
183// Evaluation functions
184//---------------------------------------
185
187 Array<OneD, NekDouble> &outarray)
188{
189 ASSERTL2(mode >= m_ncoeffs,
190 "calling argument mode is larger than total expansion order");
191
192 Vmath::Zero(m_ncoeffs, outarray, 1);
193 outarray[mode] = 1.0;
194 v_BwdTrans(outarray, outarray);
195}
196
197//---------------------------
198// Helper functions
199//---------------------------
200
205
206//---------------------------------------
207// Mapping functions
208//---------------------------------------
209
210int StdNodalPrismExp::v_GetVertexMap(const int localVertexId,
211 [[maybe_unused]] bool useCoeffPacking)
212{
213 ASSERTL0(false, "Needs setting up");
214 return localVertexId;
215}
216
218{
219 unsigned int i;
220 const unsigned int nBndryCoeff = NumBndryCoeffs();
221
222 if (outarray.size() != nBndryCoeff)
223 {
224 outarray = Array<OneD, unsigned int>(nBndryCoeff);
225 }
226
227 for (i = 0; i < nBndryCoeff; i++)
228 {
229 outarray[i] = i;
230 }
231}
232
234{
235 unsigned int i;
236 const unsigned int nBndryCoeff = NumBndryCoeffs();
237
238 if (outarray.size() != m_ncoeffs - nBndryCoeff)
239 {
240 outarray = Array<OneD, unsigned int>(m_ncoeffs - nBndryCoeff);
241 }
242
243 for (i = nBndryCoeff; i < m_ncoeffs; i++)
244 {
245 outarray[i - nBndryCoeff] = i;
246 }
247}
248
249//---------------------------------------
250// Wrapper functions
251//---------------------------------------
252
254{
256
257 switch (mkey.GetMatrixType())
258 {
259 case eNBasisTrans:
260 Mat = GenNBasisTransMatrix();
261 break;
262 default:
264 break;
265 }
266
267 return Mat;
268}
269
274} // namespace Nektar::StdRegions
#define ASSERTL0(condition, msg)
#define ASSERTL2(condition, msg)
Assert Level 2 – Debugging which is used FULLDEBUG compilation mode. This level assert is designed to...
Describes the specification for a Basis.
Definition Basis.h:45
int GetNumModes() const
Returns the order of the basis.
Definition Basis.h:74
PointsType GetPointsType() const
Definition Points.h:90
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
The base class for all shapes.
int GetTotPoints() const
This function returns the total number of quadrature points used in the element.
DNekMatSharedPtr GetStdMatrix(const StdMatrixKey &mkey)
virtual NekDouble v_PhysEvaluate(const Array< OneD, const NekDouble > &coords, const Array< OneD, const NekDouble > &physvals)
DNekMatSharedPtr CreateGeneralMatrix(const StdMatrixKey &mkey)
this function generates the mass matrix
LibUtilities::ShapeType DetShapeType() const
This function returns the shape of the expansion domain.
virtual void v_IProductWRTBase(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)=0
Calculates the inner product of a given function f with the different modes of the expansion.
MatrixType GetMatrixType() const
DNekMatSharedPtr v_CreateStdMatrix(const StdMatrixKey &mkey) override
LibUtilities::PointsKey m_nodalPointsKey
DNekMatSharedPtr v_GenMatrix(const StdMatrixKey &mkey) override
void v_GetBoundaryMap(Array< OneD, unsigned int > &outarray) override
void v_IProductWRTDerivBase(const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
int v_GetVertexMap(const int localVertexId, bool useCoeffPacking=false) override
void v_GetInteriorMap(Array< OneD, unsigned int > &outarray) override
void v_FillMode(const int mode, Array< OneD, NekDouble > &outarray) override
void GetNodalPoints(Array< OneD, const NekDouble > &x, Array< OneD, const NekDouble > &y, Array< OneD, const NekDouble > &z)
StdNodalPrismExp(const LibUtilities::BasisKey &Ba, const LibUtilities::BasisKey &Bb, const LibUtilities::BasisKey &Bc, const LibUtilities::PointsType Ntype)
void v_IProductWRTBase(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
void v_BwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
void NodalToModal(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
void NodalToModalTranspose(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
LibUtilities::ShapeType v_DetShapeType() const override
void ModalToNodal(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Class representing a prismatic element in reference space.
Definition StdPrismExp.h:45
void v_FillMode(const int mode, Array< OneD, NekDouble > &outarray) override
void v_BwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
void v_IProductWRTDerivBase(const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
Inner product of inarray over region with respect to the object's default expansion basis; output in ...
PointsManagerT & PointsManager(void)
static VarFactorsMap NullVarFactorsMap
static ConstFactorMap NullConstFactorMap
static VarCoeffMap NullVarCoeffMap
NekMatrix< InnerMatrixType, BlockMatrixTag > Transpose(NekMatrix< InnerMatrixType, BlockMatrixTag > &rhs)
std::shared_ptr< DNekMat > DNekMatSharedPtr
void Zero(int n, T *x, const int incx)
Zero vector.
Definition Vmath.hpp:273