49 namespace NekMeshUtils
57 int Tetrahedron::m_edgeVertMap[6][2] = {
58 {0, 1}, {1, 2}, {0, 2}, {0, 3}, {1, 3}, {2, 3}
62 int Tetrahedron::m_faceVertMap[4][3] = {
63 {0, 1, 2}, {0, 1, 3}, {1, 2, 3}, {0, 2, 3}
67 int Tetrahedron::m_faceEdgeMap[4][3] = {
68 {0, 1, 2}, {0, 4, 3}, {1, 5, 4}, {2, 5, 3}
75 vector<NodeSharedPtr> pNodeList,
77 :
Element(pConf, GetNumNodes(pConf), pNodeList.size())
86 for (
int i = 0; i < 4; ++i)
101 for (
int i = 0; i < 4; ++i)
110 for (
int i = 0; i < 6; ++i)
112 std::vector<NodeSharedPtr> edgeNodes(n);
116 for (
int j = 0; j < 6; ++j)
133 for (
int j = 0; j < n; ++j)
135 edgeNodes[j] = pNodeList[4 + origEdge * n + j];
139 m_edge[i] = std::make_shared<Edge>(
147 m_edge[i] = std::make_shared<Edge>(
158 for (
int j = 0; j < 4; ++j)
160 vector<NodeSharedPtr> faceVertices(3);
161 vector<EdgeSharedPtr> faceEdges(3);
162 vector<NodeSharedPtr> faceNodes;
164 for (
int k = 0; k < 3; ++k)
176 const int nFaceNodes = n * (n - 1) / 2;
179 vector<int> faceVertIds(3);
180 faceVertIds[0] = faceVertices[0]->m_id;
181 faceVertIds[1] = faceVertices[1]->m_id;
182 faceVertIds[2] = faceVertices[2]->m_id;
187 for (
int i = 0; i < 4; ++i)
196 ASSERTL0(origFace >= 0,
"Couldn't find face");
199 int N = 4 + 6 * n + origFace * nFaceNodes;
200 for (
int i = 0; i < nFaceNodes; ++i)
202 faceNodes.push_back(pNodeList[N + i]);
206 vector<int> origFaceIds(3);
207 origFaceIds[0] = pNodeList[
m_faceVertMap[origFace][0]]->m_id;
208 origFaceIds[1] = pNodeList[
m_faceVertMap[origFace][1]]->m_id;
209 origFaceIds[2] = pNodeList[
m_faceVertMap[origFace][2]]->m_id;
214 hoTri.
Align(faceVertIds);
220 m_face[j] = std::make_shared<Face>(
226 const int nFaceNodes = n * (n - 1) / 2;
227 for (
int i = 4 + 6 * n + 4 * nFaceNodes; i < pNodeList.size(); ++i)
239 for (
int i = 0; i < 4; ++i)
242 m_face[i]->GetGeom(coordDim));
265 ASSERTL1(
false,
"Edge is not connected to this quadrilateral.");
282 if (order == 1 || order == 2)
307 int nPoints = order + 1;
317 for (
int i = 0; i < coordDim; ++i)
320 xmap->BwdTrans(geom->GetCoeffs(i), phys[i]);
323 const int nTetPts = nPoints * (nPoints + 1) * (nPoints + 2) / 6;
324 const int nTetIntPts = (nPoints - 4) * (nPoints - 3) * (nPoints - 2) / 6;
327 for (
int i = nTetPts - nTetIntPts, cnt = 0; i < nTetPts; ++i, ++cnt)
335 for (
int j = 0; j < coordDim; ++j)
337 x[j] = xmap->PhysEvaluate(xp, phys[j]);
341 id++, x[0], x[1], x[2]);
352 return (n + 1) * (n + 2) * (n + 3) / 6;
354 return 4 * (n + 1) * (n + 2) / 2 - 6 * (n + 1) + 4;
356 return 6 * (n + 1) - 8;
361 int n =
m_edge[0]->GetNodeCount();
362 nodeList.resize(n*(n+1)*(n+2)/6);
370 for(
int i = 0; i < 6; i++)
372 bool reverseEdge =
false;
384 for(
int j = 0; j < n-2; j++)
386 nodeList[k++] =
m_edge[i]->m_edgeNodes[j];
391 for(
int j = n-3; j >= 0; j--)
393 nodeList[k++] =
m_edge[i]->m_edgeNodes[j];
398 vector<vector<int> > ts;
417 for(
int i = 0; i < 4; i++)
420 fcid.push_back(
m_face[i]->m_vertexList[0]->
m_id);
421 fcid.push_back(
m_face[i]->m_vertexList[1]->
m_id);
422 fcid.push_back(
m_face[i]->m_vertexList[2]->
m_id);
430 nodeList.begin() + k);
436 nodeList.begin() + k);
445 #define SWAP(a,b) if (a > b) std::swap(a,b); 470 int orig_faces[4][3];
471 for (
int i = 0; i < 4; ++i)
476 sort3(v0id, v1id, v2id);
477 orig_faces[i][0] = v0id;
478 orig_faces[i][1] = v1id;
479 orig_faces[i][2] = v2id;
484 vector<NodeSharedPtr> origVert =
m_vertex;
507 NekDouble nmag = sqrt(nx * nx + ny * ny + nz * nz);
515 NekDouble dist = cx * nx + cy * ny + cz * nz;
517 if (fabs(dist) / area <= 1e-4 )
519 cerr <<
"Warning: degenerate tetrahedron, 3rd vertex is = " << dist
520 <<
" from face" << endl;
528 nx = (ay * cz - az * cy);
529 ny = (az * cx - ax * cz);
530 nz = (ax * cy - ay * cx);
531 nmag = sqrt(nx * nx + ny * ny + nz * nz);
539 dist = bx * nx + by * ny + bz * nz;
541 if (fabs(dist) / area <= 1e-4)
543 cerr <<
"Warning: degenerate tetrahedron, 2nd vertex is = " << dist
544 <<
" from face" << endl;
547 nx = (by * cz - bz * cy);
548 ny = (bz * cx - bx * cz);
549 nz = (bx * cy - by * cx);
550 nmag = sqrt(nx * nx + ny * ny + nz * nz);
558 dist = ax * nx + ay * ny + az * nz;
560 if (fabs(dist) / area <= 1e-4)
562 cerr <<
"Warning: degenerate tetrahedron, 1st vertex is = " << dist
563 <<
" from face" << endl;
568 for (
int i = 0; i < 4; ++i)
573 sort3(v0id, v1id, v2id);
575 for (
int j = 0; j < 4; ++j)
577 if (v0id == orig_faces[j][0] && v1id == orig_faces[j][1] &&
578 v2id == orig_faces[j][2])
585 for (
int j = 0; j < 4; ++j)
bool m_faceNodes
Denotes whether the element contains face nodes. For 2D elements, if this is true then the element co...
static int m_faceEdgeMap[4][3]
Local edges that make up each tetrahedral face.
#define ASSERTL0(condition, msg)
Basic information about an element.
LibUtilities::PointsType m_faceCurveType
Distribution of points in faces.
static int m_faceVertMap[4][3]
Local vertices that make up each tetrahedral face.
virtual NEKMESHUTILS_EXPORT StdRegions::Orientation GetEdgeOrient(int edgeId, EdgeSharedPtr edge)
Get the edge orientation of edge with respect to the local element, which lies at edge index edgeId...
void Align(std::vector< int > vertId)
Align this surface to a given vertex ID.
std::shared_ptr< TetGeom > TetGeomSharedPtr
virtual NEKMESHUTILS_EXPORT SpatialDomains::GeometrySharedPtr GetGeom(int coordDim)
Generate a Nektar++ geometry object for this element.
std::vector< T > surfVerts
The triangle surface vertices – templated so that this can either be nodes or IDs.
unsigned int GetPointsDim() const
std::shared_ptr< Edge > EdgeSharedPtr
Shared pointer to an edge.
static int m_edgeVertMap[6][2]
Local vertices that make up each tetrahedral edge.
ElementFactory & GetElementFactory()
ElmtConfig m_conf
Contains configuration of the element.
std::vector< int > m_taglist
List of integers specifying properties of the element.
LibUtilities::PointsType m_edgeCurveType
Distribution of points in edges.
unsigned int m_order
Order of the element.
std::shared_ptr< StdExpansion > StdExpansionSharedPtr
std::vector< NodeSharedPtr > m_vertex
List of element vertex nodes.
std::shared_ptr< TriGeom > TriGeomSharedPtr
unsigned int m_dim
Dimension of the element.
bool m_volumeNodes
Denotes whether the element contains volume (i.e. interior) nodes. These are not supported by either ...
std::vector< EdgeSharedPtr > m_edge
List of element edges.
std::shared_ptr< Geometry > GeometrySharedPtr
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
virtual NEKMESHUTILS_EXPORT void GetCurvedNodes(std::vector< NodeSharedPtr > &nodeList) const
get list of volume interior nodes
PointsManagerT & PointsManager(void)
Defines a specification for a set of points.
std::vector< NodeSharedPtr > m_volumeNodes
List of element volume nodes.
void OrientTet()
Orient tetrahedron to align degenerate vertices.
A lightweight struct for dealing with high-order triangle alignment.
std::string m_tag
Tag character describing the element.
static NEKMESHUTILS_EXPORT unsigned int GetNumNodes(ElmtConfig pConf)
Return the number of nodes defining a tetrahedron.
unsigned int m_id
ID of the element.
virtual NEKMESHUTILS_EXPORT void MakeOrder(int order, SpatialDomains::GeometrySharedPtr geom, LibUtilities::PointsType pType, int coordDim, int &id, bool justConfig=false)
Insert interior (i.e. volume) points into this element to make the geometry an order order representa...
LibUtilities::PointsType m_curveType
Volume curve type.
std::vector< FaceSharedPtr > m_face
List of element faces.
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
bool m_reorient
Denotes whether the element needs to be re-orientated for a spectral element framework.
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
void sort3(K &x, K &y, K &z)
Helper function to sort 3 numbers using sorting network.
Base class for element definitions.