Nektar++
GaussPoints.h
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File: GaussPoints.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 of GaussPoints Distributions
32 //
33 ///////////////////////////////////////////////////////////////////////////////
34 
35 #ifndef GAUSSPOINTS_H
36 #define GAUSSPOINTS_H
37 
42 
43 namespace Nektar
44 {
45 namespace LibUtilities
46 {
47 class GaussPoints : public Points<NekDouble>
48 {
49 public:
50  virtual ~GaussPoints()
51  {
52  }
53 
54  LIB_UTILITIES_EXPORT static std::shared_ptr<Points<NekDouble>> Create(
55  const PointsKey &pkey);
56 
57  LIB_UTILITIES_EXPORT std::shared_ptr<NekMatrix<NekDouble>> CreateMatrix(
58  const PointsKey &pkey);
59 
60  LIB_UTILITIES_EXPORT std::shared_ptr<NekMatrix<NekDouble>> CreateGPMatrix(
61  const PointsKey &pkey);
62 
63  GaussPoints(const PointsKey &pkey) : PointsBaseType(pkey)
64  {
65  namespace pl = std::placeholders;
66  m_InterpManager.RegisterCreator(
68  std::bind(&GaussPoints::CreateMatrix, this, pl::_1));
69  m_InterpManager.RegisterCreator(
71  std::bind(&GaussPoints::CreateMatrix, this, pl::_1));
72  m_InterpManager.RegisterCreator(
74  std::bind(&GaussPoints::CreateMatrix, this, pl::_1));
75  m_InterpManager.RegisterCreator(
77  std::bind(&GaussPoints::CreateMatrix, this, pl::_1));
78  m_InterpManager.RegisterCreator(
80  std::bind(&GaussPoints::CreateMatrix, this, pl::_1));
81  m_InterpManager.RegisterCreator(
83  std::bind(&GaussPoints::CreateMatrix, this, pl::_1));
84  m_InterpManager.RegisterCreator(
86  std::bind(&GaussPoints::CreateMatrix, this, pl::_1));
87  m_InterpManager.RegisterCreator(
89  std::bind(&GaussPoints::CreateMatrix, this, pl::_1));
90  m_InterpManager.RegisterCreator(
92  std::bind(&GaussPoints::CreateMatrix, this, pl::_1));
93  m_InterpManager.RegisterCreator(
94  PointsKey(0, eGaussRadauMAlpha0Beta2),
95  std::bind(&GaussPoints::CreateMatrix, this, pl::_1));
96  m_InterpManager.RegisterCreator(
97  PointsKey(0, eGaussRadauMAlpha1Beta0),
98  std::bind(&GaussPoints::CreateMatrix, this, pl::_1));
99  m_InterpManager.RegisterCreator(
100  PointsKey(0, eGaussRadauMAlpha2Beta0),
101  std::bind(&GaussPoints::CreateMatrix, this, pl::_1));
102  m_InterpManager.RegisterCreator(
103  PointsKey(0, eGaussKronrodLegendre),
104  std::bind(&GaussPoints::CreateMatrix, this, pl::_1));
105  m_InterpManager.RegisterCreator(
107  std::bind(&GaussPoints::CreateMatrix, this, pl::_1));
108  m_InterpManager.RegisterCreator(
110  std::bind(&GaussPoints::CreateMatrix, this, pl::_1));
111  m_InterpManager.RegisterCreator(
113  std::bind(&GaussPoints::CreateMatrix, this, pl::_1));
114  m_InterpManager.RegisterCreator(
116  std::bind(&GaussPoints::CreateMatrix, this, pl::_1));
117  m_InterpManager.RegisterCreator(
119  std::bind(&GaussPoints::CreateMatrix, this, pl::_1));
120  m_InterpManager.RegisterCreator(
122  std::bind(&GaussPoints::CreateMatrix, this, pl::_1));
123  m_InterpManager.RegisterCreator(
125  std::bind(&GaussPoints::CreateMatrix, this, pl::_1));
126  m_GalerkinProjectionManager.RegisterCreator(
128  std::bind(&GaussPoints::CreateGPMatrix, this, pl::_1));
129  m_GalerkinProjectionManager.RegisterCreator(
131  std::bind(&GaussPoints::CreateGPMatrix, this, pl::_1));
132  m_GalerkinProjectionManager.RegisterCreator(
134  std::bind(&GaussPoints::CreateGPMatrix, this, pl::_1));
135  m_GalerkinProjectionManager.RegisterCreator(
137  std::bind(&GaussPoints::CreateGPMatrix, this, pl::_1));
138  m_GalerkinProjectionManager.RegisterCreator(
140  std::bind(&GaussPoints::CreateGPMatrix, this, pl::_1));
141  m_GalerkinProjectionManager.RegisterCreator(
143  std::bind(&GaussPoints::CreateGPMatrix, this, pl::_1));
144  m_GalerkinProjectionManager.RegisterCreator(
146  std::bind(&GaussPoints::CreateGPMatrix, this, pl::_1));
147  m_GalerkinProjectionManager.RegisterCreator(
149  std::bind(&GaussPoints::CreateGPMatrix, this, pl::_1));
150  m_GalerkinProjectionManager.RegisterCreator(
152  std::bind(&GaussPoints::CreateGPMatrix, this, pl::_1));
153  m_GalerkinProjectionManager.RegisterCreator(
154  PointsKey(0, eGaussRadauMAlpha0Beta2),
155  std::bind(&GaussPoints::CreateGPMatrix, this, pl::_1));
156  m_GalerkinProjectionManager.RegisterCreator(
157  PointsKey(0, eGaussRadauMAlpha1Beta0),
158  std::bind(&GaussPoints::CreateGPMatrix, this, pl::_1));
159  m_GalerkinProjectionManager.RegisterCreator(
160  PointsKey(0, eGaussRadauMAlpha2Beta0),
161  std::bind(&GaussPoints::CreateGPMatrix, this, pl::_1));
162  m_GalerkinProjectionManager.RegisterCreator(
163  PointsKey(0, eGaussKronrodLegendre),
164  std::bind(&GaussPoints::CreateGPMatrix, this, pl::_1));
165  m_GalerkinProjectionManager.RegisterCreator(
167  std::bind(&GaussPoints::CreateGPMatrix, this, pl::_1));
168  m_GalerkinProjectionManager.RegisterCreator(
170  std::bind(&GaussPoints::CreateGPMatrix, this, pl::_1));
171  m_GalerkinProjectionManager.RegisterCreator(
173  std::bind(&GaussPoints::CreateGPMatrix, this, pl::_1));
174  m_GalerkinProjectionManager.RegisterCreator(
176  std::bind(&GaussPoints::CreateGPMatrix, this, pl::_1));
177  m_GalerkinProjectionManager.RegisterCreator(
179  std::bind(&GaussPoints::CreateGPMatrix, this, pl::_1));
180  m_GalerkinProjectionManager.RegisterCreator(
182  std::bind(&GaussPoints::CreateGPMatrix, this, pl::_1));
183  m_GalerkinProjectionManager.RegisterCreator(
185  std::bind(&GaussPoints::CreateGPMatrix, this, pl::_1));
186  }
187 
188 protected:
189  LIB_UTILITIES_EXPORT virtual const std::shared_ptr<NekMatrix<NekDouble>> v_GetI(
190  const PointsKey &pkey) override;
191  LIB_UTILITIES_EXPORT virtual const std::shared_ptr<NekMatrix<NekDouble>> v_GetI(
192  const Array<OneD, const NekDouble> &x) override;
193  LIB_UTILITIES_EXPORT virtual const std::shared_ptr<NekMatrix<NekDouble>> v_GetI(
194  unsigned int numpoints, const Array<OneD, const NekDouble> &x) override;
195  LIB_UTILITIES_EXPORT virtual const std::shared_ptr<NekMatrix<NekDouble>>
196  v_GetGalerkinProjection(const PointsKey &pkey) override;
197 
198 private:
199  static bool initPointsManager[];
200 
201  /// These should not be called. All creation is done
202  /// using the constructor requiring the key, declared
203  /// above.
205  GaussPoints(const GaussPoints &points);
206 
207  virtual void v_CalculatePoints() override;
208  virtual void v_CalculateWeights() override;
209  virtual void v_CalculateDerivMatrix() override;
210 
211  void CalculateInterpMatrix(unsigned int npts,
212  const Array<OneD, const NekDouble> &xpoints,
213  Array<OneD, NekDouble> &interp);
214 
215  std::shared_ptr<NekMatrix<NekDouble>> CalculateGalerkinProjectionMatrix(
216  const PointsKey &pkey);
217 
218  /// functions used by the Kronrod points
220  const Array<OneD, const NekDouble> &xpts,
221  const Array<OneD, const NekDouble> &funcvals);
222  NekDouble LagrangePoly(NekDouble x, int pt, int npts,
223  const Array<OneD, const NekDouble> &xpts);
224  NekDouble LagrangePolyDeriv(NekDouble x, int pt, int npts,
225  const Array<OneD, const NekDouble> &xpts);
226 
227 }; // class GaussPoints
228 } // namespace LibUtilities
229 } // namespace Nektar
230 
231 #endif // GAUSSPOINTS_H
#define LIB_UTILITIES_EXPORT
static std::shared_ptr< Points< NekDouble > > Create(const PointsKey &pkey)
std::shared_ptr< NekMatrix< NekDouble > > CreateGPMatrix(const PointsKey &pkey)
NekDouble LagrangePolyDeriv(NekDouble x, int pt, int npts, const Array< OneD, const NekDouble > &xpts)
virtual const std::shared_ptr< NekMatrix< NekDouble > > v_GetGalerkinProjection(const PointsKey &pkey) override
NekDouble LagrangeInterpolant(NekDouble x, int npts, const Array< OneD, const NekDouble > &xpts, const Array< OneD, const NekDouble > &funcvals)
functions used by the Kronrod points
virtual void v_CalculateWeights() override
virtual void v_CalculatePoints() override
Definition: GaussPoints.cpp:83
void CalculateInterpMatrix(unsigned int npts, const Array< OneD, const NekDouble > &xpoints, Array< OneD, NekDouble > &interp)
std::shared_ptr< NekMatrix< NekDouble > > CreateMatrix(const PointsKey &pkey)
GaussPoints(const PointsKey &pkey)
Definition: GaussPoints.h:63
virtual const std::shared_ptr< NekMatrix< NekDouble > > v_GetI(const PointsKey &pkey) override
GaussPoints(const GaussPoints &points)
NekDouble LagrangePoly(NekDouble x, int pt, int npts, const Array< OneD, const NekDouble > &xpts)
std::shared_ptr< NekMatrix< NekDouble > > CalculateGalerkinProjectionMatrix(const PointsKey &pkey)
GaussPoints()
These should not be called. All creation is done using the constructor requiring the key,...
virtual void v_CalculateDerivMatrix() override
Stores a set of points of datatype DataT, defined by a PointKey.
Definition: Points.h:254
NekManager< PointsKey, NekMatrix< DataType >, PointsKey::opLess > m_InterpManager
Definition: Points.h:383
NekManager< PointsKey, NekMatrix< DataType >, PointsKey::opLess > m_GalerkinProjectionManager
Definition: Points.h:385
Defines a specification for a set of points.
Definition: Points.h:59
@ eGaussRadauMLegendre
1D Gauss-Radau-Legendre quadrature points, pinned at x=-1
Definition: PointsType.h:49
@ eBoundaryLayerPoints
1D power law distribution for boundary layer points
Definition: PointsType.h:79
@ eGaussRadauMAlpha0Beta1
Gauss Radau pinned at x=-1,.
Definition: PointsType.h:60
@ eGaussRadauKronrodMLegendre
1D Gauss-Radau-Kronrod-Legendre quadrature points, pinned at x=-1
Definition: PointsType.h:69
@ eGaussLobattoChebyshev
1D Gauss-Lobatto-Legendre quadrature points
Definition: PointsType.h:59
@ eFourierEvenlySpaced
1D Evenly-spaced points using Fourier Fit
Definition: PointsType.h:76
@ eGaussRadauPChebyshev
1D Gauss-Radau-Chebyshev quadrature points, pinned at x=1
Definition: PointsType.h:57
@ eGaussRadauMChebyshev
1D Gauss-Radau-Chebyshev quadrature points, pinned at x=-1
Definition: PointsType.h:55
@ eGaussRadauKronrodMAlpha1Beta0
1D Gauss-Radau-Kronrod-Legendre pinned at x=-1,
Definition: PointsType.h:71
@ eGaussLobattoLegendre
1D Gauss-Lobatto-Legendre quadrature points
Definition: PointsType.h:53
@ eGaussGaussChebyshev
1D Gauss-Gauss-Chebyshev quadrature points
Definition: PointsType.h:54
@ eBoundaryLayerPointsRev
1D power law distribution for boundary layer points
Definition: PointsType.h:81
@ ePolyEvenlySpaced
1D Evenly-spaced points using Lagrange polynomial
Definition: PointsType.h:75
@ eGaussLobattoKronrodLegendre
1D Lobatto Kronrod quadrature points
Definition: PointsType.h:74
@ eGaussGaussLegendre
1D Gauss-Gauss-Legendre quadrature points
Definition: PointsType.h:48
@ eGaussRadauPLegendre
1D Gauss-Radau-Legendre quadrature points, pinned at x=1
Definition: PointsType.h:51
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:2
double NekDouble