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

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

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

Private Member Functions

 NodalTetEvenlySpaced ()=delete
 
 NodalTetEvenlySpaced (const NodalTetEvenlySpaced &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< 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 45 of file NodalTetEvenlySpaced.h.

Constructor & Destructor Documentation

◆ ~NodalTetEvenlySpaced()

Nektar::LibUtilities::NodalTetEvenlySpaced::~NodalTetEvenlySpaced ( )
inlineoverride

Definition at line 48 of file NodalTetEvenlySpaced.h.

49 {
50 }

◆ NodalTetEvenlySpaced() [1/3]

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

Definition at line 52 of file NodalTetEvenlySpaced.h.

52 : PointsBaseType(key)
53 {
54 }
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 365 of file NodalTetEvenlySpaced.cpp.

369{
370 Array<OneD, Array<OneD, NekDouble>> xi(3);
371 xi[0] = xia;
372 xi[1] = yia;
373 xi[2] = zia;
374
375 std::shared_ptr<NekMatrix<NekDouble>> mat =
376 m_util->GetInterpolationMatrix(xi);
377 Vmath::Vcopy(mat->GetRows() * mat->GetColumns(), mat->GetRawPtr(), 1,
378 &interp[0], 1);
379}
std::shared_ptr< NodalUtilTetrahedron > 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::NodalTetEvenlySpaced::Create ( const PointsKey key)
static

Definition at line 393 of file NodalTetEvenlySpaced.cpp.

395{
396 std::shared_ptr<PointsBaseType> returnval(
398
399 returnval->Initialize();
400
401 return returnval;
402}
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 158 of file NodalTetEvenlySpaced.cpp.

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

Definition at line 383 of file NodalTetEvenlySpaced.cpp.

384{
385 // Allocate the derivative matrix.
386 PointsBaseType::v_CalculateDerivMatrix();
387
388 m_derivmatrix[0] = m_util->GetDerivMatrix(0);
389 m_derivmatrix[1] = m_util->GetDerivMatrix(1);
390 m_derivmatrix[2] = m_util->GetDerivMatrix(2);
391}
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::NodalTetEvenlySpaced::v_CalculatePoints ( )
finalprivatevirtual

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

Definition at line 128 of file NodalTetEvenlySpaced.cpp.

129{
130 // Allocate the storage for points
132
133 // Populate m_points
134 size_t npts = GetNumPoints();
135 NekDouble delta = 2.0 / (npts - 1.0);
136 for (size_t z = 0, index = 0; z < npts; ++z)
137 {
138 for (size_t y = 0; y < npts - z; ++y)
139 {
140 for (size_t x = 0; x < npts - z - y; ++x, ++index)
141 {
142 NekDouble xi = -1.0 + x * delta;
143 NekDouble yi = -1.0 + y * delta;
144 NekDouble zi = -1.0 + z * delta;
145
146 m_points[0][index] = xi;
147 m_points[1][index] = yi;
148 m_points[2][index] = zi;
149 }
150 }
151 }
152
155 npts - 1, m_points[0], m_points[1], m_points[2]);
156}
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 ( )
finalprivatevirtual

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

Definition at line 351 of file NodalTetEvenlySpaced.cpp.

352{
353 // Allocate storage for points
355
356 typedef DataType T;
357
358 // Solve the Vandermonde system of integrals for the weight vector
359 NekVector<T> w = m_util->GetWeights();
360 m_weights = Array<OneD, T>(w.GetRows(), w.GetPtr());
361}
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::NodalTetEvenlySpaced::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 NodalTetEvenlySpaced.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(), Nektar::UnitTests::d(), Nektar::LibUtilities::Points< NekDouble >::GetTotNumPoints(), and Nektar::UnitTests::z().

◆ v_GetI() [2/2]

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

Definition at line 60 of file NodalTetEvenlySpaced.h.

61 {
62 ASSERTL0(pkey.GetPointsDim() == 3,
63 "NodalTetEvenlySpaced Points can only interp to other "
64 "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)
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(), 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:168
static std::shared_ptr< PointsBaseType > Create(const PointsKey &key)
@ eNodalTetEvenlySpaced
3D Evenly-spaced points on a Tetrahedron
Definition: PointsType.h:84

Definition at line 87 of file NodalTetEvenlySpaced.h.

◆ m_util

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