35 #include <boost/core/ignore_unused.hpp>
45 namespace LibUtilities
54 bool isVertex(
int t,
int y,
int npts)
56 return (t == 0 && y == 0) || (t == 1 && y == 0) || (t == 2 && y == 0) ||
57 (t == 0 && y == (npts - 1)) || (t == 1 && y == (npts - 1)) ||
58 (t == 2 && y == (npts - 1));
61 bool isEdge_01(
int t,
int y,
int npts)
63 return y == 0 && t > 2 && t <= npts;
66 bool isEdge_12(
int t,
int y,
int npts)
68 boost::ignore_unused(y, npts);
72 bool isEdge_23(
int t,
int y,
int npts)
74 return y == (npts - 1) && t > 2 && t <= npts;
77 bool isEdge_30(
int t,
int y,
int npts)
79 boost::ignore_unused(y, npts);
83 bool isEdge_04(
int t,
int y,
int npts)
85 return y == 0 && t >= 3 + 2 * (npts - 2) && t < 3 + 3 * (npts - 2);
88 bool isEdge_14(
int t,
int y,
int npts)
90 return y == 0 && t >= 3 + (npts - 2) && t < 3 + 2 * (npts - 2);
93 bool isEdge_25(
int t,
int y,
int npts)
95 return y == npts - 1 && t >= 3 + (npts - 2) && t < 3 + 2 * (npts - 2);
98 bool isEdge_35(
int t,
int y,
int npts)
100 return y == npts - 1 && t >= 3 + 2 * (npts - 2) && t < 3 + 3 * (npts - 2);
103 bool isEdge_45(
int t,
int y,
int npts)
105 boost::ignore_unused(y, npts);
109 bool isEdge(
int t,
int y,
int npts)
111 return isEdge_01(t, y, npts) || isEdge_12(t, y, npts) ||
112 isEdge_23(t, y, npts) || isEdge_30(t, y, npts) ||
113 isEdge_04(t, y, npts) || isEdge_14(t, y, npts) ||
114 isEdge_25(t, y, npts) || isEdge_35(t, y, npts) ||
115 isEdge_45(t, y, npts);
118 bool isFace_0123(
int t,
int y,
int npts)
120 boost::ignore_unused(y);
121 return t < 3 + (npts - 2);
124 bool isFace_014(
int t,
int y,
int npts)
126 boost::ignore_unused(t, npts);
130 bool isFace_1254(
int t,
int y,
int npts)
132 boost::ignore_unused(y);
133 return t < 3 + 2 * (npts - 2) && t >= 3 + (npts - 2);
136 bool isFace_325(
int t,
int y,
int npts)
138 boost::ignore_unused(t);
139 return y == (npts - 1);
142 bool isFace_0354(
int t,
int y,
int npts)
144 boost::ignore_unused(y);
145 return t < 3 + 3 * (npts - 2) && t >= 3 + 2 * (npts - 2);
148 bool isFace(
int t,
int y,
int npts)
150 return isFace_0123(t, y, npts) || isFace_014(t, y, npts) ||
151 isFace_1254(t, y, npts) || isFace_325(t, y, npts) ||
152 isFace_0354(t, y, npts);
172 for (
unsigned int y = 0, index = 0; y < npts; y++)
174 for (
size_t t = 0; t < u1.size(); t++, index++)
192 vector<int> iEdge_01;
193 vector<int> iEdge_12;
194 vector<int> iEdge_23;
195 vector<int> iEdge_30;
196 vector<int> iEdge_04;
197 vector<int> iEdge_14;
198 vector<int> iEdge_25;
199 vector<int> iEdge_35;
200 vector<int> iEdge_45;
201 vector<int> iFace_0123;
202 vector<int> iFace_014;
203 vector<int> iFace_1254;
204 vector<int> iFace_325;
205 vector<int> iFace_0354;
206 vector<int> interiorVolumePoints;
210 for (
unsigned int y = 0, index = 0; y < npts; y++)
212 for (
unsigned int t = 0; t < npts * (npts + 1) / 2; t++, index++)
214 if (isVertex(t, y, npts))
216 vertex.push_back(index);
218 else if (isEdge(t, y, npts))
220 if (isEdge_01(t, y, npts))
222 iEdge_01.push_back(index);
224 else if (isEdge_12(t, y, npts))
226 iEdge_12.push_back(index);
228 else if (isEdge_23(t, y, npts))
230 iEdge_23.push_back(index);
232 else if (isEdge_30(t, y, npts))
234 iEdge_30.push_back(index);
236 else if (isEdge_04(t, y, npts))
238 iEdge_04.push_back(index);
240 else if (isEdge_14(t, y, npts))
242 iEdge_14.push_back(index);
244 else if (isEdge_25(t, y, npts))
246 iEdge_25.push_back(index);
248 else if (isEdge_35(t, y, npts))
250 iEdge_35.push_back(index);
252 else if (isEdge_45(t, y, npts))
254 iEdge_45.push_back(index);
257 else if (isFace(t, y, npts))
259 if (isFace_0123(t, y, npts))
261 iFace_0123.push_back(index);
263 else if (isFace_014(t, y, npts))
265 iFace_014.push_back(index);
267 else if (isFace_1254(t, y, npts))
269 iFace_1254.push_back(index);
271 else if (isFace_325(t, y, npts))
273 iFace_325.push_back(index);
275 else if (isFace_0354(t, y, npts))
277 iFace_0354.push_back(index);
282 interiorVolumePoints.push_back(index);
288 std::swap(vertex[2], vertex[4]);
290 std::reverse(iEdge_23.begin(), iEdge_23.end());
291 std::reverse(iEdge_30.begin(), iEdge_30.end());
292 std::reverse(iEdge_04.begin(), iEdge_04.end());
293 std::reverse(iEdge_35.begin(), iEdge_35.end());
296 for (
unsigned int i = 0; i < npts - 2; i++)
298 for (
unsigned int j = i + 1; j < npts - 2; j++)
300 std::swap(iFace_1254[i * (npts - 2) + j],
301 iFace_1254[j * (npts - 2) + i]);
304 for (
int i = 0; i < npts - 2; i++)
306 std::reverse(iFace_0354.begin() + (i * (npts - 2)),
307 iFace_0354.begin() + (i * (npts - 2) + npts - 2));
309 for (
unsigned int i = 0; i < npts - 2; i++)
311 for (
unsigned int j = i + 1; j < npts - 2; j++)
313 std::swap(iFace_0354[i * (npts - 2) + j],
314 iFace_0354[j * (npts - 2) + i]);
318 for (
unsigned int n = 0; n < vertex.size(); ++n)
320 map.push_back(vertex[n]);
323 for (
unsigned int n = 0; n < iEdge_01.size(); ++n)
325 map.push_back(iEdge_01[n]);
328 for (
unsigned int n = 0; n < iEdge_12.size(); ++n)
330 map.push_back(iEdge_12[n]);
333 for (
unsigned int n = 0; n < iEdge_23.size(); ++n)
335 map.push_back(iEdge_23[n]);
338 for (
unsigned int n = 0; n < iEdge_30.size(); ++n)
340 map.push_back(iEdge_30[n]);
343 for (
unsigned int n = 0; n < iEdge_04.size(); ++n)
345 map.push_back(iEdge_04[n]);
348 for (
unsigned int n = 0; n < iEdge_14.size(); ++n)
350 map.push_back(iEdge_14[n]);
353 for (
unsigned int n = 0; n < iEdge_25.size(); ++n)
355 map.push_back(iEdge_25[n]);
358 for (
unsigned int n = 0; n < iEdge_35.size(); ++n)
360 map.push_back(iEdge_35[n]);
363 for (
unsigned int n = 0; n < iEdge_45.size(); ++n)
365 map.push_back(iEdge_45[n]);
368 for (
unsigned int n = 0; n < iFace_0123.size(); ++n)
370 map.push_back(iFace_0123[n]);
373 for (
unsigned int n = 0; n < iFace_014.size(); ++n)
375 map.push_back(iFace_014[n]);
378 for (
unsigned int n = 0; n < iFace_1254.size(); ++n)
380 map.push_back(iFace_1254[n]);
383 for (
unsigned int n = 0; n < iFace_325.size(); ++n)
385 map.push_back(iFace_325[n]);
388 for (
unsigned int n = 0; n < iFace_0354.size(); ++n)
390 map.push_back(iFace_0354[n]);
393 for (
unsigned int n = 0; n < interiorVolumePoints.size(); ++n)
395 map.push_back(interiorVolumePoints[n]);
403 for (
unsigned int index = 0; index < map.size(); ++index)
405 points[0][index] =
m_points[0][index];
406 points[1][index] =
m_points[1][index];
407 points[2][index] =
m_points[2][index];
410 for (
unsigned int index = 0; index < map.size(); ++index)
412 m_points[0][index] = points[0][map[index]];
413 m_points[1][index] = points[1][map[index]];
414 m_points[2][index] = points[2][map[index]];
443 std::shared_ptr<NekMatrix<NekDouble> > mat =
444 m_util->GetInterpolationMatrix(xi);
445 Vmath::Vcopy(mat->GetRows() * mat->GetColumns(), mat->GetRawPtr(), 1,
463 std::shared_ptr<PointsBaseType> returnval(
466 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
void CalculateDerivMatrix()
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)
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 CalculateWeights()
virtual void CalculateDerivMatrix()
unsigned int GetNumPoints() const
virtual void CalculatePoints()
unsigned int GetTotNumPoints() const
Array< OneD, DataType > m_weights
Quadrature weights for the weights.
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)
@ eNodalTriElec
2D Nodal Electrostatic Points on a Triangle
@ eGaussLobattoLegendre
1D Gauss-Lobatto-Legendre quadrature points
@ eNodalPrismElec
3D electrostatically spaced points on a Prism
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)