Nektar++
StdExpansion0D.cpp
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File: StdExpansion0D.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: Daughter of StdExpansion. This class contains routine
32 // which are common to 0d expansion. Typically this inolves physiocal
33 // space operations.
34 //
35 ///////////////////////////////////////////////////////////////////////////////
36 
38 
39 namespace Nektar
40 {
41 namespace StdRegions
42 {
44 {
45 }
46 
48  : StdExpansion(numcoeffs, 1, Ba)
49 {
50 }
51 
53 {
54 }
55 
57 {
58 }
59 
60 //----------------------------
61 // Differentiation Methods
62 //-----------------------------
63 
65  const Array<OneD, const NekDouble> &inarray,
66  Array<OneD, NekDouble> &outarray)
67 {
68  int nquad = GetTotPoints();
69  DNekMatSharedPtr D = m_base[0]->GetD();
70 
71  if (inarray.data() == outarray.data())
72  {
73  Array<OneD, NekDouble> wsp(nquad);
74  CopyArray(inarray, wsp);
75  Blas::Dgemv('N', nquad, nquad, 1.0, &(D->GetPtr())[0], nquad, &wsp[0],
76  1, 0.0, &outarray[0], 1);
77  }
78  else
79  {
80  Blas::Dgemv('N', nquad, nquad, 1.0, &(D->GetPtr())[0], nquad,
81  &inarray[0], 1, 0.0, &outarray[0], 1);
82  }
83 }
84 
86  const Array<OneD, const NekDouble> &Lcoord,
87  const Array<OneD, const NekDouble> &physvals)
88 {
89  ASSERTL2(Lcoord[0] >= -1 - NekConstants::kNekZeroTol, "Lcoord[0] < -1");
90  ASSERTL2(Lcoord[0] <= 1 + NekConstants::kNekZeroTol, "Lcoord[0] > 1");
91 
92  return StdExpansion::BaryEvaluate<0>(Lcoord[0], &physvals[0]);
93 }
94 
95 // NekDouble StdExpansion0D::v_PhysEvaluate(
96 // const Array<OneD, DNekMatSharedPtr> &I,
97 // const Array<OneD, const NekDouble> &physvals)
98 //{
99 // NekDouble val;
100 // int nquad = GetTotPoints();
101 //
102 // val = Blas::Ddot(nquad, I[0]->GetPtr(), 1, physvals, 1);
103 //
104 // return val;
105 //}
106 
107 } // namespace StdRegions
108 } // namespace Nektar
#define ASSERTL2(condition, msg)
Assert Level 2 – Debugging which is used FULLDEBUG compilation mode. This level assert is designed to...
Definition: ErrorUtil.hpp:272
Describes the specification for a Basis.
Definition: Basis.h:50
void PhysTensorDeriv(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
virtual NekDouble v_PhysEvaluate(const Array< OneD, const NekDouble > &coords, const Array< OneD, const NekDouble > &physvals) override
The base class for all shapes.
Definition: StdExpansion.h:71
int GetTotPoints() const
This function returns the total number of quadrature points used in the element.
Definition: StdExpansion.h:140
Array< OneD, LibUtilities::BasisSharedPtr > m_base
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 = A x where A[m x n].
Definition: Blas.hpp:246
static const NekDouble kNekZeroTol
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:2
std::shared_ptr< DNekMat > DNekMatSharedPtr
Definition: NekTypeDefs.hpp:75
double NekDouble
void CopyArray(const Array< OneD, ConstDataType > &source, Array< OneD, DataType > &dest)