35 #include <boost/core/ignore_unused.hpp>
47 namespace LibUtilities
58 bool isVertex(
int x,
int y,
int z,
int npts)
60 return (x == 0 && y == 0 && z == 0) ||
61 (x == (npts - 1) && y == 0 && z == 0) ||
62 (x == 0 && y == (npts - 1) && z == 0) ||
63 (x == 0 && y == 0 && z == (npts - 1));
66 bool isEdge_01(
int x,
int y,
int z,
int npts)
68 boost::ignore_unused(x, npts);
69 return y == 0 && z == 0;
72 bool isEdge_12(
int x,
int y,
int z,
int npts)
74 return z == 0 && x + y == npts - 1;
77 bool isEdge_20(
int x,
int y,
int z,
int npts)
79 boost::ignore_unused(y, npts);
80 return x == 0 && z == 0;
83 bool isEdge_03(
int x,
int y,
int z,
int npts)
85 boost::ignore_unused(z, npts);
86 return x == 0 && y == 0;
89 bool isEdge_13(
int x,
int y,
int z,
int npts)
91 return y == 0 && x + z == npts - 1;
94 bool isEdge_23(
int x,
int y,
int z,
int npts)
96 return x == 0 && y + z == npts - 1;
99 bool isEdge(
int x,
int y,
int z,
int npts)
101 return isEdge_01(x, y, z, npts) || isEdge_12(x, y, z, npts) ||
102 isEdge_20(x, y, z, npts) || isEdge_03(x, y, z, npts) ||
103 isEdge_13(x, y, z, npts) || isEdge_23(x, y, z, npts);
106 bool isFace_012(
int x,
int y,
int z,
int npts)
108 boost::ignore_unused(x, y, npts);
112 bool isFace_013(
int x,
int y,
int z,
int npts)
114 boost::ignore_unused(x, z, npts);
118 bool isFace_123(
int x,
int y,
int z,
int npts)
120 return x + y + z == npts - 1;
123 bool isFace_203(
int x,
int y,
int z,
int npts)
125 boost::ignore_unused(y, z, npts);
129 bool isFace(
int x,
int y,
int z,
int npts)
131 return isFace_012(x, y, z, npts) || isFace_013(x, y, z, npts) ||
132 isFace_123(x, y, z, npts) || isFace_203(x, y, z, npts);
145 for (
unsigned int z = 0, index = 0; z < npts; ++z)
147 for (
unsigned int y = 0; y < npts - z; ++y)
149 for (
unsigned int x = 0; x < npts - z - y; ++x, ++index)
172 vector<int> iEdge_01;
173 vector<int> iEdge_12;
174 vector<int> iEdge_20;
175 vector<int> iEdge_03;
176 vector<int> iEdge_13;
177 vector<int> iEdge_23;
178 vector<int> iFace_012;
179 vector<int> iFace_013;
180 vector<int> iFace_123;
181 vector<int> iFace_203;
182 vector<int> interiorVolumePoints;
186 for (
int z = 0, index = 0; z < npts; ++z)
188 for (
int y = 0; y < npts - z; ++y)
190 for (
int x = 0; x < npts - z - y; ++x, ++index)
193 if (isVertex(x, y, z, npts))
196 vertex.push_back(index);
198 else if (isEdge(x, y, z, npts))
201 if (isEdge_01(x, y, z, npts))
204 iEdge_01.push_back(index);
206 else if (isEdge_12(x, y, z, npts))
209 iEdge_12.push_back(index);
211 else if (isEdge_20(x, y, z, npts))
214 iEdge_20.insert(iEdge_20.begin(), index);
216 else if (isEdge_03(x, y, z, npts))
219 iEdge_03.push_back(index);
221 else if (isEdge_13(x, y, z, npts))
224 iEdge_13.push_back(index);
226 else if (isEdge_23(x, y, z, npts))
229 iEdge_23.push_back(index);
232 else if (isFace(x, y, z, npts))
235 if (isFace_012(x, y, z, npts))
238 iFace_012.push_back(index);
240 else if (isFace_013(x, y, z, npts))
243 iFace_013.push_back(index);
245 else if (isFace_123(x, y, z, npts))
248 iFace_123.push_back(index);
250 else if (isFace_203(x, y, z, npts))
253 iFace_203.push_back(index);
259 interiorVolumePoints.push_back(index);
267 for (
unsigned int n = 0; n < vertex.size(); ++n)
270 map.push_back(vertex[n]);
273 for (
unsigned int n = 0; n < iEdge_01.size(); ++n)
276 map.push_back(iEdge_01[n]);
279 for (
unsigned int n = 0; n < iEdge_12.size(); ++n)
282 map.push_back(iEdge_12[n]);
285 for (
unsigned int n = 0; n < iEdge_20.size(); ++n)
288 map.push_back(iEdge_20[n]);
291 for (
unsigned int n = 0; n < iEdge_03.size(); ++n)
294 map.push_back(iEdge_03[n]);
297 for (
unsigned int n = 0; n < iEdge_13.size(); ++n)
300 map.push_back(iEdge_13[n]);
303 for (
unsigned int n = 0; n < iEdge_23.size(); ++n)
306 map.push_back(iEdge_23[n]);
309 for (
unsigned int n = 0; n < iFace_012.size(); ++n)
312 map.push_back(iFace_012[n]);
315 for (
unsigned int n = 0; n < iFace_013.size(); ++n)
318 map.push_back(iFace_013[n]);
321 for (
unsigned int n = 0; n < iFace_123.size(); ++n)
324 map.push_back(iFace_123[n]);
327 for (
unsigned int n = 0; n < iFace_203.size(); ++n)
330 map.push_back(iFace_203[n]);
333 for (
unsigned int n = 0; n < interiorVolumePoints.size(); ++n)
336 map.push_back(interiorVolumePoints[n]);
343 for (
unsigned int index = 0; index < map.size(); ++index)
346 points[0][index] =
m_points[0][index];
347 points[1][index] =
m_points[1][index];
348 points[2][index] =
m_points[2][index];
351 for (
unsigned int index = 0; index < map.size(); ++index)
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]];
384 std::shared_ptr<NekMatrix<NekDouble>> mat =
385 m_util->GetInterpolationMatrix(xi);
386 Vmath::Vcopy(mat->GetRows() * mat->GetColumns(), mat->GetRawPtr(), 1,
405 std::shared_ptr<PointsBaseType> returnval(
408 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...
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
virtual void v_CalculatePoints() override
virtual void v_CalculateDerivMatrix() override
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()
unsigned int GetNumPoints() const
unsigned int GetTotNumPoints() const
Array< OneD, DataType > m_weights
Quadrature weights for the weights.
virtual void v_CalculateDerivMatrix()
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.
Array< OneD, DataType > & GetPtr()
unsigned int GetRows() const
PointsManagerT & PointsManager(void)
@ eNodalTetEvenlySpaced
3D Evenly-spaced points on a Tetrahedron
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)