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::v_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::v_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::v_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::v_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::v_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::v_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::v_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::v_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::v_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::v_WriteTris(TiXmlElement *faceTag,
 
 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::v_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::v_WriteHexs(TiXmlElement *elmtTag,
 
 1145     if (hexs.size() == 0)
 
 1152     vector<MeshHex> elementInfo;
 
 1154     for (
auto &i : hexs)
 
 1158         e.
f[0] = i.second->GetFid(0);
 
 1159         e.
f[1] = i.second->GetFid(1);
 
 1160         e.
f[2] = i.second->GetFid(2);
 
 1161         e.
f[3] = i.second->GetFid(3);
 
 1162         e.
f[4] = i.second->GetFid(4);
 
 1163         e.
f[5] = i.second->GetFid(5);
 
 1164         elementInfo.push_back(e);
 
 1167     TiXmlElement *x = 
new TiXmlElement(tag);
 
 1171     x->SetAttribute(
"COMPRESSED",
 
 1175     x->LinkEndChild(
new TiXmlText(elStr));
 
 1177     elmtTag->LinkEndChild(x);
 
 1180 void MeshGraphXmlCompressed::v_WritePrisms(TiXmlElement *elmtTag,
 
 1183     if (pris.size() == 0)
 
 1190     vector<MeshPrism> elementInfo;
 
 1192     for (
auto &i : pris)
 
 1196         e.
f[0] = i.second->GetFid(0);
 
 1197         e.
f[1] = i.second->GetFid(1);
 
 1198         e.
f[2] = i.second->GetFid(2);
 
 1199         e.
f[3] = i.second->GetFid(3);
 
 1200         e.
f[4] = i.second->GetFid(4);
 
 1201         elementInfo.push_back(e);
 
 1204     TiXmlElement *x = 
new TiXmlElement(tag);
 
 1208     x->SetAttribute(
"COMPRESSED",
 
 1212     x->LinkEndChild(
new TiXmlText(elStr));
 
 1214     elmtTag->LinkEndChild(x);
 
 1217 void MeshGraphXmlCompressed::v_WritePyrs(TiXmlElement *elmtTag,
 
 1220     if (pyrs.size() == 0)
 
 1227     vector<MeshPyr> elementInfo;
 
 1229     for (
auto &i : pyrs)
 
 1233         e.
f[0] = i.second->GetFid(0);
 
 1234         e.
f[1] = i.second->GetFid(1);
 
 1235         e.
f[2] = i.second->GetFid(2);
 
 1236         e.
f[3] = i.second->GetFid(3);
 
 1237         e.
f[4] = i.second->GetFid(4);
 
 1238         elementInfo.push_back(e);
 
 1241     TiXmlElement *x = 
new TiXmlElement(tag);
 
 1245     x->SetAttribute(
"COMPRESSED",
 
 1249     x->LinkEndChild(
new TiXmlText(elStr));
 
 1251     elmtTag->LinkEndChild(x);
 
 1254 void MeshGraphXmlCompressed::v_WriteTets(TiXmlElement *elmtTag,
 
 1257     if (tets.size() == 0)
 
 1264     vector<MeshTet> elementInfo;
 
 1266     for (
auto &i : tets)
 
 1270         e.
f[0] = i.second->GetFid(0);
 
 1271         e.
f[1] = i.second->GetFid(1);
 
 1272         e.
f[2] = i.second->GetFid(2);
 
 1273         e.
f[3] = i.second->GetFid(3);
 
 1274         elementInfo.push_back(e);
 
 1277     TiXmlElement *x = 
new TiXmlElement(tag);
 
 1281     x->SetAttribute(
"COMPRESSED",
 
 1285     x->LinkEndChild(
new TiXmlText(elStr));
 
 1287     elmtTag->LinkEndChild(x);
 
 1290 void MeshGraphXmlCompressed::v_WriteCurves(TiXmlElement *geomTag,
 
 1293     if (edges.size() == 0 && faces.size() == 0)
 
 1298     TiXmlElement *curveTag = 
new TiXmlElement(
"CURVED");
 
 1300     vector<MeshCurvedInfo> edgeInfo;
 
 1301     vector<MeshCurvedInfo> faceInfo;
 
 1309     for (
auto &i : edges)
 
 1312         cinfo.
id       = edgeCnt++;
 
 1314         cinfo.
npoints  = i.second->m_points.size();
 
 1315         cinfo.
ptype    = i.second->m_ptype;
 
 1319         edgeInfo.push_back(cinfo);
 
 1321         for (
int j = 0; j < i.second->m_points.size(); j++)
 
 1325             v.
x  = i.second->m_points[j]->x();
 
 1326             v.
y  = i.second->m_points[j]->y();
 
 1327             v.
z  = i.second->m_points[j]->z();
 
 1328             curvedPts.
pts.push_back(v);
 
 1329             curvedPts.
index.push_back(newIdx);
 
 1335     for (
auto &i : faces)
 
 1338         cinfo.
id       = faceCnt++;
 
 1340         cinfo.
npoints  = i.second->m_points.size();
 
 1341         cinfo.
ptype    = i.second->m_ptype;
 
 1345         faceInfo.push_back(cinfo);
 
 1347         for (
int j = 0; j < i.second->m_points.size(); j++)
 
 1351             v.
x  = i.second->m_points[j]->x();
 
 1352             v.
y  = i.second->m_points[j]->y();
 
 1353             v.
z  = i.second->m_points[j]->z();
 
 1354             curvedPts.
pts.push_back(v);
 
 1355             curvedPts.
index.push_back(newIdx);
 
 1361     curveTag->SetAttribute(
"COMPRESSED",
 
 1363     curveTag->SetAttribute(
"BITSIZE",
 
 1366     if (edgeInfo.size())
 
 1368         TiXmlElement *x = 
new TiXmlElement(
"E");
 
 1372         x->LinkEndChild(
new TiXmlText(dataStr));
 
 1373         curveTag->LinkEndChild(x);
 
 1376     if (faceInfo.size())
 
 1378         TiXmlElement *x = 
new TiXmlElement(
"F");
 
 1382         x->LinkEndChild(
new TiXmlText(dataStr));
 
 1383         curveTag->LinkEndChild(x);
 
 1386     if (edgeInfo.size() || faceInfo.size())
 
 1388         TiXmlElement *x = 
new TiXmlElement(
"DATAPOINTS");
 
 1389         x->SetAttribute(
"ID", curvedPts.
id);
 
 1390         TiXmlElement *subx = 
new TiXmlElement(
"INDEX");
 
 1394         subx->LinkEndChild(
new TiXmlText(dataStr));
 
 1395         x->LinkEndChild(subx);
 
 1397         subx = 
new TiXmlElement(
"POINTS");
 
 1400         subx->LinkEndChild(
new TiXmlText(dataStr));
 
 1401         x->LinkEndChild(subx);
 
 1402         curveTag->LinkEndChild(x);
 
 1405     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< HexGeom > HexGeomSharedPtr
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< 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