52 typedef std::pair<int, int>
ipair;
57 ProcessTetSplit::create,
58 "Split prismatic elements to tetrahedra");
63 ConfigOption(
false,
"3",
"Number of points in high order elements.");
72 int nodeId =
m_mesh->m_vertexSet.size();
79 map<ipair, ipair> edgeMap;
83 int nft = (ne - 1) * ne / 2;
101 edgeMap[
ipair(1, 3)] =
ipair(o + ne - 1, ne - 1);
106 edgeMap[
ipair(2, 4)] =
ipair(o + ne - 1, ne - 1);
111 edgeMap[
ipair(3, 4)] =
ipair(o + ne - 1, ne - 1);
132 static int indir[6][6] = {{0, 1, 2, 3, 4, 5},
142 static int prismTet[6][4] = {{0, 1, 2, 5},
150 static int tetEdges[6][2] = {
151 {0, 1}, {1, 2}, {0, 2}, {0, 3}, {1, 3}, {2, 3}};
154 static int tetFaceNodes[4][3] = {
155 {0, 1, 2}, {0, 1, 3}, {1, 2, 3}, {0, 2, 3}};
171 vector<ElementSharedPtr> el =
m_mesh->m_element[
m_mesh->m_expDim];
174 for (
int i = 0; i < el.size(); ++i)
182 vector<NodeSharedPtr> nodeList(6);
186 int mapPrism[6] = {0, 1, 4, 3, 2, 5};
187 for (
int j = 0; j < 6; ++j)
189 nodeList[j] = el[i]->GetVertex(mapPrism[j]);
193 int minElId = nodeList[0]->m_id;
195 for (
int j = 1; j < 6; ++j)
197 int curId = nodeList[j]->m_id;
208 int id1 = min(nodeList[indir[minId][1]]->m_id,
209 nodeList[indir[minId][5]]->m_id);
210 int id2 = min(nodeList[indir[minId][2]]->m_id,
211 nodeList[indir[minId][4]]->m_id);
223 cerr <<
"Connectivity issue with prism->tet splitting." << endl;
231 el[i]->GetGeom(
m_mesh->m_spaceDim));
242 B0, B0, B1, geomLayer);
248 x[1] = wsp + 1 * nq * nq * nq;
249 x[2] = wsp + 2 * nq * nq * nq;
250 qs->GetCoords(x[0], x[1], x[2]);
263 int nCoeffs = nodalPrism->GetNcoeffs();
267 xn[1] = wsp2 + 1 * nCoeffs;
268 xn[2] = wsp2 + 2 * nCoeffs;
270 for (
int j = 0; j < 3; ++j)
273 qs->FwdTrans(x[j], tmp);
274 nodalPrism->ModalToNodal(tmp, xn[j]);
278 map<int, int> prismVerts;
279 for (
int j = 0; j < 6; ++j)
281 prismVerts[el[i]->GetVertex(j)->m_id] = j;
284 for (
int j = 0; j < 3; ++j)
286 vector<NodeSharedPtr> tetNodes(4);
289 for (
int k = 0; k < 4; ++k)
291 tetNodes[k] = nodeList[indir[minId][prismTet[j + offset][k]]];
295 for (
int k = 0; k < 6; ++k)
302 [indir[minId][prismTet[j + offset][tetEdges[k][0]]]];
304 [indir[minId][prismTet[j + offset][tetEdges[k][1]]]];
307 auto it = edgeMap.find(pair<int, int>(n1, n2));
308 if (it == edgeMap.end())
310 it = edgeMap.find(pair<int, int>(n2, n1));
311 if (it == edgeMap.end())
313 cerr <<
"Couldn't find prism edges " << n1 <<
" " << n2
318 for (
int l = ne - 1; l >= 0; --l)
320 int pos = it->second.first + l * it->second.second;
322 nodeId++, xn[0][pos], xn[1][pos], xn[2][pos])));
328 for (
int l = 0; l < ne; ++l)
330 int pos = it->second.first + l * it->second.second;
332 nodeId++, xn[0][pos], xn[1][pos], xn[2][pos])));
338 vector<int> tags = el[i]->GetTagList();
344 for (
int k = 0; k < 4; ++k)
349 vector<NodeSharedPtr> triNodes(3);
351 for (
int l = 0; l < 3; ++l)
354 triNodes[l] = stdPrismNodes[prismVerts[v->m_id]];
368 for (
int l = 0; l < nft; ++l)
373 tmp2[0] = triGeom->GetCoord(0, tmp1);
374 tmp2[1] = triGeom->GetCoord(1, tmp1);
375 tmp2[2] = triGeom->GetCoord(2, tmp1);
378 NekDouble xc = geomLayer->GetCoord(0, tmp2);
379 NekDouble yc = geomLayer->GetCoord(1, tmp2);
380 NekDouble zc = geomLayer->GetCoord(2, tmp2);
381 face->m_faceNodes.push_back(
397 for (
int fid = 0; fid < 5; fid += 2)
399 int bl = el[i]->GetBoundaryLink(fid);
406 vector<NodeSharedPtr> triNodeList(3);
407 vector<int> faceNodes(3);
415 tagBE =
m_mesh->m_element[
m_mesh->m_expDim - 1][bl]->GetTagList();
418 for (
int j = 0; j < 3; ++j)
421 for (
int k = 0; k < 4; ++k)
425 for (
int l = 0; l < 3; ++l)
427 faceNodes[l] = mapPrism
429 [prismTet[j + offset][tetFaceNodes[k][l]]]];
433 sort(faceNodes.begin(), faceNodes.end());
437 if ((fid == 0 && ((faceNodes[0] == 0 && faceNodes[1] == 1 &&
438 faceNodes[2] == 2) ||
439 (faceNodes[0] == 0 && faceNodes[1] == 2 &&
440 faceNodes[2] == 3) ||
441 (faceNodes[0] == 0 && faceNodes[1] == 1 &&
442 faceNodes[2] == 3) ||
443 (faceNodes[0] == 1 && faceNodes[1] == 2 &&
444 faceNodes[2] == 3))) ||
445 (fid == 2 && ((faceNodes[0] == 1 && faceNodes[1] == 2 &&
446 faceNodes[2] == 5) ||
447 (faceNodes[0] == 1 && faceNodes[1] == 4 &&
448 faceNodes[2] == 5) ||
449 (faceNodes[0] == 1 && faceNodes[1] == 2 &&
450 faceNodes[2] == 4) ||
451 (faceNodes[0] == 2 && faceNodes[1] == 4 &&
452 faceNodes[2] == 5))) ||
453 (fid == 4 && ((faceNodes[0] == 0 && faceNodes[1] == 3 &&
454 faceNodes[2] == 5) ||
455 (faceNodes[0] == 0 && faceNodes[1] == 4 &&
456 faceNodes[2] == 5) ||
457 (faceNodes[0] == 0 && faceNodes[1] == 3 &&
458 faceNodes[2] == 4) ||
459 (faceNodes[0] == 3 && faceNodes[1] == 4 &&
460 faceNodes[2] == 5))))
462 triNodeList[0] = nodeList[mapPrism[tmp[0]]];
463 triNodeList[1] = nodeList[mapPrism[tmp[1]]];
464 triNodeList[2] = nodeList[mapPrism[tmp[2]]];
467 m_mesh->m_element[
m_mesh->m_expDim - 1].push_back(elmt);
475 vector<ElementSharedPtr> tmp;
476 for (
int i = 0; i <
m_mesh->m_element[
m_mesh->m_expDim - 1].size(); ++i)
478 if (toRemove.find(i) == toRemove.end())
480 tmp.push_back(
m_mesh->m_element[
m_mesh->m_expDim - 1][i]);
Basic information about an element.
Principle Modified Functions .
MeshSharedPtr m_mesh
Mesh object.
std::shared_ptr< Mesh > MeshSharedPtr
Shared pointer to a mesh.
ElementFactory & GetElementFactory()
std::shared_ptr< Node > NodeSharedPtr
Gauss Radau pinned at x=-1, .
std::shared_ptr< Face > FaceSharedPtr
Principle Orthogonal Functions .
1D Evenly-spaced points using Lagrange polynomial
tBaseSharedPtr CreateInstance(tKey idKey, tParam... args)
Create an instance of the class referred to by idKey.
std::pair< int, int > ipair
std::pair< ModuleType, std::string > ModuleKey
virtual NEKMESHUTILS_EXPORT void ProcessFaces(bool ReprocessFaces=true)
Extract element faces.
Principle Modified Functions .
std::shared_ptr< Element > ElementSharedPtr
virtual NEKMESHUTILS_EXPORT void ProcessElements()
Generate element IDs.
Represents a command-line configuration option.
std::shared_ptr< Geometry > GeometrySharedPtr
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
PointsManagerT & PointsManager(void)
Principle Orthogonal Functions .
Defines a specification for a set of points.
virtual ~ProcessTetSplit()
std::map< std::string, ConfigOption > m_config
List of configuration values.
std::shared_ptr< StdNodalPrismExp > StdNodalPrismExpSharedPtr
std::shared_ptr< PrismExp > PrismExpSharedPtr
Abstract base class for processing modules.
virtual void Process()
Write mesh to output file.
virtual NEKMESHUTILS_EXPORT void ProcessVertices()
Extract element vertices.
3D Evenly-spaced points on a Prism
virtual NEKMESHUTILS_EXPORT void ProcessEdges(bool ReprocessEdges=true)
Extract element edges.
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
2D Evenly-spaced points on a Triangle
std::shared_ptr< PrismGeom > PrismGeomSharedPtr
std::pair< ModuleType, std::string > ModuleKey
Describes the specification for a Basis.
virtual NEKMESHUTILS_EXPORT void ProcessComposites()
Generate composites.
1D Gauss-Lobatto-Legendre quadrature points
ModuleFactory & GetModuleFactory()