35#include <boost/core/ignore_unused.hpp>
53bool isVertex(
size_t x,
size_t y,
size_t z,
size_t npts)
55 return (x == 0 && y == 0 &&
z == 0) ||
56 (x == (npts - 1) && y == 0 &&
z == 0) ||
57 (x == 0 && y == (npts - 1) &&
z == 0) ||
58 (x == 0 && y == 0 &&
z == (npts - 1));
61bool isEdge_01(
size_t x,
size_t y,
size_t z,
size_t npts)
63 boost::ignore_unused(x, npts);
64 return y == 0 &&
z == 0;
67bool isEdge_12(
size_t x,
size_t y,
size_t z,
size_t npts)
69 return z == 0 && x + y == npts - 1;
72bool isEdge_20(
size_t x,
size_t y,
size_t z,
size_t npts)
74 boost::ignore_unused(y, npts);
75 return x == 0 &&
z == 0;
78bool isEdge_03(
size_t x,
size_t y,
size_t z,
size_t npts)
80 boost::ignore_unused(
z, npts);
81 return x == 0 && y == 0;
84bool isEdge_13(
size_t x,
size_t y,
size_t z,
size_t npts)
86 return y == 0 && x +
z == npts - 1;
89bool isEdge_23(
size_t x,
size_t y,
size_t z,
size_t npts)
91 return x == 0 && y +
z == npts - 1;
94bool isEdge(
size_t x,
size_t y,
size_t z,
size_t npts)
96 return isEdge_01(x, y,
z, npts) || isEdge_12(x, y,
z, npts) ||
97 isEdge_20(x, y,
z, npts) || isEdge_03(x, y,
z, npts) ||
98 isEdge_13(x, y,
z, npts) || isEdge_23(x, y,
z, npts);
101bool isFace_012(
size_t x,
size_t y,
size_t z,
size_t npts)
103 boost::ignore_unused(x, y, npts);
107bool isFace_013(
size_t x,
size_t y,
size_t z,
size_t npts)
109 boost::ignore_unused(x,
z, npts);
113bool isFace_123(
size_t x,
size_t y,
size_t z,
size_t npts)
115 return x + y +
z == npts - 1;
118bool isFace_203(
size_t x,
size_t y,
size_t z,
size_t npts)
120 boost::ignore_unused(y,
z, npts);
124bool isFace(
size_t x,
size_t y,
size_t z,
size_t npts)
126 return isFace_012(x, y,
z, npts) || isFace_013(x, y,
z, npts) ||
127 isFace_123(x, y,
z, npts) || isFace_203(x, y,
z, npts);
140 for (
size_t z = 0, index = 0;
z < npts; ++
z)
142 for (
size_t y = 0; y < npts -
z; ++y)
144 for (
size_t x = 0; x < npts -
z - y; ++x, ++index)
167 vector<int> iEdge_01;
168 vector<int> iEdge_12;
169 vector<int> iEdge_20;
170 vector<int> iEdge_03;
171 vector<int> iEdge_13;
172 vector<int> iEdge_23;
173 vector<int> iFace_012;
174 vector<int> iFace_013;
175 vector<int> iFace_123;
176 vector<int> iFace_203;
177 vector<int> interiorVolumePoints;
181 for (
size_t z = 0, index = 0;
z < npts; ++
z)
183 for (
size_t y = 0; y < npts -
z; ++y)
185 for (
size_t x = 0; x < npts -
z - y; ++x, ++index)
188 if (isVertex(x, y,
z, npts))
191 vertex.push_back(index);
193 else if (isEdge(x, y,
z, npts))
196 if (isEdge_01(x, y,
z, npts))
199 iEdge_01.push_back(index);
201 else if (isEdge_12(x, y,
z, npts))
204 iEdge_12.push_back(index);
206 else if (isEdge_20(x, y,
z, npts))
209 iEdge_20.insert(iEdge_20.begin(), index);
211 else if (isEdge_03(x, y,
z, npts))
214 iEdge_03.push_back(index);
216 else if (isEdge_13(x, y,
z, npts))
219 iEdge_13.push_back(index);
221 else if (isEdge_23(x, y,
z, npts))
224 iEdge_23.push_back(index);
227 else if (isFace(x, y,
z, npts))
230 if (isFace_012(x, y,
z, npts))
233 iFace_012.push_back(index);
235 else if (isFace_013(x, y,
z, npts))
238 iFace_013.push_back(index);
240 else if (isFace_123(x, y,
z, npts))
243 iFace_123.push_back(index);
245 else if (isFace_203(x, y,
z, npts))
248 iFace_203.push_back(index);
254 interiorVolumePoints.push_back(index);
262 for (
size_t n = 0; n < vertex.size(); ++n)
265 map.push_back(vertex[n]);
268 for (
size_t n = 0; n < iEdge_01.size(); ++n)
271 map.push_back(iEdge_01[n]);
274 for (
size_t n = 0; n < iEdge_12.size(); ++n)
277 map.push_back(iEdge_12[n]);
280 for (
size_t n = 0; n < iEdge_20.size(); ++n)
283 map.push_back(iEdge_20[n]);
286 for (
size_t n = 0; n < iEdge_03.size(); ++n)
289 map.push_back(iEdge_03[n]);
292 for (
size_t n = 0; n < iEdge_13.size(); ++n)
295 map.push_back(iEdge_13[n]);
298 for (
size_t n = 0; n < iEdge_23.size(); ++n)
301 map.push_back(iEdge_23[n]);
304 for (
size_t n = 0; n < iFace_012.size(); ++n)
307 map.push_back(iFace_012[n]);
310 for (
size_t n = 0; n < iFace_013.size(); ++n)
313 map.push_back(iFace_013[n]);
316 for (
size_t n = 0; n < iFace_123.size(); ++n)
319 map.push_back(iFace_123[n]);
322 for (
size_t n = 0; n < iFace_203.size(); ++n)
325 map.push_back(iFace_203[n]);
328 for (
size_t n = 0; n < interiorVolumePoints.size(); ++n)
331 map.push_back(interiorVolumePoints[n]);
338 for (
size_t index = 0; index < map.size(); ++index)
341 points[0][index] =
m_points[0][index];
342 points[1][index] =
m_points[1][index];
343 points[2][index] =
m_points[2][index];
346 for (
size_t index = 0; index < map.size(); ++index)
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]];
379 std::shared_ptr<NekMatrix<NekDouble>> mat =
380 m_util->GetInterpolationMatrix(xi);
381 Vmath::Vcopy(mat->GetRows() * mat->GetColumns(), mat->GetRawPtr(), 1,
390 PointsBaseType::v_CalculateDerivMatrix();
400 std::shared_ptr<PointsBaseType> returnval(
403 returnval->Initialize();
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...
virtual void v_CalculateDerivMatrix() override final
static bool initPointsManager[]
std::shared_ptr< NodalUtilTetrahedron > m_util
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)
virtual void v_CalculateWeights() override final
virtual void v_CalculatePoints() override final
static std::shared_ptr< PointsBaseType > Create(const PointsKey &key)
Array< OneD, DataType > m_points[3]
Storage for the point locations, allowing for up to a 3D points storage.
MatrixSharedPtrType m_derivmatrix[3]
Derivative matrices.
virtual void v_CalculatePoints()
size_t GetNumPoints() const
size_t GetTotNumPoints() const
Array< OneD, DataType > m_weights
Quadrature weights for the weights.
virtual void v_CalculateWeights()
Defines a specification for a set of points.
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
PointsManagerT & PointsManager(void)
@ eNodalTetEvenlySpaced
3D Evenly-spaced points on a Tetrahedron
std::vector< double > w(NPUPPER)
std::vector< double > z(NPUPPER)
The above copyright notice and this permission notice shall be included.
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)