46 #include <boost/algorithm/string/predicate.hpp>
47 #include <boost/archive/iterators/base64_from_binary.hpp>
48 #include <boost/archive/iterators/binary_from_base64.hpp>
49 #include <boost/archive/iterators/transform_width.hpp>
50 #include <boost/format.hpp>
51 #include <boost/iostreams/copy.hpp>
52 #include <boost/iostreams/filter/zlib.hpp>
53 #include <boost/iostreams/filtering_stream.hpp>
54 #include <boost/make_shared.hpp>
61 namespace SpatialDomains
64 std::string MeshGraphXmlCompressed::className =
66 "XmlCompressed", MeshGraphXmlCompressed::create,
67 "IO with Xml geometry");
69 void MeshGraphXmlCompressed::ReadVertices()
72 TiXmlElement *element = m_xmlGeom->FirstChildElement(
"VERTEX");
73 ASSERTL0(element,
"Unable to find mesh VERTEX tag in file.");
80 const char *xscal = element->Attribute(
"XSCALE");
87 std::string xscalstr = xscal;
89 xscale = expEvaluator.
Evaluate(expr_id);
92 const char *yscal = element->Attribute(
"YSCALE");
99 std::string yscalstr = yscal;
101 yscale = expEvaluator.
Evaluate(expr_id);
104 const char *zscal = element->Attribute(
"ZSCALE");
111 std::string zscalstr = zscal;
113 zscale = expEvaluator.
Evaluate(expr_id);
121 const char *xmov = element->Attribute(
"XMOVE");
128 std::string xmovstr = xmov;
130 xmove = expEvaluator.
Evaluate(expr_id);
133 const char *ymov = element->Attribute(
"YMOVE");
140 std::string ymovstr = ymov;
142 ymove = expEvaluator.
Evaluate(expr_id);
145 const char *zmov = element->Attribute(
"ZMOVE");
152 std::string zmovstr = zmov;
154 zmove = expEvaluator.
Evaluate(expr_id);
158 element->QueryStringAttribute(
"COMPRESSED", &IsCompressed);
160 if (boost::iequals(IsCompressed,
164 TiXmlNode *vertexChild = element->FirstChild();
165 ASSERTL0(vertexChild,
"Unable to extract the data from the compressed "
168 std::string vertexStr;
169 if (vertexChild->Type() == TiXmlNode::TINYXML_TEXT)
171 vertexStr += vertexChild->ToText()->ValueStr();
174 std::vector<SpatialDomains::MeshVertex> vertData;
180 for (
int i = 0; i < vertData.size(); ++i)
182 indx = vertData[i].id;
183 xval = vertData[i].x;
184 yval = vertData[i].y;
185 zval = vertData[i].z;
187 xval = xval * xscale + xmove;
188 yval = yval * yscale + ymove;
189 zval = zval * zscale + zmove;
192 m_spaceDimension, indx, xval, yval, zval));
194 vert->SetGlobalID(indx);
195 m_vertSet[indx] = vert;
200 ASSERTL0(
false,
"Compressed formats do not match. Expected :" +
202 " but got " + std::string(IsCompressed));
206 void MeshGraphXmlCompressed::ReadCurves()
210 TiXmlElement *element = m_xmlGeom->FirstChildElement(
"VERTEX");
211 ASSERTL0(element,
"Unable to find mesh VERTEX tag in file.");
216 const char *xscal = element->Attribute(
"XSCALE");
223 std::string xscalstr = xscal;
225 xscale = expEvaluator.
Evaluate(expr_id);
228 const char *yscal = element->Attribute(
"YSCALE");
235 std::string yscalstr = yscal;
237 yscale = expEvaluator.
Evaluate(expr_id);
240 const char *zscal = element->Attribute(
"ZSCALE");
247 std::string zscalstr = zscal;
249 zscale = expEvaluator.
Evaluate(expr_id);
257 const char *xmov = element->Attribute(
"XMOVE");
264 std::string xmovstr = xmov;
266 xmove = expEvaluator.
Evaluate(expr_id);
269 const char *ymov = element->Attribute(
"YMOVE");
276 std::string ymovstr = ymov;
278 ymove = expEvaluator.
Evaluate(expr_id);
281 const char *zmov = element->Attribute(
"ZMOVE");
288 std::string zmovstr = zmov;
290 zmove = expEvaluator.
Evaluate(expr_id);
294 TiXmlElement *field = m_xmlGeom->FirstChildElement(
"CURVED");
302 field->QueryStringAttribute(
"COMPRESSED", &IsCompressed);
304 if (IsCompressed.size() == 0)
311 ASSERTL0(boost::iequals(IsCompressed,
313 "Compressed formats do not match. Expected :" +
315 boost::lexical_cast<std::string>(IsCompressed));
317 std::vector<SpatialDomains::MeshCurvedInfo> edginfo;
318 std::vector<SpatialDomains::MeshCurvedInfo> facinfo;
322 TiXmlElement *x = field->FirstChildElement();
325 const char *entitytype = x->Value();
327 if (boost::iequals(entitytype,
"E"))
331 TiXmlNode *child = x->FirstChild();
333 if (child->Type() == TiXmlNode::TINYXML_TEXT)
335 elmtStr += child->ToText()->ValueStr();
341 else if (boost::iequals(entitytype,
"F"))
345 TiXmlNode *child = x->FirstChild();
347 if (child->Type() == TiXmlNode::TINYXML_TEXT)
349 elmtStr += child->ToText()->ValueStr();
355 else if (boost::iequals(entitytype,
"DATAPOINTS"))
359 "Failed to get ID from PTS section");
365 TiXmlElement *DataIdx = x->FirstChildElement(
"INDEX");
366 ASSERTL0(DataIdx,
"Cannot read data index tag in compressed "
369 TiXmlNode *child = DataIdx->FirstChild();
370 if (child->Type() == TiXmlNode::TINYXML_TEXT)
372 elmtStr = child->ToText()->ValueStr();
378 TiXmlElement *DataPts = x->FirstChildElement(
"POINTS");
379 ASSERTL0(DataPts,
"Cannot read data pts tag in compressed "
382 child = DataPts->FirstChild();
383 if (child->Type() == TiXmlNode::TINYXML_TEXT)
385 elmtStr = child->ToText()->ValueStr();
393 ASSERTL0(
false,
"Unknown tag in curved section");
395 x = x->NextSiblingElement();
399 for (
int i = 0; i < cpts.
pts.size(); ++i)
401 cpts.
pts[i].x = xscale * cpts.
pts[i].x + xmove;
402 cpts.
pts[i].y = yscale * cpts.
pts[i].y + ymove;
403 cpts.
pts[i].z = zscale * cpts.
pts[i].z + zmove;
406 for (
int i = 0; i < edginfo.size(); ++i)
408 int edgeid = edginfo[i].entityid;
415 int offset = edginfo[i].ptoffset;
416 for (
int j = 0; j < edginfo[i].npoints; ++j)
418 int idx = cpts.
index[offset + j];
421 m_spaceDimension, edginfo[i].
id, cpts.
pts[idx].x,
422 cpts.
pts[idx].y, cpts.
pts[idx].z));
423 curve->m_points.push_back(vert);
426 m_curvedEdges[edgeid] = curve;
429 for (
int i = 0; i < facinfo.size(); ++i)
431 int faceid = facinfo[i].entityid;
437 int offset = facinfo[i].ptoffset;
438 for (
int j = 0; j < facinfo[i].npoints; ++j)
440 int idx = cpts.
index[offset + j];
443 m_spaceDimension, facinfo[i].
id, cpts.
pts[idx].x,
444 cpts.
pts[idx].y, cpts.
pts[idx].z));
445 curve->m_points.push_back(vert);
448 m_curvedFaces[faceid] = curve;
452 void MeshGraphXmlCompressed::ReadEdges()
454 CurveMap::iterator it;
457 TiXmlElement *field = m_xmlGeom->FirstChildElement(
"EDGE");
459 ASSERTL0(field,
"Unable to find EDGE tag in file.");
462 field->QueryStringAttribute(
"COMPRESSED", &IsCompressed);
464 ASSERTL0(boost::iequals(IsCompressed,
466 "Compressed formats do not match. Expected :" +
468 std::string(IsCompressed));
470 TiXmlNode *edgeChild = field->FirstChild();
471 ASSERTL0(edgeChild,
"Unable to extract the data from "
472 "the compressed edge tag.");
475 if (edgeChild->Type() == TiXmlNode::TINYXML_TEXT)
477 edgeStr += edgeChild->ToText()->ValueStr();
480 std::vector<SpatialDomains::MeshEdge> edgeData;
484 for (
int i = 0; i < edgeData.size(); ++i)
486 indx = edgeData[i].id;
488 GetVertex(edgeData[i].v1)};
491 it = m_curvedEdges.find(indx);
492 if (it == m_curvedEdges.end())
495 indx, m_spaceDimension, vertices);
500 indx, m_spaceDimension, vertices, it->second);
502 m_segGeoms[indx] = edge;
506 void MeshGraphXmlCompressed::ReadFaces()
509 TiXmlElement *field = m_xmlGeom->FirstChildElement(
"FACE");
511 ASSERTL0(field,
"Unable to find FACE tag in file.");
517 TiXmlElement *element = field->FirstChildElement();
518 CurveMap::iterator it;
522 std::string elementType(element->ValueStr());
524 ASSERTL0(elementType ==
"Q" || elementType ==
"T",
525 (std::string(
"Unknown 3D face type: ") + elementType).c_str());
528 element->QueryStringAttribute(
"COMPRESSED", &IsCompressed);
531 boost::iequals(IsCompressed,
533 "Compressed formats do not match. Expected :" +
535 std::string(IsCompressed));
538 TiXmlNode *faceChild = element->FirstChild();
539 ASSERTL0(faceChild,
"Unable to extract the data from "
540 "the compressed face tag.");
543 if (faceChild->Type() == TiXmlNode::TINYXML_TEXT)
545 faceStr += faceChild->ToText()->ValueStr();
549 if (elementType ==
"T")
551 std::vector<SpatialDomains::MeshTri> faceData;
555 for (
int i = 0; i < faceData.size(); ++i)
557 indx = faceData[i].id;
560 it = m_curvedFaces.find(indx);
564 GetSegGeom(faceData[i].e[0]), GetSegGeom(faceData[i].e[1]),
565 GetSegGeom(faceData[i].e[2])};
568 if (it == m_curvedFaces.end())
576 indx, edges, it->second);
578 trigeom->SetGlobalID(indx);
579 m_triGeoms[indx] = trigeom;
582 else if (elementType ==
"Q")
584 std::vector<SpatialDomains::MeshQuad> faceData;
588 for (
int i = 0; i < faceData.size(); ++i)
590 indx = faceData[i].id;
593 it = m_curvedFaces.find(indx);
597 GetSegGeom(faceData[i].e[0]), GetSegGeom(faceData[i].e[1]),
598 GetSegGeom(faceData[i].e[2]), GetSegGeom(faceData[i].e[3])};
601 if (it == m_curvedFaces.end())
609 indx, edges, it->second);
611 quadgeom->SetGlobalID(indx);
612 m_quadGeoms[indx] = quadgeom;
616 element = element->NextSiblingElement();
620 void MeshGraphXmlCompressed::ReadElements1D()
622 TiXmlElement *field = NULL;
625 field = m_xmlGeom->FirstChildElement(
"ELEMENT");
627 ASSERTL0(field,
"Unable to find ELEMENT tag in file.");
632 TiXmlElement *segment = field->FirstChildElement(
"S");
633 CurveMap::iterator it;
638 segment->QueryStringAttribute(
"COMPRESSED", &IsCompressed);
640 boost::iequals(IsCompressed,
642 "Compressed formats do not match. Expected :" +
644 std::string(IsCompressed));
647 TiXmlNode *child = segment->FirstChild();
648 ASSERTL0(child,
"Unable to extract the data from "
649 "the compressed face tag.");
652 if (child->Type() == TiXmlNode::TINYXML_TEXT)
654 str += child->ToText()->ValueStr();
659 std::vector<SpatialDomains::MeshEdge> data;
662 for (
int i = 0; i < data.size(); ++i)
667 it = m_curvedEdges.find(indx);
670 GetVertex(data[i].v1)};
673 if (it == m_curvedEdges.end())
676 indx, m_spaceDimension, vertices);
677 seg->SetGlobalID(indx);
682 indx, m_spaceDimension, vertices, it->second);
683 seg->SetGlobalID(indx);
685 seg->SetGlobalID(indx);
686 m_segGeoms[indx] = seg;
689 segment = segment->NextSiblingElement(
"S");
693 void MeshGraphXmlCompressed::ReadElements2D()
696 TiXmlElement *field = m_xmlGeom->FirstChildElement(
"ELEMENT");
698 ASSERTL0(field,
"Unable to find ELEMENT tag in file.");
701 CurveMap::iterator it;
706 TiXmlElement *element = field->FirstChildElement();
710 std::string elementType(element->ValueStr());
713 elementType ==
"Q" || elementType ==
"T",
714 (std::string(
"Unknown 2D element type: ") + elementType).c_str());
717 element->QueryStringAttribute(
"COMPRESSED", &IsCompressed);
720 boost::iequals(IsCompressed,
722 "Compressed formats do not match. Expected :" +
724 std::string(IsCompressed));
727 TiXmlNode *faceChild = element->FirstChild();
728 ASSERTL0(faceChild,
"Unable to extract the data from "
729 "the compressed face tag.");
732 if (faceChild->Type() == TiXmlNode::TINYXML_TEXT)
734 faceStr += faceChild->ToText()->ValueStr();
738 if (elementType ==
"T")
740 std::vector<SpatialDomains::MeshTri> faceData;
744 for (
int i = 0; i < faceData.size(); ++i)
746 indx = faceData[i].id;
749 it = m_curvedFaces.find(indx);
753 GetSegGeom(faceData[i].e[0]), GetSegGeom(faceData[i].e[1]),
754 GetSegGeom(faceData[i].e[2])};
757 if (it == m_curvedFaces.end())
765 indx, edges, it->second);
767 trigeom->SetGlobalID(indx);
768 m_triGeoms[indx] = trigeom;
771 else if (elementType ==
"Q")
773 std::vector<SpatialDomains::MeshQuad> faceData;
777 for (
int i = 0; i < faceData.size(); ++i)
779 indx = faceData[i].id;
782 it = m_curvedFaces.find(indx);
786 GetSegGeom(faceData[i].e[0]), GetSegGeom(faceData[i].e[1]),
787 GetSegGeom(faceData[i].e[2]), GetSegGeom(faceData[i].e[3])};
790 if (it == m_curvedFaces.end())
798 indx, edges, it->second);
800 quadgeom->SetGlobalID(indx);
801 m_quadGeoms[indx] = quadgeom;
805 element = element->NextSiblingElement();
809 void MeshGraphXmlCompressed::ReadElements3D()
812 TiXmlElement *field = m_xmlGeom->FirstChildElement(
"ELEMENT");
814 ASSERTL0(field,
"Unable to find ELEMENT tag in file.");
819 TiXmlElement *element = field->FirstChildElement();
823 std::string elementType(element->ValueStr());
827 elementType ==
"A" || elementType ==
"P" || elementType ==
"R" ||
829 (std::string(
"Unknown 3D element type: ") + elementType).c_str());
832 element->QueryStringAttribute(
"COMPRESSED", &IsCompressed);
835 boost::iequals(IsCompressed,
837 "Compressed formats do not match. Expected :" +
839 std::string(IsCompressed));
842 TiXmlNode *child = element->FirstChild();
843 ASSERTL0(child,
"Unable to extract the data from "
844 "the compressed face tag.");
847 if (child->Type() == TiXmlNode::TINYXML_TEXT)
849 str += child->ToText()->ValueStr();
853 if (elementType ==
"A")
855 std::vector<SpatialDomains::MeshTet> data;
858 for (
int i = 0; i < data.size(); ++i)
861 for (
int j = 0; j < 4; ++j)
864 tfaces[j] = static_pointer_cast<TriGeom>(face);
869 m_tetGeoms[indx] = tetgeom;
870 PopulateFaceToElMap(tetgeom, 4);
873 else if (elementType ==
"P")
875 std::vector<SpatialDomains::MeshPyr> data;
878 for (
int i = 0; i < data.size(); ++i)
883 for (
int j = 0; j < 5; ++j)
891 std::stringstream errorstring;
892 errorstring <<
"Element " << indx
893 <<
" has invalid face: " << j;
894 ASSERTL0(
false, errorstring.str().c_str());
898 faces[j] = static_pointer_cast<TriGeom>(face);
901 else if (face->GetShapeType() ==
904 faces[j] = static_pointer_cast<QuadGeom>(face);
908 ASSERTL0((Ntfaces == 4) && (Nqfaces == 1),
909 "Did not identify the correct number of "
910 "triangular and quadrilateral faces for a "
916 m_pyrGeoms[indx] = pyrgeom;
917 PopulateFaceToElMap(pyrgeom, 5);
920 else if (elementType ==
"R")
922 std::vector<SpatialDomains::MeshPrism> data;
925 for (
int i = 0; i < data.size(); ++i)
930 for (
int j = 0; j < 5; ++j)
937 std::stringstream errorstring;
938 errorstring <<
"Element " << indx
939 <<
" has invalid face: " << j;
940 ASSERTL0(
false, errorstring.str().c_str());
944 faces[j] = static_pointer_cast<TriGeom>(face);
947 else if (face->GetShapeType() ==
950 faces[j] = static_pointer_cast<QuadGeom>(face);
954 ASSERTL0((Ntfaces == 2) && (Nqfaces == 3),
955 "Did not identify the correct number of "
956 "triangular and quadrilateral faces for a "
962 m_prismGeoms[indx] = prismgeom;
963 PopulateFaceToElMap(prismgeom, 5);
966 else if (elementType ==
"H")
968 std::vector<SpatialDomains::MeshHex> data;
972 for (
int i = 0; i < data.size(); ++i)
975 for (
int j = 0; j < 6; ++j)
978 faces[j] = static_pointer_cast<QuadGeom>(face);
983 m_hexGeoms[indx] = hexgeom;
984 PopulateFaceToElMap(hexgeom, 6);
988 element = element->NextSiblingElement();
992 void MeshGraphXmlCompressed::WriteVertices(TiXmlElement *geomTag,
995 if (verts.size() == 0)
1000 TiXmlElement *vertTag =
new TiXmlElement(
"VERTEX");
1002 vector<MeshVertex> vertInfo;
1004 for (
auto &i : verts)
1008 v.
x = i.second->x();
1009 v.
y = i.second->y();
1010 v.
z = i.second->z();
1011 vertInfo.push_back(v);
1014 vertTag->SetAttribute(
"COMPRESSED",
1016 vertTag->SetAttribute(
"BITSIZE",
1022 vertTag->LinkEndChild(
new TiXmlText(vertStr));
1024 geomTag->LinkEndChild(vertTag);
1027 void MeshGraphXmlCompressed::WriteEdges(TiXmlElement *geomTag,
1030 if (edges.size() == 0)
1035 TiXmlElement *edgeTag =
1036 new TiXmlElement(m_meshDimension == 1 ?
"S" :
"EDGE");
1038 vector<MeshEdge> edgeInfo;
1040 for (
auto &i : edges)
1044 e.
v0 = i.second->GetVid(0);
1045 e.
v1 = i.second->GetVid(1);
1046 edgeInfo.push_back(e);
1052 edgeTag->SetAttribute(
"COMPRESSED",
1054 edgeTag->SetAttribute(
"BITSIZE",
1057 edgeTag->LinkEndChild(
new TiXmlText(edgeStr));
1059 if (m_meshDimension == 1)
1061 TiXmlElement *tmp =
new TiXmlElement(
"ELEMENT");
1062 tmp->LinkEndChild(edgeTag);
1063 geomTag->LinkEndChild(tmp);
1067 geomTag->LinkEndChild(edgeTag);
1071 void MeshGraphXmlCompressed::WriteTris(TiXmlElement *faceTag,
TriGeomMap &tris)
1073 if (tris.size() == 0)
1080 vector<MeshTri> triInfo;
1082 for (
auto &i : tris)
1086 t.
e[0] = i.second->GetEid(0);
1087 t.
e[1] = i.second->GetEid(1);
1088 t.
e[2] = i.second->GetEid(2);
1089 triInfo.push_back(t);
1092 TiXmlElement *x =
new TiXmlElement(tag);
1096 x->SetAttribute(
"COMPRESSED",
1100 x->LinkEndChild(
new TiXmlText(triStr));
1102 faceTag->LinkEndChild(x);
1105 void MeshGraphXmlCompressed::WriteQuads(TiXmlElement *faceTag,
1108 if (quads.size() == 0)
1115 vector<MeshQuad> quadInfo;
1117 for (
auto &i : quads)
1121 q.
e[0] = i.second->GetEid(0);
1122 q.
e[1] = i.second->GetEid(1);
1123 q.
e[2] = i.second->GetEid(2);
1124 q.
e[3] = i.second->GetEid(3);
1125 quadInfo.push_back(q);
1128 TiXmlElement *x =
new TiXmlElement(tag);
1132 x->SetAttribute(
"COMPRESSED",
1136 x->LinkEndChild(
new TiXmlText(quadStr));
1138 faceTag->LinkEndChild(x);
1141 void MeshGraphXmlCompressed::WriteHexs(TiXmlElement *elmtTag,
HexGeomMap &hexs)
1143 if (hexs.size() == 0)
1150 vector<MeshHex> elementInfo;
1152 for (
auto &i : hexs)
1156 e.
f[0] = i.second->GetFid(0);
1157 e.
f[1] = i.second->GetFid(1);
1158 e.
f[2] = i.second->GetFid(2);
1159 e.
f[3] = i.second->GetFid(3);
1160 e.
f[4] = i.second->GetFid(4);
1161 e.
f[5] = i.second->GetFid(5);
1162 elementInfo.push_back(e);
1165 TiXmlElement *x =
new TiXmlElement(tag);
1169 x->SetAttribute(
"COMPRESSED",
1173 x->LinkEndChild(
new TiXmlText(elStr));
1175 elmtTag->LinkEndChild(x);
1178 void MeshGraphXmlCompressed::WritePrisms(TiXmlElement *elmtTag,
1181 if (pris.size() == 0)
1188 vector<MeshPrism> elementInfo;
1190 for (
auto &i : pris)
1194 e.
f[0] = i.second->GetFid(0);
1195 e.
f[1] = i.second->GetFid(1);
1196 e.
f[2] = i.second->GetFid(2);
1197 e.
f[3] = i.second->GetFid(3);
1198 e.
f[4] = i.second->GetFid(4);
1199 elementInfo.push_back(e);
1202 TiXmlElement *x =
new TiXmlElement(tag);
1206 x->SetAttribute(
"COMPRESSED",
1210 x->LinkEndChild(
new TiXmlText(elStr));
1212 elmtTag->LinkEndChild(x);
1215 void MeshGraphXmlCompressed::WritePyrs(TiXmlElement *elmtTag,
PyrGeomMap &pyrs)
1217 if (pyrs.size() == 0)
1224 vector<MeshPyr> elementInfo;
1226 for (
auto &i : pyrs)
1230 e.
f[0] = i.second->GetFid(0);
1231 e.
f[1] = i.second->GetFid(1);
1232 e.
f[2] = i.second->GetFid(2);
1233 e.
f[3] = i.second->GetFid(3);
1234 e.
f[4] = i.second->GetFid(4);
1235 elementInfo.push_back(e);
1238 TiXmlElement *x =
new TiXmlElement(tag);
1242 x->SetAttribute(
"COMPRESSED",
1246 x->LinkEndChild(
new TiXmlText(elStr));
1248 elmtTag->LinkEndChild(x);
1251 void MeshGraphXmlCompressed::WriteTets(TiXmlElement *elmtTag,
TetGeomMap &tets)
1253 if (tets.size() == 0)
1260 vector<MeshTet> elementInfo;
1262 for (
auto &i : tets)
1266 e.
f[0] = i.second->GetFid(0);
1267 e.
f[1] = i.second->GetFid(1);
1268 e.
f[2] = i.second->GetFid(2);
1269 e.
f[3] = i.second->GetFid(3);
1270 elementInfo.push_back(e);
1273 TiXmlElement *x =
new TiXmlElement(tag);
1277 x->SetAttribute(
"COMPRESSED",
1281 x->LinkEndChild(
new TiXmlText(elStr));
1283 elmtTag->LinkEndChild(x);
1286 void MeshGraphXmlCompressed::WriteCurves(TiXmlElement *geomTag,
CurveMap &edges,
1289 if (edges.size() == 0 && faces.size() == 0)
1294 TiXmlElement *curveTag =
new TiXmlElement(
"CURVED");
1296 vector<MeshCurvedInfo> edgeInfo;
1297 vector<MeshCurvedInfo> faceInfo;
1305 for (
auto &i : edges)
1308 cinfo.
id = edgeCnt++;
1310 cinfo.
npoints = i.second->m_points.size();
1311 cinfo.
ptype = i.second->m_ptype;
1315 edgeInfo.push_back(cinfo);
1317 for (
int j = 0; j < i.second->m_points.size(); j++)
1321 v.
x = i.second->m_points[j]->x();
1322 v.
y = i.second->m_points[j]->y();
1323 v.
z = i.second->m_points[j]->z();
1324 curvedPts.
pts.push_back(v);
1325 curvedPts.
index.push_back(newIdx);
1331 for (
auto &i : faces)
1334 cinfo.
id = faceCnt++;
1336 cinfo.
npoints = i.second->m_points.size();
1337 cinfo.
ptype = i.second->m_ptype;
1341 faceInfo.push_back(cinfo);
1343 for (
int j = 0; j < i.second->m_points.size(); j++)
1347 v.
x = i.second->m_points[j]->x();
1348 v.
y = i.second->m_points[j]->y();
1349 v.
z = i.second->m_points[j]->z();
1350 curvedPts.
pts.push_back(v);
1351 curvedPts.
index.push_back(newIdx);
1357 curveTag->SetAttribute(
"COMPRESSED",
1359 curveTag->SetAttribute(
"BITSIZE",
1362 if (edgeInfo.size())
1364 TiXmlElement *x =
new TiXmlElement(
"E");
1368 x->LinkEndChild(
new TiXmlText(dataStr));
1369 curveTag->LinkEndChild(x);
1372 if (faceInfo.size())
1374 TiXmlElement *x =
new TiXmlElement(
"F");
1378 x->LinkEndChild(
new TiXmlText(dataStr));
1379 curveTag->LinkEndChild(x);
1382 if (edgeInfo.size() || faceInfo.size())
1384 TiXmlElement *x =
new TiXmlElement(
"DATAPOINTS");
1385 x->SetAttribute(
"ID", curvedPts.
id);
1386 TiXmlElement *subx =
new TiXmlElement(
"INDEX");
1390 subx->LinkEndChild(
new TiXmlText(dataStr));
1391 x->LinkEndChild(subx);
1393 subx =
new TiXmlElement(
"POINTS");
1396 subx->LinkEndChild(
new TiXmlText(dataStr));
1397 x->LinkEndChild(subx);
1398 curveTag->LinkEndChild(x);
1401 geomTag->LinkEndChild(curveTag);
#define ASSERTL0(condition, msg)
Interpreter class for the evaluation of mathematical expressions.
int DefineFunction(const std::string &vlist, const std::string &expr)
Defines a function for the purposes of evaluation.
NekDouble Evaluate(const int id)
Evaluate a function which depends only on constants and/or parameters.
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
std::string GetBitSizeStr(void)
int ZlibDecodeFromBase64Str(std::string &in64, std::vector< T > &out)
std::string GetCompressString(void)
int ZlibEncodeToBase64Str(std::vector< T > &in, std::string &out64)
std::map< int, TriGeomSharedPtr > TriGeomMap
std::shared_ptr< QuadGeom > QuadGeomSharedPtr
std::map< int, PyrGeomSharedPtr > PyrGeomMap
std::map< int, QuadGeomSharedPtr > QuadGeomMap
std::shared_ptr< PrismGeom > PrismGeomSharedPtr
std::map< int, SegGeomSharedPtr > SegGeomMap
std::shared_ptr< Curve > CurveSharedPtr
std::unordered_map< int, CurveSharedPtr > CurveMap
std::shared_ptr< SegGeom > SegGeomSharedPtr
std::map< int, TetGeomSharedPtr > TetGeomMap
std::shared_ptr< PyrGeom > PyrGeomSharedPtr
std::shared_ptr< TetGeom > TetGeomSharedPtr
std::map< int, PrismGeomSharedPtr > PrismGeomMap
std::shared_ptr< HexGeom > HexGeomSharedPtr
std::shared_ptr< PointGeom > PointGeomSharedPtr
std::shared_ptr< Geometry2D > Geometry2DSharedPtr
std::shared_ptr< TriGeom > TriGeomSharedPtr
MeshGraphFactory & GetMeshGraphFactory()
std::map< int, HexGeomSharedPtr > HexGeomMap
std::map< int, PointGeomSharedPtr > PointGeomMap
The above copyright notice and this permission notice shall be included.
NekInt64 ptid
The number of points in this curved entity.
NekInt64 npoints
The entity id corresponding to the global edge/curve.
NekInt64 ptype
point offset of data entry for this curve
NekInt64 ptoffset
the id of point data map (currently always 0 since we are using just one set).
NekInt64 entityid
Id of this curved information.
std::vector< MeshVertex > pts
mapping to access pts value.
std::vector< NekInt64 > index
id of this Point set