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 const std::shared_ptr<NekMatrix<NekDouble>> GetI(
61  const PointsKey &pkey);
62  LIB_UTILITIES_EXPORT const std::shared_ptr<NekMatrix<NekDouble>> GetI(
64  LIB_UTILITIES_EXPORT const std::shared_ptr<NekMatrix<NekDouble>> GetI(
65  unsigned int numpoints, const Array<OneD, const NekDouble> &x);
66 
67  LIB_UTILITIES_EXPORT std::shared_ptr<NekMatrix<NekDouble>> CreateGPMatrix(
68  const PointsKey &pkey);
69 
70  LIB_UTILITIES_EXPORT const std::shared_ptr<NekMatrix<NekDouble>>
71  GetGalerkinProjection(const PointsKey &pkey);
72 
73  GaussPoints(const PointsKey &pkey) : PointsBaseType(pkey)
74  {
75  namespace pl = std::placeholders;
76  m_InterpManager.RegisterCreator(
78  std::bind(&GaussPoints::CreateMatrix, this, pl::_1));
79  m_InterpManager.RegisterCreator(
81  std::bind(&GaussPoints::CreateMatrix, this, pl::_1));
82  m_InterpManager.RegisterCreator(
84  std::bind(&GaussPoints::CreateMatrix, this, pl::_1));
85  m_InterpManager.RegisterCreator(
87  std::bind(&GaussPoints::CreateMatrix, this, pl::_1));
88  m_InterpManager.RegisterCreator(
90  std::bind(&GaussPoints::CreateMatrix, this, pl::_1));
91  m_InterpManager.RegisterCreator(
93  std::bind(&GaussPoints::CreateMatrix, this, pl::_1));
94  m_InterpManager.RegisterCreator(
96  std::bind(&GaussPoints::CreateMatrix, this, pl::_1));
97  m_InterpManager.RegisterCreator(
99  std::bind(&GaussPoints::CreateMatrix, this, pl::_1));
100  m_InterpManager.RegisterCreator(
102  std::bind(&GaussPoints::CreateMatrix, this, pl::_1));
103  m_InterpManager.RegisterCreator(
104  PointsKey(0, eGaussRadauMAlpha0Beta2),
105  std::bind(&GaussPoints::CreateMatrix, this, pl::_1));
106  m_InterpManager.RegisterCreator(
107  PointsKey(0, eGaussRadauMAlpha1Beta0),
108  std::bind(&GaussPoints::CreateMatrix, this, pl::_1));
109  m_InterpManager.RegisterCreator(
110  PointsKey(0, eGaussRadauMAlpha2Beta0),
111  std::bind(&GaussPoints::CreateMatrix, this, pl::_1));
112  m_InterpManager.RegisterCreator(
113  PointsKey(0, eGaussKronrodLegendre),
114  std::bind(&GaussPoints::CreateMatrix, this, pl::_1));
115  m_InterpManager.RegisterCreator(
117  std::bind(&GaussPoints::CreateMatrix, this, pl::_1));
118  m_InterpManager.RegisterCreator(
120  std::bind(&GaussPoints::CreateMatrix, this, pl::_1));
121  m_InterpManager.RegisterCreator(
123  std::bind(&GaussPoints::CreateMatrix, this, pl::_1));
124  m_InterpManager.RegisterCreator(
126  std::bind(&GaussPoints::CreateMatrix, this, pl::_1));
127  m_InterpManager.RegisterCreator(
129  std::bind(&GaussPoints::CreateMatrix, this, pl::_1));
130  m_InterpManager.RegisterCreator(
132  std::bind(&GaussPoints::CreateMatrix, this, pl::_1));
133  m_InterpManager.RegisterCreator(
135  std::bind(&GaussPoints::CreateMatrix, this, pl::_1));
136  m_GalerkinProjectionManager.RegisterCreator(
138  std::bind(&GaussPoints::CreateGPMatrix, this, pl::_1));
139  m_GalerkinProjectionManager.RegisterCreator(
141  std::bind(&GaussPoints::CreateGPMatrix, this, pl::_1));
142  m_GalerkinProjectionManager.RegisterCreator(
144  std::bind(&GaussPoints::CreateGPMatrix, this, pl::_1));
145  m_GalerkinProjectionManager.RegisterCreator(
147  std::bind(&GaussPoints::CreateGPMatrix, this, pl::_1));
148  m_GalerkinProjectionManager.RegisterCreator(
150  std::bind(&GaussPoints::CreateGPMatrix, this, pl::_1));
151  m_GalerkinProjectionManager.RegisterCreator(
153  std::bind(&GaussPoints::CreateGPMatrix, this, pl::_1));
154  m_GalerkinProjectionManager.RegisterCreator(
156  std::bind(&GaussPoints::CreateGPMatrix, this, pl::_1));
157  m_GalerkinProjectionManager.RegisterCreator(
159  std::bind(&GaussPoints::CreateGPMatrix, this, pl::_1));
160  m_GalerkinProjectionManager.RegisterCreator(
162  std::bind(&GaussPoints::CreateGPMatrix, this, pl::_1));
163  m_GalerkinProjectionManager.RegisterCreator(
164  PointsKey(0, eGaussRadauMAlpha0Beta2),
165  std::bind(&GaussPoints::CreateGPMatrix, this, pl::_1));
166  m_GalerkinProjectionManager.RegisterCreator(
167  PointsKey(0, eGaussRadauMAlpha1Beta0),
168  std::bind(&GaussPoints::CreateGPMatrix, this, pl::_1));
169  m_GalerkinProjectionManager.RegisterCreator(
170  PointsKey(0, eGaussRadauMAlpha2Beta0),
171  std::bind(&GaussPoints::CreateGPMatrix, this, pl::_1));
172  m_GalerkinProjectionManager.RegisterCreator(
173  PointsKey(0, eGaussKronrodLegendre),
174  std::bind(&GaussPoints::CreateGPMatrix, this, pl::_1));
175  m_GalerkinProjectionManager.RegisterCreator(
177  std::bind(&GaussPoints::CreateGPMatrix, this, pl::_1));
178  m_GalerkinProjectionManager.RegisterCreator(
180  std::bind(&GaussPoints::CreateGPMatrix, this, pl::_1));
181  m_GalerkinProjectionManager.RegisterCreator(
183  std::bind(&GaussPoints::CreateGPMatrix, this, pl::_1));
184  m_GalerkinProjectionManager.RegisterCreator(
186  std::bind(&GaussPoints::CreateGPMatrix, this, pl::_1));
187  m_GalerkinProjectionManager.RegisterCreator(
189  std::bind(&GaussPoints::CreateGPMatrix, this, pl::_1));
190  m_GalerkinProjectionManager.RegisterCreator(
192  std::bind(&GaussPoints::CreateGPMatrix, this, pl::_1));
193  m_GalerkinProjectionManager.RegisterCreator(
195  std::bind(&GaussPoints::CreateGPMatrix, this, pl::_1));
196  }
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  void CalculatePoints();
208  void CalculateWeights();
209  void CalculateDerivMatrix();
210  void CalculateInterpMatrix(unsigned int npts,
211  const Array<OneD, const NekDouble> &xpoints,
212  Array<OneD, NekDouble> &interp);
213 
214  std::shared_ptr<NekMatrix<NekDouble>> CalculateGalerkinProjectionMatrix(
215  const PointsKey &pkey);
216 
217  /// functions used by the Kronrod points
219  const Array<OneD, const NekDouble> &xpts,
220  const Array<OneD, const NekDouble> &funcvals);
221  NekDouble LagrangePoly(NekDouble x, int pt, int npts,
222  const Array<OneD, const NekDouble> &xpts);
223  NekDouble LagrangePolyDeriv(NekDouble x, int pt, int npts,
224  const Array<OneD, const NekDouble> &xpts);
225 
226 }; // class GaussPoints
227 } // namespace LibUtilities
228 } // namespace Nektar
229 
230 #endif // GAUSSPOINTS_H
#define LIB_UTILITIES_EXPORT
static std::shared_ptr< Points< NekDouble > > Create(const PointsKey &pkey)
const std::shared_ptr< NekMatrix< NekDouble > > GetI(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)
NekDouble LagrangeInterpolant(NekDouble x, int npts, const Array< OneD, const NekDouble > &xpts, const Array< OneD, const NekDouble > &funcvals)
functions used by the Kronrod points
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:73
const std::shared_ptr< NekMatrix< NekDouble > > GetGalerkinProjection(const PointsKey &pkey)
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,...
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:411
NekManager< PointsKey, NekMatrix< DataType >, PointsKey::opLess > m_GalerkinProjectionManager
Definition: Points.h:413
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:1
double NekDouble