62 #include <boost/archive/iterators/base64_from_binary.hpp>
63 #include <boost/archive/iterators/binary_from_base64.hpp>
64 #include <boost/archive/iterators/transform_width.hpp>
65 #include <boost/iostreams/copy.hpp>
66 #include <boost/iostreams/filter/zlib.hpp>
67 #include <boost/iostreams/filtering_stream.hpp>
68 #include <boost/make_shared.hpp>
74 namespace SpatialDomains
79 MeshGraph::MeshGraph():
91 unsigned int meshDimension,
92 unsigned int spaceDimension) :
93 m_meshDimension(meshDimension),
94 m_spaceDimension(spaceDimension),
128 boost::shared_ptr<MeshGraph> returnval;
132 TiXmlElement* geometry_tag = pSession->GetElement(
"NEKTAR/GEOMETRY");
133 TiXmlAttribute *attr = geometry_tag->FirstAttribute();
137 std::string attrName(attr->Name());
138 if (attrName ==
"DIM")
140 int err = attr->QueryIntValue(&meshDim);
141 ASSERTL0(err==TIXML_SUCCESS,
"Unable to read mesh dimension.");
146 std::string errstr(
"Unknown attribute: ");
172 std::string err =
"Invalid mesh dimension: ";
173 std::stringstream strstrm;
175 err += strstrm.str();
186 const std::string& infilename,
187 bool pReadExpansions)
189 boost::shared_ptr<MeshGraph> returnval;
211 std::string err =
"Invalid mesh dimension: ";
212 std::stringstream strstrm;
214 err += strstrm.str();
220 returnval->ReadGeometry(infilename);
221 returnval->ReadGeometryInfo(infilename);
224 returnval->ReadExpansions(infilename);
237 TiXmlDocument doc(infilename);
238 bool loadOkay = doc.LoadFile();
240 std::stringstream errstr;
241 errstr <<
"Unable to load file: " << infilename <<
" (";
242 errstr << doc.ErrorDesc() <<
", line " << doc.ErrorRow()
243 <<
", column " << doc.ErrorCol() <<
")";
255 TiXmlHandle docHandle(&doc);
256 TiXmlElement* mesh = NULL;
257 TiXmlElement* master = NULL;
261 master = doc.FirstChildElement(
"NEKTAR");
262 ASSERTL0(master,
"Unable to find NEKTAR tag in file.");
265 mesh = master->FirstChildElement(
"GEOMETRY");
267 ASSERTL0(mesh,
"Unable to find GEOMETRY tag in file.");
268 TiXmlAttribute *attr = mesh->FirstAttribute();
279 std::string attrName(attr->Name());
280 if (attrName ==
"DIM")
283 ASSERTL1(err==TIXML_SUCCESS,
"Unable to read mesh dimension.");
285 else if (attrName ==
"SPACE")
288 ASSERTL1(err==TIXML_SUCCESS,
"Unable to read space dimension.");
290 else if (attrName ==
"PARTITION")
293 ASSERTL1(err==TIXML_SUCCESS,
"Unable to read partition.");
298 std::string errstr(
"Unknown attribute: ");
310 TiXmlElement* element = mesh->FirstChildElement(
"VERTEX");
311 ASSERTL0(element,
"Unable to find mesh VERTEX tag in file.");
319 const char *xscal = element->Attribute(
"XSCALE");
326 std::string xscalstr = xscal;
328 xscale = expEvaluator.
Evaluate(expr_id);
331 const char *yscal = element->Attribute(
"YSCALE");
338 std::string yscalstr = yscal;
340 yscale = expEvaluator.
Evaluate(expr_id);
343 const char *zscal = element->Attribute(
"ZSCALE");
350 std::string zscalstr = zscal;
352 zscale = expEvaluator.
Evaluate(expr_id);
362 const char *xmov = element->Attribute(
"XMOVE");
369 std::string xmovstr = xmov;
371 xmove = expEvaluator.
Evaluate(expr_id);
374 const char *ymov = element->Attribute(
"YMOVE");
381 std::string ymovstr = ymov;
383 ymove = expEvaluator.
Evaluate(expr_id);
386 const char *zmov = element->Attribute(
"ZMOVE");
393 std::string zmovstr = zmov;
395 zmove = expEvaluator.
Evaluate(expr_id);
399 element->QueryStringAttribute(
"COMPRESSED",&IsCompressed);
401 if(IsCompressed.size())
403 if(boost::iequals(IsCompressed,
407 TiXmlNode* vertexChild = element->FirstChild();
409 "Unable to extract the data from the compressed "
412 std::string vertexStr;
413 if (vertexChild->Type() == TiXmlNode::TINYXML_TEXT)
415 vertexStr += vertexChild->ToText()->ValueStr();
418 std::vector<LibUtilities::MeshVertex> vertData;
424 for(
int i = 0; i < vertData.size(); ++i)
426 indx = vertData[i].id;
427 xval = vertData[i].x;
428 yval = vertData[i].y;
429 zval = vertData[i].z;
431 xval = xval*xscale + xmove;
432 yval = yval*yscale + ymove;
433 zval = zval*zscale + zmove;
439 vert->SetGlobalID(indx);
445 ASSERTL0(
false,
"Compressed formats do not match. Expected :"
447 +
" but got " + std::string(IsCompressed));
452 TiXmlElement *
vertex = element->FirstChildElement(
"V");
455 int nextVertexNumber = -1;
461 TiXmlAttribute *vertexAttr = vertex->FirstAttribute();
462 std::string attrName(vertexAttr->Name());
464 ASSERTL0(attrName ==
"ID", (std::string(
"Unknown attribute name: ") + attrName).c_str());
466 err = vertexAttr->QueryIntValue(&indx);
467 ASSERTL0(err == TIXML_SUCCESS,
"Unable to read attribute ID.");
470 std::string vertexBodyStr;
472 TiXmlNode *vertexBody = vertex->FirstChild();
477 if (vertexBody->Type() == TiXmlNode::TINYXML_TEXT)
479 vertexBodyStr += vertexBody->ToText()->Value();
480 vertexBodyStr +=
" ";
483 vertexBody = vertexBody->NextSibling();
486 ASSERTL0(!vertexBodyStr.empty(),
"Vertex definitions must contain vertex data.");
490 std::istringstream vertexDataStrm(vertexBodyStr.c_str());
494 while(!vertexDataStrm.fail())
496 vertexDataStrm >> xval >> yval >> zval;
498 xval = xval*xscale + xmove;
499 yval = yval*yscale + ymove;
500 zval = zval*zscale + zmove;
505 if (!vertexDataStrm.fail())
508 vert->SetGlobalID(indx);
515 ASSERTL0(
false,
"Unable to read VERTEX data.");
518 vertex = vertex->NextSiblingElement(
"V");
532 TiXmlDocument doc(infilename);
533 bool loadOkay = doc.LoadFile();
535 std::stringstream errstr;
536 errstr <<
"Unable to load file: " << infilename << std::endl;
537 errstr <<
"Reason: " << doc.ErrorDesc() << std::endl;
538 errstr <<
"Position: Line " << doc.ErrorRow() <<
", Column " << doc.ErrorCol() << std::endl;
553 TiXmlElement *master = doc.FirstChildElement(
"NEKTAR");
554 ASSERTL0(master,
"Unable to find NEKTAR tag in file.");
557 TiXmlElement *geomTag = master->FirstChildElement(
"GEOMETRY");
558 ASSERTL0(geomTag,
"Unable to find GEOMETRY tag in file.");
561 TiXmlElement *geomInfoTag = geomTag->FirstChildElement(
"GEOMINFO");
562 if (!geomInfoTag)
return;
564 TiXmlElement *infoItem = geomInfoTag->FirstChildElement(
"I");
570 std::string geomProperty = infoItem->Attribute(
"PROPERTY");
571 std::string geomValue = infoItem->Attribute(
"VALUE");
575 "Property " + geomProperty +
" already specified.");
577 infoItem = infoItem->NextSiblingElement(
"I");
587 TiXmlDocument doc(infilename);
588 bool loadOkay = doc.LoadFile();
590 std::stringstream errstr;
591 errstr <<
"Unable to load file: " << infilename << std::endl;
592 errstr <<
"Reason: " << doc.ErrorDesc() << std::endl;
593 errstr <<
"Position: Line " << doc.ErrorRow() <<
", Column " << doc.ErrorCol() << std::endl;
605 TiXmlElement *master = doc.FirstChildElement(
"NEKTAR");
606 ASSERTL0(master,
"Unable to find NEKTAR tag in file.");
609 TiXmlElement *expansionTypes = master->FirstChildElement(
"EXPANSIONS");
610 ASSERTL0(expansionTypes,
"Unable to find EXPANSIONS tag in file.");
615 TiXmlElement *expansion = expansionTypes->FirstChildElement();
616 std::string expType = expansion->Value();
636 const char *fStr = expansion->Attribute(
"FIELDS");
637 std::vector<std::string> fieldStrings;
641 std::string fieldStr = fStr;
643 ASSERTL0(valid,
"Unable to correctly parse the field string in ExpansionTypes.");
657 for(i = 0; i < fieldStrings.size(); ++i)
665 if(fieldStrings.size())
677 for(i = 0; i < fieldStrings.size(); ++i)
685 ASSERTL0(
false,
"Expansion vector for this field is already setup");
698 std::string compositeStr = expansion->Attribute(
"COMPOSITE");
699 ASSERTL0(compositeStr.length() > 3,
"COMPOSITE must be specified in expansion definition");
700 int beg = compositeStr.find_first_of(
"[");
701 int end = compositeStr.find_first_of(
"]");
702 std::string compositeListStr = compositeStr.substr(beg+1,end-beg-1);
707 bool useExpansionType =
false;
712 const char * tStr = expansion->Attribute(
"TYPE");
716 std::string typeStr = tStr;
719 const std::string* expStr =
std::find(begStr, endStr, typeStr);
721 ASSERTL0(expStr != endStr,
"Invalid expansion type.");
732 const char *nStr = expansion->Attribute(
"NUMMODES");
733 ASSERTL0(nStr,
"NUMMODES was not defined in EXPANSION section of input");
734 std::string nummodesStr = nStr;
740 num_modes = (int) nummodesEqn.
Evaluate();
744 num_modes = boost::lexical_cast<
int>(nummodesStr);
747 useExpansionType =
true;
752 const char *bTypeStr = expansion->Attribute(
"BASISTYPE");
753 ASSERTL0(bTypeStr,
"TYPE or BASISTYPE was not defined in EXPANSION section of input");
754 std::string basisTypeStr = bTypeStr;
757 std::vector<std::string> basisStrings;
758 std::vector<LibUtilities::BasisType> basis;
760 ASSERTL0(valid,
"Unable to correctly parse the basis types.");
761 for (vector<std::string>::size_type i = 0; i < basisStrings.size(); i++)
773 ASSERTL0(valid, std::string(
"Unable to correctly parse the basis type: ").append(basisStrings[i]).c_str());
775 const char *nModesStr = expansion->Attribute(
"NUMMODES");
776 ASSERTL0(nModesStr,
"NUMMODES was not defined in EXPANSION section of input");
778 std::string numModesStr = nModesStr;
779 std::vector<unsigned int> numModes;
781 ASSERTL0(valid,
"Unable to correctly parse the number of modes.");
782 ASSERTL0(numModes.size() == basis.size(),
"information for num modes does not match the number of basis");
784 const char *pTypeStr = expansion->Attribute(
"POINTSTYPE");
785 ASSERTL0(pTypeStr,
"POINTSTYPE was not defined in EXPANSION section of input");
786 std::string pointsTypeStr = pTypeStr;
788 std::vector<std::string> pointsStrings;
789 std::vector<LibUtilities::PointsType> points;
791 ASSERTL0(valid,
"Unable to correctly parse the points types.");
792 for (vector<std::string>::size_type i = 0; i < pointsStrings.size(); i++)
804 ASSERTL0(valid, std::string(
"Unable to correctly parse the points type: ").append(pointsStrings[i]).c_str());
807 const char *nPointsStr = expansion->Attribute(
"NUMPOINTS");
808 ASSERTL0(nPointsStr,
"NUMPOINTS was not defined in EXPANSION section of input");
809 std::string numPointsStr = nPointsStr;
810 std::vector<unsigned int> numPoints;
812 ASSERTL0(valid,
"Unable to correctly parse the number of points.");
813 ASSERTL0(numPoints.size() == numPoints.size(),
"information for num points does not match the number of basis");
815 for(
int i = 0; i < basis.size(); ++i)
828 for (compVecIter = compositeVector.begin(); compVecIter != compositeVector.end(); ++compVecIter)
831 for (geomVecIter = (compVecIter->second)->begin(); geomVecIter != (compVecIter->second)->end(); ++geomVecIter)
834 ASSERTL0(x != expansionMap->end(),
"Expansion not found!!");
841 ASSERTL0((*geomVecIter)->GetShapeDim() == basiskeyvec.size(),
" There is an incompatible expansion dimension with geometry dimension");
842 (x->second)->m_basisKeyVector = basiskeyvec;
847 expansion = expansion->NextSiblingElement(
"E");
850 else if(expType ==
"H")
858 const char *fStr = expansion->Attribute(
"FIELDS");
859 std::vector<std::string> fieldStrings;
863 std::string fieldStr = fStr;
865 ASSERTL0(valid,
"Unable to correctly parse the field string in ExpansionTypes.");
879 for(i = 0; i < fieldStrings.size(); ++i)
887 if(fieldStrings.size())
899 for(i = 0; i < fieldStrings.size(); ++i)
907 ASSERTL0(
false,
"Expansion vector for this field is already setup");
920 std::string compositeStr = expansion->Attribute(
"COMPOSITE");
921 ASSERTL0(compositeStr.length() > 3,
"COMPOSITE must be specified in expansion definition");
922 int beg = compositeStr.find_first_of(
"[");
923 int end = compositeStr.find_first_of(
"]");
924 std::string compositeListStr = compositeStr.substr(beg+1,end-beg-1);
938 const char * tStr_x = expansion->Attribute(
"TYPE-X");
942 std::string typeStr = tStr_x;
945 const std::string* expStr =
std::find(begStr, endStr, typeStr);
947 ASSERTL0(expStr != endStr,
"Invalid expansion type.");
950 const char *nStr = expansion->Attribute(
"NUMMODES-X");
951 ASSERTL0(nStr,
"NUMMODES-X was not defined in EXPANSION section of input");
952 std::string nummodesStr = nStr;
959 num_modes_x = (int) nummodesEqn.
Evaluate();
963 num_modes_x = boost::lexical_cast<
int>(nummodesStr);
968 const char * tStr_y = expansion->Attribute(
"TYPE-Y");
972 std::string typeStr = tStr_y;
975 const std::string* expStr =
std::find(begStr, endStr, typeStr);
977 ASSERTL0(expStr != endStr,
"Invalid expansion type.");
980 const char *nStr = expansion->Attribute(
"NUMMODES-Y");
981 ASSERTL0(nStr,
"NUMMODES-Y was not defined in EXPANSION section of input");
982 std::string nummodesStr = nStr;
988 num_modes_y = (int) nummodesEqn.
Evaluate();
992 num_modes_y = boost::lexical_cast<
int>(nummodesStr);
997 const char * tStr_z = expansion->Attribute(
"TYPE-Z");
1001 std::string typeStr = tStr_z;
1004 const std::string* expStr =
std::find(begStr, endStr, typeStr);
1006 ASSERTL0(expStr != endStr,
"Invalid expansion type.");
1009 const char *nStr = expansion->Attribute(
"NUMMODES-Z");
1010 ASSERTL0(nStr,
"NUMMODES-Z was not defined in EXPANSION section of input");
1011 std::string nummodesStr = nStr;
1017 num_modes_z = (int) nummodesEqn.
Evaluate();
1021 num_modes_z = boost::lexical_cast<
int>(nummodesStr);
1027 for (compVecIter = compositeVector.begin(); compVecIter != compositeVector.end(); ++compVecIter)
1030 for (geomVecIter = (compVecIter->second)->begin(); geomVecIter != (compVecIter->second)->end(); ++geomVecIter)
1033 for (expVecIter = expansionMap->begin(); expVecIter != expansionMap->end(); ++expVecIter)
1047 expansion = expansion->NextSiblingElement(
"H");
1050 else if(expType ==
"ELEMENTS")
1052 std::vector<LibUtilities::FieldDefinitionsSharedPtr> fielddefs;
1055 boost::shared_ptr<LibUtilities::FieldIOXml> f = boost::make_shared<LibUtilities::FieldIOXml>(
m_session->GetComm(),
false);
1057 cout <<
" Number of elements: " << fielddefs.size() << endl;
1060 else if(expType ==
"F")
1062 ASSERTL0(expansion->Attribute(
"FILE"),
1063 "Attribute FILE expected for type F expansion");
1064 std::string filenameStr = expansion->Attribute(
"FILE");
1066 "A filename must be specified for the FILE "
1067 "attribute of expansion");
1069 std::vector<LibUtilities::FieldDefinitionsSharedPtr> fielddefs;
1073 f->Import(filenameStr, fielddefs);
1078 ASSERTL0(
false,
"Expansion type not defined");
1089 TiXmlHandle docHandle(&doc);
1091 TiXmlElement* mesh = docHandle.FirstChildElement(
"NEKTAR").FirstChildElement(
"GEOMETRY").Element();
1092 TiXmlElement* domain = NULL;
1094 ASSERTL0(mesh,
"Unable to find GEOMETRY tag in file.");
1097 domain = mesh->FirstChildElement(
"DOMAIN");
1099 ASSERTL0(domain,
"Unable to find DOMAIN tag in file.");
1103 TiXmlElement *multidomains = domain->FirstChildElement(
"D");
1107 int nextDomainNumber = 0;
1108 while (multidomains)
1111 int err = multidomains->QueryIntAttribute(
"ID", &indx);
1113 "Unable to read attribute ID in Domain.");
1116 TiXmlNode* elementChild = multidomains->FirstChild();
1117 while(elementChild && elementChild->Type() != TiXmlNode::TINYXML_TEXT)
1119 elementChild = elementChild->NextSibling();
1122 ASSERTL0(elementChild,
"Unable to read DOMAIN body.");
1123 std::string elementStr = elementChild->ToText()->ValueStr();
1125 elementStr = elementStr.substr(elementStr.find_first_not_of(
" "));
1127 std::string::size_type indxBeg = elementStr.find_first_of(
'[') + 1;
1128 std::string::size_type indxEnd = elementStr.find_last_of(
']') - 1;
1129 std::string indxStr = elementStr.substr(indxBeg, indxEnd - indxBeg + 1);
1131 ASSERTL0(!indxStr.empty(),
"Unable to read domain's composite index (index missing?).");
1139 ASSERTL0(!
m_domain[nextDomainNumber++].empty(), (std::string(
"Unable to obtain domain's referenced composite: ") + indxStr).c_str());
1142 multidomains = multidomains->NextSiblingElement(
"D");
1150 TiXmlNode* elementChild = domain->FirstChild();
1151 while(elementChild && elementChild->Type() != TiXmlNode::TINYXML_TEXT)
1153 elementChild = elementChild->NextSibling();
1156 ASSERTL0(elementChild,
"Unable to read DOMAIN body.");
1157 std::string elementStr = elementChild->ToText()->ValueStr();
1159 elementStr = elementStr.substr(elementStr.find_first_not_of(
" "));
1161 std::string::size_type indxBeg = elementStr.find_first_of(
'[') + 1;
1162 std::string::size_type indxEnd = elementStr.find_last_of(
']') - 1;
1163 std::string indxStr = elementStr.substr(indxBeg, indxEnd - indxBeg + 1);
1165 ASSERTL0(!indxStr.empty(),
"Unable to read domain's composite index (index missing?).");
1173 ASSERTL0(!
m_domain[0].empty(), (std::string(
"Unable to obtain domain's referenced composite: ") + indxStr).c_str());
1184 TiXmlHandle docHandle(&doc);
1185 TiXmlElement* mesh = docHandle.FirstChildElement(
"NEKTAR").FirstChildElement(
"GEOMETRY").Element();
1186 TiXmlElement* field = NULL;
1190 TiXmlElement* element = mesh->FirstChildElement(
"VERTEX");
1191 ASSERTL0(element,
"Unable to find mesh VERTEX tag in file.");
1196 const char *xscal = element->Attribute(
"XSCALE");
1203 std::string xscalstr = xscal;
1205 xscale = expEvaluator.
Evaluate(expr_id);
1208 const char *yscal = element->Attribute(
"YSCALE");
1215 std::string yscalstr = yscal;
1217 yscale = expEvaluator.
Evaluate(expr_id);
1220 const char *zscal = element->Attribute(
"ZSCALE");
1227 std::string zscalstr = zscal;
1229 zscale = expEvaluator.
Evaluate(expr_id);
1238 const char *xmov = element->Attribute(
"XMOVE");
1245 std::string xmovstr = xmov;
1247 xmove = expEvaluator.
Evaluate(expr_id);
1250 const char *ymov = element->Attribute(
"YMOVE");
1257 std::string ymovstr = ymov;
1259 ymove = expEvaluator.
Evaluate(expr_id);
1262 const char *zmov = element->Attribute(
"ZMOVE");
1269 std::string zmovstr = zmov;
1271 zmove = expEvaluator.
Evaluate(expr_id);
1277 field = mesh->FirstChildElement(
"CURVED");
1284 string IsCompressed;
1285 field->QueryStringAttribute(
"COMPRESSED",&IsCompressed);
1287 if(IsCompressed.size())
1289 ASSERTL0(boost::iequals(IsCompressed,
1291 "Compressed formats do not match. Expected :"
1294 + boost::lexical_cast<std::string>(IsCompressed));
1296 std::vector<LibUtilities::MeshCurvedInfo> edginfo;
1297 std::vector<LibUtilities::MeshCurvedInfo> facinfo;
1301 TiXmlElement *x = field->FirstChildElement();
1304 const char *entitytype = x->Value();
1306 if(boost::iequals(entitytype,
"E"))
1309 std::string elmtStr;
1310 TiXmlNode* child = x->FirstChild();
1312 if (child->Type() == TiXmlNode::TINYXML_TEXT)
1314 elmtStr += child->ToText()->ValueStr();
1320 else if(boost::iequals(entitytype,
"F"))
1323 std::string elmtStr;
1324 TiXmlNode* child = x->FirstChild();
1326 if (child->Type() == TiXmlNode::TINYXML_TEXT)
1328 elmtStr += child->ToText()->ValueStr();
1334 else if(boost::iequals(entitytype,
"DATAPOINTS"))
1338 "Failed to get ID from PTS section");
1342 std::string elmtStr;
1344 TiXmlElement* DataIdx =
1345 x->FirstChildElement(
"INDEX");
1347 "Cannot read data index tag in compressed "
1350 TiXmlNode* child = DataIdx->FirstChild();
1351 if (child->Type() == TiXmlNode::TINYXML_TEXT)
1353 elmtStr = child->ToText()->ValueStr();
1357 elmtStr,cpts.
index);
1359 TiXmlElement* DataPts =
1360 x->FirstChildElement(
"POINTS");
1362 "Cannot read data pts tag in compressed "
1365 child = DataPts->FirstChild();
1366 if (child->Type() == TiXmlNode::TINYXML_TEXT)
1368 elmtStr = child->ToText()->ValueStr();
1376 ASSERTL0(
false,
"Unknown tag in curved section");
1378 x = x->NextSiblingElement();
1382 for(
int i = 0; i > cpts.
pts.size(); ++i)
1384 cpts.
pts[i].x = xscale*cpts.
pts[i].x + xmove;
1385 cpts.
pts[i].y = yscale*cpts.
pts[i].y + ymove;
1386 cpts.
pts[i].z = zscale*cpts.
pts[i].z + zmove;
1389 for(
int i = 0; i < edginfo.size(); ++i)
1391 int edgeid = edginfo[i].entityid;
1400 int offset = edginfo[i].ptoffset;
1401 for(
int j = 0; j < edginfo[i].npoints; ++j)
1403 int idx = cpts.
index[offset+j];
1408 cpts.
pts[idx].x, cpts.
pts[idx].y,
1410 curve->m_points.push_back(vert);
1416 for(
int i = 0; i < facinfo.size(); ++i)
1418 int faceid = facinfo[i].entityid;
1426 int offset = facinfo[i].ptoffset;
1427 for(
int j = 0; j < facinfo[i].npoints; ++j)
1429 int idx = cpts.
index[offset+j];
1437 curve->m_points.push_back(vert);
1449 TiXmlElement *edgelement = field->FirstChildElement(
"E");
1451 int edgeindx, edgeid;
1452 int nextEdgeNumber = -1;
1459 std::string edge(edgelement->ValueStr());
1460 ASSERTL0(edge ==
"E", (std::string(
"Unknown 3D curve type:") + edge).c_str());
1463 err = edgelement->QueryIntAttribute(
"ID", &edgeindx);
1464 ASSERTL0(err == TIXML_SUCCESS,
"Unable to read curve attribute ID.");
1467 err = edgelement->QueryIntAttribute(
"EDGEID", &edgeid);
1468 ASSERTL0(err == TIXML_SUCCESS,
"Unable to read curve attribute EDGEID.");
1471 std::string elementStr;
1472 TiXmlNode* elementChild = edgelement->FirstChild();
1477 if (elementChild->Type() == TiXmlNode::TINYXML_TEXT)
1479 elementStr += elementChild->ToText()->ValueStr();
1482 elementChild = elementChild->NextSibling();
1485 ASSERTL0(!elementStr.empty(),
"Unable to read curve description body.");
1492 std::string typeStr = edgelement->Attribute(
"TYPE");
1493 ASSERTL0(!typeStr.empty(),
"TYPE must be specified in " "points definition");
1498 const std::string* ptsStr =
std::find(begStr, endStr, typeStr);
1500 ASSERTL0(ptsStr != endStr,
"Invalid points type.");
1504 err = edgelement->QueryIntAttribute(
"NUMPOINTS", &numPts);
1505 ASSERTL0(err == TIXML_SUCCESS,
"Unable to read curve attribute NUMPOINTS.");
1510 std::istringstream elementDataStrm(elementStr.c_str());
1513 while(!elementDataStrm.fail())
1515 elementDataStrm >> xval >> yval >> zval;
1517 xval = xval*xscale + xmove;
1518 yval = yval*yscale + ymove;
1519 zval = zval*zscale + zmove;
1524 if (!elementDataStrm.fail())
1528 curve->m_points.push_back(vert);
1536 (std::string(
"Unable to read curve data for EDGE: ") + elementStr).c_str());
1540 ASSERTL0(curve->m_points.size() == numPts,
1541 "Number of points specificed by attribute "
1542 "NUMPOINTS is different from number of points "
1543 "in list (edgeid = " +
1544 boost::lexical_cast<
string>(edgeid));
1548 edgelement = edgelement->NextSiblingElement(
"E");
1554 TiXmlElement *facelement = field->FirstChildElement(
"F");
1555 int faceindx, faceid;
1559 std::string face(facelement->ValueStr());
1560 ASSERTL0(face ==
"F", (std::string(
"Unknown 3D curve type: ") + face).c_str());
1563 err = facelement->QueryIntAttribute(
"ID", &faceindx);
1564 ASSERTL0(err == TIXML_SUCCESS,
"Unable to read curve attribute ID.");
1567 err = facelement->QueryIntAttribute(
"FACEID", &faceid);
1568 ASSERTL0(err == TIXML_SUCCESS,
"Unable to read curve attribute FACEID.");
1571 std::string elementStr;
1572 TiXmlNode* elementChild = facelement->FirstChild();
1577 if (elementChild->Type() == TiXmlNode::TINYXML_TEXT)
1579 elementStr += elementChild->ToText()->ValueStr();
1582 elementChild = elementChild->NextSibling();
1585 ASSERTL0(!elementStr.empty(),
"Unable to read curve description body.");
1590 std::string typeStr = facelement->Attribute(
"TYPE");
1591 ASSERTL0(!typeStr.empty(),
"TYPE must be specified in " "points definition");
1595 const std::string* ptsStr =
std::find(begStr, endStr, typeStr);
1597 ASSERTL0(ptsStr != endStr,
"Invalid points type.");
1600 std::string numptsStr = facelement->Attribute(
"NUMPOINTS");
1601 ASSERTL0(!numptsStr.empty(),
"NUMPOINTS must be specified in points definition");
1603 std::stringstream s;
1609 ASSERTL0(numPts >= 3,
"NUMPOINTS for face must be greater than 2");
1613 ASSERTL0(ptsStr != endStr,
"Invalid points type.");
1618 std::istringstream elementDataStrm(elementStr.c_str());
1621 while(!elementDataStrm.fail())
1623 elementDataStrm >> xval >> yval >> zval;
1629 if (!elementDataStrm.fail())
1632 curve->m_points.push_back(vert);
1639 (std::string(
"Unable to read curve data for FACE: ")
1640 + elementStr).c_str());
1644 facelement = facelement->NextSiblingElement(
"F");
1656 TiXmlDocument doc(infilename);
1657 bool loadOkay = doc.LoadFile();
1659 std::stringstream errstr;
1660 errstr <<
"Unable to load file: " << infilename << std::endl;
1661 errstr <<
"Reason: " << doc.ErrorDesc() << std::endl;
1662 errstr <<
"Position: Line " << doc.ErrorRow() <<
", Column " << doc.ErrorCol() << std::endl;
1679 TiXmlElement *root = doc.FirstChildElement(
"NEKTAR");
1680 TiXmlElement *geomTag;
1685 root =
new TiXmlElement(
"NEKTAR");
1686 doc.LinkEndChild(root);
1688 geomTag =
new TiXmlElement(
"GEOMETRY");
1689 root->LinkEndChild(geomTag);
1694 geomTag = root->FirstChildElement(
"GEOMETRY");
1698 geomTag =
new TiXmlElement(
"GEOMETRY");
1699 root->LinkEndChild(geomTag);
1711 TiXmlElement *vertTag =
new TiXmlElement(
"VERTEX");
1717 s << scientific << setprecision(8)
1718 << (*pIt->second)(0) <<
" " << (*pIt->second)(1) <<
" "
1719 << (*pIt->second)(2);
1720 TiXmlElement * v =
new TiXmlElement(
"V");
1721 v->SetAttribute(
"ID", pIt->second->GetVid());
1722 v->LinkEndChild(
new TiXmlText(s.str()));
1723 vertTag->LinkEndChild(v);
1726 geomTag->LinkEndChild(vertTag);
1729 TiXmlElement *edgeTag =
new TiXmlElement(
1738 s << seg->GetVid(0) <<
" " << seg->GetVid(1);
1739 TiXmlElement *e =
new TiXmlElement(tag);
1740 e->SetAttribute(
"ID", sIt->first);
1741 e->LinkEndChild(
new TiXmlText(s.str()));
1742 edgeTag->LinkEndChild(e);
1745 geomTag->LinkEndChild(edgeTag);
1750 TiXmlElement *faceTag =
new TiXmlElement(
1760 s << tri->GetEid(0) <<
" " << tri->GetEid(1) <<
" "
1762 TiXmlElement *t =
new TiXmlElement(tag);
1763 t->SetAttribute(
"ID", tIt->first);
1764 t->LinkEndChild(
new TiXmlText(s.str()));
1765 faceTag->LinkEndChild(t);
1775 s << quad->GetEid(0) <<
" " << quad->GetEid(1) <<
" "
1776 << quad->GetEid(2) <<
" " << quad->GetEid(3);
1777 TiXmlElement *q =
new TiXmlElement(tag);
1778 q->SetAttribute(
"ID", qIt->first);
1779 q->LinkEndChild(
new TiXmlText(s.str()));
1780 faceTag->LinkEndChild(q);
1783 geomTag->LinkEndChild(faceTag);
1788 TiXmlElement *elmtTag =
new TiXmlElement(
"ELEMENT");
1797 s << hex->GetFid(0) <<
" " << hex->GetFid(1) <<
" "
1798 << hex->GetFid(2) <<
" " << hex->GetFid(3) <<
" "
1799 << hex->GetFid(4) <<
" " << hex->GetFid(5) <<
" ";
1800 TiXmlElement *h =
new TiXmlElement(tag);
1801 h->SetAttribute(
"ID", hIt->first);
1802 h->LinkEndChild(
new TiXmlText(s.str()));
1803 elmtTag->LinkEndChild(h);
1813 s << prism->GetFid(0) <<
" " << prism->GetFid(1) <<
" "
1814 << prism->GetFid(2) <<
" " << prism->GetFid(3) <<
" "
1815 << prism->GetFid(4) <<
" ";
1816 TiXmlElement *
p =
new TiXmlElement(tag);
1817 p->SetAttribute(
"ID", rIt->first);
1818 p->LinkEndChild(
new TiXmlText(s.str()));
1819 elmtTag->LinkEndChild(p);
1829 s << pyr->GetFid(0) <<
" " << pyr->GetFid(1) <<
" "
1830 << pyr->GetFid(2) <<
" " << pyr->GetFid(3) <<
" "
1831 << pyr->GetFid(4) <<
" ";
1832 TiXmlElement *
p =
new TiXmlElement(tag);
1833 p->SetAttribute(
"ID", pIt->first);
1834 p->LinkEndChild(
new TiXmlText(s.str()));
1835 elmtTag->LinkEndChild(p);
1845 s << tet->GetFid(0) <<
" " << tet->GetFid(1) <<
" "
1846 << tet->GetFid(2) <<
" " << tet->GetFid(3) <<
" ";
1847 TiXmlElement *t =
new TiXmlElement(tag);
1848 t->SetAttribute(
"ID", tIt->first);
1849 t->LinkEndChild(
new TiXmlText(s.str()));
1850 elmtTag->LinkEndChild(t);
1853 geomTag->LinkEndChild(elmtTag);
1857 TiXmlElement *curveTag =
new TiXmlElement(
"CURVED");
1865 TiXmlElement *c =
new TiXmlElement(
"E");
1869 for (
int j = 0; j < curve->m_points.size(); ++j)
1872 s << scientific << (*p)(0) <<
" " << (*p)(1) <<
" " << (*p)(2) <<
" ";
1875 c->SetAttribute(
"ID", curveId++);
1876 c->SetAttribute(
"EDGEID", curve->m_curveID);
1877 c->SetAttribute(
"NUMPOINTS", curve->m_points.size());
1879 c->LinkEndChild(
new TiXmlText(s.str()));
1880 curveTag->LinkEndChild(c);
1887 TiXmlElement *c =
new TiXmlElement(
"F");
1891 for (
int j = 0; j < curve->m_points.size(); ++j)
1894 s << scientific << (*p)(0) <<
" " << (*p)(1) <<
" " << (*p)(2) <<
" ";
1897 c->SetAttribute(
"ID", curveId++);
1898 c->SetAttribute(
"FACEID", curve->m_curveID);
1899 c->SetAttribute(
"NUMPOINTS", curve->m_points.size());
1901 c->LinkEndChild(
new TiXmlText(s.str()));
1902 curveTag->LinkEndChild(c);
1905 geomTag->LinkEndChild(curveTag);
1908 TiXmlElement *compTag =
new TiXmlElement(
"COMPOSITE");
1913 map<LibUtilities::ShapeType, pair<string, string> > compMap;
1922 std::vector<unsigned int> idxList;
1927 TiXmlElement *c =
new TiXmlElement(
"C");
1929 if (cIt->second->size() == 0)
1935 int shapeDim = firstGeom->GetShapeDim();
1937 compMap[firstGeom->GetShapeType()].second :
1938 compMap[firstGeom->GetShapeType()].first;
1941 s <<
" " << tag <<
"[";
1943 for (
int i = 0; i < cIt->second->size(); ++i)
1945 idxList.push_back((*cIt->second)[i]->GetGlobalID());
1950 c->SetAttribute(
"ID", cIt->first);
1951 c->LinkEndChild(
new TiXmlText(s.str()));
1952 compTag->LinkEndChild(c);
1955 geomTag->LinkEndChild(compTag);
1958 TiXmlElement *domTag =
new TiXmlElement(
"DOMAIN");
1959 stringstream domString;
1965 idxList.push_back(cIt->first);
1969 domTag->LinkEndChild(
new TiXmlText(domString.str()));
1970 geomTag->LinkEndChild(domTag);
1981 TiXmlDeclaration* decl =
new TiXmlDeclaration(
"1.0",
"utf-8",
"");
1982 doc.LinkEndChild(decl);
1988 doc.SaveFile(outfilename);
2031 bool returnval =
true;
2043 for(
int i = 0; i < nverts; ++i)
2046 if(xval < m_domainRange->m_xmin)
2060 if((ncnt_up == nverts)||(ncnt_low == nverts))
2071 for(
int i = 0; i < nverts; ++i)
2074 if(yval < m_domainRange->m_ymin)
2088 if((ncnt_up == nverts)||(ncnt_low == nverts))
2102 for(
int i = 0; i < nverts; ++i)
2106 if(zval < m_domainRange->m_zmin)
2120 if((ncnt_up == nverts)||(ncnt_low == nverts))
2134 bool returnval =
true;
2145 for(
int i = 0; i < nverts; ++i)
2148 if(xval < m_domainRange->m_xmin)
2162 if((ncnt_up == nverts)||(ncnt_low == nverts))
2172 for(
int i = 0; i < nverts; ++i)
2175 if(yval < m_domainRange->m_ymin)
2189 if((ncnt_up == nverts)||(ncnt_low == nverts))
2199 for(
int i = 0; i < nverts; ++i)
2203 if(zval < m_domainRange->m_zmin)
2217 if((ncnt_up == nverts)||(ncnt_low == nverts))
2246 if (whichItem >= 0 && whichItem <
int(
m_meshComposites[whichComposite]->size()))
2262 std::ostringstream errStream;
2263 errStream <<
"Unable to access composite item [" << whichComposite <<
"][" << whichItem <<
"].";
2265 std::string testStr = errStream.str();
2280 typedef vector<unsigned int> SeqVector;
2281 SeqVector seqVector;
2284 ASSERTL0(parseGood && !seqVector.empty(), (std::string(
"Unable to read composite index range: ") + compositeStr).c_str());
2286 SeqVector addedVector;
2292 if (
std::find(addedVector.begin(), addedVector.end(), *iter) == addedVector.end())
2303 addedVector.push_back(*iter);
2308 compositeVector[*iter] = composite;
2313 ::sprintf(str,
"%d", *iter);
2357 iter = expansionMap->find(geom->GetGlobalID());
2358 ASSERTL1(iter != expansionMap->end(),
2359 "Could not find expansion " +
2360 boost::lexical_cast<
string>(geom->GetGlobalID()) +
2361 " in expansion for variable " + variable);
2362 return iter->second;
2370 std::vector<LibUtilities::FieldDefinitionsSharedPtr> &fielddef)
2372 int i, j, k, cnt, id;
2379 for(i = 0; i < fielddef.size(); ++i)
2381 for(j = 0; j < fielddef[i]->m_fields.size(); ++j)
2383 std::string field = fielddef[i]->m_fields[j];
2401 for(i = 0; i < fielddef.size(); ++i)
2404 std::vector<std::string> fields = fielddef[i]->m_fields;
2405 std::vector<unsigned int> nmodes = fielddef[i]->m_numModes;
2406 std::vector<LibUtilities::BasisType> basis = fielddef[i]->m_basis;
2407 bool pointDef = fielddef[i]->m_pointsDef;
2408 bool numPointDef = fielddef[i]->m_numPointsDef;
2411 std::vector<unsigned int> npoints = fielddef[i]->m_numPoints;
2412 std::vector<LibUtilities::PointsType> points = fielddef[i]->m_points;
2414 bool UniOrder = fielddef[i]->m_uniOrder;
2416 for (j = 0; j < fielddef[i]->m_elementIDs.size(); ++j)
2420 id = fielddef[i]->m_elementIDs[j];
2422 switch (fielddef[i]->m_shapeType)
2426 if(
m_segGeoms.count(fielddef[i]->m_elementIDs[j]) == 0)
2432 cnt += fielddef[i]->m_numHomogeneousDir;
2436 geom =
m_segGeoms[fielddef[i]->m_elementIDs[j]];
2440 if(numPointDef&&pointDef)
2445 else if(!numPointDef&&pointDef)
2450 else if(numPointDef&&!pointDef)
2461 cnt += fielddef[i]->m_numHomogeneousDir;
2463 bkeyvec.push_back(bkey);
2468 if(
m_triGeoms.count(fielddef[i]->m_elementIDs[j]) == 0)
2474 cnt += fielddef[i]->m_numHomogeneousDir;
2478 geom =
m_triGeoms[fielddef[i]->m_elementIDs[j]];
2481 if(numPointDef&&pointDef)
2486 else if(!numPointDef&&pointDef)
2491 else if(numPointDef&&!pointDef)
2498 bkeyvec.push_back(bkey);
2501 if(numPointDef&&pointDef)
2506 else if(!numPointDef&&pointDef)
2511 else if(numPointDef&&!pointDef)
2517 bkeyvec.push_back(bkey1);
2522 cnt += fielddef[i]->m_numHomogeneousDir;
2528 if(
m_quadGeoms.count(fielddef[i]->m_elementIDs[j]) == 0)
2534 cnt += fielddef[i]->m_numHomogeneousDir;
2541 for(
int b = 0; b < 2; ++b)
2545 if(numPointDef&&pointDef)
2550 else if(!numPointDef&&pointDef)
2555 else if(numPointDef&&!pointDef)
2561 bkeyvec.push_back(bkey);
2567 cnt += fielddef[i]->m_numHomogeneousDir;
2574 k = fielddef[i]->m_elementIDs[j];
2592 if(numPointDef&&pointDef)
2597 else if(!numPointDef&&pointDef)
2602 else if(numPointDef&&!pointDef)
2610 bkeyvec.push_back(bkey);
2615 if(numPointDef&&pointDef)
2620 else if(!numPointDef&&pointDef)
2625 else if(numPointDef&&!pointDef)
2633 bkeyvec.push_back(bkey);
2639 if(numPointDef&&pointDef)
2644 else if(!numPointDef&&pointDef)
2649 else if(numPointDef&&!pointDef)
2657 bkeyvec.push_back(bkey);
2668 k = fielddef[i]->m_elementIDs[j];
2679 for(
int b = 0; b < 2; ++b)
2683 if(numPointDef&&pointDef)
2688 else if(!numPointDef&&pointDef)
2693 else if(numPointDef&&!pointDef)
2700 bkeyvec.push_back(bkey);
2706 if(numPointDef&&pointDef)
2711 else if(!numPointDef&&pointDef)
2716 else if(numPointDef&&!pointDef)
2723 bkeyvec.push_back(bkey);
2734 k = fielddef[i]->m_elementIDs[j];
2736 "Failed to find geometry with same global id");
2740 for(
int b = 0; b < 2; ++b)
2744 if(numPointDef&&pointDef)
2749 else if(!numPointDef&&pointDef)
2754 else if(numPointDef&&!pointDef)
2761 bkeyvec.push_back(bkey);
2767 if(numPointDef&&pointDef)
2772 else if(!numPointDef&&pointDef)
2777 else if(numPointDef&&!pointDef)
2784 bkeyvec.push_back(bkey);
2795 k = fielddef[i]->m_elementIDs[j];
2807 for(
int b = 0; b < 3; ++b)
2811 if(numPointDef&&pointDef)
2816 else if(!numPointDef&&pointDef)
2821 else if(numPointDef&&!pointDef)
2828 bkeyvec.push_back(bkey);
2838 ASSERTL0(
false,
"Need to set up for pyramid and prism 3D Expansions");
2842 for(k = 0; k < fields.size(); ++k)
2845 if((*expansionMap).find(
id) != (*expansionMap).end())
2847 (*expansionMap)[id]->m_geomShPtr = geom;
2848 (*expansionMap)[id]->m_basisKeyVector = bkeyvec;
2860 std::vector<LibUtilities::FieldDefinitionsSharedPtr> &fielddef,
2861 std::vector< std::vector<LibUtilities::PointsType> > &pointstype)
2870 for(i = 0; i < fielddef.size(); ++i)
2872 for(j = 0; j < fielddef[i]->m_fields.size(); ++j)
2874 std::string field = fielddef[i]->m_fields[j];
2893 for(i = 0; i < fielddef.size(); ++i)
2896 std::vector<std::string> fields = fielddef[i]->m_fields;
2897 std::vector<unsigned int> nmodes = fielddef[i]->m_numModes;
2898 std::vector<LibUtilities::BasisType> basis = fielddef[i]->m_basis;
2899 bool UniOrder = fielddef[i]->m_uniOrder;
2901 for(j = 0; j < fielddef[i]->m_elementIDs.size(); ++j)
2904 id = fielddef[i]->m_elementIDs[j];
2906 switch(fielddef[i]->m_shapeType)
2910 k = fielddef[i]->m_elementIDs[j];
2912 "Failed to find geometry with same global id.");
2920 cnt += fielddef[i]->m_numHomogeneousDir;
2922 bkeyvec.push_back(bkey);
2927 k = fielddef[i]->m_elementIDs[j];
2929 "Failed to find geometry with same global id.");
2931 for(
int b = 0; b < 2; ++b)
2935 bkeyvec.push_back(bkey);
2941 cnt += fielddef[i]->m_numHomogeneousDir;
2947 k = fielddef[i]->m_elementIDs[j];
2949 "Failed to find geometry with same global id");
2952 for(
int b = 0; b < 2; ++b)
2956 bkeyvec.push_back(bkey);
2962 cnt += fielddef[i]->m_numHomogeneousDir;
2968 k = fielddef[i]->m_elementIDs[j];
2970 "Failed to find geometry with same global id");
2973 for(
int b = 0; b < 3; ++b)
2977 bkeyvec.push_back(bkey);
2988 k = fielddef[i]->m_elementIDs[j];
2990 "Failed to find geometry with same global id");
2993 for(
int b = 0; b < 3; ++b)
2997 bkeyvec.push_back(bkey);
3008 k = fielddef[i]->m_elementIDs[j];
3010 "Failed to find geometry with same global id");
3013 for(
int b = 0; b < 3; ++b)
3017 bkeyvec.push_back(bkey);
3028 k = fielddef[i]->m_elementIDs[j];
3030 "Failed to find geometry with same global id");
3033 for(
int b = 0; b < 3; ++b)
3037 bkeyvec.push_back(bkey);
3047 ASSERTL0(
false,
"Need to set up for pyramid and prism 3D Expansions");
3051 for(k = 0; k < fields.size(); ++k)
3054 if((*expansionMap).find(
id) != (*expansionMap).end())
3056 (*expansionMap)[id]->m_geomShPtr = geom;
3057 (*expansionMap)[id]->m_basisKeyVector = bkeyvec;
3078 for(expIt = it->second->begin(); expIt != it->second->end(); ++expIt)
3080 for(
int i = 0; i < expIt->second->m_basisKeyVector.size(); ++i)
3098 expIt->second->m_basisKeyVector[i] = bkeynew;
3120 for(expIt = it->second->begin(); expIt != it->second->end(); ++expIt)
3122 for(
int i = 0; i < expIt->second->m_basisKeyVector.size(); ++i)
3130 expIt->second->m_basisKeyVector[i] = bkeynew;
3155 for (expIt = it->second->begin();
3156 expIt != it->second->end();
3160 i < expIt->second->m_basisKeyVector.size();
3164 expIt->second->m_basisKeyVector[i];
3172 expIt->second->m_basisKeyVector[i] = bkeynew;
3199 for (elemIter = expansionMap->begin(); elemIter != expansionMap->end(); ++elemIter)
3201 if ((elemIter->second)->m_geomShPtr->GetShapeType() == shape)
3203 (elemIter->second)->m_basisKeyVector = keys;
3251 returnval.push_back(bkey);
3258 returnval.push_back(bkey);
3259 returnval.push_back(bkey);
3266 returnval.push_back(bkey);
3267 returnval.push_back(bkey);
3268 returnval.push_back(bkey);
3275 returnval.push_back(bkey);
3280 returnval.push_back(bkey1);
3287 returnval.push_back(bkey);
3291 returnval.push_back(bkey1);
3297 returnval.push_back(bkey2);
3303 returnval.push_back(bkey2);
3311 returnval.push_back(bkey);
3312 returnval.push_back(bkey);
3316 returnval.push_back(bkey1);
3323 returnval.push_back(bkey);
3324 returnval.push_back(bkey);
3328 returnval.push_back(bkey1);
3334 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3349 returnval.push_back(bkey);
3356 returnval.push_back(bkey);
3357 returnval.push_back(bkey);
3365 returnval.push_back(bkey);
3369 returnval.push_back(bkey1);
3377 returnval.push_back(bkey);
3378 returnval.push_back(bkey);
3379 returnval.push_back(bkey);
3384 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3400 returnval.push_back(bkey);
3408 returnval.push_back(bkey);
3409 returnval.push_back(bkey);
3417 returnval.push_back(bkey);
3418 returnval.push_back(bkey);
3419 returnval.push_back(bkey);
3424 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3440 returnval.push_back(bkey);
3448 returnval.push_back(bkey);
3453 returnval.push_back(bkey1);
3461 returnval.push_back(bkey);
3462 returnval.push_back(bkey);
3470 returnval.push_back(bkey);
3475 returnval.push_back(bkey1);
3483 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3499 returnval.push_back(bkey);
3507 returnval.push_back(bkey);
3508 returnval.push_back(bkey);
3516 returnval.push_back(bkey);
3517 returnval.push_back(bkey);
3518 returnval.push_back(bkey);
3523 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3539 returnval.push_back(bkey);
3546 returnval.push_back(bkey);
3547 returnval.push_back(bkey);
3554 returnval.push_back(bkey);
3555 returnval.push_back(bkey);
3556 returnval.push_back(bkey);
3561 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3577 returnval.push_back(bkey);
3584 returnval.push_back(bkey);
3585 returnval.push_back(bkey);
3592 returnval.push_back(bkey);
3593 returnval.push_back(bkey);
3594 returnval.push_back(bkey);
3599 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3614 returnval.push_back(bkey);
3621 returnval.push_back(bkey);
3622 returnval.push_back(bkey);
3629 returnval.push_back(bkey);
3630 returnval.push_back(bkey);
3631 returnval.push_back(bkey);
3636 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3651 returnval.push_back(bkey);
3658 returnval.push_back(bkey);
3659 returnval.push_back(bkey);
3666 returnval.push_back(bkey);
3667 returnval.push_back(bkey);
3668 returnval.push_back(bkey);
3673 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3688 returnval.push_back(bkey);
3695 returnval.push_back(bkey);
3696 returnval.push_back(bkey);
3703 returnval.push_back(bkey);
3704 returnval.push_back(bkey);
3705 returnval.push_back(bkey);
3710 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3725 returnval.push_back(bkey);
3729 returnval.push_back(bkey1);
3734 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3749 returnval.push_back(bkey1);
3753 returnval.push_back(bkey);
3758 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3773 returnval.push_back(bkey);
3777 returnval.push_back(bkey1);
3782 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3791 ASSERTL0(
false,
"Expansion type not defined");
3809 const int nummodes_x,
3810 const int nummodes_y,
3811 const int nummodes_z)
3821 ASSERTL0(
false,
"Homogeneous expansion not defined for this shape");
3827 ASSERTL0(
false,
"Homogeneous expansion not defined for this shape");
3839 returnval.push_back(bkey1);
3847 returnval.push_back(bkey1);
3855 returnval.push_back(bkey1);
3863 returnval.push_back(bkey1);
3872 returnval.push_back(bkey1);
3880 ASSERTL0(
false,
"Homogeneous expansion can be of Fourier or Chebyshev type only");
3892 returnval.push_back(bkey2);
3901 returnval.push_back(bkey2);
3909 returnval.push_back(bkey2);
3917 returnval.push_back(bkey2);
3925 returnval.push_back(bkey2);
3931 ASSERTL0(
false,
"Homogeneous expansion can be of Fourier or Chebyshev type only");
3942 returnval.push_back(bkey3);
3950 returnval.push_back(bkey3);
3958 returnval.push_back(bkey3);
3966 returnval.push_back(bkey3);
3974 returnval.push_back(bkey3);
3980 ASSERTL0(
false,
"Homogeneous expansion can be of Fourier or Chebyshev type only");
3989 ASSERTL0(
false,
"Homogeneous expansion not defined for this shape");
3995 ASSERTL0(
false,
"Homogeneous expansion not defined for this shape");
4000 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
4013 unsigned int nextId =
m_vertSet.rbegin()->first + 1;
4029 if( curveDefinition )
4049 trigeom->SetGlobalID(indx);
4064 quadgeom->SetGlobalID(indx);
4081 prismgeom->SetGlobalID(index);
4093 unsigned int index =
m_tetGeoms.rbegin()->first + 1;
4095 tetgeom->SetGlobalID(index);
4109 unsigned int index =
m_pyrGeoms.rbegin()->first + 1;
4112 pyrgeom->SetGlobalID(index);
4124 unsigned int index =
m_hexGeoms.rbegin()->first + 1;
4126 hexgeom->SetGlobalID(index);
4144 for(
int d = 0; d <
m_domain.size(); ++d)
4146 CompositeMap::const_iterator compIter;
4148 for (compIter =
m_domain[d].begin(); compIter !=
m_domain[d].end(); ++compIter)
4150 GeometryVector::const_iterator x;
4151 for (x = compIter->second->begin(); x != compIter->second->end(); ++x)
4156 int id = (*x)->GetGlobalID();
4157 (*returnval)[id] = expansionElementShPtr;
void SetExpansions(std::vector< LibUtilities::FieldDefinitionsSharedPtr > &fielddef)
Sets expansions given field definitions.
boost::shared_ptr< PyrGeom > PyrGeomSharedPtr
#define ASSERTL0(condition, msg)
static bool GenerateOrderedStringVector(const char *const str, std::vector< std::string > &vec)
LibUtilities::SessionReaderSharedPtr m_session
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mod...
Principle Modified Functions .
static bool GenerateOrderedVector(const char *const str, std::vector< unsigned int > &vec)
void SetExpansionsToPolyOrder(int nmodes)
Reset expansion to have specified polynomial order nmodes.
PrismGeomMap m_prismGeoms
static boost::shared_ptr< MeshGraph > Read(const LibUtilities::SessionReaderSharedPtr &pSession, DomainRangeShPtr &rng=NullDomainRangeShPtr)
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
const char *const BasisTypeMap[]
void ReadCurves(TiXmlDocument &doc)
PrismGeomSharedPtr AddPrism(TriGeomSharedPtr tfaces[PrismGeom::kNtfaces], QuadGeomSharedPtr qfaces[PrismGeom::kNqfaces])
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
const std::string kPointsTypeStr[]
CompositeMap m_meshComposites
BasisType GetBasisType() const
Return type of expansion basis.
boost::shared_ptr< QuadGeom > QuadGeomSharedPtr
std::vector< NekInt64 > index
id of this Point set
int GetMeshDimension() const
Dimension of the mesh (can be a 1D curve in 3D space).
Principle Modified Functions .
Lagrange Polynomials using the Gauss points .
static std::string GenerateSeqString(const std::vector< unsigned int > &elmtids)
NekDouble Evaluate(const int AnalyticExpression_id)
Evaluation method for expressions depending on parameters only.
PointsType GetPointsType() const
Return type of quadrature.
static const int kNtfaces
boost::shared_ptr< HexGeom > HexGeomSharedPtr
PointGeomSharedPtr AddVertex(NekDouble x, NekDouble y, NekDouble z)
Adds a vertex to the with the next available ID.
QuadGeomSharedPtr AddQuadrilateral(SegGeomSharedPtr edges[], StdRegions::Orientation orient[])
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
static bool GenerateSeqVector(const char *const str, std::vector< unsigned int > &vec)
virtual void ReadGeometry(const std::string &infilename)
Read will read the meshgraph vertices given a filename.
boost::shared_ptr< Curve > CurveSharedPtr
const ExpansionMap & GetExpansions()
1D Gauss-Gauss-Legendre quadrature points
Gauss Radau pinned at x=-1, .
static LibUtilities::BasisKeyVector DefineBasisKeyFromExpansionType(GeometrySharedPtr in, ExpansionType type, const int order)
std::string GetCompressString(void)
std::vector< GeometrySharedPtr >::iterator GeometryVectorIter
Principle Orthogonal Functions .
void SetExpansionsToPointOrder(int npts)
Reset expansion to have specified point order npts.
1D Evenly-spaced points using Lagrange polynomial
TriGeomSharedPtr AddTriangle(SegGeomSharedPtr edges[], StdRegions::Orientation orient[])
DomainRangeShPtr m_domainRange
1D Evenly-spaced points using Fourier Fit
Fourier Modified expansions with just the real part of the first mode .
void WriteGeometry(std::string &outfilename)
Write out an XML file containing the GEOMETRY block representing this MeshGraph instance inside a NEK...
GeometrySharedPtr GetCompositeItem(int whichComposite, int whichItem)
boost::shared_ptr< ExpansionMap > ExpansionMapShPtr
SegGeomSharedPtr AddEdge(PointGeomSharedPtr v0, PointGeomSharedPtr v1, CurveSharedPtr curveDefinition=CurveSharedPtr())
Adds an edge between two points. If curveDefinition is null, then the edge is straight, otherwise it is curved according to the curveDefinition.
static const int kNqfaces
Composite GetComposite(int whichComposite) const
boost::shared_ptr< SegGeom > SegGeomSharedPtr
Principle Modified Functions .
static DataSourceSharedPtr create(const std::string &fn)
Create a new XML data source based on the filename.
std::map< std::string, ExpansionMapShPtr >::iterator ExpansionMapShPtrMapIter
NekDouble Evaluate() const
int GetNumPoints() const
Return points order at which basis is defined.
boost::shared_ptr< DomainRange > DomainRangeShPtr
PyrGeomSharedPtr AddPyramid(TriGeomSharedPtr tfaces[PyrGeom::kNtfaces], QuadGeomSharedPtr qfaces[PyrGeom::kNqfaces])
Principle Orthogonal Functions .
std::map< int, Composite >::iterator CompositeMapIter
Principle Orthogonal Functions .
1D Gauss-Gauss-Chebyshev quadrature points
Defines a specification for a set of points.
boost::shared_ptr< FieldIO > FieldIOSharedPtr
LibUtilities::BasisKeyVector DefineBasisKeyFromExpansionTypeHomo(GeometrySharedPtr in, ExpansionType type_x, ExpansionType type_y, ExpansionType type_z, const int nummodes_x, const int nummodes_y, const int nummodes_z)
std::vector< BasisKey > BasisKeyVector
Name for a vector of BasisKeys.
boost::shared_ptr< GeometryVector > Composite
static const NekDouble kNekUnsetDouble
This class defines evaluator of analytic (symbolic) mathematical expressions. Expressions are allowed...
PointGeomSharedPtr GetVertex(int i) const
std::map< int, Composite > CompositeMap
Fourier Modified expansions with just the imaginary part of the first mode .
static const int kNtfaces
boost::shared_ptr< Geometry2D > Geometry2DSharedPtr
void ReadGeometryInfo(const std::string &infilename)
Read geometric information from a file.
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator
int DefineFunction(const std::string &vlist, const std::string &function)
This function allows one to define a function to evaluate. The first argument (vlist) is a list of va...
static boost::shared_ptr< FieldIO > CreateForFile(const LibUtilities::SessionReaderSharedPtr session, const std::string &filename)
Construct a FieldIO object for a given input filename.
static const int kNqfaces
std::vector< CompositeMap > m_domain
void GetCompositeList(const std::string &compositeStr, CompositeMap &compositeVector) const
static DomainRangeShPtr NullDomainRangeShPtr
boost::shared_ptr< Expansion > ExpansionShPtr
ExpansionMapShPtrMap m_expansionMapShPtrMap
Fourier ModifiedExpansion with just the first mode .
Base class for a spectral/hp element mesh.
void ReadDomain(TiXmlDocument &doc)
boost::shared_ptr< PrismGeom > PrismGeomSharedPtr
void SetDomainRange(NekDouble xmin, NekDouble xmax, NekDouble ymin=NekConstants::kNekUnsetDouble, NekDouble ymax=NekConstants::kNekUnsetDouble, NekDouble zmin=NekConstants::kNekUnsetDouble, NekDouble zmax=NekConstants::kNekUnsetDouble)
1D Non Evenly-spaced points for Single Mode analysis
bool CheckRange(Geometry2D &geom)
Check if goemetry is in range definition if activated.
Gauss Radau pinned at x=-1, .
std::vector< MeshVertex > pts
mapping to access pts value.
void SetBasisKey(LibUtilities::ShapeType shape, LibUtilities::BasisKeyVector &keys, std::string var="DefaultVar")
Sets the basis key for all expansions of the given shape.
ExpansionShPtr GetExpansion(GeometrySharedPtr geom, const std::string variable="DefaultVar")
boost::shared_ptr< TetGeom > TetGeomSharedPtr
boost::shared_ptr< TriGeom > TriGeomSharedPtr
HexGeomSharedPtr AddHexahedron(QuadGeomSharedPtr qfaces[HexGeom::kNqfaces])
InputIterator find(InputIterator first, InputIterator last, InputIterator startingpoint, const EqualityComparable &value)
ExpansionMapShPtr SetUpExpansionMap(void)
void ReadExpansions(const std::string &infilename)
Read the expansions given the XML file path.
static const int kNqfaces
int GetNumModes() const
Returns the order of the basis.
const std::string kExpansionTypeStr[]
static const int kNtfaces
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
boost::shared_ptr< Geometry > GeometrySharedPtr
void SetExpansionsToEvenlySpacedPoints(int npoints=0)
Sets expansions to have equispaced points.
Describes the specification for a Basis.
LibUtilities::ShapeType GetShapeType(void)
boost::shared_ptr< PointGeom > PointGeomSharedPtr
1D Gauss-Lobatto-Legendre quadrature points
std::map< int, ExpansionShPtr > ExpansionMap
int ZlibDecodeFromBase64Str(std::string &in64, std::vector< T > &out)
TetGeomSharedPtr AddTetrahedron(TriGeomSharedPtr tfaces[TetGeom::kNtfaces])
std::map< int, ExpansionShPtr >::iterator ExpansionMapIter