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

#include <NodalTriEvenlySpaced.h>

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

Public Member Functions

 ~NodalTriEvenlySpaced () override
 
 NodalTriEvenlySpaced (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

const MatrixSharedPtrType v_GetI (const PointsKey &pkey) override
 
const MatrixSharedPtrType v_GetI (const Array< OneD, const NekDouble > &x, const Array< OneD, const NekDouble > &y) 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

 NodalTriEvenlySpaced ()=delete
 
 NodalTriEvenlySpaced (const NodalTriEvenlySpaced &points)=delete
 
void NodalPointReorder2d ()
 
void v_CalculatePoints () final
 
void v_CalculateWeights () final
 
void v_CalculateDerivMatrix () final
 
void CalculateInterpMatrix (const Array< OneD, const NekDouble > &xi, const Array< OneD, const NekDouble > &yi, Array< OneD, NekDouble > &interp)
 

Private Attributes

std::shared_ptr< NodalUtilTrianglem_util
 

Static Private Attributes

static bool initPointsManager []
 

Additional Inherited Members

- Public Types inherited from Nektar::LibUtilities::Points< NekDouble >
typedef NekDouble DataType
 
typedef std::shared_ptr< NekMatrix< DataType > > MatrixSharedPtrType
 
- 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 44 of file NodalTriEvenlySpaced.h.

Constructor & Destructor Documentation

◆ ~NodalTriEvenlySpaced()

Nektar::LibUtilities::NodalTriEvenlySpaced::~NodalTriEvenlySpaced ( )
inlineoverride

Definition at line 47 of file NodalTriEvenlySpaced.h.

48 {
49 }

◆ NodalTriEvenlySpaced() [1/3]

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

Definition at line 51 of file NodalTriEvenlySpaced.h.

51 : PointsBaseType(key)
52 {
53 }
Points< NekDouble > PointsBaseType

◆ NodalTriEvenlySpaced() [2/3]

Nektar::LibUtilities::NodalTriEvenlySpaced::NodalTriEvenlySpaced ( )
privatedelete

◆ NodalTriEvenlySpaced() [3/3]

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

Member Function Documentation

◆ CalculateInterpMatrix()

void Nektar::LibUtilities::NodalTriEvenlySpaced::CalculateInterpMatrix ( const Array< OneD, const NekDouble > &  xi,
const Array< OneD, const NekDouble > &  yi,
Array< OneD, NekDouble > &  interp 
)
private

Definition at line 110 of file NodalTriEvenlySpaced.cpp.

113{
114 Array<OneD, Array<OneD, NekDouble>> xi(2);
115 xi[0] = xia;
116 xi[1] = yia;
117
118 std::shared_ptr<NekMatrix<NekDouble>> mat =
119 m_util->GetInterpolationMatrix(xi);
120 Vmath::Vcopy(mat->GetRows() * mat->GetColumns(), mat->GetRawPtr(), 1,
121 &interp[0], 1);
122}
std::shared_ptr< NodalUtilTriangle > m_util
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.hpp:825

References m_util, and Vmath::Vcopy().

Referenced by v_GetI().

◆ Create()

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

Definition at line 136 of file NodalTriEvenlySpaced.cpp.

138{
139 std::shared_ptr<PointsBaseType> returnval(
141
142 returnval->Initialize();
143
144 return returnval;
145}
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.

◆ NodalPointReorder2d()

void Nektar::LibUtilities::NodalTriEvenlySpaced::NodalPointReorder2d ( )
private

Definition at line 147 of file NodalTriEvenlySpaced.cpp.

148{
149 size_t npts = GetNumPoints();
150 using std::vector;
151 vector<int> vertex;
152 vector<int> iEdge_1; // interior edge points on the bottom triangle edge
153 vector<int> iEdge_2; // interior edge points on the right triangle edge
154 vector<int> iEdge_3; // interior edge points on the left triangle edge
155 vector<int> interiorPoints;
156 vector<int> map;
157
158 // Build the lattice triangle left to right - bottom to top
159 for (size_t i = 0, index = 0; i < npts; ++i)
160 { // y-direction
161 for (size_t j = 0; j < npts - i; ++j, ++index)
162 { // x-direction
163
164 if (isVertex(i, j, npts))
165 {
166
167 vertex.push_back(index);
168 }
169 else if (isEdge(i, j, npts))
170 { // interior edge
171
172 if (isEdge_1(i, j, npts))
173 { // bottom edge
174
175 iEdge_1.push_back(index);
176 }
177 else if (isEdge_2(i, j, npts))
178 { // right edge
179
180 iEdge_2.push_back(index);
181 }
182 else // left edge
183 {
184 // Add backwards. This is because of counter clockwise.
185 iEdge_3.insert(iEdge_3.begin(), index);
186 }
187 }
188 else
189 { // Interior points
190
191 interiorPoints.push_back(index);
192 }
193 }
194 }
195
196 // Mapping the vertex, edges, and interior points using the permutation
197 // matrix, so the points are ordered anticlockwise.
198 for (size_t k = 0; k < vertex.size(); ++k)
199 {
200
201 map.push_back(vertex[k]);
202 }
203
204 for (size_t k = 0; k < iEdge_1.size(); ++k)
205 {
206
207 map.push_back(iEdge_1[k]);
208 }
209
210 for (size_t k = 0; k < iEdge_2.size(); ++k)
211 {
212
213 map.push_back(iEdge_2[k]);
214 }
215
216 for (size_t k = 0; k < iEdge_3.size(); ++k)
217 {
218
219 map.push_back(iEdge_3[k]);
220 }
221
222 for (size_t k = 0; k < interiorPoints.size(); ++k)
223 {
224
225 map.push_back(interiorPoints[k]);
226 }
227
228 Array<OneD, NekDouble> points[2];
229 points[0] = Array<OneD, NekDouble>(GetTotNumPoints());
230 points[1] = Array<OneD, NekDouble>(GetTotNumPoints());
231 for (size_t index = 0; index < map.size(); ++index)
232 {
233 points[0][index] = m_points[0][index];
234 points[1][index] = m_points[1][index];
235 }
236
237 for (size_t index = 0; index < map.size(); ++index)
238 {
239 m_points[0][index] = points[0][map[index]];
240 m_points[1][index] = points[1][map[index]];
241 }
242}
Array< OneD, DataType > m_points[3]
Storage for the point locations, allowing for up to a 3D points storage.
Definition: Points.h:356

References Nektar::LibUtilities::Points< NekDouble >::GetNumPoints(), Nektar::LibUtilities::Points< NekDouble >::GetTotNumPoints(), and Nektar::LibUtilities::Points< NekDouble >::m_points.

Referenced by v_CalculatePoints().

◆ v_CalculateDerivMatrix()

void Nektar::LibUtilities::NodalTriEvenlySpaced::v_CalculateDerivMatrix ( )
finalprivate

Definition at line 126 of file NodalTriEvenlySpaced.cpp.

127{
128
129 // Allocate the derivative matrix.
130 PointsBaseType::v_CalculateDerivMatrix();
131
132 m_derivmatrix[0] = m_util->GetDerivMatrix(0);
133 m_derivmatrix[1] = m_util->GetDerivMatrix(1);
134}
MatrixSharedPtrType m_derivmatrix[3]
Derivative matrices.
Definition: Points.h:362

References Nektar::LibUtilities::Points< NekDouble >::m_derivmatrix, and m_util.

◆ v_CalculatePoints()

void Nektar::LibUtilities::NodalTriEvenlySpaced::v_CalculatePoints ( )
finalprivatevirtual

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

Definition at line 70 of file NodalTriEvenlySpaced.cpp.

71{
72 // Allocate the storage for points
74
75 // Populate m_points
76 size_t npts = GetNumPoints();
77 NekDouble delta = 2.0 / (npts - 1.0);
78 for (size_t i = 0, index = 0; i < npts; ++i)
79 { // y-direction
80 for (size_t j = 0; j < npts - i; ++j, ++index)
81 { // x-direction
82 NekDouble x = -1.0 + j * delta;
83 NekDouble y = -1.0 + i * delta;
84 m_points[0][index] = x;
85 m_points[1][index] = y;
86 }
87 }
88
90
92 npts - 1, m_points[0], m_points[1]);
93}
double NekDouble

References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), Nektar::LibUtilities::Points< NekDouble >::GetNumPoints(), Nektar::LibUtilities::Points< NekDouble >::m_points, m_util, NodalPointReorder2d(), and Nektar::LibUtilities::Points< NekDouble >::v_CalculatePoints().

◆ v_CalculateWeights()

void Nektar::LibUtilities::NodalTriEvenlySpaced::v_CalculateWeights ( )
finalprivatevirtual

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

Definition at line 95 of file NodalTriEvenlySpaced.cpp.

96{
97 // Allocate the storage for points
99
100 typedef DataType T;
101
102 // Solve the Vandermonde system of integrals for the weight vector
103 NekVector<T> w = m_util->GetWeights();
104
105 m_weights = Array<OneD, T>(w.GetRows(), w.GetPtr());
106}
Array< OneD, DataType > m_weights
Quadrature weights for the weights.
Definition: Points.h:358
std::vector< double > w(NPUPPER)

References m_util, Nektar::LibUtilities::Points< NekDouble >::m_weights, Nektar::LibUtilities::Points< NekDouble >::v_CalculateWeights(), and Nektar::UnitTests::w().

◆ v_GetI() [1/2]

const MatrixSharedPtrType Nektar::LibUtilities::NodalTriEvenlySpaced::v_GetI ( const Array< OneD, const NekDouble > &  x,
const Array< OneD, const NekDouble > &  y 
)
inlineoverrideprotected

Definition at line 69 of file NodalTriEvenlySpaced.h.

72 {
73 size_t numpoints = x.size();
74 size_t np = GetTotNumPoints();
75
76 Array<OneD, NekDouble> interp(GetTotNumPoints() * numpoints);
77 CalculateInterpMatrix(x, y, interp);
78
79 NekDouble *d = interp.data();
80 return MemoryManager<NekMatrix<NekDouble>>::AllocateSharedPtr(numpoints,
81 np, d);
82 }
void CalculateInterpMatrix(const Array< OneD, const NekDouble > &xi, const Array< OneD, const NekDouble > &yi, Array< OneD, NekDouble > &interp)
std::vector< double > d(NPUPPER *NPUPPER)

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

◆ v_GetI() [2/2]

const MatrixSharedPtrType Nektar::LibUtilities::NodalTriEvenlySpaced::v_GetI ( const PointsKey pkey)
inlineoverrideprotected

Definition at line 59 of file NodalTriEvenlySpaced.h.

60 {
61 ASSERTL0(pkey.GetPointsDim() == 2,
62 "NodalTriEvenlySpaced Points can only interp to other "
63 "2d point distributions");
64 Array<OneD, const NekDouble> x, y;
65 PointsManager()[pkey]->GetPoints(x, y);
66 return GetI(x, y);
67 }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:208
const MatrixSharedPtrType GetI(const PointsKey &key)
Definition: Points.h:317
PointsManagerT & PointsManager(void)

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

Member Data Documentation

◆ initPointsManager

bool Nektar::LibUtilities::NodalTriEvenlySpaced::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:168
static std::shared_ptr< PointsBaseType > Create(const PointsKey &key)
@ eNodalTriEvenlySpaced
2D Evenly-spaced points on a Triangle
Definition: PointsType.h:83

Definition at line 85 of file NodalTriEvenlySpaced.h.

◆ m_util

std::shared_ptr<NodalUtilTriangle> Nektar::LibUtilities::NodalTriEvenlySpaced::m_util
private