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::NodalTetEvenlySpaced Class Reference

#include <NodalTetEvenlySpaced.h>

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

Public Member Functions

virtual ~NodalTetEvenlySpaced ()
 
 NodalTetEvenlySpaced (const PointsKey &key)
 
- Public Member Functions inherited from Nektar::LibUtilities::Points< NekDouble >
virtual ~Points ()
 
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
 
const MatrixSharedPtrType GetI (const PointsKey &key)
 
const MatrixSharedPtrType GetI (const Array< OneD, const DataType > &x)
 
const MatrixSharedPtrType GetI (unsigned int 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 MatrixSharedPtrType v_GetI (const PointsKey &pkey) override
 
virtual 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)
 
virtual void v_CalculateBaryWeights ()
 This function calculates the barycentric weights used for enhanced interpolation speed. More...
 
 Points (const PointsKey &key)
 
virtual const MatrixSharedPtrType v_GetI (const Array< OneD, const DataType > &x)
 
virtual const MatrixSharedPtrType v_GetI (unsigned int, const Array< OneD, const DataType > &x)
 
virtual const MatrixSharedPtrType v_GetI (const Array< OneD, const DataType > &x, const Array< OneD, const DataType > &y)
 
virtual const MatrixSharedPtrType v_GetGalerkinProjection (const PointsKey &pkey)
 

Private Member Functions

 NodalTetEvenlySpaced ()
 Default constructor should not be called except by Create matrix. More...
 
void NodalPointReorder3d ()
 
virtual void v_CalculatePoints () override
 
virtual void v_CalculateWeights () override
 
virtual void v_CalculateDerivMatrix () override
 
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< NodalUtilTetrahedronm_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 52 of file NodalTetEvenlySpaced.h.

Constructor & Destructor Documentation

◆ ~NodalTetEvenlySpaced()

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

Definition at line 55 of file NodalTetEvenlySpaced.h.

56  {
57  }

◆ NodalTetEvenlySpaced() [1/2]

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

Definition at line 59 of file NodalTetEvenlySpaced.h.

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

◆ NodalTetEvenlySpaced() [2/2]

Nektar::LibUtilities::NodalTetEvenlySpaced::NodalTetEvenlySpaced ( )
inlineprivate

Default constructor should not be called except by Create matrix.

Definition at line 99 of file NodalTetEvenlySpaced.h.

100  {
101  }
static const PointsKey NullPointsKey(0, eNoPointsType)

Member Function Documentation

◆ CalculateInterpMatrix()

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

378 {
379  Array<OneD, Array<OneD, NekDouble>> xi(3);
380  xi[0] = xia;
381  xi[1] = yia;
382  xi[2] = zia;
383 
384  std::shared_ptr<NekMatrix<NekDouble>> mat =
385  m_util->GetInterpolationMatrix(xi);
386  Vmath::Vcopy(mat->GetRows() * mat->GetColumns(), mat->GetRawPtr(), 1,
387  &interp[0], 1);
388 }
std::shared_ptr< NodalUtilTetrahedron > m_util
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 v_GetI().

◆ Create()

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

Definition at line 402 of file NodalTetEvenlySpaced.cpp.

404 {
405  std::shared_ptr<PointsBaseType> returnval(
407 
408  returnval->Initialize();
409 
410  return returnval;
411 }
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.

◆ NodalPointReorder3d()

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

Definition at line 167 of file NodalTetEvenlySpaced.cpp.

168 {
169  unsigned int npts = GetNumPoints();
170  using std::vector;
171  vector<int> vertex;
172  vector<int> iEdge_01; // interior edge 0
173  vector<int> iEdge_12; // interior edge 1
174  vector<int> iEdge_20; // interior edge 2
175  vector<int> iEdge_03; // interior edge 3
176  vector<int> iEdge_13; // interior edge 4
177  vector<int> iEdge_23; // interior edge 5
178  vector<int> iFace_012; // interior face 0
179  vector<int> iFace_013; // interior face 1
180  vector<int> iFace_123; // interior face 2
181  vector<int> iFace_203; // interior face 3
182  vector<int> interiorVolumePoints; // interior volume points
183  vector<int> map;
184 
185  // Build the lattice tetrahedron left to right - bottom to top
186  for (int z = 0, index = 0; z < npts; ++z)
187  {
188  for (int y = 0; y < npts - z; ++y)
189  {
190  for (int x = 0; x < npts - z - y; ++x, ++index)
191  {
192 
193  if (isVertex(x, y, z, npts))
194  { // vertex
195 
196  vertex.push_back(index);
197  }
198  else if (isEdge(x, y, z, npts))
199  { // interior edge
200 
201  if (isEdge_01(x, y, z, npts))
202  { // interior edge 0
203 
204  iEdge_01.push_back(index);
205  }
206  else if (isEdge_12(x, y, z, npts))
207  { // interior edge 1
208 
209  iEdge_12.push_back(index);
210  }
211  else if (isEdge_20(x, y, z, npts))
212  { // interior edge 2
213 
214  iEdge_20.insert(iEdge_20.begin(), index);
215  }
216  else if (isEdge_03(x, y, z, npts))
217  { // interior edge 3
218 
219  iEdge_03.push_back(index);
220  }
221  else if (isEdge_13(x, y, z, npts))
222  { // interior edge 4
223 
224  iEdge_13.push_back(index);
225  }
226  else if (isEdge_23(x, y, z, npts))
227  { // interior edge 5
228 
229  iEdge_23.push_back(index);
230  }
231  }
232  else if (isFace(x, y, z, npts))
233  { // interior face
234 
235  if (isFace_012(x, y, z, npts))
236  { // interior face 0
237 
238  iFace_012.push_back(index);
239  }
240  else if (isFace_013(x, y, z, npts))
241  { // interior face 1
242 
243  iFace_013.push_back(index);
244  }
245  else if (isFace_123(x, y, z, npts))
246  { // interior face 2
247 
248  iFace_123.push_back(index);
249  }
250  else if (isFace_203(x, y, z, npts))
251  { // interior face 3
252 
253  iFace_203.push_back(index);
254  }
255  }
256  else
257  { // interior volume points
258 
259  interiorVolumePoints.push_back(index);
260  }
261  }
262  }
263  }
264 
265  // Mapping the vertex, edges, faces, interior volume points using the
266  // permutation matrix, so the points are ordered anticlockwise.
267  for (unsigned int n = 0; n < vertex.size(); ++n)
268  {
269 
270  map.push_back(vertex[n]);
271  }
272 
273  for (unsigned int n = 0; n < iEdge_01.size(); ++n)
274  {
275 
276  map.push_back(iEdge_01[n]);
277  }
278 
279  for (unsigned int n = 0; n < iEdge_12.size(); ++n)
280  {
281 
282  map.push_back(iEdge_12[n]);
283  }
284 
285  for (unsigned int n = 0; n < iEdge_20.size(); ++n)
286  {
287 
288  map.push_back(iEdge_20[n]);
289  }
290 
291  for (unsigned int n = 0; n < iEdge_03.size(); ++n)
292  {
293 
294  map.push_back(iEdge_03[n]);
295  }
296 
297  for (unsigned int n = 0; n < iEdge_13.size(); ++n)
298  {
299 
300  map.push_back(iEdge_13[n]);
301  }
302 
303  for (unsigned int n = 0; n < iEdge_23.size(); ++n)
304  {
305 
306  map.push_back(iEdge_23[n]);
307  }
308 
309  for (unsigned int n = 0; n < iFace_012.size(); ++n)
310  {
311 
312  map.push_back(iFace_012[n]);
313  }
314 
315  for (unsigned int n = 0; n < iFace_013.size(); ++n)
316  {
317 
318  map.push_back(iFace_013[n]);
319  }
320 
321  for (unsigned int n = 0; n < iFace_123.size(); ++n)
322  {
323 
324  map.push_back(iFace_123[n]);
325  }
326 
327  for (unsigned int n = 0; n < iFace_203.size(); ++n)
328  {
329 
330  map.push_back(iFace_203[n]);
331  }
332 
333  for (unsigned int n = 0; n < interiorVolumePoints.size(); ++n)
334  {
335 
336  map.push_back(interiorVolumePoints[n]);
337  }
338 
339  Array<OneD, NekDouble> points[3];
340  points[0] = Array<OneD, NekDouble>(GetTotNumPoints());
341  points[1] = Array<OneD, NekDouble>(GetTotNumPoints());
342  points[2] = Array<OneD, NekDouble>(GetTotNumPoints());
343  for (unsigned int index = 0; index < map.size(); ++index)
344  {
345 
346  points[0][index] = m_points[0][index];
347  points[1][index] = m_points[1][index];
348  points[2][index] = m_points[2][index];
349  }
350 
351  for (unsigned int index = 0; index < map.size(); ++index)
352  {
353 
354  m_points[0][index] = points[0][map[index]];
355  m_points[1][index] = points[1][map[index]];
356  m_points[2][index] = points[2][map[index]];
357  }
358 }
Array< OneD, DataType > m_points[3]
Storage for the point locations, allowing for up to a 3D points storage.
Definition: Points.h:375
unsigned int GetNumPoints() const
Definition: Points.h:273
unsigned int GetTotNumPoints() const
Definition: Points.h:278

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::NodalTetEvenlySpaced::v_CalculateDerivMatrix ( )
overrideprivatevirtual

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

Definition at line 392 of file NodalTetEvenlySpaced.cpp.

393 {
394  // Allocate the derivative matrix.
396 
397  m_derivmatrix[0] = m_util->GetDerivMatrix(0);
398  m_derivmatrix[1] = m_util->GetDerivMatrix(1);
399  m_derivmatrix[2] = m_util->GetDerivMatrix(2);
400 }
MatrixSharedPtrType m_derivmatrix[3]
Derivative matrices.
Definition: Points.h:381

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

◆ v_CalculatePoints()

void Nektar::LibUtilities::NodalTetEvenlySpaced::v_CalculatePoints ( )
overrideprivatevirtual

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

Definition at line 137 of file NodalTetEvenlySpaced.cpp.

138 {
139  // Allocate the storage for points
141 
142  // Populate m_points
143  unsigned int npts = GetNumPoints();
144  NekDouble delta = 2.0 / (npts - 1.0);
145  for (unsigned int z = 0, index = 0; z < npts; ++z)
146  {
147  for (unsigned int y = 0; y < npts - z; ++y)
148  {
149  for (unsigned int x = 0; x < npts - z - y; ++x, ++index)
150  {
151  NekDouble xi = -1.0 + x * delta;
152  NekDouble yi = -1.0 + y * delta;
153  NekDouble zi = -1.0 + z * delta;
154 
155  m_points[0][index] = xi;
156  m_points[1][index] = yi;
157  m_points[2][index] = zi;
158  }
159  }
160  }
161 
164  npts - 1, m_points[0], m_points[1], m_points[2]);
165 }
double NekDouble

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::NodalTetEvenlySpaced::v_CalculateWeights ( )
overrideprivatevirtual

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

Definition at line 360 of file NodalTetEvenlySpaced.cpp.

361 {
362  // Allocate storage for points
364 
365  typedef DataType T;
366 
367  // Solve the Vandermonde system of integrals for the weight vector
368  NekVector<T> w = m_util->GetWeights();
369  m_weights = Array<OneD, T>(w.GetRows(), w.GetPtr());
370 }
Array< OneD, DataType > m_weights
Quadrature weights for the weights.
Definition: Points.h:377

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

◆ v_GetI() [1/2]

virtual const MatrixSharedPtrType Nektar::LibUtilities::NodalTetEvenlySpaced::v_GetI ( const Array< OneD, const NekDouble > &  x,
const Array< OneD, const NekDouble > &  y,
const Array< OneD, const NekDouble > &  z 
)
inlineoverrideprotectedvirtual

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

Definition at line 77 of file NodalTetEvenlySpaced.h.

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

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

◆ v_GetI() [2/2]

virtual const MatrixSharedPtrType Nektar::LibUtilities::NodalTetEvenlySpaced::v_GetI ( const PointsKey pkey)
inlineoverrideprotectedvirtual

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

Definition at line 67 of file NodalTetEvenlySpaced.h.

68  {
69  ASSERTL0(pkey.GetPointsDim() == 3,
70  "NodalTetEvenlySpaced Points can only interp to other "
71  "3d point distributions");
72  Array<OneD, const NekDouble> x, y, z;
73  PointsManager()[pkey]->GetPoints(x, y, z);
74  return GetI(x, y, z);
75  }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:215
const MatrixSharedPtrType GetI(const PointsKey &key)
Definition: Points.h:336
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::NodalTetEvenlySpaced::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)
@ eNodalTetEvenlySpaced
3D Evenly-spaced points on a Tetrahedron
Definition: PointsType.h:86

Definition at line 94 of file NodalTetEvenlySpaced.h.

◆ m_util

std::shared_ptr<NodalUtilTetrahedron> Nektar::LibUtilities::NodalTetEvenlySpaced::m_util
private