Nektar++
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
Nektar::LibUtilities::NodalPyrEvenlySpaced Class Reference

#include <NodalPyrEvenlySpaced.h>

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

Public Member Functions

 ~NodalPyrEvenlySpaced () override
 
 NodalPyrEvenlySpaced (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 MatrixSharedPtrType & GetD (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< PointsBaseType > Create (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, const Array< OneD, const NekDouble > &z) override
 
- Protected Member Functions inherited from Nektar::LibUtilities::Points< NekDouble >
virtual void v_Initialize (void)
 

Private Member Functions

 NodalPyrEvenlySpaced ()=delete
 
 NodalPyrEvenlySpaced (const NodalPyrEvenlySpaced &points)=delete
 
void NodalPointReorder3d ()
 
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, const Array< OneD, const NekDouble > &zi, Array< OneD, NekDouble > &interp)
 

Private Attributes

std::shared_ptr< NodalUtilPyr > m_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.
 
Array< OneD, DataType > m_points [3]
 Storage for the point locations, allowing for up to a 3D points storage.
 
Array< OneD, DataType > m_weights
 Quadrature weights for the weights.
 
Array< OneD, DataType > m_bcweights
 Barycentric weights.
 
MatrixSharedPtrType m_derivmatrix [3]
 Derivative matrices.
 
NekManager< PointsKey, NekMatrix< DataType >, PointsKey::opLess > m_InterpManager
 
NekManager< PointsKey, NekMatrix< DataType >, PointsKey::opLess > m_GalerkinProjectionManager
 

Detailed Description

Definition at line 45 of file NodalPyrEvenlySpaced.h.

Constructor & Destructor Documentation

◆ ~NodalPyrEvenlySpaced()

Nektar::LibUtilities::NodalPyrEvenlySpaced::~NodalPyrEvenlySpaced ( )
inlineoverride

Definition at line 48 of file NodalPyrEvenlySpaced.h.

49 {
50 }

◆ NodalPyrEvenlySpaced() [1/3]

Nektar::LibUtilities::NodalPyrEvenlySpaced::NodalPyrEvenlySpaced ( const PointsKey &  key)
inline

Definition at line 52 of file NodalPyrEvenlySpaced.h.

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

◆ NodalPyrEvenlySpaced() [2/3]

Nektar::LibUtilities::NodalPyrEvenlySpaced::NodalPyrEvenlySpaced ( )
privatedelete

◆ NodalPyrEvenlySpaced() [3/3]

Nektar::LibUtilities::NodalPyrEvenlySpaced::NodalPyrEvenlySpaced ( const NodalPyrEvenlySpaced &  points)
privatedelete

Member Function Documentation

◆ CalculateInterpMatrix()

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

Definition at line 404 of file NodalPyrEvenlySpaced.cpp.

408{
409 Array<OneD, Array<OneD, NekDouble>> xi(3);
410 xi[0] = xia;
411 xi[1] = yia;
412 xi[2] = zia;
413
414 std::shared_ptr<NekMatrix<NekDouble>> mat =
415 m_util->GetInterpolationMatrix(xi);
416 Vmath::Vcopy(mat->GetRows() * mat->GetColumns(), mat->GetRawPtr(), 1,
417 &interp[0], 1);
418}
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition Vmath.hpp:828

References m_util, and Vmath::Vcopy().

Referenced by v_GetI().

◆ Create()

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

Definition at line 432 of file NodalPyrEvenlySpaced.cpp.

434{
435 std::shared_ptr<PointsBaseType> returnval(
437
438 returnval->Initialize();
439
440 return returnval;
441}
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.

◆ NodalPointReorder3d()

void Nektar::LibUtilities::NodalPyrEvenlySpaced::NodalPointReorder3d ( )
private

Definition at line 188 of file NodalPyrEvenlySpaced.cpp.

189{
190 size_t npts = GetNumPoints();
191 using std::vector;
192 vector<int> vertex;
193 vector<int> iEdge_01; // interior edge 0
194 vector<int> iEdge_12; // interior edge 1
195 vector<int> iEdge_23; // interior edge 2
196 vector<int> iEdge_30; // interior edge 3
197 vector<int> iEdge_04; // interior edge 4
198 vector<int> iEdge_14; // interior edge 5
199 vector<int> iEdge_24; // interior edge 6
200 vector<int> iEdge_34; // interior edge 7
201 vector<int> iFace_0123; // interior face 0 (base quad)
202 vector<int> iFace_014; // interior face 1
203 vector<int> iFace_124; // interior face 2
204 vector<int> iFace_234; // interior face 3
205 vector<int> iFace_034; // interior face 4
206 vector<int> interiorVolumePoints; // interior volume points
207 vector<int> map;
208
209 // Build the lattice pyramid left to right - bottom to top. Note that,
210 // unlike the prism, both the x and y extents shrink together as z
211 // increases, since the pyramid tapers to a single apex point rather than
212 // an edge.
213 for (size_t z = 0, index = 0; z < npts; ++z)
214 {
215 for (size_t y = 0; y < npts - z; ++y)
216 {
217 for (size_t x = 0; x < npts - z; ++x, ++index)
218 {
219 if (isVertex(x, y, z, npts))
220 {
221 vertex.push_back(index);
222 }
223 else if (isEdge(x, y, z, npts))
224 {
225 if (isEdge_01(x, y, z, npts))
226 {
227 iEdge_01.push_back(index);
228 }
229 else if (isEdge_12(x, y, z, npts))
230 {
231 iEdge_12.push_back(index);
232 }
233 else if (isEdge_23(x, y, z, npts))
234 {
235 iEdge_23.push_back(index);
236 }
237 else if (isEdge_30(x, y, z, npts))
238 {
239 iEdge_30.push_back(index);
240 }
241 else if (isEdge_04(x, y, z, npts))
242 {
243 iEdge_04.push_back(index);
244 }
245 else if (isEdge_14(x, y, z, npts))
246 {
247 iEdge_14.push_back(index);
248 }
249 else if (isEdge_24(x, y, z, npts))
250 {
251 iEdge_24.push_back(index);
252 }
253 else if (isEdge_34(x, y, z, npts))
254 {
255 iEdge_34.push_back(index);
256 }
257 }
258 else if (isFace(x, y, z, npts))
259 {
260 if (isFace_0123(x, y, z, npts))
261 {
262 iFace_0123.push_back(index);
263 }
264 else if (isFace_014(x, y, z, npts))
265 {
266 iFace_014.push_back(index);
267 }
268 else if (isFace_124(x, y, z, npts))
269 {
270 iFace_124.push_back(index);
271 }
272 else if (isFace_234(x, y, z, npts))
273 {
274 iFace_234.push_back(index);
275 }
276 else if (isFace_034(x, y, z, npts))
277 {
278 iFace_034.push_back(index);
279 }
280 }
281 else
282 {
283 interiorVolumePoints.push_back(index);
284 }
285 }
286 }
287 }
288
289 // The lattice walks the base in raster order, which puts the corner at
290 // (-1, 1, -1) third; the standard pyramid numbers that corner 3, so the
291 // two middle slots are the wrong way round.
292 std::swap(vertex[2], vertex[3]);
293
294 for (size_t n = 0; n < vertex.size(); ++n)
295 {
296 map.push_back(vertex[n]);
297 }
298
299 for (size_t n = 0; n < iEdge_01.size(); ++n)
300 {
301 map.push_back(iEdge_01[n]);
302 }
303
304 for (size_t n = 0; n < iEdge_12.size(); ++n)
305 {
306 map.push_back(iEdge_12[n]);
307 }
308
309 for (size_t n = 0; n < iEdge_23.size(); ++n)
310 {
311 map.push_back(iEdge_23[n]);
312 }
313
314 for (size_t n = 0; n < iEdge_30.size(); ++n)
315 {
316 map.push_back(iEdge_30[n]);
317 }
318
319 for (size_t n = 0; n < iEdge_04.size(); ++n)
320 {
321 map.push_back(iEdge_04[n]);
322 }
323
324 for (size_t n = 0; n < iEdge_14.size(); ++n)
325 {
326 map.push_back(iEdge_14[n]);
327 }
328
329 for (size_t n = 0; n < iEdge_24.size(); ++n)
330 {
331 map.push_back(iEdge_24[n]);
332 }
333
334 for (size_t n = 0; n < iEdge_34.size(); ++n)
335 {
336 map.push_back(iEdge_34[n]);
337 }
338
339 for (size_t n = 0; n < iFace_0123.size(); ++n)
340 {
341 map.push_back(iFace_0123[n]);
342 }
343
344 for (size_t n = 0; n < iFace_014.size(); ++n)
345 {
346 map.push_back(iFace_014[n]);
347 }
348
349 for (size_t n = 0; n < iFace_124.size(); ++n)
350 {
351 map.push_back(iFace_124[n]);
352 }
353
354 for (size_t n = 0; n < iFace_234.size(); ++n)
355 {
356 map.push_back(iFace_234[n]);
357 }
358
359 for (size_t n = 0; n < iFace_034.size(); ++n)
360 {
361 map.push_back(iFace_034[n]);
362 }
363
364 for (size_t n = 0; n < interiorVolumePoints.size(); ++n)
365 {
366 map.push_back(interiorVolumePoints[n]);
367 }
368
369 Array<OneD, NekDouble> points[3];
370 points[0] = Array<OneD, NekDouble>(GetTotNumPoints());
371 points[1] = Array<OneD, NekDouble>(GetTotNumPoints());
372 points[2] = Array<OneD, NekDouble>(GetTotNumPoints());
373
374 for (size_t index = 0; index < map.size(); ++index)
375 {
376 points[0][index] = m_points[0][index];
377 points[1][index] = m_points[1][index];
378 points[2][index] = m_points[2][index];
379 }
380
381 for (size_t index = 0; index < map.size(); ++index)
382 {
383 m_points[0][index] = points[0][map[index]];
384 m_points[1][index] = points[1][map[index]];
385 m_points[2][index] = points[2][map[index]];
386 }
387}
Array< OneD, DataType > m_points[3]
Storage for the point locations, allowing for up to a 3D points storage.
Definition Points.h:434

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::NodalPyrEvenlySpaced::v_CalculateDerivMatrix ( )
finalprivate

Definition at line 422 of file NodalPyrEvenlySpaced.cpp.

423{
424 // Allocate the derivative matrix.
425 PointsBaseType::v_CalculateDerivMatrix();
426
427 m_derivmatrix[0] = m_util->GetDerivMatrix(0);
428 m_derivmatrix[1] = m_util->GetDerivMatrix(1);
429 m_derivmatrix[2] = m_util->GetDerivMatrix(2);
430}
MatrixSharedPtrType m_derivmatrix[3]
Derivative matrices.
Definition Points.h:440

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

◆ v_CalculatePoints()

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

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

Definition at line 158 of file NodalPyrEvenlySpaced.cpp.

159{
160 // Allocate the storage for points
162
163 // Populate m_points
164 size_t npts = GetNumPoints();
165 NekDouble delta = 2.0 / (npts - 1.0);
166 for (size_t z = 0, index = 0; z < npts; ++z)
167 {
168 for (size_t y = 0; y < npts - z; ++y)
169 {
170 for (size_t x = 0; x < npts - z; ++x, ++index)
171 {
172 NekDouble xi = -1.0 + x * delta;
173 NekDouble yi = -1.0 + y * delta;
174 NekDouble zi = -1.0 + z * delta;
175
176 m_points[0][index] = xi;
177 m_points[1][index] = yi;
178 m_points[2][index] = zi;
179 }
180 }
181 }
182
185 npts - 1, m_points[0], m_points[1], m_points[2]);
186}

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

◆ v_CalculateWeights()

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

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

Definition at line 389 of file NodalPyrEvenlySpaced.cpp.

390{
391 // Allocate the storage for points
393
394 typedef DataType T;
395
396 // Solve the Vandermonde system of integrals for the weight vector
397 NekVector<T> w = m_util->GetWeights();
398
399 m_weights = Array<OneD, T>(w.GetRows(), w.GetPtr());
400}
Array< OneD, DataType > m_weights
Quadrature weights for the weights.
Definition Points.h:436

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

◆ v_GetI() [1/2]

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

Definition at line 70 of file NodalPyrEvenlySpaced.h.

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

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

◆ v_GetI() [2/2]

const MatrixSharedPtrType Nektar::LibUtilities::NodalPyrEvenlySpaced::v_GetI ( const PointsKey &  pkey)
inlineoverrideprotected

Definition at line 60 of file NodalPyrEvenlySpaced.h.

61 {
62 ASSERTL0(pkey.GetPointsDim() == 3,
63 "NodalPyrEvenlySpaced Points can only interp to "
64 "other 3d point distributions");
65 Array<OneD, const NekDouble> x, y, z;
66 PointsManager()[pkey]->GetPoints(x, y, z);
67 return GetI(x, y, z);
68 }
#define ASSERTL0(condition, msg)
const MatrixSharedPtrType GetI(const PointsKey &key)
Definition Points.h:395
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::NodalPyrEvenlySpaced::initPointsManager
staticprivate
Initial value:
= {
PointsManager().RegisterCreator(PointsKey(0, eNodalPyrEvenlySpaced),
static std::shared_ptr< PointsBaseType > Create(const PointsKey &key)
@ eNodalPyrEvenlySpaced
3D Nodal Pyramid evenly spaced points
Definition PointsType.h:99

Definition at line 87 of file NodalPyrEvenlySpaced.h.

◆ m_util

std::shared_ptr<NodalUtilPyr> Nektar::LibUtilities::NodalPyrEvenlySpaced::m_util
private