36 #ifndef NEKMESHUTILS_MESHELEMENTS_ALIGNMENT
37 #define NEKMESHUTILS_MESHELEMENTS_ALIGNMENT
41 namespace NekMeshUtils
52 HOTriangle(std::vector<int> pVertId, std::vector<T> pSurfVerts)
76 int np = ((int)sqrt(8.0 * surfVerts.size() + 1.0) - 1) / 2;
77 std::vector<T> tmp(np * np);
79 for (n = 0; n < nrot; ++n)
81 for (cnt = i = 0; i < np; ++i)
83 for (j = 0; j < np - i; ++j, cnt++)
85 tmp[i * np + j] = surfVerts[cnt];
88 for (cnt = i = 0; i < np; ++i)
90 for (j = 0; j < np - i; ++j, cnt++)
92 surfVerts[cnt] = tmp[(np - 1 - i - j) * np + i];
112 int np = ((int)sqrt(8.0 * surfVerts.size() + 1.0) - 1) / 2;
113 std::vector<T> tmp(np * np);
115 for (cnt = i = 0; i < np; ++i)
117 for (j = 0; j < np - i; ++j, cnt++)
119 tmp[i * np + np - i - 1 - j] = surfVerts[cnt];
123 for (cnt = i = 0; i < np; ++i)
125 for (j = 0; j < np - i; ++j, cnt++)
127 surfVerts[cnt] = tmp[i * np + j];
137 if (vertId[0] == this->vertId[0])
139 if (vertId[1] == this->vertId[1] || vertId[1] == this->vertId[2])
141 if (vertId[1] == this->vertId[2])
148 else if (vertId[0] == this->vertId[1])
150 if (vertId[1] == this->vertId[0] || vertId[1] == this->vertId[2])
152 if (vertId[1] == this->vertId[0])
162 else if (vertId[0] == this->vertId[2])
164 if (vertId[1] == this->vertId[0] || vertId[1] == this->vertId[1])
166 if (vertId[1] == this->vertId[1])
186 struct HOSurfHash : std::unary_function<HOSurfSharedPtr, std::size_t>
194 std::size_t seed = 0;
195 std::vector<int> ids = p->vertId;
197 std::sort(ids.begin(), ids.end());
198 for (
int i = 0; i < ids.size(); ++i)
200 boost::hash_combine(seed, ids[i]);
207 HOSurfSharedPtr
const &p2);
209 typedef boost::unordered_set<HOSurfSharedPtr, HOSurfHash>
HOSurfSet;
235 int np = (int)(sqrt((
NekDouble)surfVerts.size()) + 0.5);
236 for (
int i = 0; i < np; ++i)
238 for (
int j = 0; j < np/2; ++j)
240 swap(surfVerts[i*np + j], surfVerts[i*np + np-j-1]);
247 int np = (int)(sqrt((
NekDouble)surfVerts.size()) + 0.5);
249 for (
int j = 0; j < np; ++j)
251 for (
int i = 0; i < np/2; ++i)
253 swap(surfVerts[i*np + j], surfVerts[(np-i-1)*np + j]);
260 int np = (int)(sqrt((
NekDouble)surfVerts.size()) + 0.5);
261 std::vector<T> tmp(surfVerts.size());
263 for (
int i = 0; i < np; ++i)
265 for (
int j = 0; j < np; ++j)
267 tmp[i*np+j] = surfVerts[j*np+i];
280 int vmap[4] = {-1, -1, -1, -1};
283 for (
int i = 0; i < 4; ++i)
285 for (
int j = 0; j < 4; ++j)
287 if (this->vertId[j] == vertId[i])
295 "Could not determine mapping between vertex IDs");
300 if (vmap[1] == (vmap[0]+1) % 4)
boost::unordered_set< HOSurfSharedPtr, HOSurfHash > HOSurfSet
void Align(std::vector< int > vertId)
Align this surface to a given vertex ID.
std::vector< T > surfVerts
The quadrilateral surface vertices – templated so that this can either be nodes or IDs...
boost::shared_ptr< HOSurf > HOSurfSharedPtr
std::vector< int > vertId
The quadrilateral vertex IDs.
std::size_t operator()(HOSurfSharedPtr const &p) const
std::vector< T > surfVerts
The triangle surface vertices – templated so that this can either be nodes or IDs.
std::vector< int > vertId
The triangle vertex IDs.
void Rotate(int nrot)
Rotates the triangle of data points inside surfVerts counter-clockwise nrot times.
HOQuadrilateral(std::vector< int > pVertId)
bool operator==(ElmtConfig const &c1, ElmtConfig const &c2)
Compares two element config structs.
HOTriangle(std::vector< int > pVertId)
void Align(std::vector< int > vertId)
Align this surface to a given vertex ID.
A lightweight struct for dealing with high-order triangle alignment.
A lightweight struct for dealing with high-order quadrilateral alignment.
#define NEKMESHUTILS_EXPORT
HOQuadrilateral(std::vector< int > pVertId, std::vector< T > pSurfVerts)
void Reflect()
Reflect data points inside surfVerts.
HOTriangle(std::vector< int > pVertId, std::vector< T > pSurfVerts)
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
HOTriangle< NodeSharedPtr > HOSurf