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 int shapeDim = firstGeom->GetShapeDim();
1931 compMap[firstGeom->GetShapeType()].second :
1932 compMap[firstGeom->GetShapeType()].first;
1935 s <<
" " << tag <<
"[";
1937 for (
int i = 0; i < cIt->second->size(); ++i)
1939 idxList.push_back((*cIt->second)[i]->GetGlobalID());
1944 c->SetAttribute(
"ID", cIt->first);
1945 c->LinkEndChild(
new TiXmlText(s.str()));
1946 compTag->LinkEndChild(c);
1949 geomTag->LinkEndChild(compTag);
1952 TiXmlElement *domTag =
new TiXmlElement(
"DOMAIN");
1953 stringstream domString;
1959 idxList.push_back(cIt->first);
1963 domTag->LinkEndChild(
new TiXmlText(domString.str()));
1964 geomTag->LinkEndChild(domTag);
1975 TiXmlDeclaration* decl =
new TiXmlDeclaration(
"1.0",
"utf-8",
"");
1976 doc.LinkEndChild(decl);
1982 doc.SaveFile(outfilename);
2025 bool returnval =
true;
2037 for(
int i = 0; i < nverts; ++i)
2040 if(xval < m_domainRange->m_xmin)
2054 if((ncnt_up == nverts)||(ncnt_low == nverts))
2065 for(
int i = 0; i < nverts; ++i)
2068 if(yval < m_domainRange->m_ymin)
2082 if((ncnt_up == nverts)||(ncnt_low == nverts))
2096 for(
int i = 0; i < nverts; ++i)
2100 if(zval < m_domainRange->m_zmin)
2114 if((ncnt_up == nverts)||(ncnt_low == nverts))
2128 bool returnval =
true;
2139 for(
int i = 0; i < nverts; ++i)
2142 if(xval < m_domainRange->m_xmin)
2156 if((ncnt_up == nverts)||(ncnt_low == nverts))
2166 for(
int i = 0; i < nverts; ++i)
2169 if(yval < m_domainRange->m_ymin)
2183 if((ncnt_up == nverts)||(ncnt_low == nverts))
2193 for(
int i = 0; i < nverts; ++i)
2197 if(zval < m_domainRange->m_zmin)
2211 if((ncnt_up == nverts)||(ncnt_low == nverts))
2240 if (whichItem >= 0 && whichItem <
int(
m_meshComposites[whichComposite]->size()))
2256 std::ostringstream errStream;
2257 errStream <<
"Unable to access composite item [" << whichComposite <<
"][" << whichItem <<
"].";
2259 std::string testStr = errStream.str();
2274 typedef vector<unsigned int> SeqVector;
2275 SeqVector seqVector;
2278 ASSERTL0(parseGood && !seqVector.empty(), (std::string(
"Unable to read composite index range: ") + compositeStr).c_str());
2280 SeqVector addedVector;
2286 if (
std::find(addedVector.begin(), addedVector.end(), *iter) == addedVector.end())
2297 addedVector.push_back(*iter);
2302 compositeVector[*iter] = composite;
2307 ::sprintf(str,
"%d", *iter);
2351 iter = expansionMap->find(geom->GetGlobalID());
2352 ASSERTL1(iter != expansionMap->end(),
2353 "Could not find expansion " +
2354 boost::lexical_cast<
string>(geom->GetGlobalID()) +
2355 " in expansion for variable " + variable);
2356 return iter->second;
2364 std::vector<LibUtilities::FieldDefinitionsSharedPtr> &fielddef)
2366 int i, j, k, cnt, id;
2373 for(i = 0; i < fielddef.size(); ++i)
2375 for(j = 0; j < fielddef[i]->m_fields.size(); ++j)
2377 std::string field = fielddef[i]->m_fields[j];
2395 for(i = 0; i < fielddef.size(); ++i)
2398 std::vector<std::string> fields = fielddef[i]->m_fields;
2399 std::vector<unsigned int> nmodes = fielddef[i]->m_numModes;
2400 std::vector<LibUtilities::BasisType> basis = fielddef[i]->m_basis;
2401 bool pointDef = fielddef[i]->m_pointsDef;
2402 bool numPointDef = fielddef[i]->m_numPointsDef;
2405 std::vector<unsigned int> npoints = fielddef[i]->m_numPoints;
2406 std::vector<LibUtilities::PointsType> points = fielddef[i]->m_points;
2408 bool UniOrder = fielddef[i]->m_uniOrder;
2410 for (j = 0; j < fielddef[i]->m_elementIDs.size(); ++j)
2414 id = fielddef[i]->m_elementIDs[j];
2416 switch (fielddef[i]->m_shapeType)
2420 if(
m_segGeoms.count(fielddef[i]->m_elementIDs[j]) == 0)
2426 cnt += fielddef[i]->m_numHomogeneousDir;
2430 geom =
m_segGeoms[fielddef[i]->m_elementIDs[j]];
2434 if(numPointDef&&pointDef)
2439 else if(!numPointDef&&pointDef)
2444 else if(numPointDef&&!pointDef)
2455 cnt += fielddef[i]->m_numHomogeneousDir;
2457 bkeyvec.push_back(bkey);
2462 if(
m_triGeoms.count(fielddef[i]->m_elementIDs[j]) == 0)
2468 cnt += fielddef[i]->m_numHomogeneousDir;
2472 geom =
m_triGeoms[fielddef[i]->m_elementIDs[j]];
2475 if(numPointDef&&pointDef)
2480 else if(!numPointDef&&pointDef)
2485 else if(numPointDef&&!pointDef)
2492 bkeyvec.push_back(bkey);
2495 if(numPointDef&&pointDef)
2500 else if(!numPointDef&&pointDef)
2505 else if(numPointDef&&!pointDef)
2511 bkeyvec.push_back(bkey1);
2516 cnt += fielddef[i]->m_numHomogeneousDir;
2522 if(
m_quadGeoms.count(fielddef[i]->m_elementIDs[j]) == 0)
2528 cnt += fielddef[i]->m_numHomogeneousDir;
2535 for(
int b = 0; b < 2; ++b)
2539 if(numPointDef&&pointDef)
2544 else if(!numPointDef&&pointDef)
2549 else if(numPointDef&&!pointDef)
2555 bkeyvec.push_back(bkey);
2561 cnt += fielddef[i]->m_numHomogeneousDir;
2568 k = fielddef[i]->m_elementIDs[j];
2586 if(numPointDef&&pointDef)
2591 else if(!numPointDef&&pointDef)
2596 else if(numPointDef&&!pointDef)
2604 bkeyvec.push_back(bkey);
2609 if(numPointDef&&pointDef)
2614 else if(!numPointDef&&pointDef)
2619 else if(numPointDef&&!pointDef)
2627 bkeyvec.push_back(bkey);
2633 if(numPointDef&&pointDef)
2638 else if(!numPointDef&&pointDef)
2643 else if(numPointDef&&!pointDef)
2651 bkeyvec.push_back(bkey);
2662 k = fielddef[i]->m_elementIDs[j];
2673 for(
int b = 0; b < 2; ++b)
2677 if(numPointDef&&pointDef)
2682 else if(!numPointDef&&pointDef)
2687 else if(numPointDef&&!pointDef)
2694 bkeyvec.push_back(bkey);
2700 if(numPointDef&&pointDef)
2705 else if(!numPointDef&&pointDef)
2710 else if(numPointDef&&!pointDef)
2717 bkeyvec.push_back(bkey);
2728 k = fielddef[i]->m_elementIDs[j];
2730 "Failed to find geometry with same global id");
2734 for(
int b = 0; b < 2; ++b)
2738 if(numPointDef&&pointDef)
2743 else if(!numPointDef&&pointDef)
2748 else if(numPointDef&&!pointDef)
2755 bkeyvec.push_back(bkey);
2761 if(numPointDef&&pointDef)
2766 else if(!numPointDef&&pointDef)
2771 else if(numPointDef&&!pointDef)
2778 bkeyvec.push_back(bkey);
2789 k = fielddef[i]->m_elementIDs[j];
2801 for(
int b = 0; b < 3; ++b)
2805 if(numPointDef&&pointDef)
2810 else if(!numPointDef&&pointDef)
2815 else if(numPointDef&&!pointDef)
2822 bkeyvec.push_back(bkey);
2832 ASSERTL0(
false,
"Need to set up for pyramid and prism 3D Expansions");
2836 for(k = 0; k < fields.size(); ++k)
2839 if((*expansionMap).find(
id) != (*expansionMap).end())
2841 (*expansionMap)[id]->m_geomShPtr = geom;
2842 (*expansionMap)[id]->m_basisKeyVector = bkeyvec;
2854 std::vector<LibUtilities::FieldDefinitionsSharedPtr> &fielddef,
2855 std::vector< std::vector<LibUtilities::PointsType> > &pointstype)
2864 for(i = 0; i < fielddef.size(); ++i)
2866 for(j = 0; j < fielddef[i]->m_fields.size(); ++j)
2868 std::string field = fielddef[i]->m_fields[j];
2887 for(i = 0; i < fielddef.size(); ++i)
2890 std::vector<std::string> fields = fielddef[i]->m_fields;
2891 std::vector<unsigned int> nmodes = fielddef[i]->m_numModes;
2892 std::vector<LibUtilities::BasisType> basis = fielddef[i]->m_basis;
2893 bool UniOrder = fielddef[i]->m_uniOrder;
2895 for(j = 0; j < fielddef[i]->m_elementIDs.size(); ++j)
2898 id = fielddef[i]->m_elementIDs[j];
2900 switch(fielddef[i]->m_shapeType)
2904 k = fielddef[i]->m_elementIDs[j];
2906 "Failed to find geometry with same global id.");
2914 cnt += fielddef[i]->m_numHomogeneousDir;
2916 bkeyvec.push_back(bkey);
2921 k = fielddef[i]->m_elementIDs[j];
2923 "Failed to find geometry with same global id.");
2925 for(
int b = 0; b < 2; ++b)
2929 bkeyvec.push_back(bkey);
2935 cnt += fielddef[i]->m_numHomogeneousDir;
2941 k = fielddef[i]->m_elementIDs[j];
2943 "Failed to find geometry with same global id");
2946 for(
int b = 0; b < 2; ++b)
2950 bkeyvec.push_back(bkey);
2956 cnt += fielddef[i]->m_numHomogeneousDir;
2962 k = fielddef[i]->m_elementIDs[j];
2964 "Failed to find geometry with same global id");
2967 for(
int b = 0; b < 3; ++b)
2971 bkeyvec.push_back(bkey);
2982 k = fielddef[i]->m_elementIDs[j];
2984 "Failed to find geometry with same global id");
2987 for(
int b = 0; b < 3; ++b)
2991 bkeyvec.push_back(bkey);
3002 k = fielddef[i]->m_elementIDs[j];
3004 "Failed to find geometry with same global id");
3007 for(
int b = 0; b < 3; ++b)
3011 bkeyvec.push_back(bkey);
3022 k = fielddef[i]->m_elementIDs[j];
3024 "Failed to find geometry with same global id");
3027 for(
int b = 0; b < 3; ++b)
3031 bkeyvec.push_back(bkey);
3041 ASSERTL0(
false,
"Need to set up for pyramid and prism 3D Expansions");
3045 for(k = 0; k < fields.size(); ++k)
3048 if((*expansionMap).find(
id) != (*expansionMap).end())
3050 (*expansionMap)[id]->m_geomShPtr = geom;
3051 (*expansionMap)[id]->m_basisKeyVector = bkeyvec;
3072 for(expIt = it->second->begin(); expIt != it->second->end(); ++expIt)
3074 for(
int i = 0; i < expIt->second->m_basisKeyVector.size(); ++i)
3092 expIt->second->m_basisKeyVector[i] = bkeynew;
3114 for(expIt = it->second->begin(); expIt != it->second->end(); ++expIt)
3116 for(
int i = 0; i < expIt->second->m_basisKeyVector.size(); ++i)
3124 expIt->second->m_basisKeyVector[i] = bkeynew;
3149 for (expIt = it->second->begin();
3150 expIt != it->second->end();
3154 i < expIt->second->m_basisKeyVector.size();
3158 expIt->second->m_basisKeyVector[i];
3166 expIt->second->m_basisKeyVector[i] = bkeynew;
3193 for (elemIter = expansionMap->begin(); elemIter != expansionMap->end(); ++elemIter)
3195 if ((elemIter->second)->m_geomShPtr->GetShapeType() == shape)
3197 (elemIter->second)->m_basisKeyVector = keys;
3245 returnval.push_back(bkey);
3252 returnval.push_back(bkey);
3253 returnval.push_back(bkey);
3260 returnval.push_back(bkey);
3261 returnval.push_back(bkey);
3262 returnval.push_back(bkey);
3269 returnval.push_back(bkey);
3274 returnval.push_back(bkey1);
3281 returnval.push_back(bkey);
3285 returnval.push_back(bkey1);
3291 returnval.push_back(bkey2);
3297 returnval.push_back(bkey2);
3305 returnval.push_back(bkey);
3306 returnval.push_back(bkey);
3310 returnval.push_back(bkey1);
3317 returnval.push_back(bkey);
3318 returnval.push_back(bkey);
3322 returnval.push_back(bkey1);
3328 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3343 returnval.push_back(bkey);
3350 returnval.push_back(bkey);
3351 returnval.push_back(bkey);
3359 returnval.push_back(bkey);
3363 returnval.push_back(bkey1);
3371 returnval.push_back(bkey);
3372 returnval.push_back(bkey);
3373 returnval.push_back(bkey);
3378 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3394 returnval.push_back(bkey);
3402 returnval.push_back(bkey);
3403 returnval.push_back(bkey);
3411 returnval.push_back(bkey);
3412 returnval.push_back(bkey);
3413 returnval.push_back(bkey);
3418 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3434 returnval.push_back(bkey);
3442 returnval.push_back(bkey);
3447 returnval.push_back(bkey1);
3455 returnval.push_back(bkey);
3456 returnval.push_back(bkey);
3464 returnval.push_back(bkey);
3469 returnval.push_back(bkey1);
3477 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3493 returnval.push_back(bkey);
3501 returnval.push_back(bkey);
3502 returnval.push_back(bkey);
3510 returnval.push_back(bkey);
3511 returnval.push_back(bkey);
3512 returnval.push_back(bkey);
3517 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3533 returnval.push_back(bkey);
3540 returnval.push_back(bkey);
3541 returnval.push_back(bkey);
3548 returnval.push_back(bkey);
3549 returnval.push_back(bkey);
3550 returnval.push_back(bkey);
3555 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3571 returnval.push_back(bkey);
3578 returnval.push_back(bkey);
3579 returnval.push_back(bkey);
3586 returnval.push_back(bkey);
3587 returnval.push_back(bkey);
3588 returnval.push_back(bkey);
3593 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3608 returnval.push_back(bkey);
3615 returnval.push_back(bkey);
3616 returnval.push_back(bkey);
3623 returnval.push_back(bkey);
3624 returnval.push_back(bkey);
3625 returnval.push_back(bkey);
3630 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3645 returnval.push_back(bkey);
3652 returnval.push_back(bkey);
3653 returnval.push_back(bkey);
3660 returnval.push_back(bkey);
3661 returnval.push_back(bkey);
3662 returnval.push_back(bkey);
3667 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3682 returnval.push_back(bkey);
3689 returnval.push_back(bkey);
3690 returnval.push_back(bkey);
3697 returnval.push_back(bkey);
3698 returnval.push_back(bkey);
3699 returnval.push_back(bkey);
3704 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3719 returnval.push_back(bkey);
3723 returnval.push_back(bkey1);
3728 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3743 returnval.push_back(bkey1);
3747 returnval.push_back(bkey);
3752 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3767 returnval.push_back(bkey);
3771 returnval.push_back(bkey1);
3776 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3785 ASSERTL0(
false,
"Expansion type not defined");
3803 const int nummodes_x,
3804 const int nummodes_y,
3805 const int nummodes_z)
3815 ASSERTL0(
false,
"Homogeneous expansion not defined for this shape");
3821 ASSERTL0(
false,
"Homogeneous expansion not defined for this shape");
3833 returnval.push_back(bkey1);
3841 returnval.push_back(bkey1);
3849 returnval.push_back(bkey1);
3857 returnval.push_back(bkey1);
3866 returnval.push_back(bkey1);
3874 ASSERTL0(
false,
"Homogeneous expansion can be of Fourier or Chebyshev type only");
3886 returnval.push_back(bkey2);
3895 returnval.push_back(bkey2);
3903 returnval.push_back(bkey2);
3911 returnval.push_back(bkey2);
3919 returnval.push_back(bkey2);
3925 ASSERTL0(
false,
"Homogeneous expansion can be of Fourier or Chebyshev type only");
3936 returnval.push_back(bkey3);
3944 returnval.push_back(bkey3);
3952 returnval.push_back(bkey3);
3960 returnval.push_back(bkey3);
3968 returnval.push_back(bkey3);
3974 ASSERTL0(
false,
"Homogeneous expansion can be of Fourier or Chebyshev type only");
3983 ASSERTL0(
false,
"Homogeneous expansion not defined for this shape");
3989 ASSERTL0(
false,
"Homogeneous expansion not defined for this shape");
3994 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
4007 unsigned int nextId =
m_vertSet.rbegin()->first + 1;
4023 if( curveDefinition )
4043 trigeom->SetGlobalID(indx);
4058 quadgeom->SetGlobalID(indx);
4075 prismgeom->SetGlobalID(index);
4087 unsigned int index =
m_tetGeoms.rbegin()->first + 1;
4089 tetgeom->SetGlobalID(index);
4103 unsigned int index =
m_pyrGeoms.rbegin()->first + 1;
4106 pyrgeom->SetGlobalID(index);
4118 unsigned int index =
m_hexGeoms.rbegin()->first + 1;
4120 hexgeom->SetGlobalID(index);
4138 for(
int d = 0; d <
m_domain.size(); ++d)
4140 CompositeMap::const_iterator compIter;
4142 for (compIter =
m_domain[d].begin(); compIter !=
m_domain[d].end(); ++compIter)
4144 GeometryVector::const_iterator x;
4145 for (x = compIter->second->begin(); x != compIter->second->end(); ++x)
4150 int id = (*x)->GetGlobalID();
4151 (*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