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

#include <NodalPrismEvenlySpaced.h>

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

Public Member Functions

virtual ~NodalPrismEvenlySpaced ()
 
 NodalPrismEvenlySpaced (const PointsKey &key)
 
const MatrixSharedPtrType GetI (const PointsKey &pkey)
 
const MatrixSharedPtrType GetI (const Array< OneD, const NekDouble > &x, const Array< OneD, const NekDouble > &y, const Array< OneD, const NekDouble > &z)
 
- Public Member Functions inherited from Nektar::LibUtilities::Points< NekDouble >
virtual ~Points ()
 
virtual void Initialize (void)
 
unsigned int GetPointsDim () const
 
unsigned int GetNumPoints () const
 
unsigned int 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
 
virtual const MatrixSharedPtrType GetI (const Array< OneD, const DataType > &x)
 
virtual const MatrixSharedPtrType GetI (unsigned int, const Array< OneD, const DataType > &x)
 
virtual const MatrixSharedPtrType GetI (const Array< OneD, const DataType > &x, const Array< OneD, const DataType > &y)
 
virtual const MatrixSharedPtrType GetGalerkinProjection (const PointsKey &pkey)
 

Static Public Member Functions

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

Private Member Functions

 NodalPrismEvenlySpaced ()
 Default constructor should not be called except by Create matrix. More...
 
void CalculatePoints ()
 
void CalculateWeights ()
 
void CalculateDerivMatrix ()
 
void NodalPointReorder3d ()
 
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< NodalUtilPrismm_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 Member Functions inherited from Nektar::LibUtilities::Points< NekDouble >
virtual void CalculateBaryWeights ()
 This function calculates the barycentric weights used for enhanced interpolation speed. More...
 
 Points (const PointsKey &key)
 
- 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 52 of file NodalPrismEvenlySpaced.h.

Constructor & Destructor Documentation

◆ ~NodalPrismEvenlySpaced()

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

Definition at line 55 of file NodalPrismEvenlySpaced.h.

56  {
57  }

◆ NodalPrismEvenlySpaced() [1/2]

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

Definition at line 59 of file NodalPrismEvenlySpaced.h.

59  : PointsBaseType(key)
60  {
61  }
Points< NekDouble > PointsBaseType

◆ NodalPrismEvenlySpaced() [2/2]

Nektar::LibUtilities::NodalPrismEvenlySpaced::NodalPrismEvenlySpaced ( )
inlineprivate

Default constructor should not be called except by Create matrix.

Definition at line 97 of file NodalPrismEvenlySpaced.h.

98  {
99  }
static const PointsKey NullPointsKey(0, eNoPointsType)

Member Function Documentation

◆ CalculateDerivMatrix()

void Nektar::LibUtilities::NodalPrismEvenlySpaced::CalculateDerivMatrix ( )
privatevirtual

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

Definition at line 429 of file NodalPrismEvenlySpaced.cpp.

430 {
431  // Allocate the derivative matrix.
433 
434  m_derivmatrix[0] = m_util->GetDerivMatrix(0);
435  m_derivmatrix[1] = m_util->GetDerivMatrix(1);
436  m_derivmatrix[2] = m_util->GetDerivMatrix(2);
437 }
MatrixSharedPtrType m_derivmatrix[3]
Derivative matrices.
Definition: Points.h:409

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

◆ CalculateInterpMatrix()

void Nektar::LibUtilities::NodalPrismEvenlySpaced::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 411 of file NodalPrismEvenlySpaced.cpp.

415 {
416  Array<OneD, Array<OneD, NekDouble>> xi(3);
417  xi[0] = xia;
418  xi[1] = yia;
419  xi[2] = zia;
420 
421  std::shared_ptr<NekMatrix<NekDouble>> mat =
422  m_util->GetInterpolationMatrix(xi);
423  Vmath::Vcopy(mat->GetRows() * mat->GetColumns(), mat->GetRawPtr(), 1,
424  &interp[0], 1);
425 }
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1255

References m_util, and Vmath::Vcopy().

Referenced by GetI().

◆ CalculatePoints()

void Nektar::LibUtilities::NodalPrismEvenlySpaced::CalculatePoints ( )
privatevirtual

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

Definition at line 163 of file NodalPrismEvenlySpaced.cpp.

164 {
165  // Allocate the storage for points
167 
168  // Populate m_points
169  unsigned int npts = GetNumPoints();
170  NekDouble delta = 2.0 / (npts - 1.0);
171  for (unsigned int z = 0, index = 0; z < npts; ++z)
172  {
173  for (unsigned int y = 0; y < npts; ++y)
174  {
175  for (unsigned int x = 0; x < npts - z; ++x, ++index)
176  {
177  NekDouble xi = -1.0 + x * delta;
178  NekDouble yi = -1.0 + y * delta;
179  NekDouble zi = -1.0 + z * delta;
180 
181  m_points[0][index] = xi;
182  m_points[1][index] = yi;
183  m_points[2][index] = zi;
184  }
185  }
186  }
187 
190  npts - 1, m_points[0], m_points[1], m_points[2]);
191 }
Array< OneD, DataType > m_points[3]
Storage for the point locations, allowing for up to a 3D points storage.
Definition: Points.h:403
unsigned int GetNumPoints() const
Definition: Points.h:276
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
double NekDouble

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

◆ CalculateWeights()

void Nektar::LibUtilities::NodalPrismEvenlySpaced::CalculateWeights ( )
privatevirtual

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

Definition at line 396 of file NodalPrismEvenlySpaced.cpp.

397 {
398  // Allocate the storage for points
400 
401  typedef DataType T;
402 
403  // Solve the Vandermonde system of integrals for the weight vector
404  NekVector<T> w = m_util->GetWeights();
405 
406  m_weights = Array<OneD, T>(w.GetRows(), w.GetPtr());
407 }
Array< OneD, DataType > m_weights
Quadrature weights for the weights.
Definition: Points.h:405

References Nektar::LibUtilities::Points< NekDouble >::CalculateWeights(), Nektar::NekVector< DataType >::GetPtr(), Nektar::NekVector< DataType >::GetRows(), m_util, and Nektar::LibUtilities::Points< NekDouble >::m_weights.

◆ Create()

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

Definition at line 439 of file NodalPrismEvenlySpaced.cpp.

441 {
442  std::shared_ptr<PointsBaseType> returnval(
444 
445  returnval->Initialize();
446 
447  return returnval;
448 }

◆ GetI() [1/2]

const MatrixSharedPtrType Nektar::LibUtilities::NodalPrismEvenlySpaced::GetI ( const Array< OneD, const NekDouble > &  x,
const Array< OneD, const NekDouble > &  y,
const Array< OneD, const NekDouble > &  z 
)
inlinevirtual

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

Definition at line 76 of file NodalPrismEvenlySpaced.h.

79  {
80  size_t numpoints = x.size();
81  unsigned int np = GetTotNumPoints();
82 
83  Array<OneD, NekDouble> interp(GetTotNumPoints() * numpoints);
84  CalculateInterpMatrix(x, y, z, interp);
85 
86  NekDouble *d = interp.data();
87  return MemoryManager<NekMatrix<NekDouble>>::AllocateSharedPtr(numpoints,
88  np, d);
89  }
void CalculateInterpMatrix(const Array< OneD, const NekDouble > &xi, const Array< OneD, const NekDouble > &yi, const Array< OneD, const NekDouble > &zi, Array< OneD, NekDouble > &interp)
unsigned int GetTotNumPoints() const
Definition: Points.h:281

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

◆ GetI() [2/2]

const MatrixSharedPtrType Nektar::LibUtilities::NodalPrismEvenlySpaced::GetI ( const PointsKey pkey)
inlinevirtual

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

Definition at line 66 of file NodalPrismEvenlySpaced.h.

67  {
68  ASSERTL0(pkey.GetPointsDim() == 3,
69  "NodalPrismEvenlySpaced Points can only interp to "
70  "other 3d point distributions");
71  Array<OneD, const NekDouble> x, y, z;
72  PointsManager()[pkey]->GetPoints(x, y, z);
73  return GetI(x, y, z);
74  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:215
const MatrixSharedPtrType GetI(const PointsKey &pkey)
PointsManagerT & PointsManager(void)

References ASSERTL0, Nektar::LibUtilities::PointsKey::GetPointsDim(), and Nektar::LibUtilities::PointsManager().

◆ NodalPointReorder3d()

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

Definition at line 193 of file NodalPrismEvenlySpaced.cpp.

194 {
195  unsigned int npts = GetNumPoints();
196  using std::vector;
197  vector<int> vertex;
198  vector<int> iEdge_01; // interior edge 0
199  vector<int> iEdge_12; // interior edge 1
200  vector<int> iEdge_23; // interior edge 2
201  vector<int> iEdge_30; // interior edge 3
202  vector<int> iEdge_04; // interior edge 4
203  vector<int> iEdge_14; // interior edge 5
204  vector<int> iEdge_25; // interior edge 6
205  vector<int> iEdge_35; // interior edge 7
206  vector<int> iEdge_45; // interior edge 8
207  vector<int> iFace_0123; // interior face 0
208  vector<int> iFace_014; // interior face 1
209  vector<int> iFace_1254; // interior face 2
210  vector<int> iFace_325; // interior face 3
211  vector<int> iFace_0354; // interior face 4
212  vector<int> interiorVolumePoints; // interior volume points
213  vector<int> map;
214 
215  // Build the lattice prism left to right - bottom to top
216  for (unsigned int z = 0, index = 0; z < npts; ++z)
217  {
218  for (unsigned int y = 0; y < npts; ++y)
219  {
220  for (unsigned int x = 0; x < npts - z; ++x, ++index)
221  {
222  if (isVertex(x, y, z, npts))
223  {
224  vertex.push_back(index);
225  }
226  else if (isEdge(x, y, z, npts))
227  {
228  if (isEdge_01(x, y, z, npts))
229  {
230  iEdge_01.push_back(index);
231  }
232  else if (isEdge_12(x, y, z, npts))
233  {
234  iEdge_12.push_back(index);
235  }
236  else if (isEdge_23(x, y, z, npts))
237  {
238  iEdge_23.push_back(index);
239  }
240  else if (isEdge_30(x, y, z, npts))
241  {
242  iEdge_30.push_back(index);
243  }
244  else if (isEdge_04(x, y, z, npts))
245  {
246  iEdge_04.push_back(index);
247  }
248  else if (isEdge_14(x, y, z, npts))
249  {
250  iEdge_14.push_back(index);
251  }
252  else if (isEdge_25(x, y, z, npts))
253  {
254  iEdge_25.push_back(index);
255  }
256  else if (isEdge_35(x, y, z, npts))
257  {
258  iEdge_35.push_back(index);
259  }
260  else if (isEdge_45(x, y, z, npts))
261  {
262  iEdge_45.push_back(index);
263  }
264  }
265  else if (isFace(x, y, z, npts))
266  {
267  if (isFace_0123(x, y, z, npts))
268  {
269  iFace_0123.push_back(index);
270  }
271  else if (isFace_014(x, y, z, npts))
272  {
273  iFace_014.push_back(index);
274  }
275  else if (isFace_1254(x, y, z, npts))
276  {
277  iFace_1254.push_back(index);
278  }
279  else if (isFace_325(x, y, z, npts))
280  {
281  iFace_325.push_back(index);
282  }
283  else if (isFace_0354(x, y, z, npts))
284  {
285  iFace_0354.push_back(index);
286  }
287  }
288  else
289  {
290  interiorVolumePoints.push_back(index);
291  }
292  }
293  }
294  }
295 
296  for (unsigned int n = 0; n < vertex.size(); ++n)
297  {
298  map.push_back(vertex[n]);
299  }
300 
301  for (unsigned int n = 0; n < iEdge_01.size(); ++n)
302  {
303  map.push_back(iEdge_01[n]);
304  }
305 
306  for (unsigned int n = 0; n < iEdge_12.size(); ++n)
307  {
308  map.push_back(iEdge_12[n]);
309  }
310 
311  for (unsigned int n = 0; n < iEdge_23.size(); ++n)
312  {
313  map.push_back(iEdge_23[n]);
314  }
315 
316  for (unsigned int n = 0; n < iEdge_30.size(); ++n)
317  {
318  map.push_back(iEdge_30[n]);
319  }
320 
321  for (unsigned int n = 0; n < iEdge_04.size(); ++n)
322  {
323  map.push_back(iEdge_04[n]);
324  }
325 
326  for (unsigned int n = 0; n < iEdge_14.size(); ++n)
327  {
328  map.push_back(iEdge_14[n]);
329  }
330 
331  for (unsigned int n = 0; n < iEdge_25.size(); ++n)
332  {
333  map.push_back(iEdge_25[n]);
334  }
335 
336  for (unsigned int n = 0; n < iEdge_35.size(); ++n)
337  {
338  map.push_back(iEdge_35[n]);
339  }
340 
341  for (unsigned int n = 0; n < iEdge_45.size(); ++n)
342  {
343  map.push_back(iEdge_45[n]);
344  }
345 
346  for (unsigned int n = 0; n < iFace_0123.size(); ++n)
347  {
348  map.push_back(iFace_0123[n]);
349  }
350 
351  for (unsigned int n = 0; n < iFace_014.size(); ++n)
352  {
353  map.push_back(iFace_014[n]);
354  }
355 
356  for (unsigned int n = 0; n < iFace_1254.size(); ++n)
357  {
358  map.push_back(iFace_1254[n]);
359  }
360 
361  for (unsigned int n = 0; n < iFace_325.size(); ++n)
362  {
363  map.push_back(iFace_325[n]);
364  }
365 
366  for (unsigned int n = 0; n < iFace_0354.size(); ++n)
367  {
368  map.push_back(iFace_0354[n]);
369  }
370 
371  for (unsigned int n = 0; n < interiorVolumePoints.size(); ++n)
372  {
373  map.push_back(interiorVolumePoints[n]);
374  }
375 
376  Array<OneD, NekDouble> points[3];
377  points[0] = Array<OneD, NekDouble>(GetTotNumPoints());
378  points[1] = Array<OneD, NekDouble>(GetTotNumPoints());
379  points[2] = Array<OneD, NekDouble>(GetTotNumPoints());
380 
381  for (unsigned int index = 0; index < map.size(); ++index)
382  {
383  points[0][index] = m_points[0][index];
384  points[1][index] = m_points[1][index];
385  points[2][index] = m_points[2][index];
386  }
387 
388  for (unsigned int index = 0; index < map.size(); ++index)
389  {
390  m_points[0][index] = points[0][map[index]];
391  m_points[1][index] = points[1][map[index]];
392  m_points[2][index] = points[2][map[index]];
393  }
394 }

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

Referenced by CalculatePoints().

Member Data Documentation

◆ initPointsManager

bool Nektar::LibUtilities::NodalPrismEvenlySpaced::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:170
static std::shared_ptr< PointsBaseType > Create(const PointsKey &key)
@ eNodalPrismEvenlySpaced
3D Evenly-spaced points on a Prism
Definition: PointsType.h:88

Definition at line 92 of file NodalPrismEvenlySpaced.h.

◆ m_util

std::shared_ptr<NodalUtilPrism> Nektar::LibUtilities::NodalPrismEvenlySpaced::m_util
private