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)
 
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 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_CalculatePoints ()
 
virtual void v_CalculateWeights ()
 

Private Member Functions

 NodalTetEvenlySpaced ()=delete
 
 NodalTetEvenlySpaced (const NodalTetEvenlySpaced &points)=delete
 
void NodalPointReorder3d ()
 
virtual void v_CalculatePoints () override final
 
virtual void v_CalculateWeights () override final
 
virtual void v_CalculateDerivMatrix () override 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< 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 47 of file NodalTetEvenlySpaced.h.

Constructor & Destructor Documentation

◆ ~NodalTetEvenlySpaced()

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

Definition at line 50 of file NodalTetEvenlySpaced.h.

51 {
52 }

◆ NodalTetEvenlySpaced() [1/3]

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

Definition at line 54 of file NodalTetEvenlySpaced.h.

54 : PointsBaseType(key)
55 {
56 }
Points< NekDouble > PointsBaseType

◆ NodalTetEvenlySpaced() [2/3]

Nektar::LibUtilities::NodalTetEvenlySpaced::NodalTetEvenlySpaced ( )
privatedelete

◆ NodalTetEvenlySpaced() [3/3]

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

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 369 of file NodalTetEvenlySpaced.cpp.

373{
374 Array<OneD, Array<OneD, NekDouble>> xi(3);
375 xi[0] = xia;
376 xi[1] = yia;
377 xi[2] = zia;
378
379 std::shared_ptr<NekMatrix<NekDouble>> mat =
380 m_util->GetInterpolationMatrix(xi);
381 Vmath::Vcopy(mat->GetRows() * mat->GetColumns(), mat->GetRawPtr(), 1,
382 &interp[0], 1);
383}
std::shared_ptr< NodalUtilTetrahedron > m_util
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Definition: Vmath.cpp:1191

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 397 of file NodalTetEvenlySpaced.cpp.

399{
400 std::shared_ptr<PointsBaseType> returnval(
402
403 returnval->Initialize();
404
405 return returnval;
406}
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 162 of file NodalTetEvenlySpaced.cpp.

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

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

Referenced by v_CalculatePoints().

◆ v_CalculateDerivMatrix()

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

Definition at line 387 of file NodalTetEvenlySpaced.cpp.

388{
389 // Allocate the derivative matrix.
390 PointsBaseType::v_CalculateDerivMatrix();
391
392 m_derivmatrix[0] = m_util->GetDerivMatrix(0);
393 m_derivmatrix[1] = m_util->GetDerivMatrix(1);
394 m_derivmatrix[2] = m_util->GetDerivMatrix(2);
395}
MatrixSharedPtrType m_derivmatrix[3]
Derivative matrices.
Definition: Points.h:367

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

◆ v_CalculatePoints()

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

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

Definition at line 132 of file NodalTetEvenlySpaced.cpp.

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

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

◆ v_CalculateWeights()

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

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

Definition at line 355 of file NodalTetEvenlySpaced.cpp.

356{
357 // Allocate storage for points
359
360 typedef DataType T;
361
362 // Solve the Vandermonde system of integrals for the weight vector
363 NekVector<T> w = m_util->GetWeights();
364 m_weights = Array<OneD, T>(w.GetRows(), w.GetPtr());
365}
Array< OneD, DataType > m_weights
Quadrature weights for the weights.
Definition: Points.h:363
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]

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

Definition at line 72 of file NodalTetEvenlySpaced.h.

76 {
77 size_t numpoints = x.size();
78 size_t np = GetTotNumPoints();
79
80 Array<OneD, NekDouble> interp(GetTotNumPoints() * numpoints);
81 CalculateInterpMatrix(x, y, z, interp);
82
83 NekDouble *d = interp.data();
84 return MemoryManager<NekMatrix<NekDouble>>::AllocateSharedPtr(numpoints,
85 np, d);
86 }
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(), Nektar::UnitTests::d(), Nektar::LibUtilities::Points< NekDouble >::GetTotNumPoints(), and Nektar::UnitTests::z().

◆ v_GetI() [2/2]

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

Definition at line 62 of file NodalTetEvenlySpaced.h.

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

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

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:169
static std::shared_ptr< PointsBaseType > Create(const PointsKey &key)
@ eNodalTetEvenlySpaced
3D Evenly-spaced points on a Tetrahedron
Definition: PointsType.h:86

Definition at line 89 of file NodalTetEvenlySpaced.h.

◆ m_util

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