36 #ifndef NekMeshUtils_MESHELEMENTS_TRIANGLE
37 #define NekMeshUtils_MESHELEMENTS_TRIANGLE
44 namespace NekMeshUtils
79 int np = ((int)sqrt(8.0 * surfVerts.size() + 1.0) - 1) / 2;
80 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 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.
vector< T > surfVerts
The triangle surface vertices – templated so that this can either be nodes or IDs.
boost::unordered_set< HOSurfSharedPtr, HOSurfHash > HOSurfSet
static LibUtilities::ShapeType m_type
Element type.
Basic information about an element.
A 2-dimensional three-sided element.
boost::shared_ptr< HOSurf > HOSurfSharedPtr
bool operator==(ElmtConfig const &c1, ElmtConfig const &c2)
virtual NEKMESHUTILS_EXPORT void Complete(int order)
Complete this object.
std::size_t operator()(HOSurfSharedPtr const &p) const
void Rotate(int nrot)
Rotates the triangle of data points inside surfVerts counter-clockwise nrot times.
HOTriangle(vector< int > pVertId, vector< T > pSurfVerts)
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.
vector< int > vertId
The triangle vertex IDs.
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.
HOTriangle(vector< int > pVertId)
#define NEKMESHUTILS_EXPORT
void Align(vector< int > vertId)
Align this surface to a given vertex ID.
boost::shared_ptr< Element > ElementSharedPtr
void Reflect()
Reflect data points inside surfVerts.
virtual NEKMESHUTILS_EXPORT ~Triangle()
HOTriangle< NodeSharedPtr > HOSurf
boost::shared_ptr< Geometry > GeometrySharedPtr
Base class for element definitions.