44 namespace LibUtilities
48 bool isVertex(
int t,
int y,
int npts)
50 return (t == 0 && y == 0) || (t == 1 && y == 0) || (t == 2 && y == 0) ||
51 (t == 0 && y == (npts - 1)) || (t == 1 && y == (npts - 1)) ||
52 (t == 2 && y == (npts - 1));
55 bool isEdge_01(
int t,
int y,
int npts)
57 return y == 0 && t > 2 && t <=
npts;
60 bool isEdge_12(
int t,
int y,
int npts)
65 bool isEdge_23(
int t,
int y,
int npts)
67 return y == (npts - 1) && t > 2 && t <= npts;
70 bool isEdge_30(
int t,
int y,
int npts)
75 bool isEdge_04(
int t,
int y,
int npts)
77 return y == 0 && t >= 3 + 2 * (npts - 2) && t < 3 + 3 * (npts - 2);
80 bool isEdge_14(
int t,
int y,
int npts)
82 return y == 0 && t >= 3 + (npts - 2) && t < 3 + 2 * (npts - 2);
85 bool isEdge_25(
int t,
int y,
int npts)
87 return y == npts - 1 && t >= 3 + (npts - 2) && t < 3 + 2 * (npts - 2);
90 bool isEdge_35(
int t,
int y,
int npts)
92 return y == npts - 1 && t >= 3 + 2 * (npts - 2) && t < 3 + 3 * (npts - 2);
95 bool isEdge_45(
int t,
int y,
int npts)
100 bool isEdge(
int t,
int y,
int npts)
102 return isEdge_01(t, y, npts) || isEdge_12(t, y, npts) ||
103 isEdge_23(t, y, npts) || isEdge_30(t, y, npts) ||
104 isEdge_04(t, y, npts) || isEdge_14(t, y, npts) ||
105 isEdge_25(t, y, npts) || isEdge_35(t, y, npts) ||
106 isEdge_45(t, y, npts);
109 bool isFace_0123(
int t,
int y,
int npts)
111 return t < 3 + (npts - 2);
114 bool isFace_014(
int t,
int y,
int npts)
119 bool isFace_1254(
int t,
int y,
int npts)
121 return t < 3 + 2 * (npts - 2) && t >= 3 + (npts - 2);
124 bool isFace_325(
int t,
int y,
int npts)
126 return y == (npts - 1);
129 bool isFace_0354(
int t,
int y,
int npts)
131 return t < 3 + 3 * (npts - 2) && t >= 3 + 2 * (npts - 2);
134 bool isFace(
int t,
int y,
int npts)
136 return isFace_0123(t, y, npts) || isFace_014(t, y, npts) ||
137 isFace_1254(t, y, npts) || isFace_325(t, y, npts) ||
138 isFace_0354(t, y, npts);
158 for (
int y = 0, index = 0; y <
npts; y++)
160 for (
int t = 0; t < u1.num_elements(); t++, index++)
178 vector<int> iEdge_01;
179 vector<int> iEdge_12;
180 vector<int> iEdge_23;
181 vector<int> iEdge_30;
182 vector<int> iEdge_04;
183 vector<int> iEdge_14;
184 vector<int> iEdge_25;
185 vector<int> iEdge_35;
186 vector<int> iEdge_45;
187 vector<int> iFace_0123;
188 vector<int> iFace_014;
189 vector<int> iFace_1254;
190 vector<int> iFace_325;
191 vector<int> iFace_0354;
192 vector<int> interiorVolumePoints;
196 for (
int y = 0, index = 0; y <
npts; y++)
198 for (
int t = 0; t < npts * (npts + 1) / 2; t++, index++)
200 if (isVertex(t, y, npts))
202 vertex.push_back(index);
204 else if (isEdge(t, y, npts))
206 if (isEdge_01(t, y, npts))
208 iEdge_01.push_back(index);
210 else if (isEdge_12(t, y, npts))
212 iEdge_12.push_back(index);
214 else if (isEdge_23(t, y, npts))
216 iEdge_23.push_back(index);
218 else if (isEdge_30(t, y, npts))
220 iEdge_30.push_back(index);
222 else if (isEdge_04(t, y, npts))
224 iEdge_04.push_back(index);
226 else if (isEdge_14(t, y, npts))
228 iEdge_14.push_back(index);
230 else if (isEdge_25(t, y, npts))
232 iEdge_25.push_back(index);
234 else if (isEdge_35(t, y, npts))
236 iEdge_35.push_back(index);
238 else if (isEdge_45(t, y, npts))
240 iEdge_45.push_back(index);
243 else if (isFace(t, y, npts))
245 if (isFace_0123(t, y, npts))
247 iFace_0123.push_back(index);
249 else if (isFace_014(t, y, npts))
251 iFace_014.push_back(index);
253 else if (isFace_1254(t, y, npts))
255 iFace_1254.push_back(index);
257 else if (isFace_325(t, y, npts))
259 iFace_325.push_back(index);
261 else if (isFace_0354(t, y, npts))
263 iFace_0354.push_back(index);
268 interiorVolumePoints.push_back(index);
274 swap(vertex[2], vertex[4]);
276 reverse(iEdge_23.begin(), iEdge_23.end());
277 reverse(iEdge_30.begin(), iEdge_30.end());
278 reverse(iEdge_04.begin(), iEdge_04.end());
279 reverse(iEdge_35.begin(), iEdge_35.end());
282 for (
int i = 0; i < npts - 2; i++)
284 for (
int j = i + 1; j < npts - 2; j++)
286 swap(iFace_1254[i * (npts - 2) + j],
287 iFace_1254[j * (npts - 2) + i]);
290 for (
int i = 0; i < npts - 2; i++)
292 reverse(iFace_0354.begin() + i * (npts - 2),
293 iFace_0354.begin() + i * (npts - 2) + npts - 2);
295 for (
int i = 0; i < npts - 2; i++)
297 for (
int j = i + 1; j < npts - 2; j++)
299 swap(iFace_0354[i * (npts - 2) + j],
300 iFace_0354[j * (npts - 2) + i]);
304 for (
unsigned int n = 0; n < vertex.size(); ++n)
306 map.push_back(vertex[n]);
309 for (
unsigned int n = 0; n < iEdge_01.size(); ++n)
311 map.push_back(iEdge_01[n]);
314 for (
unsigned int n = 0; n < iEdge_12.size(); ++n)
316 map.push_back(iEdge_12[n]);
319 for (
unsigned int n = 0; n < iEdge_23.size(); ++n)
321 map.push_back(iEdge_23[n]);
324 for (
unsigned int n = 0; n < iEdge_30.size(); ++n)
326 map.push_back(iEdge_30[n]);
329 for (
unsigned int n = 0; n < iEdge_04.size(); ++n)
331 map.push_back(iEdge_04[n]);
334 for (
unsigned int n = 0; n < iEdge_14.size(); ++n)
336 map.push_back(iEdge_14[n]);
339 for (
unsigned int n = 0; n < iEdge_25.size(); ++n)
341 map.push_back(iEdge_25[n]);
344 for (
unsigned int n = 0; n < iEdge_35.size(); ++n)
346 map.push_back(iEdge_35[n]);
349 for (
unsigned int n = 0; n < iEdge_45.size(); ++n)
351 map.push_back(iEdge_45[n]);
354 for (
unsigned int n = 0; n < iFace_0123.size(); ++n)
356 map.push_back(iFace_0123[n]);
359 for (
unsigned int n = 0; n < iFace_014.size(); ++n)
361 map.push_back(iFace_014[n]);
364 for (
unsigned int n = 0; n < iFace_1254.size(); ++n)
366 map.push_back(iFace_1254[n]);
369 for (
unsigned int n = 0; n < iFace_325.size(); ++n)
371 map.push_back(iFace_325[n]);
374 for (
unsigned int n = 0; n < iFace_0354.size(); ++n)
376 map.push_back(iFace_0354[n]);
379 for (
unsigned int n = 0; n < interiorVolumePoints.size(); ++n)
381 map.push_back(interiorVolumePoints[n]);
389 for (
unsigned int index = 0; index < map.size(); ++index)
391 points[0][index] =
m_points[0][index];
392 points[1][index] =
m_points[1][index];
393 points[2][index] =
m_points[2][index];
396 for (
unsigned int index = 0; index < map.size(); ++index)
398 m_points[0][index] = points[0][map[index]];
399 m_points[1][index] = points[1][map[index]];
400 m_points[2][index] = points[2][map[index]];
429 boost::shared_ptr<NekMatrix<NekDouble> > mat =
430 m_util->GetInterpolationMatrix(xi);
431 Vmath::Vcopy(mat->GetRows() * mat->GetColumns(), mat->GetRawPtr(), 1,
449 boost::shared_ptr<PointsBaseType> returnval(
452 returnval->Initialize();
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
virtual void CalculatePoints()
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
boost::shared_ptr< NodalUtilPrism > m_util
MatrixSharedPtrType m_derivmatrix[3]
Array< OneD, DataType > m_points[3]
void CalculateInterpMatrix(const Array< OneD, const NekDouble > &xi, const Array< OneD, const NekDouble > &yi, const Array< OneD, const NekDouble > &zi, Array< OneD, NekDouble > &interp)
void CalculateDerivMatrix()
unsigned int GetNumPoints() const
PointsManagerT & PointsManager(void)
Array< OneD, DataType > m_weights
Defines a specification for a set of points.
void NodalPointReorder3d()
virtual void CalculateDerivMatrix()
static boost::shared_ptr< PointsBaseType > Create(const PointsKey &key)
unsigned int GetRows() const
unsigned int GetTotNumPoints() const
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
Array< OneD, DataType > & GetPtr()
1D Gauss-Lobatto-Legendre quadrature points
2D Nodal Electrostatic Points on a Triangle
virtual void CalculateWeights()