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(const PointsKey &pkey);
55 
56  LIB_UTILITIES_EXPORT std::shared_ptr< NekMatrix<NekDouble> > CreateMatrix(const PointsKey &pkey);
57 
58  LIB_UTILITIES_EXPORT const std::shared_ptr<NekMatrix<NekDouble> > GetI(const PointsKey &pkey);
59  LIB_UTILITIES_EXPORT const std::shared_ptr<NekMatrix<NekDouble> > GetI(const Array<OneD, const NekDouble>& x);
60  LIB_UTILITIES_EXPORT const std::shared_ptr<NekMatrix<NekDouble> > GetI(unsigned int numpoints, const Array<OneD, const NekDouble>& x);
61 
62  LIB_UTILITIES_EXPORT std::shared_ptr< NekMatrix<NekDouble> > CreateGPMatrix(const PointsKey &pkey);
63 
64  LIB_UTILITIES_EXPORT const std::shared_ptr<NekMatrix<NekDouble> > GetGalerkinProjection(const PointsKey &pkey);
65 
66 
67 
69  {
70  namespace pl = std::placeholders;
71  m_InterpManager.RegisterCreator(PointsKey(0, eGaussGaussLegendre),
72  std::bind(&GaussPoints::CreateMatrix, this, pl::_1));
74  std::bind(&GaussPoints::CreateMatrix, this, pl::_1));
76  std::bind(&GaussPoints::CreateMatrix, this, pl::_1));
78  std::bind(&GaussPoints::CreateMatrix, this, pl::_1));
80  std::bind(&GaussPoints::CreateMatrix, this, pl::_1));
82  std::bind(&GaussPoints::CreateMatrix, this, pl::_1));
84  std::bind(&GaussPoints::CreateMatrix, this, pl::_1));
86  std::bind(&GaussPoints::CreateMatrix, this, pl::_1));
88  std::bind(&GaussPoints::CreateMatrix, this, pl::_1));
90  std::bind(&GaussPoints::CreateMatrix, this, pl::_1));
92  std::bind(&GaussPoints::CreateMatrix, this, pl::_1));
94  std::bind(&GaussPoints::CreateMatrix, this, pl::_1));
96  std::bind(&GaussPoints::CreateMatrix, this, pl::_1));
98  std::bind(&GaussPoints::CreateMatrix, this, pl::_1));
100  std::bind(&GaussPoints::CreateMatrix, this, pl::_1));
102  std::bind(&GaussPoints::CreateMatrix, this, pl::_1));
103  m_InterpManager.RegisterCreator(PointsKey(0, eFourierEvenlySpaced),
104  std::bind(&GaussPoints::CreateMatrix, this, pl::_1));
105  m_InterpManager.RegisterCreator(PointsKey(0, ePolyEvenlySpaced),
106  std::bind(&GaussPoints::CreateMatrix, this, pl::_1));
107  m_InterpManager.RegisterCreator(PointsKey(0, eBoundaryLayerPoints),
108  std::bind(&GaussPoints::CreateMatrix, this, pl::_1));
110  std::bind(&GaussPoints::CreateMatrix, this, pl::_1));
112  std::bind(&GaussPoints::CreateGPMatrix, this, pl::_1));
114  std::bind(&GaussPoints::CreateGPMatrix, this, pl::_1));
116  std::bind(&GaussPoints::CreateGPMatrix, this, pl::_1));
118  std::bind(&GaussPoints::CreateGPMatrix, this, pl::_1));
120  std::bind(&GaussPoints::CreateGPMatrix, this, pl::_1));
122  std::bind(&GaussPoints::CreateGPMatrix, this, pl::_1));
124  std::bind(&GaussPoints::CreateGPMatrix, this, pl::_1));
126  std::bind(&GaussPoints::CreateGPMatrix, this, pl::_1));
128  std::bind(&GaussPoints::CreateGPMatrix, this, pl::_1));
130  std::bind(&GaussPoints::CreateGPMatrix, this, pl::_1));
132  std::bind(&GaussPoints::CreateGPMatrix, this, pl::_1));
134  std::bind(&GaussPoints::CreateGPMatrix, this, pl::_1));
136  std::bind(&GaussPoints::CreateGPMatrix, this, pl::_1));
138  std::bind(&GaussPoints::CreateGPMatrix, this, pl::_1));
140  std::bind(&GaussPoints::CreateGPMatrix, this, pl::_1));
142  std::bind(&GaussPoints::CreateGPMatrix, this, pl::_1));
144  std::bind(&GaussPoints::CreateGPMatrix, this, pl::_1));
146  std::bind(&GaussPoints::CreateGPMatrix, this, pl::_1));
148  std::bind(&GaussPoints::CreateGPMatrix, this, pl::_1));
150  std::bind(&GaussPoints::CreateGPMatrix, this, pl::_1));
151  }
152 
153 
154  private:
155  static bool initPointsManager[];
156 
157  /// These should not be called. All creation is done
158  /// using the constructor requiring the key, declared
159  /// above.
160  GaussPoints();
161  GaussPoints(const GaussPoints &points);
162 
163  void CalculatePoints();
164  void CalculateWeights();
165  void CalculateDerivMatrix();
166  void CalculateInterpMatrix(unsigned int npts, const Array<OneD, const NekDouble>& xpoints, Array<OneD, NekDouble>& interp);
167 
168 
169  std::shared_ptr<NekMatrix<NekDouble> > CalculateGalerkinProjectionMatrix(const PointsKey &pkey);
170 
171 
172  /// functions used by the Kronrod points
174  NekDouble LagrangePoly(NekDouble x, int pt, int npts, const Array<OneD, const NekDouble>& xpts);
175  NekDouble LagrangePolyDeriv(NekDouble x, int pt, int npts, const Array<OneD, const NekDouble>& xpts);
176 
177  }; // class GaussPoints
178  } // end of namespace
179 } // end of namespace
180 
181 #endif //GAUSSPOINTS_H
1D Gauss-Radau-Kronrod-Legendre quadrature points, pinned at x=-1
Definition: PointsType.h:61
NekDouble LagrangePolyDeriv(NekDouble x, int pt, int npts, const Array< OneD, const NekDouble > &xpts)
1D Gauss-Radau-Chebyshev quadrature points, pinned at x=-1
Definition: PointsType.h:53
NekDouble LagrangePoly(NekDouble x, int pt, int npts, const Array< OneD, const NekDouble > &xpts)
const std::shared_ptr< NekMatrix< NekDouble > > GetI(const PointsKey &pkey)
1D Gauss-Radau-Legendre quadrature points, pinned at x=1
Definition: PointsType.h:50
GaussPoints()
These should not be called. All creation is done using the constructor requiring the key...
1D Gauss-Kronrod-Legendre quadrature points
Definition: PointsType.h:60
Stores a set of points of datatype DataT, defined by a PointKey.
1D Gauss-Gauss-Legendre quadrature points
Definition: PointsType.h:48
Gauss Radau pinned at x=-1, .
Definition: PointsType.h:58
1D Gauss-Radau-Kronrod-Legendre pinned at x=-1,
Definition: PointsType.h:62
1D Evenly-spaced points using Lagrange polynomial
Definition: PointsType.h:64
const std::shared_ptr< NekMatrix< NekDouble > > GetGalerkinProjection(const PointsKey &pkey)
1D Lobatto Kronrod quadrature points
Definition: PointsType.h:63
1D Evenly-spaced points using Fourier Fit
Definition: PointsType.h:65
#define LIB_UTILITIES_EXPORT
NekManager< PointsKey, NekMatrix< DataType >, PointsKey::opLess > m_InterpManager
Definition: Points.h:384
std::shared_ptr< NekMatrix< NekDouble > > CreateMatrix(const PointsKey &pkey)
1D Gauss-Radau-Chebyshev quadrature points, pinned at x=1
Definition: PointsType.h:54
1D Gauss-Gauss-Chebyshev quadrature points
Definition: PointsType.h:52
Defines a specification for a set of points.
Definition: Points.h:59
double NekDouble
NekManager< PointsKey, NekMatrix< DataType >, PointsKey::opLess > m_GalerkinProjectionManager
Definition: Points.h:385
void CalculateInterpMatrix(unsigned int npts, const Array< OneD, const NekDouble > &xpoints, Array< OneD, NekDouble > &interp)
1D power law distribution for boundary layer points
Definition: PointsType.h:68
GaussPoints(const PointsKey &pkey)
Definition: GaussPoints.h:68
std::shared_ptr< NekMatrix< NekDouble > > CalculateGalerkinProjectionMatrix(const PointsKey &pkey)
std::shared_ptr< NekMatrix< NekDouble > > CreateGPMatrix(const PointsKey &pkey)
Gauss Radau pinned at x=-1, .
Definition: PointsType.h:59
NekDouble LagrangeInterpolant(NekDouble x, int npts, const Array< OneD, const NekDouble > &xpts, const Array< OneD, const NekDouble > &funcvals)
functions used by the Kronrod points
1D power law distribution for boundary layer points
Definition: PointsType.h:67
static std::shared_ptr< Points< NekDouble > > Create(const PointsKey &pkey)
Gauss Radau pinned at x=-1, .
Definition: PointsType.h:57
Gauss Radau pinned at x=-1, .
Definition: PointsType.h:56
1D Gauss-Lobatto-Legendre quadrature points
Definition: PointsType.h:51
1D Gauss-Radau-Legendre quadrature points, pinned at x=-1
Definition: PointsType.h:49
1D Gauss-Lobatto-Legendre quadrature points
Definition: PointsType.h:55