35#include <boost/core/ignore_unused.hpp>
50bool isVertex(
size_t t,
size_t y,
size_t npts)
52 return (t == 0 && y == 0) || (t == 1 && y == 0) || (t == 2 && y == 0) ||
53 (t == 0 && y == (npts - 1)) || (t == 1 && y == (npts - 1)) ||
54 (t == 2 && y == (npts - 1));
57bool isEdge_01(
size_t t,
size_t y,
size_t npts)
59 return y == 0 && t > 2 && t <= npts;
62bool isEdge_12(
size_t t,
size_t y,
size_t npts)
64 boost::ignore_unused(y, npts);
68bool isEdge_23(
size_t t,
size_t y,
size_t npts)
70 return y == (npts - 1) && t > 2 && t <= npts;
73bool isEdge_30(
size_t t,
size_t y,
size_t npts)
75 boost::ignore_unused(y, npts);
79bool isEdge_04(
size_t t,
size_t y,
size_t npts)
81 return y == 0 && t >= 3 + 2 * (npts - 2) && t < 3 + 3 * (npts - 2);
84bool isEdge_14(
size_t t,
size_t y,
size_t npts)
86 return y == 0 && t >= 3 + (npts - 2) && t < 3 + 2 * (npts - 2);
89bool isEdge_25(
size_t t,
size_t y,
size_t npts)
91 return y == npts - 1 && t >= 3 + (npts - 2) && t < 3 + 2 * (npts - 2);
94bool isEdge_35(
size_t t,
size_t y,
size_t npts)
96 return y == npts - 1 && t >= 3 + 2 * (npts - 2) && t < 3 + 3 * (npts - 2);
99bool isEdge_45(
size_t t,
size_t y,
size_t npts)
101 boost::ignore_unused(y, npts);
105bool isEdge(
size_t t,
size_t y,
size_t npts)
107 return isEdge_01(t, y, npts) || isEdge_12(t, y, npts) ||
108 isEdge_23(t, y, npts) || isEdge_30(t, y, npts) ||
109 isEdge_04(t, y, npts) || isEdge_14(t, y, npts) ||
110 isEdge_25(t, y, npts) || isEdge_35(t, y, npts) ||
111 isEdge_45(t, y, npts);
114bool isFace_0123(
size_t t,
size_t y,
size_t npts)
116 boost::ignore_unused(y);
117 return t < 3 + (npts - 2);
120bool isFace_014(
size_t t,
size_t y,
size_t npts)
122 boost::ignore_unused(t, npts);
126bool isFace_1254(
size_t t,
size_t y,
size_t npts)
128 boost::ignore_unused(y);
129 return t < 3 + 2 * (npts - 2) && t >= 3 + (npts - 2);
132bool isFace_325(
size_t t,
size_t y,
size_t npts)
134 boost::ignore_unused(t);
135 return y == (npts - 1);
138bool isFace_0354(
size_t t,
size_t y,
size_t npts)
140 boost::ignore_unused(y);
141 return t < 3 + 3 * (npts - 2) && t >= 3 + 2 * (npts - 2);
144bool isFace(
size_t t,
size_t y,
size_t npts)
146 return isFace_0123(t, y, npts) || isFace_014(t, y, npts) ||
147 isFace_1254(t, y, npts) || isFace_325(t, y, npts) ||
148 isFace_0354(t, y, npts);
168 for (
size_t y = 0, index = 0; y < npts; y++)
170 for (
size_t t = 0; t < u1.size(); t++, index++)
188 vector<int> iEdge_01;
189 vector<int> iEdge_12;
190 vector<int> iEdge_23;
191 vector<int> iEdge_30;
192 vector<int> iEdge_04;
193 vector<int> iEdge_14;
194 vector<int> iEdge_25;
195 vector<int> iEdge_35;
196 vector<int> iEdge_45;
197 vector<int> iFace_0123;
198 vector<int> iFace_014;
199 vector<int> iFace_1254;
200 vector<int> iFace_325;
201 vector<int> iFace_0354;
202 vector<int> interiorVolumePoints;
206 for (
size_t y = 0, index = 0; y < npts; y++)
208 for (
size_t t = 0; t < npts * (npts + 1) / 2; t++, index++)
210 if (isVertex(t, y, npts))
212 vertex.push_back(index);
214 else if (isEdge(t, y, npts))
216 if (isEdge_01(t, y, npts))
218 iEdge_01.push_back(index);
220 else if (isEdge_12(t, y, npts))
222 iEdge_12.push_back(index);
224 else if (isEdge_23(t, y, npts))
226 iEdge_23.push_back(index);
228 else if (isEdge_30(t, y, npts))
230 iEdge_30.push_back(index);
232 else if (isEdge_04(t, y, npts))
234 iEdge_04.push_back(index);
236 else if (isEdge_14(t, y, npts))
238 iEdge_14.push_back(index);
240 else if (isEdge_25(t, y, npts))
242 iEdge_25.push_back(index);
244 else if (isEdge_35(t, y, npts))
246 iEdge_35.push_back(index);
248 else if (isEdge_45(t, y, npts))
250 iEdge_45.push_back(index);
253 else if (isFace(t, y, npts))
255 if (isFace_0123(t, y, npts))
257 iFace_0123.push_back(index);
259 else if (isFace_014(t, y, npts))
261 iFace_014.push_back(index);
263 else if (isFace_1254(t, y, npts))
265 iFace_1254.push_back(index);
267 else if (isFace_325(t, y, npts))
269 iFace_325.push_back(index);
271 else if (isFace_0354(t, y, npts))
273 iFace_0354.push_back(index);
278 interiorVolumePoints.push_back(index);
284 std::swap(vertex[2], vertex[4]);
286 std::reverse(iEdge_23.begin(), iEdge_23.end());
287 std::reverse(iEdge_30.begin(), iEdge_30.end());
288 std::reverse(iEdge_04.begin(), iEdge_04.end());
289 std::reverse(iEdge_35.begin(), iEdge_35.end());
292 for (
size_t i = 0; i < npts - 2; i++)
294 for (
size_t j = i + 1; j < npts - 2; j++)
296 std::swap(iFace_1254[i * (npts - 2) + j],
297 iFace_1254[j * (npts - 2) + i]);
300 for (
size_t i = 0; i < npts - 2; i++)
302 std::reverse(iFace_0354.begin() + (i * (npts - 2)),
303 iFace_0354.begin() + (i * (npts - 2) + npts - 2));
305 for (
size_t i = 0; i < npts - 2; i++)
307 for (
size_t j = i + 1; j < npts - 2; j++)
309 std::swap(iFace_0354[i * (npts - 2) + j],
310 iFace_0354[j * (npts - 2) + i]);
314 for (
size_t n = 0; n < vertex.size(); ++n)
316 map.push_back(vertex[n]);
319 for (
size_t n = 0; n < iEdge_01.size(); ++n)
321 map.push_back(iEdge_01[n]);
324 for (
size_t n = 0; n < iEdge_12.size(); ++n)
326 map.push_back(iEdge_12[n]);
329 for (
size_t n = 0; n < iEdge_23.size(); ++n)
331 map.push_back(iEdge_23[n]);
334 for (
size_t n = 0; n < iEdge_30.size(); ++n)
336 map.push_back(iEdge_30[n]);
339 for (
size_t n = 0; n < iEdge_04.size(); ++n)
341 map.push_back(iEdge_04[n]);
344 for (
size_t n = 0; n < iEdge_14.size(); ++n)
346 map.push_back(iEdge_14[n]);
349 for (
size_t n = 0; n < iEdge_25.size(); ++n)
351 map.push_back(iEdge_25[n]);
354 for (
size_t n = 0; n < iEdge_35.size(); ++n)
356 map.push_back(iEdge_35[n]);
359 for (
size_t n = 0; n < iEdge_45.size(); ++n)
361 map.push_back(iEdge_45[n]);
364 for (
size_t n = 0; n < iFace_0123.size(); ++n)
366 map.push_back(iFace_0123[n]);
369 for (
size_t n = 0; n < iFace_014.size(); ++n)
371 map.push_back(iFace_014[n]);
374 for (
size_t n = 0; n < iFace_1254.size(); ++n)
376 map.push_back(iFace_1254[n]);
379 for (
size_t n = 0; n < iFace_325.size(); ++n)
381 map.push_back(iFace_325[n]);
384 for (
size_t n = 0; n < iFace_0354.size(); ++n)
386 map.push_back(iFace_0354[n]);
389 for (
size_t n = 0; n < interiorVolumePoints.size(); ++n)
391 map.push_back(interiorVolumePoints[n]);
399 for (
size_t index = 0; index < map.size(); ++index)
401 points[0][index] =
m_points[0][index];
402 points[1][index] =
m_points[1][index];
403 points[2][index] =
m_points[2][index];
406 for (
size_t index = 0; index < map.size(); ++index)
408 m_points[0][index] = points[0][map[index]];
409 m_points[1][index] = points[1][map[index]];
410 m_points[2][index] = points[2][map[index]];
439 std::shared_ptr<NekMatrix<NekDouble>> mat =
440 m_util->GetInterpolationMatrix(xi);
441 Vmath::Vcopy(mat->GetRows() * mat->GetColumns(), mat->GetRawPtr(), 1,
450 PointsBaseType::v_CalculateDerivMatrix();
459 std::shared_ptr<PointsBaseType> returnval(
462 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...
std::shared_ptr< NodalUtilPrism > m_util
virtual void v_CalculateDerivMatrix() override final
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_CalculatePoints() override final
virtual void v_CalculateWeights() override final
static std::shared_ptr< PointsBaseType > Create(const PointsKey &key)
static bool initPointsManager[]
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)
@ eNodalTriElec
2D Nodal Electrostatic Points on a Triangle
@ eGaussLobattoLegendre
1D Gauss-Lobatto-Legendre quadrature points
@ eNodalPrismElec
3D electrostatically spaced points on a Prism
std::vector< double > w(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)