Nektar++
Loading...
Searching...
No Matches
StdPointExp.cpp
Go to the documentation of this file.
1///////////////////////////////////////////////////////////////////////////////
2//
3// File: StdPointExp.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: Definition of a Point expansion
32//
33///////////////////////////////////////////////////////////////////////////////
34
36
37using namespace std;
38
39namespace Nektar::StdRegions
40{
41
43 : StdExpansion(Ba.GetNumModes(), 1, Ba),
44 StdExpansion0D(Ba.GetNumModes(), Ba)
45{
46}
47
52
54 [[maybe_unused]] Array<OneD, NekDouble> &coords_1,
55 [[maybe_unused]] Array<OneD, NekDouble> &coords_2)
56{
57 Vmath::Vcopy(GetNumPoints(0), (m_base[0]->GetZ()).data(), 1, &coords_0[0],
58 1);
59}
60
62 Array<OneD, NekDouble> &outarray)
63{
64 int nquad = GetTotPoints();
65 DNekMatSharedPtr D = m_base[0]->GetD();
66
67 if (inarray.data() == outarray.data())
68 {
69 Array<OneD, NekDouble> wsp(nquad);
70 CopyArray(inarray, wsp);
71 Blas::Dgemv('N', nquad, nquad, 1.0, &(D->GetPtr())[0], nquad, &wsp[0],
72 1, 0.0, &outarray[0], 1);
73 }
74 else
75 {
76 Blas::Dgemv('N', nquad, nquad, 1.0, &(D->GetPtr())[0], nquad,
77 &inarray[0], 1, 0.0, &outarray[0], 1);
78 }
79}
80
82 Array<OneD, NekDouble> &outarray)
83{
84 int nquad = m_base[0]->GetNumPoints();
85
86 if (m_base[0]->Collocation())
87 {
88 Vmath::Vcopy(nquad, inarray, 1, outarray, 1);
89 }
90 else
91 {
92 Blas::Dgemv('N', nquad, m_base[0]->GetNumModes(), 1.0,
93 (m_base[0]->GetBdata()).data(), nquad, &inarray[0], 1, 0.0,
94 &outarray[0], 1);
95 }
96}
97
98// Inner product
100 Array<OneD, NekDouble> &outarray)
101{
103 outarray[0] = inarray[0] * w[0];
104}
105
107 [[maybe_unused]] const int dir, const Array<OneD, const NekDouble> &inarray,
108 Array<OneD, NekDouble> &outarray)
109{
110 ASSERTL1(dir >= 0 && dir < 1, "input dir is out of range");
112 outarray[0] = inarray[0] * w[0];
113}
114
116{
118 MatrixType mattype;
119
120 switch (mattype = mkey.GetMatrixType())
121 {
122 case eFwdTrans:
123 {
124 Mat =
126 StdMatrixKey iprodkey(eIProductWRTBase, v_DetShapeType(), *this);
127 DNekMat &Iprod = *GetStdMatrix(iprodkey);
128 StdMatrixKey imasskey(eInvMass, v_DetShapeType(), *this);
129 DNekMat &Imass = *GetStdMatrix(imasskey);
130
131 (*Mat) = Imass * Iprod;
132 }
133 break;
134 default:
135 {
137 }
138 break;
139 }
140
141 return Mat;
142}
143
148
149} // namespace Nektar::StdRegions
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
Describes the specification for a Basis.
Definition Basis.h:45
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)
DNekMatSharedPtr CreateGeneralMatrix(const StdMatrixKey &mkey)
this function generates the mass matrix
int GetNumPoints(const int dir) const
This function returns the number of quadrature points in the dir direction.
Array< OneD, LibUtilities::BasisSharedPtr > m_base
MatrixType GetMatrixType() const
void PhysTensorDeriv(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
DNekMatSharedPtr v_CreateStdMatrix(const StdMatrixKey &mkey) override
void v_IProductWRTBase(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
Calculates the inner product of a given function f with the different modes of the expansion.
void v_IProductWRTDerivBase(const int dir, const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
DNekMatSharedPtr v_GenMatrix(const StdMatrixKey &mkey) override
LibUtilities::ShapeType v_DetShapeType() const override
void v_BwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray) override
void v_GetCoords(Array< OneD, NekDouble > &coords_0, Array< OneD, NekDouble > &coords_1, Array< OneD, NekDouble > &coords_2) override
static void Dgemv(const char &trans, const int &m, const int &n, const double &alpha, const double *a, const int &lda, const double *x, const int &incx, const double &beta, double *y, const int &incy)
BLAS level 2: Matrix vector multiply y = alpha A x plus beta y where A[m x n].
Definition Blas.hpp:152
std::shared_ptr< DNekMat > DNekMatSharedPtr
void CopyArray(const Array< OneD, ConstDataType > &source, Array< OneD, DataType > &dest)
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition Vmath.hpp:825
STL namespace.