47 namespace NekMeshUtils
58 vector<NodeSharedPtr> pNodeList,
60 :
Element(pConf, GetNumNodes(pConf), pNodeList.size())
69 map<pair<int, int>,
int> edgeNodeMap;
71 edgeNodeMap[pair<int, int>(1, 2)] = 5;
72 edgeNodeMap[pair<int, int>(2, 3)] = 5 + n;
73 edgeNodeMap[pair<int, int>(1, 3)] = 5 + 2 * n;
74 edgeNodeMap[pair<int, int>(1, 4)] = 5 + 3 * n;
75 edgeNodeMap[pair<int, int>(2, 4)] = 5 + 4 * n;
76 edgeNodeMap[pair<int, int>(3, 4)] = 5 + 5 * n;
79 for (
int i = 0; i < 4; ++i)
86 for (it = edgeNodeMap.begin(); it != edgeNodeMap.end(); ++it)
88 vector<NodeSharedPtr> edgeNodes;
91 for (
int j = it->second; j < it->second + n; ++j)
93 edgeNodes.push_back(pNodeList[j - 1]);
97 pNodeList[it->first.second - 1],
100 m_edge.back()->m_id = eid++;
113 for (
int i = 0; i < 4; ++i)
120 int face_ids[4][3] = {{0, 1, 2}, {0, 1, 3}, {1, 2, 3}, {0, 2, 3}};
123 int face_edges[4][3];
126 for (
int j = 0; j < 4; ++j)
128 vector<NodeSharedPtr> faceVertices;
129 vector<EdgeSharedPtr> faceEdges;
130 vector<NodeSharedPtr> faceNodes;
135 for (
int k = 0; k < 3; ++k)
137 faceVertices.push_back(
m_vertex[face_ids[j][k]]);
140 for (
unsigned int i = 0; i <
m_edge.size(); ++i)
142 if (((*(
m_edge[i]->m_n1) == *a) &&
143 (*(
m_edge[i]->m_n2) == *b)) ||
144 ((*(
m_edge[i]->m_n1) == *b) && (*(
m_edge[i]->m_n2) == *a)))
146 face_edges[j][k] = i;
147 faceEdges.push_back(
m_edge[i]);
159 const int nFaceNodes = n * (n - 1) / 2;
162 vector<int> faceIds(3);
163 faceIds[0] = faceVertices[0]->m_id;
164 faceIds[1] = faceVertices[1]->m_id;
165 faceIds[2] = faceVertices[2]->m_id;
170 for (
int i = 0; i < 4; ++i)
179 ASSERTL0(origFace >= 0,
"Couldn't find face");
182 int N = 4 + 6 * n + origFace * nFaceNodes;
183 for (
int i = 0; i < nFaceNodes; ++i)
185 faceNodes.push_back(pNodeList[N + i]);
189 vector<int> origFaceIds(3);
190 origFaceIds[0] = pNodeList[face_ids[origFace][0]]->m_id;
191 origFaceIds[1] = pNodeList[face_ids[origFace][1]]->m_id;
192 origFaceIds[2] = pNodeList[face_ids[origFace][2]]->m_id;
197 hoTri.
Align(faceIds);
207 vector<EdgeSharedPtr> tmp(6);
208 tmp[0] =
m_edge[face_edges[0][0]];
209 tmp[1] =
m_edge[face_edges[0][1]];
210 tmp[2] =
m_edge[face_edges[0][2]];
211 tmp[3] =
m_edge[face_edges[1][2]];
212 tmp[4] =
m_edge[face_edges[1][1]];
213 tmp[5] =
m_edge[face_edges[2][1]];
222 for (
int i = 0; i < 4; ++i)
225 m_face[i]->GetGeom(coordDim));
240 return (n + 1) * (n + 2) * (n + 3) / 6;
242 return 4 * (n + 1) * (n + 2) / 2 - 6 * (n + 1) + 4;
244 return 6 * (n + 1) - 8;
279 nodalTet->GetNodalPoints(x, y, z);
307 int nqtot = tet->GetTotPoints();
317 tet->GetCoords(xi, yi, zi);
319 for (i = 0; i < 3; ++i)
322 tet->FwdTrans(alloc + i * nqtot, coeffs);
324 nodalTet->ModalToNodal(coeffs, tmp = alloc + (i + 3) * nqtot);
329 for (i = 0; i < 6; ++i)
331 int pos = 4 + i * (order - 1);
332 m_edge[i]->m_edgeNodes.clear();
333 for (j = 0; j < order - 1; ++j)
336 new Node(0, xo[pos + j], yo[pos + j], zo[pos + j])));
341 for (i = 0; i < 4; ++i)
343 int pos = 4 + 6 * (order - 1) + i * (order - 2) * (order - 1) / 2;
344 m_face[i]->m_faceNodes.clear();
345 for (j = 0; j < (order - 2) * (order - 1) / 2; ++j)
348 new Node(0, xo[pos + j], yo[pos + j], zo[pos + j])));
353 int pos = 4 + 6 * (order - 1) + 4 * (order - 2) * (order - 1) / 2;
354 for (i = pos; i < (order + 1) * (order + 2) * (order + 3) / 6; ++i)
378 return boost::hash_range(p.
nid.begin(), p.
nid.end());
381 typedef boost::unordered_set<struct TetOrient, TetOrientHash>
TetOrientSet;
385 if (a.
nid.size() != b.
nid.size())
390 for (
int i = 0; i < a.
nid.size(); ++i)
416 static int face_ids[4][3] = {{0, 1, 2}, {0, 1, 3}, {1, 2, 3}, {0, 2, 3}};
423 for (
int i = 0; i < 4; ++i)
425 vector<int> nodes(3);
427 nodes[0] =
m_vertex[face_ids[i][0]]->m_id;
428 nodes[1] =
m_vertex[face_ids[i][1]]->m_id;
429 nodes[2] =
m_vertex[face_ids[i][2]]->m_id;
431 sort(nodes.begin(), nodes.end());
433 faces.insert(faceNodes);
438 vector<NodeSharedPtr> origVert =
m_vertex;
461 NekDouble nmag = sqrt(nx * nx + ny * ny + nz * nz);
467 NekDouble dist = cx * nx + cy * ny + cz * nz;
469 if (fabs(dist) <= 1e-4)
471 cerr <<
"Warning: degenerate tetrahedron, 3rd vertex is = " << dist
472 <<
" from face" << endl;
480 nx = (ay * cz - az * cy);
481 ny = (az * cx - ax * cz);
482 nz = (ax * cy - ay * cx);
483 nmag = sqrt(nx * nx + ny * ny + nz * nz);
489 dist = bx * nx + by * ny + bz * nz;
491 if (fabs(dist) <= 1e-4)
493 cerr <<
"Warning: degenerate tetrahedron, 2nd vertex is = " << dist
494 <<
" from face" << endl;
497 nx = (by * cz - bz * cy);
498 ny = (bz * cx - bx * cz);
499 nz = (bx * cy - by * cx);
500 nmag = sqrt(nx * nx + ny * ny + nz * nz);
506 dist = ax * nx + ay * ny + az * nz;
508 if (fabs(dist) <= 1e-4)
510 cerr <<
"Warning: degenerate tetrahedron, 1st vertex is = " << dist
511 <<
" from face" << endl;
518 for (
int i = 0; i < 4; ++i)
520 vector<int> nodes(3);
522 nodes[0] =
m_vertex[face_ids[i][0]]->m_id;
523 nodes[1] =
m_vertex[face_ids[i][1]]->m_id;
524 nodes[2] =
m_vertex[face_ids[i][2]]->m_id;
525 sort(nodes.begin(), nodes.end());
529 it = faces.find(faceNodes);
532 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...
#define ASSERTL0(condition, msg)
Basic information about an element.
LibUtilities::PointsType m_faceCurveType
Distribution of points in faces.
Represents an edge which joins two points.
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
void Align(std::vector< int > vertId)
Align this surface to a given vertex ID.
Represents a face comprised of three or more edges.
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.
ElementFactory & GetElementFactory()
ElmtConfig m_conf
Contains configuration of the element.
boost::shared_ptr< TetExp > TetExpSharedPtr
Represents a point in the domain.
std::vector< int > m_taglist
List of integers specifying properties of the element.
Gauss Radau pinned at x=-1, .
bool operator==(ElmtConfig const &c1, ElmtConfig const &c2)
std::size_t operator()(struct TetOrient const &p) const
LibUtilities::PointsType m_edgeCurveType
Distribution of points in edges.
unsigned int m_order
Order of the element.
Principle Orthogonal Functions .
boost::unordered_set< struct TetOrient, TetOrientHash > TetOrientSet
std::vector< NodeSharedPtr > m_vertex
List of element vertex nodes.
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.
Principle Orthogonal Functions .
boost::shared_ptr< Node > NodeSharedPtr
Principle Orthogonal Functions .
Defines a specification for a set of points.
std::vector< NodeSharedPtr > m_volumeNodes
List of element volume nodes.
boost::shared_ptr< StdNodalTetExp > StdNodalTetExpSharedPtr
void OrientTet()
Orient tetrahedron to align degenerate vertices.
3D Evenly-spaced points on a Tetrahedron
A lightweight struct for dealing with high-order triangle alignment.
std::string m_tag
Tag character describing the element.
boost::shared_ptr< Edge > EdgeSharedPtr
Shared pointer to an edge.
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator
static NEKMESHUTILS_EXPORT unsigned int GetNumNodes(ElmtConfig pConf)
Return the number of nodes defining a tetrahedron.
unsigned int m_id
ID of the element.
Gauss Radau pinned at x=-1, .
boost::shared_ptr< TetGeom > TetGeomSharedPtr
boost::shared_ptr< TriGeom > TriGeomSharedPtr
std::vector< FaceSharedPtr > m_face
List of element faces.
bool m_reorient
Denotes whether the element needs to be re-orientated for a spectral element framework.
boost::shared_ptr< Face > FaceSharedPtr
Shared pointer to a face.
boost::shared_ptr< Geometry > GeometrySharedPtr
virtual NEKMESHUTILS_EXPORT void Complete(int order)
Describes the specification for a Basis.
1D Gauss-Lobatto-Legendre quadrature points
TetOrient(vector< int > nid, int fid)
Base class for element definitions.
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, tDescription pDesc="")
Register a class with the factory.