Nektar++
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Static Private Attributes | List of all members
Nektar::LibUtilities::PolyEPoints Class Reference

#include <PolyEPoints.h>

Inheritance diagram for Nektar::LibUtilities::PolyEPoints:
[legend]

Public Types

typedef Points< NekDoublePointsBaseType
 
- Public Types inherited from Nektar::LibUtilities::Points< NekDouble >
typedef NekDouble DataType
 
typedef std::shared_ptr< NekMatrix< DataType > > MatrixSharedPtrType
 

Public Member Functions

virtual ~PolyEPoints ()
 
 PolyEPoints (const PointsKey &key)
 
- Public Member Functions inherited from Nektar::LibUtilities::Points< NekDouble >
virtual ~Points ()
 
void Initialize (void)
 
size_t GetPointsDim () const
 
size_t GetNumPoints () const
 
size_t GetTotNumPoints () const
 
PointsType GetPointsType () const
 
const Array< OneD, const DataType > & GetZ () const
 
const Array< OneD, const DataType > & GetW () const
 
void GetZW (Array< OneD, const DataType > &z, Array< OneD, const DataType > &w) const
 
const Array< OneD, const NekDouble > & GetBaryWeights () const
 
void GetPoints (Array< OneD, const DataType > &x) const
 
void GetPoints (Array< OneD, const DataType > &x, Array< OneD, const DataType > &y) const
 
void GetPoints (Array< OneD, const DataType > &x, Array< OneD, const DataType > &y, Array< OneD, const DataType > &z) const
 
const MatrixSharedPtrTypeGetD (Direction dir=xDir) const
 
const MatrixSharedPtrType GetI (const PointsKey &key)
 
const MatrixSharedPtrType GetI (const Array< OneD, const DataType > &x)
 
const MatrixSharedPtrType GetI (size_t uint, const Array< OneD, const DataType > &x)
 
const MatrixSharedPtrType GetI (const Array< OneD, const DataType > &x, const Array< OneD, const DataType > &y)
 
const MatrixSharedPtrType GetI (const Array< OneD, const DataType > &x, const Array< OneD, const DataType > &y, const Array< OneD, const DataType > &z)
 
const MatrixSharedPtrType GetGalerkinProjection (const PointsKey &pkey)
 

Static Public Member Functions

static std::shared_ptr< PointsBaseTypeCreate (const PointsKey &key)
 

Protected Member Functions

virtual const std::shared_ptr< NekMatrix< NekDouble > > v_GetI (const PointsKey &pkey) override
 
virtual const std::shared_ptr< NekMatrix< NekDouble > > v_GetI (const Array< OneD, const NekDouble > &x) override
 
virtual const std::shared_ptr< NekMatrix< NekDouble > > v_GetI (size_t numpoints, const Array< OneD, const NekDouble > &x) override
 
- Protected Member Functions inherited from Nektar::LibUtilities::Points< NekDouble >
virtual void v_Initialize (void)
 
virtual void v_CalculatePoints ()
 
virtual void v_CalculateWeights ()
 

Private Member Functions

 PolyEPoints ()=delete
 
 PolyEPoints (const PolyEPoints &points)=delete
 
virtual void v_CalculatePoints () override final
 
virtual void v_CalculateWeights () override final
 
virtual void v_CalculateDerivMatrix () override final
 
void CalculateInterpMatrix (size_t npts, const Array< OneD, const NekDouble > &xpoints, Array< OneD, NekDouble > &interp)
 

Static Private Attributes

static bool initPointsManager []
 

Additional Inherited Members

- Protected Attributes inherited from Nektar::LibUtilities::Points< NekDouble >
PointsKey m_pointsKey
 Points type for this points distributions. More...
 
Array< OneD, DataTypem_points [3]
 Storage for the point locations, allowing for up to a 3D points storage. More...
 
Array< OneD, DataTypem_weights
 Quadrature weights for the weights. More...
 
Array< OneD, DataTypem_bcweights
 Barycentric weights. More...
 
MatrixSharedPtrType m_derivmatrix [3]
 Derivative matrices. More...
 
NekManager< PointsKey, NekMatrix< DataType >, PointsKey::opLessm_InterpManager
 
NekManager< PointsKey, NekMatrix< DataType >, PointsKey::opLessm_GalerkinProjectionManager
 

Detailed Description

Definition at line 46 of file PolyEPoints.h.

Member Typedef Documentation

◆ PointsBaseType

Definition at line 49 of file PolyEPoints.h.

Constructor & Destructor Documentation

◆ ~PolyEPoints()

virtual Nektar::LibUtilities::PolyEPoints::~PolyEPoints ( )
inlinevirtual

Definition at line 51 of file PolyEPoints.h.

52 {
53 }

◆ PolyEPoints() [1/3]

Nektar::LibUtilities::PolyEPoints::PolyEPoints ( const PointsKey key)
inline

Definition at line 58 of file PolyEPoints.h.

58 : PointsBaseType(key)
59 {
60 }
Points< NekDouble > PointsBaseType
Definition: PolyEPoints.h:49

◆ PolyEPoints() [2/3]

Nektar::LibUtilities::PolyEPoints::PolyEPoints ( )
privatedelete

◆ PolyEPoints() [3/3]

Nektar::LibUtilities::PolyEPoints::PolyEPoints ( const PolyEPoints points)
privatedelete

Member Function Documentation

◆ CalculateInterpMatrix()

void Nektar::LibUtilities::PolyEPoints::CalculateInterpMatrix ( size_t  npts,
const Array< OneD, const NekDouble > &  xpoints,
Array< OneD, NekDouble > &  interp 
)
private

Definition at line 111 of file PolyEPoints.cpp.

114{
115 for (size_t i = 0; i < npts; ++i)
116 {
117 for (size_t j = 0; j < m_pointsKey.GetNumPoints(); ++j)
118 {
119 interp[i + j * npts] = Polylib::laginterp(
120 xpoints[i], j, &m_points[0][0], m_pointsKey.GetNumPoints());
121 }
122 }
123}
Array< OneD, DataType > m_points[3]
Storage for the point locations, allowing for up to a 3D points storage.
Definition: Points.h:361
PointsKey m_pointsKey
Points type for this points distributions.
Definition: Points.h:358
size_t GetNumPoints() const
Definition: Points.h:90
double laginterp(double z, int j, const double *zj, int np)
Definition: Polylib.cpp:87

References Nektar::LibUtilities::PointsKey::GetNumPoints(), Polylib::laginterp(), Nektar::LibUtilities::Points< NekDouble >::m_points, and Nektar::LibUtilities::Points< NekDouble >::m_pointsKey.

Referenced by v_GetI().

◆ Create()

std::shared_ptr< PolyEPoints::PointsBaseType > Nektar::LibUtilities::PolyEPoints::Create ( const PointsKey key)
static

Definition at line 125 of file PolyEPoints.cpp.

127{
128 std::shared_ptr<PointsBaseType> returnval(
130
131 returnval->Initialize();
132
133 return returnval;
134}
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.

◆ v_CalculateDerivMatrix()

void Nektar::LibUtilities::PolyEPoints::v_CalculateDerivMatrix ( )
finaloverrideprivatevirtual

Definition at line 96 of file PolyEPoints.cpp.

97{
98 // Allocate the derivative matrix.
99 PointsBaseType::v_CalculateDerivMatrix();
100
101 for (size_t i = 0; i < m_pointsKey.GetNumPoints(); ++i)
102 {
103 for (size_t j = 0; j < m_pointsKey.GetNumPoints(); ++j)
104 {
106 m_points[0][i], j, &m_points[0][0], m_pointsKey.GetNumPoints());
107 }
108 }
109}
MatrixSharedPtrType m_derivmatrix[3]
Derivative matrices.
Definition: Points.h:367
double laginterpderiv(double z, int k, const double *zj, int np)
Definition: Polylib.cpp:100

References Nektar::LibUtilities::PointsKey::GetNumPoints(), Polylib::laginterpderiv(), Nektar::LibUtilities::Points< NekDouble >::m_derivmatrix, Nektar::LibUtilities::Points< NekDouble >::m_points, and Nektar::LibUtilities::Points< NekDouble >::m_pointsKey.

◆ v_CalculatePoints()

void Nektar::LibUtilities::PolyEPoints::v_CalculatePoints ( )
finaloverrideprivatevirtual

Reimplemented from Nektar::LibUtilities::Points< NekDouble >.

Definition at line 46 of file PolyEPoints.cpp.

47{
48 // Allocate the storage for points
50
51 size_t npts = m_pointsKey.GetNumPoints();
52 if (npts == 1)
53 {
54 m_points[0][0] = 0.0;
55 }
56 else
57 {
58 NekDouble dx = 2.0 / (NekDouble)(npts - 1);
59 for (size_t i = 0; i < npts; ++i)
60 {
61 m_points[0][i] = -1.0 + i * dx;
62 }
63 }
64}
double NekDouble

References Nektar::LibUtilities::PointsKey::GetNumPoints(), Nektar::LibUtilities::Points< NekDouble >::m_points, Nektar::LibUtilities::Points< NekDouble >::m_pointsKey, and Nektar::LibUtilities::Points< NekDouble >::v_CalculatePoints().

◆ v_CalculateWeights()

void Nektar::LibUtilities::PolyEPoints::v_CalculateWeights ( )
finaloverrideprivatevirtual

Reimplemented from Nektar::LibUtilities::Points< NekDouble >.

Definition at line 66 of file PolyEPoints.cpp.

67{
68 // Allocate the storage for points
70
71 size_t npts = m_pointsKey.GetNumPoints();
72 if (npts == 1)
73 {
74 m_weights[0] = 2.0; // midpoint rule
75 }
76 else
77 {
78 PointsKey gaussKey(npts, eGaussLobattoLegendre);
79 std::shared_ptr<PointsBaseType> ptr = PointsManager()[gaussKey];
80 Array<OneD, const NekDouble> z;
81 Array<OneD, const NekDouble> w;
82
83 ptr->GetZW(z, w);
84 for (size_t i = 0; i < npts; ++i)
85 {
86 m_weights[i] = 0.0;
87 for (unsigned j = 0; j < npts; ++j)
88 {
89 m_weights[i] +=
90 w[j] * Polylib::laginterp(z[j], i, &m_points[0][0], npts);
91 }
92 }
93 }
94}
Array< OneD, DataType > m_weights
Quadrature weights for the weights.
Definition: Points.h:363
PointsManagerT & PointsManager(void)
@ eGaussLobattoLegendre
1D Gauss-Lobatto-Legendre quadrature points
Definition: PointsType.h:53
std::vector< double > w(NPUPPER)
std::vector< double > z(NPUPPER)

References Nektar::LibUtilities::eGaussLobattoLegendre, Nektar::LibUtilities::PointsKey::GetNumPoints(), Polylib::laginterp(), Nektar::LibUtilities::Points< NekDouble >::m_points, Nektar::LibUtilities::Points< NekDouble >::m_pointsKey, Nektar::LibUtilities::Points< NekDouble >::m_weights, Nektar::LibUtilities::PointsManager(), Nektar::LibUtilities::Points< NekDouble >::v_CalculateWeights(), Nektar::UnitTests::w(), and Nektar::UnitTests::z().

◆ v_GetI() [1/3]

const std::shared_ptr< NekMatrix< NekDouble > > Nektar::LibUtilities::PolyEPoints::v_GetI ( const Array< OneD, const NekDouble > &  x)
overrideprotectedvirtual

Delegate to function below.

Definition at line 150 of file PolyEPoints.cpp.

152{
153 size_t numpoints = 1;
154
155 /// Delegate to function below.
156 return GetI(numpoints, x);
157}
const MatrixSharedPtrType GetI(const PointsKey &key)
Definition: Points.h:322

References Nektar::LibUtilities::Points< NekDouble >::GetI().

◆ v_GetI() [2/3]

const std::shared_ptr< NekMatrix< NekDouble > > Nektar::LibUtilities::PolyEPoints::v_GetI ( const PointsKey pkey)
overrideprotectedvirtual

Definition at line 136 of file PolyEPoints.cpp.

138{
139 ASSERTL0(pkey.GetPointsDim() == 1,
140 "Gauss Points can only interp to other 1d point distributions");
141
142 size_t numpoints = pkey.GetNumPoints();
143 Array<OneD, const NekDouble> xpoints;
144
145 PointsManager()[pkey]->GetPoints(xpoints);
146
147 return GetI(numpoints, xpoints);
148}
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:215

References ASSERTL0, Nektar::LibUtilities::Points< NekDouble >::GetI(), Nektar::LibUtilities::PointsKey::GetNumPoints(), Nektar::LibUtilities::PointsKey::GetPointsDim(), and Nektar::LibUtilities::PointsManager().

◆ v_GetI() [3/3]

const std::shared_ptr< NekMatrix< NekDouble > > Nektar::LibUtilities::PolyEPoints::v_GetI ( size_t  numpoints,
const Array< OneD, const NekDouble > &  x 
)
overrideprotectedvirtual

Definition at line 159 of file PolyEPoints.cpp.

161{
162 Array<OneD, NekDouble> interp(GetNumPoints() * numpoints);
163
164 CalculateInterpMatrix(numpoints, x, interp);
165
166 size_t np = GetTotNumPoints();
167 NekDouble *d = interp.data();
168 std::shared_ptr<NekMatrix<NekDouble>> returnval(
169 MemoryManager<NekMatrix<NekDouble>>::AllocateSharedPtr(numpoints, np,
170 d));
171
172 return returnval;
173}
void CalculateInterpMatrix(size_t npts, const Array< OneD, const NekDouble > &xpoints, Array< OneD, NekDouble > &interp)
std::vector< double > d(NPUPPER *NPUPPER)

References CalculateInterpMatrix(), Nektar::UnitTests::d(), Nektar::LibUtilities::Points< NekDouble >::GetNumPoints(), and Nektar::LibUtilities::Points< NekDouble >::GetTotNumPoints().

Member Data Documentation

◆ initPointsManager

bool Nektar::LibUtilities::PolyEPoints::initPointsManager
staticprivate
Initial value:
bool RegisterCreator(const KeyType &key, const CreateFuncType &createFunc)
Register the given function and associate it with the key. The return value is just to facilitate cal...
Definition: NekManager.hpp:169
static std::shared_ptr< PointsBaseType > Create(const PointsKey &key)
@ ePolyEvenlySpaced
1D Evenly-spaced points using Lagrange polynomial
Definition: PointsType.h:75

Definition at line 71 of file PolyEPoints.h.