38 #include <loki/Singleton.h>
64 Loki::NoDestroy > Type;
65 return Type::Instance();
69 unsigned int pNumNodes,
70 unsigned int pGotNodes)
75 if (pNumNodes != pGotNodes)
77 cerr <<
"Number of modes mismatch for type "
78 << pConf.
m_e <<
"! Should be " << pNumNodes
79 <<
" but got " << pGotNodes <<
" nodes." << endl;
98 unsigned int i, nElmt = 0;
112 unsigned int nEnt = 0;
114 for (
unsigned int d = 0; d <=
m_expDim; ++d)
128 int i, n = c1->type.size();
130 if (n != c2->type.size())
135 for (i = 0; i < n; ++i)
137 if (c1->type[i] != c2->type[i])
142 if (c1->field[i] != c2->field[i] || c1->value[i] != c2->value[i])
169 os << n->m_x <<
" " << n->m_y <<
" " << n->m_z;
179 return ( ((*(p1->m_n1) == *(p2->m_n1)) && (*(p1->m_n2) == *(p2->m_n2)))
180 || ((*(p1->m_n2) == *(p2->m_n1)) && (*(p1->m_n1) == *(p2->m_n2))));
188 return p1->m_id < p2->m_id;
198 for (it1 = p1->m_vertexList.begin(); it1 != p1->m_vertexList.end(); ++it1)
200 if (
find(p2->m_vertexList.begin(), p2->m_vertexList.end(), *it1)
201 == p2->m_vertexList.end())
215 return p1->m_id < p2->m_id;
232 for (
unsigned int i = 0; i <
m_edge.size(); ++i)
234 if (
m_edge[i]->m_n1 == vOld)
238 else if (
m_edge[i]->m_n2 == vOld)
243 for (
unsigned int i = 0; i <
m_face.size(); ++i)
246 for (
unsigned int j = 0; j <
m_face[i]->m_vertexList.size(); ++j)
248 if (
m_face[i]->m_vertexList[j] == vOld)
250 m_face[i]->m_vertexList[j] = pNew;
253 for (
unsigned int j = 0; j <
m_face[i]->m_edgeList.size(); ++j)
255 if (
m_face[i]->m_edgeList[j]->m_n1 == vOld)
257 m_face[i]->m_edgeList[j]->m_n1 = pNew;
259 else if (
m_face[i]->m_edgeList[j]->m_n2 == vOld)
261 m_face[i]->m_edgeList[j]->m_n2 = pNew;
280 for (
unsigned int i = 0; i <
m_face.size(); ++i)
282 for (
unsigned int j = 0; j <
m_face[i]->m_edgeList.size(); ++j)
284 if (
m_face[i]->m_edgeList[j] == vOld)
286 m_face[i]->m_edgeList[j] = pNew;
312 for (i = 0; i <
m_edge.size(); ++i)
314 int edgeOrder =
m_edge[i]->GetNodeCount()-1;
333 #if 0 // turn this option off since causes problem with InputNekpp.cpp
347 st <<
" " <<
m_tag <<
"[" << vId;
352 vId = (*it)->GetId();
355 if (prevId > -1 && vId == prevId + 1)
388 vector<NodeSharedPtr> pNodeList,
389 vector<int> pTagList)
390 :
Element(pConf, GetNumNodes(pConf), pNodeList.size())
414 vector<NodeSharedPtr> pNodeList,
415 vector<int> pTagList)
416 :
Element(pConf, GetNumNodes(pConf), pNodeList.size())
424 for (
int i = 0; i < 2; ++i) {
427 vector<NodeSharedPtr> edgeNodes;
429 for (
int j = 0; j<n; ++j) {
430 edgeNodes.push_back(pNodeList[2+j]);
433 m_edge.push_back(boost::shared_ptr<Edge>(
443 p[0] =
m_vertex[0]->GetGeom(coordDim);
444 p[1] =
m_vertex[1]->GetGeom(coordDim);
446 if (
m_edge[0]->m_edgeNodes.size() > 0)
452 c->m_points.push_back(p[0]);
453 for (
int i = 0; i <
m_edge[0]->m_edgeNodes.size(); ++i)
455 c->m_points.push_back(
m_edge[0]->m_edgeNodes[i]->
GetGeom(coordDim));
457 c->m_points.push_back(p[1]);
487 vector<NodeSharedPtr> pNodeList,
488 vector<int> pTagList)
489 :
Element(pConf, GetNumNodes(pConf), pNodeList.size())
500 map<pair<int,int>,
int> edgeNodeMap;
502 edgeNodeMap[pair<int,int>(1,2)] = 4;
503 edgeNodeMap[pair<int,int>(2,3)] = 4 + n;
504 edgeNodeMap[pair<int,int>(3,1)] = 4 + 2*n;
509 for (
int i = 0; i < 3; ++i) {
512 sum += (pNodeList[o]->m_x - pNodeList[i]->m_x) *
513 (pNodeList[o]->m_y + pNodeList[i]->m_y);
517 for (it = edgeNodeMap.begin(); it != edgeNodeMap.end(); ++it)
519 vector<NodeSharedPtr> edgeNodes;
521 for (
int j = it->second; j < it->second + n; ++j) {
522 edgeNodes.push_back(pNodeList[j-1]);
526 pNodeList[it->first.second-1],
553 for (
int i = 0; i < 3; ++i)
555 edges[i] =
m_edge [i]->GetGeom(coordDim);
556 verts[i] =
m_vertex[i]->GetGeom(coordDim);
578 return (n+1)+2*(n-1)+1;
580 return (n+1)*(n+2)/2;
623 int nqtot = tri->GetTotPoints();
624 Array<OneD, NekDouble> alloc(6*nqtot);
625 Array<OneD, NekDouble> xi(alloc);
626 Array<OneD, NekDouble> yi(alloc+ nqtot);
627 Array<OneD, NekDouble> zi(alloc+2*nqtot);
628 Array<OneD, NekDouble> xo(alloc+3*nqtot);
629 Array<OneD, NekDouble> yo(alloc+4*nqtot);
630 Array<OneD, NekDouble> zo(alloc+5*nqtot);
631 Array<OneD, NekDouble> tmp;
633 tri->GetCoords(xi, yi, zi);
635 for (i = 0; i < 3; ++i)
637 Array<OneD, NekDouble> coeffs(nodalTri->GetNcoeffs());
638 tri->FwdTrans(alloc+i*nqtot, coeffs);
640 nodalTri->ModalToNodal(coeffs, tmp=alloc+(i+3)*nqtot);
645 for (i = 0; i < 3; ++i)
647 int pos = 3 + i*(order-1);
648 m_edge[i]->m_edgeNodes.clear();
649 for (j = 0; j < order-1; ++j)
651 m_edge[i]->m_edgeNodes.push_back(
657 int pos = 3 + 3*(order-1);
658 for (i = pos; i < (order+1)*(order+2)/2; ++i)
678 vector<NodeSharedPtr> pNodeList,
679 vector<int> pTagList)
680 :
Element(pConf, GetNumNodes(pConf), pNodeList.size())
690 map<pair<int,int>,
int> edgeNodeMap;
692 edgeNodeMap[pair<int,int>(1,2)] = 5;
693 edgeNodeMap[pair<int,int>(2,3)] = 5 + n;
694 edgeNodeMap[pair<int,int>(3,4)] = 5 + 2*n;
695 edgeNodeMap[pair<int,int>(4,1)] = 5 + 3*n;
700 for (
int i = 0; i < 4; ++i) {
703 sum += (pNodeList[o]->m_x - pNodeList[i]->m_x) *
704 (pNodeList[o]->m_y + pNodeList[i]->m_y);
708 for (it = edgeNodeMap.begin(); it != edgeNodeMap.end(); ++it)
710 vector<NodeSharedPtr> edgeNodes;
712 for (
int j = it->second; j < it->second + n; ++j) {
713 edgeNodes.push_back(pNodeList[j-1]);
717 pNodeList[it->first.second-1],
755 int nqtot = quad->GetTotPoints();
756 Array<OneD, NekDouble> alloc(3*nqtot);
757 Array<OneD, NekDouble> x (alloc );
758 Array<OneD, NekDouble> y (alloc+1*nqtot);
759 Array<OneD, NekDouble> z (alloc+2*nqtot);
761 quad->GetCoords(x, y, z);
765 int edgeMap[4][2] = {{0,1},{order,order+1},
766 {nqtot-1,-1},{order*(order+1),-order-1}};
768 for (
int i = 0; i < 4; ++i)
770 int pos = edgeMap[i][0] + edgeMap[i][1];
771 m_edge[i]->m_edgeNodes.clear();
772 for (
int j = 1; j < order; ++j, pos += edgeMap[i][1])
774 m_edge[i]->m_edgeNodes.push_back(
781 for (
int i = 1; i < order; ++i)
783 int pos = i*(order+1);
784 for (
int j = 1; j < order; ++j)
802 for (
int i = 0; i < 4; ++i)
804 edges[i] =
m_edge [i]->GetGeom(coordDim);
805 verts[i] =
m_vertex[i]->GetGeom(coordDim);
841 vector<NodeSharedPtr> pNodeList,
842 vector<int> pTagList)
852 map<pair<int,int>,
int> edgeNodeMap;
854 edgeNodeMap[pair<int,int>(1,2)] = 5;
855 edgeNodeMap[pair<int,int>(2,3)] = 5 + n;
856 edgeNodeMap[pair<int,int>(1,3)] = 5 + 2*n;
857 edgeNodeMap[pair<int,int>(1,4)] = 5 + 3*n;
858 edgeNodeMap[pair<int,int>(2,4)] = 5 + 4*n;
859 edgeNodeMap[pair<int,int>(3,4)] = 5 + 5*n;
862 for (
int i = 0; i < 4; ++i)
869 for (it = edgeNodeMap.begin(); it != edgeNodeMap.end(); ++it)
871 vector<NodeSharedPtr> edgeNodes;
873 for (
int j = it->second; j < it->second + n; ++j) {
874 edgeNodes.push_back(pNodeList[j-1]);
879 pNodeList[it->first.second-1],
882 m_edge.back()->m_id = eid++;
895 for (
int i = 0; i < 4; ++i)
902 int face_ids[4][3] = {
903 {0,1,2}, {0,1,3}, {1,2,3}, {0,2,3}
907 int face_edges[4][3];
910 for (
int j = 0; j < 4; ++j)
912 vector<NodeSharedPtr> faceVertices;
913 vector<EdgeSharedPtr> faceEdges;
914 vector<NodeSharedPtr> faceNodes;
919 for (
int k = 0; k < 3; ++k)
921 faceVertices.push_back(
m_vertex[face_ids[j][k]]);
924 for (
unsigned int i = 0; i <
m_edge.size(); ++i)
926 if ( ((*(
m_edge[i]->m_n1)==*a) && (*(
m_edge[i]->m_n2)==*b))
927 || ((*(
m_edge[i]->m_n1)==*b) && (*(
m_edge[i]->m_n2) == *a)) )
929 face_edges[j][k] = i;
930 faceEdges.push_back(
m_edge[i]);
942 const int nFaceNodes = n*(n-1)/2;
945 vector<int> faceIds(3);
946 faceIds[0] = faceVertices[0]->m_id;
947 faceIds[1] = faceVertices[1]->m_id;
948 faceIds[2] = faceVertices[2]->m_id;
953 for (
int i = 0; i < 4; ++i)
962 ASSERTL0(origFace >= 0,
"Couldn't find face");
965 int N = 4 + 6*n + origFace * nFaceNodes;
966 for (
int i = 0; i < nFaceNodes; ++i)
968 faceNodes.push_back(pNodeList[N+i]);
972 vector<int> origFaceIds(3);
973 origFaceIds[0] = pNodeList[face_ids[origFace][0]]->m_id;
974 origFaceIds[1] = pNodeList[face_ids[origFace][1]]->m_id;
975 origFaceIds[2] = pNodeList[face_ids[origFace][2]]->m_id;
980 hoTri.
Align(faceIds);
989 vector<EdgeSharedPtr> tmp(6);
990 tmp[0] =
m_edge[face_edges[0][0]];
991 tmp[1] =
m_edge[face_edges[0][1]];
992 tmp[2] =
m_edge[face_edges[0][2]];
993 tmp[3] =
m_edge[face_edges[1][2]];
994 tmp[4] =
m_edge[face_edges[1][1]];
995 tmp[5] =
m_edge[face_edges[2][1]];
1004 for (
int i = 0; i < 4; ++i)
1006 tfaces[i] = boost::dynamic_pointer_cast
1023 return (n+1)*(n+2)*(n+3)/6;
1025 return 4*(n+1)*(n+2)/2-6*(n+1)+4;
1057 Array<OneD, NekDouble> x, y, z;
1059 nodalTet->GetNodalPoints(x,y,z);
1085 int nqtot = tet->GetTotPoints();
1086 Array<OneD, NekDouble> alloc(6*nqtot);
1087 Array<OneD, NekDouble> xi(alloc);
1088 Array<OneD, NekDouble> yi(alloc+ nqtot);
1089 Array<OneD, NekDouble> zi(alloc+2*nqtot);
1090 Array<OneD, NekDouble> xo(alloc+3*nqtot);
1091 Array<OneD, NekDouble> yo(alloc+4*nqtot);
1092 Array<OneD, NekDouble> zo(alloc+5*nqtot);
1093 Array<OneD, NekDouble> tmp;
1095 tet->GetCoords(xi, yi, zi);
1097 for (i = 0; i < 3; ++i)
1099 Array<OneD, NekDouble> coeffs(nodalTet->GetNcoeffs());
1100 tet->FwdTrans(alloc+i*nqtot, coeffs);
1102 nodalTet->ModalToNodal(coeffs, tmp=alloc+(i+3)*nqtot);
1107 for (i = 0; i < 6; ++i)
1109 int pos = 4 + i*(order-1);
1110 m_edge[i]->m_edgeNodes.clear();
1111 for (j = 0; j < order-1; ++j)
1113 m_edge[i]->m_edgeNodes.push_back(
1119 for (i = 0; i < 4; ++i)
1121 int pos = 4 + 6*(order-1) + i*(order-2)*(order-1)/2;
1122 m_face[i]->m_faceNodes.clear();
1123 for (j = 0; j < (order-2)*(order-1)/2; ++j)
1125 m_face[i]->m_faceNodes.push_back(
1131 int pos = 4 + 6*(order-1) + 4*(order-2)*(order-1)/2;
1132 for (i = pos; i < (order+1)*(order+2)*(order+3)/6; ++i)
1154 return boost::hash_range(p.
nid.begin(), p.
nid.end());
1157 typedef boost::unordered_set<struct TetOrient, TetOrientHash>
TetOrientSet;
1161 if (a.
nid.size() != b.
nid.size())
1166 for (
int i = 0; i < a.
nid.size(); ++i)
1168 if (a.
nid[i] != b.
nid[i])
1192 static int face_ids[4][3] = {
1193 {0,1,2},{0,1,3},{1,2,3},{0,2,3}};
1200 for (
int i = 0; i < 4; ++i)
1202 vector<int> nodes(3);
1204 nodes[0] =
m_vertex[face_ids[i][0]]->m_id;
1205 nodes[1] =
m_vertex[face_ids[i][1]]->m_id;
1206 nodes[2] =
m_vertex[face_ids[i][2]]->m_id;
1208 sort(nodes.begin(), nodes.end());
1210 faces.insert(faceNodes);
1215 vector<NodeSharedPtr> origVert =
m_vertex;
1234 double vol = cx*(ay*bz-az*by)+cy*(az*bx-ax*bz)+cz*(ax*by-ay*bx);
1237 if (fabs(vol) <= 1e-10)
1239 cerr <<
"Warning: degenerate tetrahedron, volume = " << vol << endl;
1251 for (
int i = 0; i < 4; ++i)
1253 vector<int> nodes(3);
1255 nodes[0] =
m_vertex[face_ids[i][0]]->m_id;
1256 nodes[1] =
m_vertex[face_ids[i][1]]->m_id;
1257 nodes[2] =
m_vertex[face_ids[i][2]]->m_id;
1258 sort(nodes.begin(), nodes.end());
1262 it = faces.find(faceNodes);
1265 for (
int j = 0; j < 4; ++j)
1283 vector<NodeSharedPtr> pNodeList,
1284 vector<int> pTagList)
1285 :
Element(pConf, GetNumNodes(pConf), pNodeList.size())
1293 map<pair<int,int>,
int> edgeNodeMap;
1295 edgeNodeMap[pair<int,int>(1,2)] = 6;
1296 edgeNodeMap[pair<int,int>(2,3)] = 6 + n;
1297 edgeNodeMap[pair<int,int>(4,3)] = 6 + 2*n;
1298 edgeNodeMap[pair<int,int>(1,4)] = 6 + 3*n;
1299 edgeNodeMap[pair<int,int>(1,5)] = 6 + 4*n;
1300 edgeNodeMap[pair<int,int>(2,5)] = 6 + 5*n;
1301 edgeNodeMap[pair<int,int>(3,5)] = 6 + 6*n;
1302 edgeNodeMap[pair<int,int>(4,5)] = 6 + 7*n;
1305 for (
int i = 0; i < 5; ++i)
1312 for (it = edgeNodeMap.begin(); it != edgeNodeMap.end(); ++it)
1314 vector<NodeSharedPtr> edgeNodes;
1317 for (
int j = it->second; j < it->second + n; ++j)
1319 edgeNodes.push_back(pNodeList[j-1]);
1324 pNodeList[it->first.second-1],
1327 m_edge.back()->m_id = eid++;
1331 int face_ids[5][4] = {
1332 {0,1,2,3}, {0,1,4,-1}, {1,2,4,-1}, {3,2,4,-1}, {0,3,4,-1}
1334 int face_edges[5][4];
1335 int faceoffset = 5 + 8*n;
1336 for (
int j = 0; j < 5; ++j)
1338 vector<NodeSharedPtr> faceVertices;
1339 vector<EdgeSharedPtr> faceEdges;
1340 vector<NodeSharedPtr> faceNodes;
1341 int nEdge = j > 0 ? 3 : 4;
1343 for (
int k = 0; k < nEdge; ++k)
1345 faceVertices.push_back(
m_vertex[face_ids[j][k]]);
1348 for (
unsigned int i = 0; i <
m_edge.size(); ++i)
1353 faceEdges.push_back(
m_edge[i]);
1354 face_edges[j][k] = i;
1362 int facenodes = j == 0 ? n*n : n*(n-1)/2;
1363 for (
int i = 0; i < facenodes; ++i)
1365 faceNodes.push_back(pNodeList[faceoffset+i]);
1367 faceoffset += facenodes;
1374 vector<EdgeSharedPtr> tmp(8);
1375 tmp[0] =
m_edge[face_edges[0][0]];
1376 tmp[1] =
m_edge[face_edges[0][1]];
1377 tmp[2] =
m_edge[face_edges[0][2]];
1378 tmp[3] =
m_edge[face_edges[0][3]];
1379 tmp[4] =
m_edge[face_edges[1][2]];
1380 tmp[5] =
m_edge[face_edges[1][1]];
1381 tmp[6] =
m_edge[face_edges[3][1]];
1382 tmp[7] =
m_edge[face_edges[3][2]];
1390 for (
int i = 0; i < 5; ++i)
1392 faces[i] =
m_face[i]->GetGeom(coordDim);
1417 vector<NodeSharedPtr> pNodeList,
1418 vector<int> pTagList)
1419 :
Element(pConf, GetNumNodes(pConf), pNodeList.size())
1429 map<pair<int,int>,
int> edgeNodeMap;
1433 edgeNodeMap[pair<int,int>(1,2)] = 7;
1434 edgeNodeMap[pair<int,int>(2,3)] = 7 + n;
1435 edgeNodeMap[pair<int,int>(4,3)] = 7 + 2*n;
1436 edgeNodeMap[pair<int,int>(1,4)] = 7 + 3*n;
1437 edgeNodeMap[pair<int,int>(1,5)] = 7 + 4*n;
1438 edgeNodeMap[pair<int,int>(2,5)] = 7 + 5*n;
1439 edgeNodeMap[pair<int,int>(3,6)] = 7 + 6*n;
1440 edgeNodeMap[pair<int,int>(4,6)] = 7 + 7*n;
1441 edgeNodeMap[pair<int,int>(5,6)] = 7 + 8*n;
1444 for (
int i = 0; i < 6; ++i)
1451 for (it = edgeNodeMap.begin(); it != edgeNodeMap.end(); ++it)
1453 vector<NodeSharedPtr> edgeNodes;
1455 for (
int j = it->second; j < it->second + n; ++j) {
1456 edgeNodes.push_back(pNodeList[j-1]);
1460 new Edge(pNodeList[it->first.first-1],
1461 pNodeList[it->first.second-1],
1464 m_edge.back()->m_id = eid++;
1477 int face_ids[5][4] = {
1478 {0,1,2,3},{0,1,4,-1},{1,2,5,4},{3,2,5,-1},{0,3,5,4}};
1479 int face_edges[5][4];
1482 face_offset[0] = 6 + 9*n;
1483 for (
int j = 0; j < 4; ++j)
1485 int facenodes = j % 2 == 0 ? n*n : n*(n-1)/2;
1486 face_offset[j+1] = face_offset[j] + facenodes;
1489 for (
int j = 0; j < 5; ++j)
1491 vector<NodeSharedPtr> faceVertices;
1492 vector<EdgeSharedPtr> faceEdges;
1493 vector<NodeSharedPtr> faceNodes;
1494 int nEdge = 3 - (j % 2 - 1);
1496 for (
int k = 0; k < nEdge; ++k)
1498 faceVertices.push_back(
m_vertex[face_ids[j][k]]);
1501 for (
unsigned int i = 0; i <
m_edge.size(); ++i)
1506 faceEdges.push_back(
m_edge[i]);
1507 face_edges[j][k] = i;
1515 int face = j, facenodes;
1522 face = (face+4) % 6;
1526 face = (face+2) % 6;
1532 facenodes = n*(n-1)/2;
1535 for (
int i = 0; i < facenodes; ++i)
1537 faceNodes.push_back(pNodeList[face_offset[face]+i]);
1545 vector<EdgeSharedPtr> tmp(9);
1546 tmp[0] =
m_edge[face_edges[0][0]];
1547 tmp[1] =
m_edge[face_edges[0][1]];
1548 tmp[2] =
m_edge[face_edges[0][2]];
1549 tmp[3] =
m_edge[face_edges[0][3]];
1550 tmp[4] =
m_edge[face_edges[1][2]];
1551 tmp[5] =
m_edge[face_edges[1][1]];
1552 tmp[6] =
m_edge[face_edges[2][1]];
1553 tmp[7] =
m_edge[face_edges[3][2]];
1554 tmp[8] =
m_edge[face_edges[4][2]];
1565 return (n+1)*(n+1)*(n+2)/2;
1567 return 3*(n+1)*(n+1)+2*(n+1)*(n+2)/2-9*(n+1)+6;
1577 for (
int i = 0; i < 5; ++i)
1579 faces[i] =
m_face[i]->GetGeom(coordDim);
1615 Array<OneD, NekDouble> x, y, z;
1616 nodalPrism->GetNodalPoints(x,y,z);
1642 int nqtot = prism->GetTotPoints();
1643 Array<OneD, NekDouble> alloc(6*nqtot);
1644 Array<OneD, NekDouble> xi(alloc);
1645 Array<OneD, NekDouble> yi(alloc+ nqtot);
1646 Array<OneD, NekDouble> zi(alloc+2*nqtot);
1647 Array<OneD, NekDouble> xo(alloc+3*nqtot);
1648 Array<OneD, NekDouble> yo(alloc+4*nqtot);
1649 Array<OneD, NekDouble> zo(alloc+5*nqtot);
1650 Array<OneD, NekDouble> tmp;
1652 prism->GetCoords(xi, yi, zi);
1654 for (i = 0; i < 3; ++i)
1656 Array<OneD, NekDouble> coeffs(nodalPrism->GetNcoeffs());
1657 prism->FwdTrans(alloc+i*nqtot, coeffs);
1659 nodalPrism->ModalToNodal(coeffs, tmp=alloc+(i+3)*nqtot);
1664 for (i = 0; i < 9; ++i)
1666 pos = 6 + i*(order-1);
1667 m_edge[i]->m_edgeNodes.clear();
1668 for (j = 0; j < order-1; ++j)
1670 m_edge[i]->m_edgeNodes.push_back(
1676 pos = 6 + 9*(order-1);
1677 for (i = 0; i < 5; ++i)
1679 int facesize = i % 2 ? (order-2)*(order-1)/2 : (order-1)*(order-1);
1680 m_face[i]->m_faceNodes.clear();
1681 for (j = 0; j < facesize; ++j)
1683 m_face[i]->m_faceNodes.push_back(
1690 for (i = pos; i < (order+1)*(order+1)*(order+2)/2; ++i)
1727 for (
int i = 0; i < 6; ++i)
1733 gid[0] = gid[3] = max(gid[0], gid[3]);
1734 gid[1] = gid[2] = max(gid[1], gid[2]);
1735 gid[4] = gid[5] = max(gid[4], gid[5]);
1737 for (
int i = 1; i < 6; ++i)
1739 if (gid[0] < gid[i])
1741 swap(gid[i], gid[0]);
1742 swap(lid[i], lid[0]);
1746 if (lid[0] == 4 || lid[0] == 5)
1750 else if (lid[0] == 1 || lid[0] == 2)
1753 vector<NodeSharedPtr> vertexmap(6);
1763 else if (lid[0] == 0 || lid[0] == 3)
1766 vector<NodeSharedPtr> vertexmap(6);
1778 cerr <<
"Warning: possible prism orientation problem." << endl;
1790 vector<NodeSharedPtr> pNodeList,
1791 vector<int> pTagList)
1792 :
Element(pConf, GetNumNodes(pConf), pNodeList.size())
1801 map<pair<int,int>,
int> edgeNodeMap;
1803 edgeNodeMap[pair<int,int>(1,2)] = 9;
1804 edgeNodeMap[pair<int,int>(2,3)] = 9 + n;
1805 edgeNodeMap[pair<int,int>(3,4)] = 9 + 2*n;
1806 edgeNodeMap[pair<int,int>(4,1)] = 9 + 3*n;
1807 edgeNodeMap[pair<int,int>(1,5)] = 9 + 4*n;
1808 edgeNodeMap[pair<int,int>(2,6)] = 9 + 5*n;
1809 edgeNodeMap[pair<int,int>(3,7)] = 9 + 6*n;
1810 edgeNodeMap[pair<int,int>(4,8)] = 9 + 7*n;
1811 edgeNodeMap[pair<int,int>(5,6)] = 9 + 8*n;
1812 edgeNodeMap[pair<int,int>(6,7)] = 9 + 9*n;
1813 edgeNodeMap[pair<int,int>(7,8)] = 9 + 10*n;
1814 edgeNodeMap[pair<int,int>(8,5)] = 9 + 11*n;
1817 for (
int i = 0; i < 8; ++i) {
1822 for (it = edgeNodeMap.begin(); it != edgeNodeMap.end(); ++it)
1824 vector<NodeSharedPtr> edgeNodes;
1826 for (
int j = it->second; j < it->second + n; ++j) {
1827 edgeNodes.push_back(pNodeList[j-1]);
1831 pNodeList[it->first.second-1],
1837 int face_edges[6][4];
1838 int face_ids[6][4] = {
1839 {0,1,2,3},{0,1,5,4},{1,2,6,5},{3,2,6,7},{0,3,7,4},{4,5,6,7}};
1840 for (
int j = 0; j < 6; ++j)
1842 vector<NodeSharedPtr> faceVertices;
1843 vector<EdgeSharedPtr> faceEdges;
1844 vector<NodeSharedPtr> faceNodes;
1845 for (
int k = 0; k < 4; ++k)
1847 faceVertices.push_back(
m_vertex[face_ids[j][k]]);
1850 for (
unsigned int i = 0; i <
m_edge.size(); ++i)
1852 if ( ((*(
m_edge[i]->m_n1)==*a) && (*(
m_edge[i]->m_n2)==*b))
1853 || ((*(
m_edge[i]->m_n1)==*b) && (*(
m_edge[i]->m_n2) == *a)) )
1855 face_edges[j][k] = i;
1856 faceEdges.push_back(
m_edge[i]);
1864 int N = 8 + 12*n + j*n*n;
1865 for (
int i = 0; i < n*n; ++i)
1867 faceNodes.push_back(pNodeList[N+i]);
1875 vector<EdgeSharedPtr> tmp(12);
1876 tmp[ 0] =
m_edge[face_edges[0][0]];
1877 tmp[ 1] =
m_edge[face_edges[0][1]];
1878 tmp[ 2] =
m_edge[face_edges[0][2]];
1879 tmp[ 3] =
m_edge[face_edges[0][3]];
1880 tmp[ 4] =
m_edge[face_edges[1][3]];
1881 tmp[ 5] =
m_edge[face_edges[1][1]];
1882 tmp[ 6] =
m_edge[face_edges[2][1]];
1883 tmp[ 7] =
m_edge[face_edges[4][1]];
1884 tmp[ 8] =
m_edge[face_edges[5][0]];
1885 tmp[ 9] =
m_edge[face_edges[5][1]];
1886 tmp[10] =
m_edge[face_edges[5][2]];
1887 tmp[11] =
m_edge[face_edges[5][3]];
1896 for (
int i = 0; i < 6; ++i)
1898 faces[i] = boost::dynamic_pointer_cast
1915 return (n+1)*(n+1)*(n+1);
1917 return 6*(n+1)*(n+1)-12*(n+1)+8;