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/algorithm/string/predicate.hpp>
51 #include <boost/format.hpp>
52 #include <boost/iostreams/copy.hpp>
53 #include <boost/iostreams/filter/zlib.hpp>
54 #include <boost/iostreams/filtering_stream.hpp>
55 #include <boost/make_shared.hpp>
62 namespace SpatialDomains
65 std::string MeshGraphXmlCompressed::className =
67 "XmlCompressed", MeshGraphXmlCompressed::create,
68 "IO with Xml geometry");
70 void MeshGraphXmlCompressed::ReadVertices()
73 TiXmlElement *element = m_xmlGeom->FirstChildElement(
"VERTEX");
74 ASSERTL0(element,
"Unable to find mesh VERTEX tag in file.");
81 const char *xscal = element->Attribute(
"XSCALE");
88 std::string xscalstr = xscal;
90 xscale = expEvaluator.
Evaluate(expr_id);
93 const char *yscal = element->Attribute(
"YSCALE");
100 std::string yscalstr = yscal;
102 yscale = expEvaluator.
Evaluate(expr_id);
105 const char *zscal = element->Attribute(
"ZSCALE");
112 std::string zscalstr = zscal;
114 zscale = expEvaluator.
Evaluate(expr_id);
122 const char *xmov = element->Attribute(
"XMOVE");
129 std::string xmovstr = xmov;
131 xmove = expEvaluator.
Evaluate(expr_id);
134 const char *ymov = element->Attribute(
"YMOVE");
141 std::string ymovstr = ymov;
143 ymove = expEvaluator.
Evaluate(expr_id);
146 const char *zmov = element->Attribute(
"ZMOVE");
153 std::string zmovstr = zmov;
155 zmove = expEvaluator.
Evaluate(expr_id);
159 element->QueryStringAttribute(
"COMPRESSED", &IsCompressed);
161 if (boost::iequals(IsCompressed,
165 TiXmlNode *vertexChild = element->FirstChild();
166 ASSERTL0(vertexChild,
"Unable to extract the data from the compressed "
169 std::string vertexStr;
170 if (vertexChild->Type() == TiXmlNode::TINYXML_TEXT)
172 vertexStr += vertexChild->ToText()->ValueStr();
175 std::vector<SpatialDomains::MeshVertex> vertData;
181 for (
int i = 0; i < vertData.size(); ++i)
183 indx = vertData[i].id;
184 xval = vertData[i].x;
185 yval = vertData[i].y;
186 zval = vertData[i].z;
188 xval = xval * xscale + xmove;
189 yval = yval * yscale + ymove;
190 zval = zval * zscale + zmove;
193 m_spaceDimension, indx, xval, yval, zval));
195 vert->SetGlobalID(indx);
196 m_vertSet[indx] = vert;
201 ASSERTL0(
false,
"Compressed formats do not match. Expected :" +
203 " but got " + std::string(IsCompressed));
207 void MeshGraphXmlCompressed::ReadCurves()
211 TiXmlElement *element = m_xmlGeom->FirstChildElement(
"VERTEX");
212 ASSERTL0(element,
"Unable to find mesh VERTEX tag in file.");
217 const char *xscal = element->Attribute(
"XSCALE");
224 std::string xscalstr = xscal;
226 xscale = expEvaluator.
Evaluate(expr_id);
229 const char *yscal = element->Attribute(
"YSCALE");
236 std::string yscalstr = yscal;
238 yscale = expEvaluator.
Evaluate(expr_id);
241 const char *zscal = element->Attribute(
"ZSCALE");
248 std::string zscalstr = zscal;
250 zscale = expEvaluator.
Evaluate(expr_id);
258 const char *xmov = element->Attribute(
"XMOVE");
265 std::string xmovstr = xmov;
267 xmove = expEvaluator.
Evaluate(expr_id);
270 const char *ymov = element->Attribute(
"YMOVE");
277 std::string ymovstr = ymov;
279 ymove = expEvaluator.
Evaluate(expr_id);
282 const char *zmov = element->Attribute(
"ZMOVE");
289 std::string zmovstr = zmov;
291 zmove = expEvaluator.
Evaluate(expr_id);
295 TiXmlElement *field = m_xmlGeom->FirstChildElement(
"CURVED");
303 field->QueryStringAttribute(
"COMPRESSED", &IsCompressed);
305 if (IsCompressed.size() == 0)
312 ASSERTL0(boost::iequals(IsCompressed,
314 "Compressed formats do not match. Expected :" +
316 boost::lexical_cast<std::string>(IsCompressed));
318 std::vector<SpatialDomains::MeshCurvedInfo> edginfo;
319 std::vector<SpatialDomains::MeshCurvedInfo> facinfo;
323 TiXmlElement *x = field->FirstChildElement();
326 const char *entitytype = x->Value();
328 if (boost::iequals(entitytype,
"E"))
332 TiXmlNode *child = x->FirstChild();
334 if (child->Type() == TiXmlNode::TINYXML_TEXT)
336 elmtStr += child->ToText()->ValueStr();
342 else if (boost::iequals(entitytype,
"F"))
346 TiXmlNode *child = x->FirstChild();
348 if (child->Type() == TiXmlNode::TINYXML_TEXT)
350 elmtStr += child->ToText()->ValueStr();
356 else if (boost::iequals(entitytype,
"DATAPOINTS"))
360 "Failed to get ID from PTS section");
366 TiXmlElement *DataIdx = x->FirstChildElement(
"INDEX");
367 ASSERTL0(DataIdx,
"Cannot read data index tag in compressed "
370 TiXmlNode *child = DataIdx->FirstChild();
371 if (child->Type() == TiXmlNode::TINYXML_TEXT)
373 elmtStr = child->ToText()->ValueStr();
379 TiXmlElement *DataPts = x->FirstChildElement(
"POINTS");
380 ASSERTL0(DataPts,
"Cannot read data pts tag in compressed "
383 child = DataPts->FirstChild();
384 if (child->Type() == TiXmlNode::TINYXML_TEXT)
386 elmtStr = child->ToText()->ValueStr();
394 ASSERTL0(
false,
"Unknown tag in curved section");
396 x = x->NextSiblingElement();
400 for (
int i = 0; i < cpts.
pts.size(); ++i)
402 cpts.
pts[i].x = xscale * cpts.
pts[i].x + xmove;
403 cpts.
pts[i].y = yscale * cpts.
pts[i].y + ymove;
404 cpts.
pts[i].z = zscale * cpts.
pts[i].z + zmove;
407 for (
int i = 0; i < edginfo.size(); ++i)
409 int edgeid = edginfo[i].entityid;
416 int offset = edginfo[i].ptoffset;
417 for (
int j = 0; j < edginfo[i].npoints; ++j)
419 int idx = cpts.
index[offset + j];
422 m_spaceDimension, edginfo[i].
id, cpts.
pts[idx].x,
423 cpts.
pts[idx].y, cpts.
pts[idx].z));
424 curve->m_points.push_back(vert);
427 m_curvedEdges[edgeid] = curve;
430 for (
int i = 0; i < facinfo.size(); ++i)
432 int faceid = facinfo[i].entityid;
438 int offset = facinfo[i].ptoffset;
439 for (
int j = 0; j < facinfo[i].npoints; ++j)
441 int idx = cpts.
index[offset + j];
444 m_spaceDimension, facinfo[i].
id, cpts.
pts[idx].x,
445 cpts.
pts[idx].y, cpts.
pts[idx].z));
446 curve->m_points.push_back(vert);
449 m_curvedFaces[faceid] = curve;
453 void MeshGraphXmlCompressed::ReadEdges()
455 CurveMap::iterator it;
458 TiXmlElement *field = m_xmlGeom->FirstChildElement(
"EDGE");
460 ASSERTL0(field,
"Unable to find EDGE tag in file.");
463 field->QueryStringAttribute(
"COMPRESSED", &IsCompressed);
465 ASSERTL0(boost::iequals(IsCompressed,
467 "Compressed formats do not match. Expected :" +
469 std::string(IsCompressed));
471 TiXmlNode *edgeChild = field->FirstChild();
472 ASSERTL0(edgeChild,
"Unable to extract the data from "
473 "the compressed edge tag.");
476 if (edgeChild->Type() == TiXmlNode::TINYXML_TEXT)
478 edgeStr += edgeChild->ToText()->ValueStr();
481 std::vector<SpatialDomains::MeshEdge> edgeData;
485 for (
int i = 0; i < edgeData.size(); ++i)
487 indx = edgeData[i].id;
489 GetVertex(edgeData[i].v1)};
492 it = m_curvedEdges.find(indx);
493 if (it == m_curvedEdges.end())
496 indx, m_spaceDimension, vertices);
501 indx, m_spaceDimension, vertices, it->second);
503 m_segGeoms[indx] = edge;
507 void MeshGraphXmlCompressed::ReadFaces()
510 TiXmlElement *field = m_xmlGeom->FirstChildElement(
"FACE");
512 ASSERTL0(field,
"Unable to find FACE tag in file.");
518 TiXmlElement *element = field->FirstChildElement();
519 CurveMap::iterator it;
523 std::string elementType(element->ValueStr());
525 ASSERTL0(elementType ==
"Q" || elementType ==
"T",
526 (std::string(
"Unknown 3D face type: ") + elementType).c_str());
529 element->QueryStringAttribute(
"COMPRESSED", &IsCompressed);
532 boost::iequals(IsCompressed,
534 "Compressed formats do not match. Expected :" +
536 std::string(IsCompressed));
539 TiXmlNode *faceChild = element->FirstChild();
540 ASSERTL0(faceChild,
"Unable to extract the data from "
541 "the compressed face tag.");
544 if (faceChild->Type() == TiXmlNode::TINYXML_TEXT)
546 faceStr += faceChild->ToText()->ValueStr();
550 if (elementType ==
"T")
552 std::vector<SpatialDomains::MeshTri> faceData;
556 for (
int i = 0; i < faceData.size(); ++i)
558 indx = faceData[i].id;
561 it = m_curvedFaces.find(indx);
565 GetSegGeom(faceData[i].e[0]), GetSegGeom(faceData[i].e[1]),
566 GetSegGeom(faceData[i].e[2])};
569 if (it == m_curvedFaces.end())
577 indx, edges, it->second);
579 trigeom->SetGlobalID(indx);
580 m_triGeoms[indx] = trigeom;
583 else if (elementType ==
"Q")
585 std::vector<SpatialDomains::MeshQuad> faceData;
589 for (
int i = 0; i < faceData.size(); ++i)
591 indx = faceData[i].id;
594 it = m_curvedFaces.find(indx);
598 GetSegGeom(faceData[i].e[0]), GetSegGeom(faceData[i].e[1]),
599 GetSegGeom(faceData[i].e[2]), GetSegGeom(faceData[i].e[3])};
602 if (it == m_curvedFaces.end())
610 indx, edges, it->second);
612 quadgeom->SetGlobalID(indx);
613 m_quadGeoms[indx] = quadgeom;
617 element = element->NextSiblingElement();
621 void MeshGraphXmlCompressed::ReadElements1D()
623 TiXmlElement *field = NULL;
626 field = m_xmlGeom->FirstChildElement(
"ELEMENT");
628 ASSERTL0(field,
"Unable to find ELEMENT tag in file.");
633 TiXmlElement *segment = field->FirstChildElement(
"S");
634 CurveMap::iterator it;
639 segment->QueryStringAttribute(
"COMPRESSED", &IsCompressed);
641 boost::iequals(IsCompressed,
643 "Compressed formats do not match. Expected :" +
645 std::string(IsCompressed));
648 TiXmlNode *child = segment->FirstChild();
649 ASSERTL0(child,
"Unable to extract the data from "
650 "the compressed face tag.");
653 if (child->Type() == TiXmlNode::TINYXML_TEXT)
655 str += child->ToText()->ValueStr();
660 std::vector<SpatialDomains::MeshEdge> data;
663 for (
int i = 0; i < data.size(); ++i)
668 it = m_curvedEdges.find(indx);
671 GetVertex(data[i].v1)};
674 if (it == m_curvedEdges.end())
677 indx, m_spaceDimension, vertices);
678 seg->SetGlobalID(indx);
683 indx, m_spaceDimension, vertices, it->second);
684 seg->SetGlobalID(indx);
686 seg->SetGlobalID(indx);
687 m_segGeoms[indx] = seg;
690 segment = segment->NextSiblingElement(
"S");
694 void MeshGraphXmlCompressed::ReadElements2D()
697 TiXmlElement *field = m_xmlGeom->FirstChildElement(
"ELEMENT");
699 ASSERTL0(field,
"Unable to find ELEMENT tag in file.");
702 CurveMap::iterator it;
707 TiXmlElement *element = field->FirstChildElement();
711 std::string elementType(element->ValueStr());
714 elementType ==
"Q" || elementType ==
"T",
715 (std::string(
"Unknown 2D element type: ") + elementType).c_str());
718 element->QueryStringAttribute(
"COMPRESSED", &IsCompressed);
721 boost::iequals(IsCompressed,
723 "Compressed formats do not match. Expected :" +
725 std::string(IsCompressed));
728 TiXmlNode *faceChild = element->FirstChild();
729 ASSERTL0(faceChild,
"Unable to extract the data from "
730 "the compressed face tag.");
733 if (faceChild->Type() == TiXmlNode::TINYXML_TEXT)
735 faceStr += faceChild->ToText()->ValueStr();
739 if (elementType ==
"T")
741 std::vector<SpatialDomains::MeshTri> faceData;
745 for (
int i = 0; i < faceData.size(); ++i)
747 indx = faceData[i].id;
750 it = m_curvedFaces.find(indx);
754 GetSegGeom(faceData[i].e[0]), GetSegGeom(faceData[i].e[1]),
755 GetSegGeom(faceData[i].e[2])};
758 if (it == m_curvedFaces.end())
766 indx, edges, it->second);
768 trigeom->SetGlobalID(indx);
769 m_triGeoms[indx] = trigeom;
772 else if (elementType ==
"Q")
774 std::vector<SpatialDomains::MeshQuad> faceData;
778 for (
int i = 0; i < faceData.size(); ++i)
780 indx = faceData[i].id;
783 it = m_curvedFaces.find(indx);
787 GetSegGeom(faceData[i].e[0]), GetSegGeom(faceData[i].e[1]),
788 GetSegGeom(faceData[i].e[2]), GetSegGeom(faceData[i].e[3])};
791 if (it == m_curvedFaces.end())
799 indx, edges, it->second);
801 quadgeom->SetGlobalID(indx);
802 m_quadGeoms[indx] = quadgeom;
806 element = element->NextSiblingElement();
810 void MeshGraphXmlCompressed::ReadElements3D()
813 TiXmlElement *field = m_xmlGeom->FirstChildElement(
"ELEMENT");
815 ASSERTL0(field,
"Unable to find ELEMENT tag in file.");
820 TiXmlElement *element = field->FirstChildElement();
824 std::string elementType(element->ValueStr());
828 elementType ==
"A" || elementType ==
"P" || elementType ==
"R" ||
830 (std::string(
"Unknown 3D element type: ") + elementType).c_str());
833 element->QueryStringAttribute(
"COMPRESSED", &IsCompressed);
836 boost::iequals(IsCompressed,
838 "Compressed formats do not match. Expected :" +
840 std::string(IsCompressed));
843 TiXmlNode *child = element->FirstChild();
844 ASSERTL0(child,
"Unable to extract the data from "
845 "the compressed face tag.");
848 if (child->Type() == TiXmlNode::TINYXML_TEXT)
850 str += child->ToText()->ValueStr();
854 if (elementType ==
"A")
856 std::vector<SpatialDomains::MeshTet> data;
859 for (
int i = 0; i < data.size(); ++i)
862 for (
int j = 0; j < 4; ++j)
865 tfaces[j] = static_pointer_cast<TriGeom>(face);
870 m_tetGeoms[indx] = tetgeom;
871 PopulateFaceToElMap(tetgeom, 4);
874 else if (elementType ==
"P")
876 std::vector<SpatialDomains::MeshPyr> data;
879 for (
int i = 0; i < data.size(); ++i)
884 for (
int j = 0; j < 5; ++j)
892 std::stringstream errorstring;
893 errorstring <<
"Element " << indx
894 <<
" has invalid face: " << j;
895 ASSERTL0(
false, errorstring.str().c_str());
899 faces[j] = static_pointer_cast<TriGeom>(face);
902 else if (face->GetShapeType() ==
905 faces[j] = static_pointer_cast<QuadGeom>(face);
909 ASSERTL0((Ntfaces == 4) && (Nqfaces == 1),
910 "Did not identify the correct number of "
911 "triangular and quadrilateral faces for a "
917 m_pyrGeoms[indx] = pyrgeom;
918 PopulateFaceToElMap(pyrgeom, 5);
921 else if (elementType ==
"R")
923 std::vector<SpatialDomains::MeshPrism> data;
926 for (
int i = 0; i < data.size(); ++i)
931 for (
int j = 0; j < 5; ++j)
938 std::stringstream errorstring;
939 errorstring <<
"Element " << indx
940 <<
" has invalid face: " << j;
941 ASSERTL0(
false, errorstring.str().c_str());
945 faces[j] = static_pointer_cast<TriGeom>(face);
948 else if (face->GetShapeType() ==
951 faces[j] = static_pointer_cast<QuadGeom>(face);
955 ASSERTL0((Ntfaces == 2) && (Nqfaces == 3),
956 "Did not identify the correct number of "
957 "triangular and quadrilateral faces for a "
963 m_prismGeoms[indx] = prismgeom;
964 PopulateFaceToElMap(prismgeom, 5);
967 else if (elementType ==
"H")
969 std::vector<SpatialDomains::MeshHex> data;
973 for (
int i = 0; i < data.size(); ++i)
976 for (
int j = 0; j < 6; ++j)
979 faces[j] = static_pointer_cast<QuadGeom>(face);
984 m_hexGeoms[indx] = hexgeom;
985 PopulateFaceToElMap(hexgeom, 6);
989 element = element->NextSiblingElement();
993 void MeshGraphXmlCompressed::WriteVertices(TiXmlElement *geomTag,
996 if (verts.size() == 0)
1001 TiXmlElement *vertTag =
new TiXmlElement(
"VERTEX");
1003 vector<MeshVertex> vertInfo;
1005 for (
auto &i : verts)
1009 v.
x = i.second->x();
1010 v.
y = i.second->y();
1011 v.
z = i.second->z();
1012 vertInfo.push_back(v);
1015 vertTag->SetAttribute(
"COMPRESSED",
1017 vertTag->SetAttribute(
"BITSIZE",
1023 vertTag->LinkEndChild(
new TiXmlText(vertStr));
1025 geomTag->LinkEndChild(vertTag);
1028 void MeshGraphXmlCompressed::WriteEdges(TiXmlElement *geomTag,
1031 if (edges.size() == 0)
1036 TiXmlElement *edgeTag =
1037 new TiXmlElement(m_meshDimension == 1 ?
"S" :
"EDGE");
1039 vector<MeshEdge> edgeInfo;
1041 for (
auto &i : edges)
1045 e.
v0 = i.second->GetVid(0);
1046 e.
v1 = i.second->GetVid(1);
1047 edgeInfo.push_back(e);
1053 edgeTag->SetAttribute(
"COMPRESSED",
1055 edgeTag->SetAttribute(
"BITSIZE",
1058 edgeTag->LinkEndChild(
new TiXmlText(edgeStr));
1060 if (m_meshDimension == 1)
1062 TiXmlElement *tmp =
new TiXmlElement(
"ELEMENT");
1063 tmp->LinkEndChild(edgeTag);
1064 geomTag->LinkEndChild(tmp);
1068 geomTag->LinkEndChild(edgeTag);
1072 void MeshGraphXmlCompressed::WriteTris(TiXmlElement *faceTag,
TriGeomMap &tris)
1074 if (tris.size() == 0)
1081 vector<MeshTri> triInfo;
1083 for (
auto &i : tris)
1087 t.
e[0] = i.second->GetEid(0);
1088 t.
e[1] = i.second->GetEid(1);
1089 t.
e[2] = i.second->GetEid(2);
1090 triInfo.push_back(t);
1093 TiXmlElement *x =
new TiXmlElement(tag);
1097 x->SetAttribute(
"COMPRESSED",
1101 x->LinkEndChild(
new TiXmlText(triStr));
1103 faceTag->LinkEndChild(x);
1106 void MeshGraphXmlCompressed::WriteQuads(TiXmlElement *faceTag,
1109 if (quads.size() == 0)
1116 vector<MeshQuad> quadInfo;
1118 for (
auto &i : quads)
1122 q.
e[0] = i.second->GetEid(0);
1123 q.
e[1] = i.second->GetEid(1);
1124 q.
e[2] = i.second->GetEid(2);
1125 q.
e[3] = i.second->GetEid(3);
1126 quadInfo.push_back(q);
1129 TiXmlElement *x =
new TiXmlElement(tag);
1133 x->SetAttribute(
"COMPRESSED",
1137 x->LinkEndChild(
new TiXmlText(quadStr));
1139 faceTag->LinkEndChild(x);
1142 void MeshGraphXmlCompressed::WriteHexs(TiXmlElement *elmtTag,
HexGeomMap &hexs)
1144 if (hexs.size() == 0)
1151 vector<MeshHex> elementInfo;
1153 for (
auto &i : hexs)
1157 e.
f[0] = i.second->GetFid(0);
1158 e.
f[1] = i.second->GetFid(1);
1159 e.
f[2] = i.second->GetFid(2);
1160 e.
f[3] = i.second->GetFid(3);
1161 e.
f[4] = i.second->GetFid(4);
1162 e.
f[5] = i.second->GetFid(5);
1163 elementInfo.push_back(e);
1166 TiXmlElement *x =
new TiXmlElement(tag);
1170 x->SetAttribute(
"COMPRESSED",
1174 x->LinkEndChild(
new TiXmlText(elStr));
1176 elmtTag->LinkEndChild(x);
1179 void MeshGraphXmlCompressed::WritePrisms(TiXmlElement *elmtTag,
1182 if (pris.size() == 0)
1189 vector<MeshPrism> elementInfo;
1191 for (
auto &i : pris)
1195 e.
f[0] = i.second->GetFid(0);
1196 e.
f[1] = i.second->GetFid(1);
1197 e.
f[2] = i.second->GetFid(2);
1198 e.
f[3] = i.second->GetFid(3);
1199 e.
f[4] = i.second->GetFid(4);
1200 elementInfo.push_back(e);
1203 TiXmlElement *x =
new TiXmlElement(tag);
1207 x->SetAttribute(
"COMPRESSED",
1211 x->LinkEndChild(
new TiXmlText(elStr));
1213 elmtTag->LinkEndChild(x);
1216 void MeshGraphXmlCompressed::WritePyrs(TiXmlElement *elmtTag,
PyrGeomMap &pyrs)
1218 if (pyrs.size() == 0)
1225 vector<MeshPyr> elementInfo;
1227 for (
auto &i : pyrs)
1231 e.
f[0] = i.second->GetFid(0);
1232 e.
f[1] = i.second->GetFid(1);
1233 e.
f[2] = i.second->GetFid(2);
1234 e.
f[3] = i.second->GetFid(3);
1235 e.
f[4] = i.second->GetFid(4);
1236 elementInfo.push_back(e);
1239 TiXmlElement *x =
new TiXmlElement(tag);
1243 x->SetAttribute(
"COMPRESSED",
1247 x->LinkEndChild(
new TiXmlText(elStr));
1249 elmtTag->LinkEndChild(x);
1252 void MeshGraphXmlCompressed::WriteTets(TiXmlElement *elmtTag,
TetGeomMap &tets)
1254 if (tets.size() == 0)
1261 vector<MeshTet> elementInfo;
1263 for (
auto &i : tets)
1267 e.
f[0] = i.second->GetFid(0);
1268 e.
f[1] = i.second->GetFid(1);
1269 e.
f[2] = i.second->GetFid(2);
1270 e.
f[3] = i.second->GetFid(3);
1271 elementInfo.push_back(e);
1274 TiXmlElement *x =
new TiXmlElement(tag);
1278 x->SetAttribute(
"COMPRESSED",
1282 x->LinkEndChild(
new TiXmlText(elStr));
1284 elmtTag->LinkEndChild(x);
1287 void MeshGraphXmlCompressed::WriteCurves(TiXmlElement *geomTag,
CurveMap &edges,
1290 if (edges.size() == 0 && faces.size() == 0)
1295 TiXmlElement *curveTag =
new TiXmlElement(
"CURVED");
1297 vector<MeshCurvedInfo> edgeInfo;
1298 vector<MeshCurvedInfo> faceInfo;
1306 for (
auto &i : edges)
1309 cinfo.
id = edgeCnt++;
1311 cinfo.
npoints = i.second->m_points.size();
1312 cinfo.
ptype = i.second->m_ptype;
1316 edgeInfo.push_back(cinfo);
1318 for (
int j = 0; j < i.second->m_points.size(); j++)
1322 v.
x = i.second->m_points[j]->x();
1323 v.
y = i.second->m_points[j]->y();
1324 v.
z = i.second->m_points[j]->z();
1325 curvedPts.
pts.push_back(v);
1326 curvedPts.
index.push_back(newIdx);
1332 for (
auto &i : faces)
1335 cinfo.
id = faceCnt++;
1337 cinfo.
npoints = i.second->m_points.size();
1338 cinfo.
ptype = i.second->m_ptype;
1342 faceInfo.push_back(cinfo);
1344 for (
int j = 0; j < i.second->m_points.size(); j++)
1348 v.
x = i.second->m_points[j]->x();
1349 v.
y = i.second->m_points[j]->y();
1350 v.
z = i.second->m_points[j]->z();
1351 curvedPts.
pts.push_back(v);
1352 curvedPts.
index.push_back(newIdx);
1358 curveTag->SetAttribute(
"COMPRESSED",
1360 curveTag->SetAttribute(
"BITSIZE",
1363 if (edgeInfo.size())
1365 TiXmlElement *x =
new TiXmlElement(
"E");
1369 x->LinkEndChild(
new TiXmlText(dataStr));
1370 curveTag->LinkEndChild(x);
1373 if (faceInfo.size())
1375 TiXmlElement *x =
new TiXmlElement(
"F");
1379 x->LinkEndChild(
new TiXmlText(dataStr));
1380 curveTag->LinkEndChild(x);
1383 if (edgeInfo.size() || faceInfo.size())
1385 TiXmlElement *x =
new TiXmlElement(
"DATAPOINTS");
1386 x->SetAttribute(
"ID", curvedPts.
id);
1387 TiXmlElement *subx =
new TiXmlElement(
"INDEX");
1391 subx->LinkEndChild(
new TiXmlText(dataStr));
1392 x->LinkEndChild(subx);
1394 subx =
new TiXmlElement(
"POINTS");
1397 subx->LinkEndChild(
new TiXmlText(dataStr));
1398 x->LinkEndChild(subx);
1399 curveTag->LinkEndChild(x);
1402 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