36 #ifndef NekMeshUtils_MESHELEMENTS_TRIANGLE
37 #define NekMeshUtils_MESHELEMENTS_TRIANGLE
44 namespace NekMeshUtils
55 HOTriangle(std::vector<int> pVertId, std::vector<T> pSurfVerts)
79 int np = ((int)sqrt(8.0 * surfVerts.size() + 1.0) - 1) / 2;
80 std::vector<T> tmp(np * np);
82 for (n = 0; n < nrot; ++n)
84 for (cnt = i = 0; i < np; ++i)
86 for (j = 0; j < np - i; ++j, cnt++)
88 tmp[i * np + j] = surfVerts[cnt];
91 for (cnt = i = 0; i < np; ++i)
93 for (j = 0; j < np - i; ++j, cnt++)
95 surfVerts[cnt] = tmp[(np - 1 - i - j) * np + i];
115 int np = ((int)sqrt(8.0 * surfVerts.size() + 1.0) - 1) / 2;
116 std::vector<T> tmp(np * np);
118 for (cnt = i = 0; i < np; ++i)
120 for (j = 0; j < np - i; ++j, cnt++)
122 tmp[i * np + np - i - 1 - j] = surfVerts[cnt];
126 for (cnt = i = 0; i < np; ++i)
128 for (j = 0; j < np - i; ++j, cnt++)
130 surfVerts[cnt] = tmp[i * np + j];
140 if (vertId[0] == this->vertId[0])
142 if (vertId[1] == this->vertId[1] || vertId[1] == this->vertId[2])
144 if (vertId[1] == this->vertId[2])
151 else if (vertId[0] == this->vertId[1])
153 if (vertId[1] == this->vertId[0] || vertId[1] == this->vertId[2])
155 if (vertId[1] == this->vertId[0])
165 else if (vertId[0] == this->vertId[2])
167 if (vertId[1] == this->vertId[0] || vertId[1] == this->vertId[1])
169 if (vertId[1] == this->vertId[1])
191 std::vector<NodeSharedPtr> pNodeList,
192 std::vector<int> pTagList)
194 return boost::shared_ptr<Element>(
195 new Triangle(pConf, pNodeList, pTagList));
201 std::vector<NodeSharedPtr> pNodeList,
202 std::vector<int> pTagList);
221 struct HOSurfHash : std::unary_function<HOSurfSharedPtr, std::size_t>
229 std::size_t seed = 0;
230 std::vector<int> ids = p->vertId;
232 std::sort(ids.begin(), ids.end());
233 for (
int i = 0; i < ids.size(); ++i)
235 boost::hash_combine(seed, ids[i]);
242 HOSurfSharedPtr
const &p2);
244 typedef boost::unordered_set<HOSurfSharedPtr, HOSurfHash>
HOSurfSet;
virtual NEKMESHUTILS_EXPORT SpatialDomains::GeometrySharedPtr GetGeom(int coordDim)
Generate a Nektar++ geometry object for this element.
boost::unordered_set< HOSurfSharedPtr, HOSurfHash > HOSurfSet
static LibUtilities::ShapeType m_type
Element type.
Basic information about an element.
void Align(std::vector< int > vertId)
Align this surface to a given vertex ID.
A 2-dimensional three-sided element.
boost::shared_ptr< HOSurf > HOSurfSharedPtr
virtual NEKMESHUTILS_EXPORT void Complete(int order)
Complete this object.
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.
bool operator==(ElmtConfig const &c1, ElmtConfig const &c2)
NEKMESHUTILS_EXPORT Triangle(ElmtConfig pConf, std::vector< NodeSharedPtr > pNodeList, std::vector< int > pTagList)
Create a triangle element.
static ElementSharedPtr create(ElmtConfig pConf, std::vector< NodeSharedPtr > pNodeList, std::vector< int > pTagList)
Creates an instance of this class.
HOTriangle(std::vector< int > pVertId)
static NEKMESHUTILS_EXPORT unsigned int GetNumNodes(ElmtConfig pConf)
Return the number of nodes defining a triangle.
A lightweight struct for dealing with high-order triangle alignment.
#define NEKMESHUTILS_EXPORT
boost::shared_ptr< Element > ElementSharedPtr
void Reflect()
Reflect data points inside surfVerts.
virtual NEKMESHUTILS_EXPORT ~Triangle()
HOTriangle(std::vector< int > pVertId, std::vector< T > pSurfVerts)
HOTriangle< NodeSharedPtr > HOSurf
boost::shared_ptr< Geometry > GeometrySharedPtr
Base class for element definitions.