60 #include <boost/archive/iterators/base64_from_binary.hpp>
61 #include <boost/archive/iterators/binary_from_base64.hpp>
62 #include <boost/archive/iterators/transform_width.hpp>
63 #include <boost/iostreams/copy.hpp>
64 #include <boost/iostreams/filter/zlib.hpp>
65 #include <boost/iostreams/filtering_stream.hpp>
71 namespace SpatialDomains
76 MeshGraph::MeshGraph():
88 unsigned int meshDimension,
89 unsigned int spaceDimension) :
90 m_meshDimension(meshDimension),
91 m_spaceDimension(spaceDimension),
125 boost::shared_ptr<MeshGraph> returnval;
129 TiXmlElement* geometry_tag = pSession->GetElement(
"NEKTAR/GEOMETRY");
130 TiXmlAttribute *attr = geometry_tag->FirstAttribute();
134 std::string attrName(attr->Name());
135 if (attrName ==
"DIM")
137 int err = attr->QueryIntValue(&meshDim);
138 ASSERTL0(err==TIXML_SUCCESS,
"Unable to read mesh dimension.");
143 std::string errstr(
"Unknown attribute: ");
169 std::string err =
"Invalid mesh dimension: ";
170 std::stringstream strstrm;
172 err += strstrm.str();
183 const std::string& infilename,
184 bool pReadExpansions)
186 boost::shared_ptr<MeshGraph> returnval;
208 std::string err =
"Invalid mesh dimension: ";
209 std::stringstream strstrm;
211 err += strstrm.str();
217 returnval->ReadGeometry(infilename);
218 returnval->ReadGeometryInfo(infilename);
221 returnval->ReadExpansions(infilename);
234 TiXmlDocument doc(infilename);
235 bool loadOkay = doc.LoadFile();
237 std::stringstream errstr;
238 errstr <<
"Unable to load file: " << infilename <<
" (";
239 errstr << doc.ErrorDesc() <<
", line " << doc.ErrorRow()
240 <<
", column " << doc.ErrorCol() <<
")";
252 TiXmlHandle docHandle(&doc);
253 TiXmlElement* mesh = NULL;
254 TiXmlElement* master = NULL;
258 master = doc.FirstChildElement(
"NEKTAR");
259 ASSERTL0(master,
"Unable to find NEKTAR tag in file.");
262 mesh = master->FirstChildElement(
"GEOMETRY");
264 ASSERTL0(mesh,
"Unable to find GEOMETRY tag in file.");
265 TiXmlAttribute *attr = mesh->FirstAttribute();
276 std::string attrName(attr->Name());
277 if (attrName ==
"DIM")
280 ASSERTL1(err==TIXML_SUCCESS,
"Unable to read mesh dimension.");
282 else if (attrName ==
"SPACE")
285 ASSERTL1(err==TIXML_SUCCESS,
"Unable to read space dimension.");
287 else if (attrName ==
"PARTITION")
290 ASSERTL1(err==TIXML_SUCCESS,
"Unable to read partition.");
295 std::string errstr(
"Unknown attribute: ");
307 TiXmlElement* element = mesh->FirstChildElement(
"VERTEX");
308 ASSERTL0(element,
"Unable to find mesh VERTEX tag in file.");
316 const char *xscal = element->Attribute(
"XSCALE");
323 std::string xscalstr = xscal;
325 xscale = expEvaluator.
Evaluate(expr_id);
328 const char *yscal = element->Attribute(
"YSCALE");
335 std::string yscalstr = yscal;
337 yscale = expEvaluator.
Evaluate(expr_id);
340 const char *zscal = element->Attribute(
"ZSCALE");
347 std::string zscalstr = zscal;
349 zscale = expEvaluator.
Evaluate(expr_id);
359 const char *xmov = element->Attribute(
"XMOVE");
366 std::string xmovstr = xmov;
368 xmove = expEvaluator.
Evaluate(expr_id);
371 const char *ymov = element->Attribute(
"YMOVE");
378 std::string ymovstr = ymov;
380 ymove = expEvaluator.
Evaluate(expr_id);
383 const char *zmov = element->Attribute(
"ZMOVE");
390 std::string zmovstr = zmov;
392 zmove = expEvaluator.
Evaluate(expr_id);
396 element->QueryStringAttribute(
"COMPRESSED",&IsCompressed);
398 if(IsCompressed.size())
400 if(boost::iequals(IsCompressed,
404 TiXmlNode* vertexChild = element->FirstChild();
406 "Unable to extract the data from the compressed "
409 std::string vertexStr;
410 if (vertexChild->Type() == TiXmlNode::TINYXML_TEXT)
412 vertexStr += vertexChild->ToText()->ValueStr();
415 std::vector<LibUtilities::MeshVertex> vertData;
421 for(
int i = 0; i < vertData.size(); ++i)
423 indx = vertData[i].id;
424 xval = vertData[i].x;
425 yval = vertData[i].y;
426 zval = vertData[i].z;
428 xval = xval*xscale + xmove;
429 yval = yval*yscale + ymove;
430 zval = zval*zscale + zmove;
436 vert->SetGlobalID(indx);
442 ASSERTL0(
false,
"Compressed formats do not match. Expected :"
444 +
" but got " + std::string(IsCompressed));
449 TiXmlElement *vertex = element->FirstChildElement(
"V");
452 int nextVertexNumber = -1;
458 TiXmlAttribute *vertexAttr = vertex->FirstAttribute();
459 std::string attrName(vertexAttr->Name());
461 ASSERTL0(attrName ==
"ID", (std::string(
"Unknown attribute name: ") + attrName).c_str());
463 err = vertexAttr->QueryIntValue(&indx);
464 ASSERTL0(err == TIXML_SUCCESS,
"Unable to read attribute ID.");
467 std::string vertexBodyStr;
469 TiXmlNode *vertexBody = vertex->FirstChild();
474 if (vertexBody->Type() == TiXmlNode::TINYXML_TEXT)
476 vertexBodyStr += vertexBody->ToText()->Value();
477 vertexBodyStr +=
" ";
480 vertexBody = vertexBody->NextSibling();
483 ASSERTL0(!vertexBodyStr.empty(),
"Vertex definitions must contain vertex data.");
487 std::istringstream vertexDataStrm(vertexBodyStr.c_str());
491 while(!vertexDataStrm.fail())
493 vertexDataStrm >> xval >> yval >> zval;
495 xval = xval*xscale + xmove;
496 yval = yval*yscale + ymove;
497 zval = zval*zscale + zmove;
502 if (!vertexDataStrm.fail())
505 vert->SetGlobalID(indx);
512 ASSERTL0(
false,
"Unable to read VERTEX data.");
515 vertex = vertex->NextSiblingElement(
"V");
529 TiXmlDocument doc(infilename);
530 bool loadOkay = doc.LoadFile();
532 std::stringstream errstr;
533 errstr <<
"Unable to load file: " << infilename << std::endl;
534 errstr <<
"Reason: " << doc.ErrorDesc() << std::endl;
535 errstr <<
"Position: Line " << doc.ErrorRow() <<
", Column " << doc.ErrorCol() << std::endl;
550 TiXmlElement *master = doc.FirstChildElement(
"NEKTAR");
551 ASSERTL0(master,
"Unable to find NEKTAR tag in file.");
554 TiXmlElement *geomTag = master->FirstChildElement(
"GEOMETRY");
555 ASSERTL0(geomTag,
"Unable to find GEOMETRY tag in file.");
558 TiXmlElement *geomInfoTag = geomTag->FirstChildElement(
"GEOMINFO");
559 if (!geomInfoTag)
return;
561 TiXmlElement *infoItem = geomInfoTag->FirstChildElement(
"I");
567 std::string geomProperty = infoItem->Attribute(
"PROPERTY");
568 std::string geomValue = infoItem->Attribute(
"VALUE");
572 "Property " + geomProperty +
" already specified.");
574 infoItem = infoItem->NextSiblingElement(
"I");
584 TiXmlDocument doc(infilename);
585 bool loadOkay = doc.LoadFile();
587 std::stringstream errstr;
588 errstr <<
"Unable to load file: " << infilename << std::endl;
589 errstr <<
"Reason: " << doc.ErrorDesc() << std::endl;
590 errstr <<
"Position: Line " << doc.ErrorRow() <<
", Column " << doc.ErrorCol() << std::endl;
602 TiXmlElement *master = doc.FirstChildElement(
"NEKTAR");
603 ASSERTL0(master,
"Unable to find NEKTAR tag in file.");
606 TiXmlElement *expansionTypes = master->FirstChildElement(
"EXPANSIONS");
607 ASSERTL0(expansionTypes,
"Unable to find EXPANSIONS tag in file.");
612 TiXmlElement *expansion = expansionTypes->FirstChildElement();
613 std::string expType = expansion->Value();
633 const char *fStr = expansion->Attribute(
"FIELDS");
634 std::vector<std::string> fieldStrings;
638 std::string fieldStr = fStr;
640 ASSERTL0(valid,
"Unable to correctly parse the field string in ExpansionTypes.");
654 for(i = 0; i < fieldStrings.size(); ++i)
662 if(fieldStrings.size())
674 for(i = 0; i < fieldStrings.size(); ++i)
682 ASSERTL0(
false,
"Expansion vector for this field is already setup");
695 std::string compositeStr = expansion->Attribute(
"COMPOSITE");
696 ASSERTL0(compositeStr.length() > 3,
"COMPOSITE must be specified in expansion definition");
697 int beg = compositeStr.find_first_of(
"[");
698 int end = compositeStr.find_first_of(
"]");
699 std::string compositeListStr = compositeStr.substr(beg+1,end-beg-1);
704 bool useExpansionType =
false;
709 const char * tStr = expansion->Attribute(
"TYPE");
713 std::string typeStr = tStr;
716 const std::string* expStr =
std::find(begStr, endStr, typeStr);
718 ASSERTL0(expStr != endStr,
"Invalid expansion type.");
729 const char *nStr = expansion->Attribute(
"NUMMODES");
730 ASSERTL0(nStr,
"NUMMODES was not defined in EXPANSION section of input");
731 std::string nummodesStr = nStr;
737 num_modes = (int) nummodesEqn.
Evaluate();
741 num_modes = boost::lexical_cast<
int>(nummodesStr);
744 useExpansionType =
true;
749 const char *bTypeStr = expansion->Attribute(
"BASISTYPE");
750 ASSERTL0(bTypeStr,
"TYPE or BASISTYPE was not defined in EXPANSION section of input");
751 std::string basisTypeStr = bTypeStr;
754 std::vector<std::string> basisStrings;
755 std::vector<LibUtilities::BasisType> basis;
757 ASSERTL0(valid,
"Unable to correctly parse the basis types.");
758 for (vector<std::string>::size_type i = 0; i < basisStrings.size(); i++)
770 ASSERTL0(valid, std::string(
"Unable to correctly parse the basis type: ").append(basisStrings[i]).c_str());
772 const char *nModesStr = expansion->Attribute(
"NUMMODES");
773 ASSERTL0(nModesStr,
"NUMMODES was not defined in EXPANSION section of input");
775 std::string numModesStr = nModesStr;
776 std::vector<unsigned int> numModes;
778 ASSERTL0(valid,
"Unable to correctly parse the number of modes.");
779 ASSERTL0(numModes.size() == basis.size(),
"information for num modes does not match the number of basis");
781 const char *pTypeStr = expansion->Attribute(
"POINTSTYPE");
782 ASSERTL0(pTypeStr,
"POINTSTYPE was not defined in EXPANSION section of input");
783 std::string pointsTypeStr = pTypeStr;
785 std::vector<std::string> pointsStrings;
786 std::vector<LibUtilities::PointsType> points;
788 ASSERTL0(valid,
"Unable to correctly parse the points types.");
789 for (vector<std::string>::size_type i = 0; i < pointsStrings.size(); i++)
801 ASSERTL0(valid, std::string(
"Unable to correctly parse the points type: ").append(pointsStrings[i]).c_str());
804 const char *nPointsStr = expansion->Attribute(
"NUMPOINTS");
805 ASSERTL0(nPointsStr,
"NUMPOINTS was not defined in EXPANSION section of input");
806 std::string numPointsStr = nPointsStr;
807 std::vector<unsigned int> numPoints;
809 ASSERTL0(valid,
"Unable to correctly parse the number of points.");
810 ASSERTL0(numPoints.size() == numPoints.size(),
"information for num points does not match the number of basis");
812 for(
int i = 0; i < basis.size(); ++i)
825 for (compVecIter = compositeVector.begin(); compVecIter != compositeVector.end(); ++compVecIter)
828 for (geomVecIter = (compVecIter->second)->begin(); geomVecIter != (compVecIter->second)->end(); ++geomVecIter)
831 ASSERTL0(x != expansionMap->end(),
"Expansion not found!!");
838 ASSERTL0((*geomVecIter)->GetShapeDim() == basiskeyvec.size(),
" There is an incompatible expansion dimension with geometry dimension");
839 (x->second)->m_basisKeyVector = basiskeyvec;
844 expansion = expansion->NextSiblingElement(
"E");
847 else if(expType ==
"H")
855 const char *fStr = expansion->Attribute(
"FIELDS");
856 std::vector<std::string> fieldStrings;
860 std::string fieldStr = fStr;
862 ASSERTL0(valid,
"Unable to correctly parse the field string in ExpansionTypes.");
876 for(i = 0; i < fieldStrings.size(); ++i)
884 if(fieldStrings.size())
896 for(i = 0; i < fieldStrings.size(); ++i)
904 ASSERTL0(
false,
"Expansion vector for this field is already setup");
917 std::string compositeStr = expansion->Attribute(
"COMPOSITE");
918 ASSERTL0(compositeStr.length() > 3,
"COMPOSITE must be specified in expansion definition");
919 int beg = compositeStr.find_first_of(
"[");
920 int end = compositeStr.find_first_of(
"]");
921 std::string compositeListStr = compositeStr.substr(beg+1,end-beg-1);
935 const char * tStr_x = expansion->Attribute(
"TYPE-X");
939 std::string typeStr = tStr_x;
942 const std::string* expStr =
std::find(begStr, endStr, typeStr);
944 ASSERTL0(expStr != endStr,
"Invalid expansion type.");
947 const char *nStr = expansion->Attribute(
"NUMMODES-X");
948 ASSERTL0(nStr,
"NUMMODES-X was not defined in EXPANSION section of input");
949 std::string nummodesStr = nStr;
956 num_modes_x = (int) nummodesEqn.
Evaluate();
960 num_modes_x = boost::lexical_cast<
int>(nummodesStr);
965 const char * tStr_y = expansion->Attribute(
"TYPE-Y");
969 std::string typeStr = tStr_y;
972 const std::string* expStr =
std::find(begStr, endStr, typeStr);
974 ASSERTL0(expStr != endStr,
"Invalid expansion type.");
977 const char *nStr = expansion->Attribute(
"NUMMODES-Y");
978 ASSERTL0(nStr,
"NUMMODES-Y was not defined in EXPANSION section of input");
979 std::string nummodesStr = nStr;
985 num_modes_y = (int) nummodesEqn.
Evaluate();
989 num_modes_y = boost::lexical_cast<
int>(nummodesStr);
994 const char * tStr_z = expansion->Attribute(
"TYPE-Z");
998 std::string typeStr = tStr_z;
1001 const std::string* expStr =
std::find(begStr, endStr, typeStr);
1003 ASSERTL0(expStr != endStr,
"Invalid expansion type.");
1006 const char *nStr = expansion->Attribute(
"NUMMODES-Z");
1007 ASSERTL0(nStr,
"NUMMODES-Z was not defined in EXPANSION section of input");
1008 std::string nummodesStr = nStr;
1014 num_modes_z = (int) nummodesEqn.
Evaluate();
1018 num_modes_z = boost::lexical_cast<
int>(nummodesStr);
1024 for (compVecIter = compositeVector.begin(); compVecIter != compositeVector.end(); ++compVecIter)
1027 for (geomVecIter = (compVecIter->second)->begin(); geomVecIter != (compVecIter->second)->end(); ++geomVecIter)
1030 for (expVecIter = expansionMap->begin(); expVecIter != expansionMap->end(); ++expVecIter)
1044 expansion = expansion->NextSiblingElement(
"H");
1047 else if(expType ==
"ELEMENTS")
1049 std::vector<LibUtilities::FieldDefinitionsSharedPtr> fielddefs;
1052 cout <<
" Number of elements: " << fielddefs.size() << endl;
1057 ASSERTL0(
false,
"Expansion type not defined");
1068 TiXmlHandle docHandle(&doc);
1070 TiXmlElement* mesh = docHandle.FirstChildElement(
"NEKTAR").FirstChildElement(
"GEOMETRY").Element();
1071 TiXmlElement* domain = NULL;
1073 ASSERTL0(mesh,
"Unable to find GEOMETRY tag in file.");
1076 domain = mesh->FirstChildElement(
"DOMAIN");
1078 ASSERTL0(domain,
"Unable to find DOMAIN tag in file.");
1082 TiXmlElement *multidomains = domain->FirstChildElement(
"D");
1086 int nextDomainNumber = 0;
1087 while (multidomains)
1090 int err = multidomains->QueryIntAttribute(
"ID", &indx);
1092 "Unable to read attribute ID in Domain.");
1095 TiXmlNode* elementChild = multidomains->FirstChild();
1096 while(elementChild && elementChild->Type() != TiXmlNode::TINYXML_TEXT)
1098 elementChild = elementChild->NextSibling();
1101 ASSERTL0(elementChild,
"Unable to read DOMAIN body.");
1102 std::string elementStr = elementChild->ToText()->ValueStr();
1104 elementStr = elementStr.substr(elementStr.find_first_not_of(
" "));
1106 std::string::size_type indxBeg = elementStr.find_first_of(
'[') + 1;
1107 std::string::size_type indxEnd = elementStr.find_last_of(
']') - 1;
1108 std::string indxStr = elementStr.substr(indxBeg, indxEnd - indxBeg + 1);
1110 ASSERTL0(!indxStr.empty(),
"Unable to read domain's composite index (index missing?).");
1118 ASSERTL0(!
m_domain[nextDomainNumber++].empty(), (std::string(
"Unable to obtain domain's referenced composite: ") + indxStr).c_str());
1121 multidomains = multidomains->NextSiblingElement(
"D");
1129 TiXmlNode* elementChild = domain->FirstChild();
1130 while(elementChild && elementChild->Type() != TiXmlNode::TINYXML_TEXT)
1132 elementChild = elementChild->NextSibling();
1135 ASSERTL0(elementChild,
"Unable to read DOMAIN body.");
1136 std::string elementStr = elementChild->ToText()->ValueStr();
1138 elementStr = elementStr.substr(elementStr.find_first_not_of(
" "));
1140 std::string::size_type indxBeg = elementStr.find_first_of(
'[') + 1;
1141 std::string::size_type indxEnd = elementStr.find_last_of(
']') - 1;
1142 std::string indxStr = elementStr.substr(indxBeg, indxEnd - indxBeg + 1);
1144 ASSERTL0(!indxStr.empty(),
"Unable to read domain's composite index (index missing?).");
1152 ASSERTL0(!
m_domain[0].empty(), (std::string(
"Unable to obtain domain's referenced composite: ") + indxStr).c_str());
1163 TiXmlHandle docHandle(&doc);
1164 TiXmlElement* mesh = docHandle.FirstChildElement(
"NEKTAR").FirstChildElement(
"GEOMETRY").Element();
1165 TiXmlElement* field = NULL;
1169 TiXmlElement* element = mesh->FirstChildElement(
"VERTEX");
1170 ASSERTL0(element,
"Unable to find mesh VERTEX tag in file.");
1175 const char *xscal = element->Attribute(
"XSCALE");
1182 std::string xscalstr = xscal;
1184 xscale = expEvaluator.
Evaluate(expr_id);
1187 const char *yscal = element->Attribute(
"YSCALE");
1194 std::string yscalstr = yscal;
1196 yscale = expEvaluator.
Evaluate(expr_id);
1199 const char *zscal = element->Attribute(
"ZSCALE");
1206 std::string zscalstr = zscal;
1208 zscale = expEvaluator.
Evaluate(expr_id);
1217 const char *xmov = element->Attribute(
"XMOVE");
1224 std::string xmovstr = xmov;
1226 xmove = expEvaluator.
Evaluate(expr_id);
1229 const char *ymov = element->Attribute(
"YMOVE");
1236 std::string ymovstr = ymov;
1238 ymove = expEvaluator.
Evaluate(expr_id);
1241 const char *zmov = element->Attribute(
"ZMOVE");
1248 std::string zmovstr = zmov;
1250 zmove = expEvaluator.
Evaluate(expr_id);
1256 field = mesh->FirstChildElement(
"CURVED");
1263 string IsCompressed;
1264 field->QueryStringAttribute(
"COMPRESSED",&IsCompressed);
1266 if(IsCompressed.size())
1268 ASSERTL0(boost::iequals(IsCompressed,
1270 "Compressed formats do not match. Expected :"
1273 + boost::lexical_cast<std::string>(IsCompressed));
1275 std::vector<LibUtilities::MeshCurvedInfo> edginfo;
1276 std::vector<LibUtilities::MeshCurvedInfo> facinfo;
1280 TiXmlElement *x = field->FirstChildElement();
1283 const char *entitytype = x->Value();
1285 if(boost::iequals(entitytype,
"E"))
1288 std::string elmtStr;
1289 TiXmlNode* child = x->FirstChild();
1291 if (child->Type() == TiXmlNode::TINYXML_TEXT)
1293 elmtStr += child->ToText()->ValueStr();
1299 else if(boost::iequals(entitytype,
"F"))
1302 std::string elmtStr;
1303 TiXmlNode* child = x->FirstChild();
1305 if (child->Type() == TiXmlNode::TINYXML_TEXT)
1307 elmtStr += child->ToText()->ValueStr();
1313 else if(boost::iequals(entitytype,
"DATAPOINTS"))
1317 "Failed to get ID from PTS section");
1321 std::string elmtStr;
1323 TiXmlElement* DataIdx =
1324 x->FirstChildElement(
"INDEX");
1326 "Cannot read data index tag in compressed "
1329 TiXmlNode* child = DataIdx->FirstChild();
1330 if (child->Type() == TiXmlNode::TINYXML_TEXT)
1332 elmtStr = child->ToText()->ValueStr();
1336 elmtStr,cpts.
index);
1338 TiXmlElement* DataPts =
1339 x->FirstChildElement(
"POINTS");
1341 "Cannot read data pts tag in compressed "
1344 child = DataPts->FirstChild();
1345 if (child->Type() == TiXmlNode::TINYXML_TEXT)
1347 elmtStr = child->ToText()->ValueStr();
1355 ASSERTL0(
false,
"Unknown tag in curved section");
1357 x = x->NextSiblingElement();
1361 for(
int i = 0; i > cpts.
pts.size(); ++i)
1363 cpts.
pts[i].x = xscale*cpts.
pts[i].x + xmove;
1364 cpts.
pts[i].y = yscale*cpts.
pts[i].y + ymove;
1365 cpts.
pts[i].z = zscale*cpts.
pts[i].z + zmove;
1368 for(
int i = 0; i < edginfo.size(); ++i)
1370 int edgeid = edginfo[i].entityid;
1379 int offset = edginfo[i].ptoffset;
1380 for(
int j = 0; j < edginfo[i].npoints; ++j)
1382 int idx = cpts.
index[offset+j];
1387 cpts.
pts[idx].x, cpts.
pts[idx].y,
1389 curve->m_points.push_back(vert);
1395 for(
int i = 0; i < facinfo.size(); ++i)
1397 int faceid = facinfo[i].entityid;
1405 int offset = facinfo[i].ptoffset;
1406 for(
int j = 0; j < facinfo[i].npoints; ++j)
1408 int idx = cpts.
index[offset+j];
1416 curve->m_points.push_back(vert);
1428 TiXmlElement *edgelement = field->FirstChildElement(
"E");
1430 int edgeindx, edgeid;
1431 int nextEdgeNumber = -1;
1438 std::string edge(edgelement->ValueStr());
1439 ASSERTL0(edge ==
"E", (std::string(
"Unknown 3D curve type:") + edge).c_str());
1442 err = edgelement->QueryIntAttribute(
"ID", &edgeindx);
1443 ASSERTL0(err == TIXML_SUCCESS,
"Unable to read curve attribute ID.");
1446 err = edgelement->QueryIntAttribute(
"EDGEID", &edgeid);
1447 ASSERTL0(err == TIXML_SUCCESS,
"Unable to read curve attribute EDGEID.");
1450 std::string elementStr;
1451 TiXmlNode* elementChild = edgelement->FirstChild();
1456 if (elementChild->Type() == TiXmlNode::TINYXML_TEXT)
1458 elementStr += elementChild->ToText()->ValueStr();
1461 elementChild = elementChild->NextSibling();
1464 ASSERTL0(!elementStr.empty(),
"Unable to read curve description body.");
1471 std::string typeStr = edgelement->Attribute(
"TYPE");
1472 ASSERTL0(!typeStr.empty(),
"TYPE must be specified in " "points definition");
1477 const std::string* ptsStr =
std::find(begStr, endStr, typeStr);
1479 ASSERTL0(ptsStr != endStr,
"Invalid points type.");
1483 err = edgelement->QueryIntAttribute(
"NUMPOINTS", &numPts);
1484 ASSERTL0(err == TIXML_SUCCESS,
"Unable to read curve attribute NUMPOINTS.");
1489 std::istringstream elementDataStrm(elementStr.c_str());
1492 while(!elementDataStrm.fail())
1494 elementDataStrm >> xval >> yval >> zval;
1496 xval = xval*xscale + xmove;
1497 yval = yval*yscale + ymove;
1498 zval = zval*zscale + zmove;
1503 if (!elementDataStrm.fail())
1507 curve->m_points.push_back(vert);
1515 (std::string(
"Unable to read curve data for EDGE: ") + elementStr).c_str());
1519 ASSERTL0(curve->m_points.size() == numPts,
1520 "Number of points specificed by attribute "
1521 "NUMPOINTS is different from number of points "
1522 "in list (edgeid = " +
1523 boost::lexical_cast<
string>(edgeid));
1527 edgelement = edgelement->NextSiblingElement(
"E");
1533 TiXmlElement *facelement = field->FirstChildElement(
"F");
1534 int faceindx, faceid;
1538 std::string face(facelement->ValueStr());
1539 ASSERTL0(face ==
"F", (std::string(
"Unknown 3D curve type: ") + face).c_str());
1542 err = facelement->QueryIntAttribute(
"ID", &faceindx);
1543 ASSERTL0(err == TIXML_SUCCESS,
"Unable to read curve attribute ID.");
1546 err = facelement->QueryIntAttribute(
"FACEID", &faceid);
1547 ASSERTL0(err == TIXML_SUCCESS,
"Unable to read curve attribute FACEID.");
1550 std::string elementStr;
1551 TiXmlNode* elementChild = facelement->FirstChild();
1556 if (elementChild->Type() == TiXmlNode::TINYXML_TEXT)
1558 elementStr += elementChild->ToText()->ValueStr();
1561 elementChild = elementChild->NextSibling();
1564 ASSERTL0(!elementStr.empty(),
"Unable to read curve description body.");
1569 std::string typeStr = facelement->Attribute(
"TYPE");
1570 ASSERTL0(!typeStr.empty(),
"TYPE must be specified in " "points definition");
1574 const std::string* ptsStr =
std::find(begStr, endStr, typeStr);
1576 ASSERTL0(ptsStr != endStr,
"Invalid points type.");
1579 std::string numptsStr = facelement->Attribute(
"NUMPOINTS");
1580 ASSERTL0(!numptsStr.empty(),
"NUMPOINTS must be specified in points definition");
1582 std::stringstream s;
1588 ASSERTL0(numPts >= 3,
"NUMPOINTS for face must be greater than 2");
1592 ASSERTL0(ptsStr != endStr,
"Invalid points type.");
1597 std::istringstream elementDataStrm(elementStr.c_str());
1600 while(!elementDataStrm.fail())
1602 elementDataStrm >> xval >> yval >> zval;
1608 if (!elementDataStrm.fail())
1611 curve->m_points.push_back(vert);
1618 (std::string(
"Unable to read curve data for FACE: ")
1619 + elementStr).c_str());
1623 facelement = facelement->NextSiblingElement(
"F");
1635 TiXmlDocument doc(infilename);
1636 bool loadOkay = doc.LoadFile();
1638 std::stringstream errstr;
1639 errstr <<
"Unable to load file: " << infilename << std::endl;
1640 errstr <<
"Reason: " << doc.ErrorDesc() << std::endl;
1641 errstr <<
"Position: Line " << doc.ErrorRow() <<
", Column " << doc.ErrorCol() << std::endl;
1658 TiXmlElement *root = doc.FirstChildElement(
"NEKTAR");
1659 TiXmlElement *geomTag;
1664 root =
new TiXmlElement(
"NEKTAR");
1665 doc.LinkEndChild(root);
1667 geomTag =
new TiXmlElement(
"GEOMETRY");
1668 root->LinkEndChild(geomTag);
1673 geomTag = root->FirstChildElement(
"GEOMETRY");
1677 geomTag =
new TiXmlElement(
"GEOMETRY");
1678 root->LinkEndChild(geomTag);
1690 TiXmlElement *vertTag =
new TiXmlElement(
"VERTEX");
1696 s << scientific << setprecision(8)
1697 << (*pIt->second)(0) <<
" " << (*pIt->second)(1) <<
" "
1698 << (*pIt->second)(2);
1699 TiXmlElement * v =
new TiXmlElement(
"V");
1700 v->SetAttribute(
"ID", pIt->second->GetVid());
1701 v->LinkEndChild(
new TiXmlText(s.str()));
1702 vertTag->LinkEndChild(v);
1705 geomTag->LinkEndChild(vertTag);
1708 TiXmlElement *edgeTag =
new TiXmlElement(
1717 s << seg->GetVid(0) <<
" " << seg->GetVid(1);
1718 TiXmlElement *e =
new TiXmlElement(tag);
1719 e->SetAttribute(
"ID", sIt->first);
1720 e->LinkEndChild(
new TiXmlText(s.str()));
1721 edgeTag->LinkEndChild(e);
1724 geomTag->LinkEndChild(edgeTag);
1729 TiXmlElement *faceTag =
new TiXmlElement(
1739 s << tri->GetEid(0) <<
" " << tri->GetEid(1) <<
" "
1741 TiXmlElement *t =
new TiXmlElement(tag);
1742 t->SetAttribute(
"ID", tIt->first);
1743 t->LinkEndChild(
new TiXmlText(s.str()));
1744 faceTag->LinkEndChild(t);
1754 s << quad->GetEid(0) <<
" " << quad->GetEid(1) <<
" "
1755 << quad->GetEid(2) <<
" " << quad->GetEid(3);
1756 TiXmlElement *q =
new TiXmlElement(tag);
1757 q->SetAttribute(
"ID", qIt->first);
1758 q->LinkEndChild(
new TiXmlText(s.str()));
1759 faceTag->LinkEndChild(q);
1762 geomTag->LinkEndChild(faceTag);
1767 TiXmlElement *elmtTag =
new TiXmlElement(
"ELEMENT");
1776 s << hex->GetFid(0) <<
" " << hex->GetFid(1) <<
" "
1777 << hex->GetFid(2) <<
" " << hex->GetFid(3) <<
" "
1778 << hex->GetFid(4) <<
" " << hex->GetFid(5) <<
" ";
1779 TiXmlElement *h =
new TiXmlElement(tag);
1780 h->SetAttribute(
"ID", hIt->first);
1781 h->LinkEndChild(
new TiXmlText(s.str()));
1782 elmtTag->LinkEndChild(h);
1792 s << prism->GetFid(0) <<
" " << prism->GetFid(1) <<
" "
1793 << prism->GetFid(2) <<
" " << prism->GetFid(3) <<
" "
1794 << prism->GetFid(4) <<
" ";
1795 TiXmlElement *p =
new TiXmlElement(tag);
1796 p->SetAttribute(
"ID", rIt->first);
1797 p->LinkEndChild(
new TiXmlText(s.str()));
1798 elmtTag->LinkEndChild(p);
1808 s << pyr->GetFid(0) <<
" " << pyr->GetFid(1) <<
" "
1809 << pyr->GetFid(2) <<
" " << pyr->GetFid(3) <<
" "
1810 << pyr->GetFid(4) <<
" ";
1811 TiXmlElement *p =
new TiXmlElement(tag);
1812 p->SetAttribute(
"ID", pIt->first);
1813 p->LinkEndChild(
new TiXmlText(s.str()));
1814 elmtTag->LinkEndChild(p);
1824 s << tet->GetFid(0) <<
" " << tet->GetFid(1) <<
" "
1825 << tet->GetFid(2) <<
" " << tet->GetFid(3) <<
" ";
1826 TiXmlElement *t =
new TiXmlElement(tag);
1827 t->SetAttribute(
"ID", tIt->first);
1828 t->LinkEndChild(
new TiXmlText(s.str()));
1829 elmtTag->LinkEndChild(t);
1832 geomTag->LinkEndChild(elmtTag);
1836 TiXmlElement *curveTag =
new TiXmlElement(
"CURVED");
1844 TiXmlElement *c =
new TiXmlElement(
"E");
1848 for (
int j = 0; j < curve->m_points.size(); ++j)
1851 s << scientific << (*p)(0) <<
" " << (*p)(1) <<
" " << (*p)(2) <<
" ";
1854 c->SetAttribute(
"ID", curveId++);
1855 c->SetAttribute(
"EDGEID", curve->m_curveID);
1856 c->SetAttribute(
"NUMPOINTS", curve->m_points.size());
1858 c->LinkEndChild(
new TiXmlText(s.str()));
1859 curveTag->LinkEndChild(c);
1866 TiXmlElement *c =
new TiXmlElement(
"F");
1870 for (
int j = 0; j < curve->m_points.size(); ++j)
1873 s << scientific << (*p)(0) <<
" " << (*p)(1) <<
" " << (*p)(2) <<
" ";
1876 c->SetAttribute(
"ID", curveId++);
1877 c->SetAttribute(
"FACEID", curve->m_curveID);
1878 c->SetAttribute(
"NUMPOINTS", curve->m_points.size());
1880 c->LinkEndChild(
new TiXmlText(s.str()));
1881 curveTag->LinkEndChild(c);
1884 geomTag->LinkEndChild(curveTag);
1887 TiXmlElement *compTag =
new TiXmlElement(
"COMPOSITE");
1892 map<LibUtilities::ShapeType, pair<string, string> > compMap;
1901 std::vector<unsigned int> idxList;
1906 TiXmlElement *c =
new TiXmlElement(
"C");
1908 int shapeDim = firstGeom->GetShapeDim();
1910 compMap[firstGeom->GetShapeType()].second :
1911 compMap[firstGeom->GetShapeType()].first;
1914 s <<
" " << tag <<
"[";
1916 for (
int i = 0; i < cIt->second->size(); ++i)
1918 idxList.push_back((*cIt->second)[i]->GetGlobalID());
1923 c->SetAttribute(
"ID", cIt->first);
1924 c->LinkEndChild(
new TiXmlText(s.str()));
1925 compTag->LinkEndChild(c);
1928 geomTag->LinkEndChild(compTag);
1931 TiXmlElement *domTag =
new TiXmlElement(
"DOMAIN");
1932 stringstream domString;
1938 idxList.push_back(cIt->first);
1942 domTag->LinkEndChild(
new TiXmlText(domString.str()));
1943 geomTag->LinkEndChild(domTag);
1954 TiXmlDeclaration* decl =
new TiXmlDeclaration(
"1.0",
"utf-8",
"");
1955 doc.LinkEndChild(decl);
1961 doc.SaveFile(outfilename);
2004 bool returnval =
true;
2016 for(
int i = 0; i < nverts; ++i)
2019 if(xval < m_domainRange->m_xmin)
2033 if((ncnt_up == nverts)||(ncnt_low == nverts))
2044 for(
int i = 0; i < nverts; ++i)
2047 if(yval < m_domainRange->m_ymin)
2061 if((ncnt_up == nverts)||(ncnt_low == nverts))
2075 for(
int i = 0; i < nverts; ++i)
2079 if(zval < m_domainRange->m_zmin)
2093 if((ncnt_up == nverts)||(ncnt_low == nverts))
2107 bool returnval =
true;
2118 for(
int i = 0; i < nverts; ++i)
2121 if(xval < m_domainRange->m_xmin)
2135 if((ncnt_up == nverts)||(ncnt_low == nverts))
2145 for(
int i = 0; i < nverts; ++i)
2148 if(yval < m_domainRange->m_ymin)
2162 if((ncnt_up == nverts)||(ncnt_low == nverts))
2172 for(
int i = 0; i < nverts; ++i)
2176 if(zval < m_domainRange->m_zmin)
2190 if((ncnt_up == nverts)||(ncnt_low == nverts))
2219 if (whichItem >= 0 && whichItem <
int(
m_meshComposites[whichComposite]->size()))
2235 std::ostringstream errStream;
2236 errStream <<
"Unable to access composite item [" << whichComposite <<
"][" << whichItem <<
"].";
2238 std::string testStr = errStream.str();
2253 typedef vector<unsigned int> SeqVector;
2254 SeqVector seqVector;
2257 ASSERTL0(parseGood && !seqVector.empty(), (std::string(
"Unable to read composite index range: ") + compositeStr).c_str());
2259 SeqVector addedVector;
2265 if (
std::find(addedVector.begin(), addedVector.end(), *iter) == addedVector.end())
2276 addedVector.push_back(*iter);
2281 compositeVector[*iter] = composite;
2286 ::sprintf(str,
"%d", *iter);
2330 iter = expansionMap->find(geom->GetGlobalID());
2331 ASSERTL1(iter != expansionMap->end(),
2332 "Could not find expansion " +
2333 boost::lexical_cast<
string>(geom->GetGlobalID()) +
2334 " in expansion for variable " + variable);
2335 return iter->second;
2343 std::vector<LibUtilities::FieldDefinitionsSharedPtr> &fielddef)
2345 int i, j, k, cnt, id;
2352 for(i = 0; i < fielddef.size(); ++i)
2354 for(j = 0; j < fielddef[i]->m_fields.size(); ++j)
2356 std::string field = fielddef[i]->m_fields[j];
2370 for(k = 0; k < fielddef.size(); ++k)
2372 for(
int h = 0; h < fielddef[k]->m_fields.size(); ++h)
2374 if(fielddef[k]->m_fields[h] == field)
2379 for(
int g = 0; g < fielddef[k]->m_elementIDs.size(); ++g)
2383 (*expansionMap)[fielddef[k]->m_elementIDs[g]] = tmpexp;
2394 for(i = 0; i < fielddef.size(); ++i)
2397 std::vector<std::string> fields = fielddef[i]->m_fields;
2398 std::vector<unsigned int> nmodes = fielddef[i]->m_numModes;
2399 std::vector<LibUtilities::BasisType> basis = fielddef[i]->m_basis;
2400 bool pointDef = fielddef[i]->m_pointsDef;
2401 bool numPointDef = fielddef[i]->m_numPointsDef;
2404 std::vector<unsigned int> npoints = fielddef[i]->m_numPoints;
2405 std::vector<LibUtilities::PointsType> points = fielddef[i]->m_points;
2407 bool UniOrder = fielddef[i]->m_uniOrder;
2409 for (j = 0; j < fielddef[i]->m_elementIDs.size(); ++j)
2413 id = fielddef[i]->m_elementIDs[j];
2415 switch (fielddef[i]->m_shapeType)
2419 if(
m_segGeoms.count(fielddef[i]->m_elementIDs[j]) == 0)
2424 geom =
m_segGeoms[fielddef[i]->m_elementIDs[j]];
2428 if(numPointDef&&pointDef)
2433 else if(!numPointDef&&pointDef)
2438 else if(numPointDef&&!pointDef)
2449 cnt += fielddef[i]->m_numHomogeneousDir;
2451 bkeyvec.push_back(bkey);
2456 if(
m_triGeoms.count(fielddef[i]->m_elementIDs[j]) == 0)
2461 geom =
m_triGeoms[fielddef[i]->m_elementIDs[j]];
2464 if(numPointDef&&pointDef)
2469 else if(!numPointDef&&pointDef)
2474 else if(numPointDef&&!pointDef)
2481 bkeyvec.push_back(bkey);
2484 if(numPointDef&&pointDef)
2489 else if(!numPointDef&&pointDef)
2494 else if(numPointDef&&!pointDef)
2500 bkeyvec.push_back(bkey1);
2505 cnt += fielddef[i]->m_numHomogeneousDir;
2511 if(
m_quadGeoms.count(fielddef[i]->m_elementIDs[j]) == 0)
2519 for(
int b = 0; b < 2; ++b)
2523 if(numPointDef&&pointDef)
2528 else if(!numPointDef&&pointDef)
2533 else if(numPointDef&&!pointDef)
2539 bkeyvec.push_back(bkey);
2545 cnt += fielddef[i]->m_numHomogeneousDir;
2552 k = fielddef[i]->m_elementIDs[j];
2566 if(numPointDef&&pointDef)
2571 else if(!numPointDef&&pointDef)
2576 else if(numPointDef&&!pointDef)
2584 bkeyvec.push_back(bkey);
2589 if(numPointDef&&pointDef)
2594 else if(!numPointDef&&pointDef)
2599 else if(numPointDef&&!pointDef)
2607 bkeyvec.push_back(bkey);
2613 if(numPointDef&&pointDef)
2618 else if(!numPointDef&&pointDef)
2623 else if(numPointDef&&!pointDef)
2631 bkeyvec.push_back(bkey);
2642 k = fielddef[i]->m_elementIDs[j];
2649 for(
int b = 0; b < 2; ++b)
2653 if(numPointDef&&pointDef)
2658 else if(!numPointDef&&pointDef)
2663 else if(numPointDef&&!pointDef)
2670 bkeyvec.push_back(bkey);
2676 if(numPointDef&&pointDef)
2681 else if(!numPointDef&&pointDef)
2686 else if(numPointDef&&!pointDef)
2693 bkeyvec.push_back(bkey);
2704 k = fielddef[i]->m_elementIDs[j];
2706 "Failed to find geometry with same global id");
2710 for(
int b = 0; b < 2; ++b)
2714 if(numPointDef&&pointDef)
2719 else if(!numPointDef&&pointDef)
2724 else if(numPointDef&&!pointDef)
2731 bkeyvec.push_back(bkey);
2737 if(numPointDef&&pointDef)
2742 else if(!numPointDef&&pointDef)
2747 else if(numPointDef&&!pointDef)
2754 bkeyvec.push_back(bkey);
2765 k = fielddef[i]->m_elementIDs[j];
2773 for(
int b = 0; b < 3; ++b)
2777 if(numPointDef&&pointDef)
2782 else if(!numPointDef&&pointDef)
2787 else if(numPointDef&&!pointDef)
2794 bkeyvec.push_back(bkey);
2804 ASSERTL0(
false,
"Need to set up for pyramid and prism 3D Expansions");
2808 for(k = 0; k < fields.size(); ++k)
2811 if((*expansionMap).find(
id) != (*expansionMap).end())
2813 (*expansionMap)[id]->m_geomShPtr = geom;
2814 (*expansionMap)[id]->m_basisKeyVector = bkeyvec;
2826 std::vector<LibUtilities::FieldDefinitionsSharedPtr> &fielddef,
2827 std::vector< std::vector<LibUtilities::PointsType> > &pointstype)
2829 int i,j,k,g,h,cnt,id;
2836 for(i = 0; i < fielddef.size(); ++i)
2838 for(j = 0; j < fielddef[i]->m_fields.size(); ++j)
2840 std::string field = fielddef[i]->m_fields[j];
2854 for(k = 0; k < fielddef.size(); ++k)
2856 for(h = 0; h < fielddef[k]->m_fields.size(); ++h)
2858 if(fielddef[k]->m_fields[h] == field)
2863 for(g = 0; g < fielddef[k]->m_elementIDs.size(); ++g)
2867 (*expansionMap)[fielddef[k]->m_elementIDs[g]] = tmpexp;
2879 for(i = 0; i < fielddef.size(); ++i)
2882 std::vector<std::string> fields = fielddef[i]->m_fields;
2883 std::vector<unsigned int> nmodes = fielddef[i]->m_numModes;
2884 std::vector<LibUtilities::BasisType> basis = fielddef[i]->m_basis;
2885 bool UniOrder = fielddef[i]->m_uniOrder;
2887 for(j = 0; j < fielddef[i]->m_elementIDs.size(); ++j)
2890 id = fielddef[i]->m_elementIDs[j];
2892 switch(fielddef[i]->m_shapeType)
2896 k = fielddef[i]->m_elementIDs[j];
2898 "Failed to find geometry with same global id.");
2907 bkeyvec.push_back(bkey);
2912 k = fielddef[i]->m_elementIDs[j];
2914 "Failed to find geometry with same global id.");
2916 for(
int b = 0; b < 2; ++b)
2920 bkeyvec.push_back(bkey);
2931 k = fielddef[i]->m_elementIDs[j];
2933 "Failed to find geometry with same global id");
2936 for(
int b = 0; b < 2; ++b)
2940 bkeyvec.push_back(bkey);
2951 k = fielddef[i]->m_elementIDs[j];
2953 "Failed to find geometry with same global id");
2956 for(
int b = 0; b < 3; ++b)
2960 bkeyvec.push_back(bkey);
2971 k = fielddef[i]->m_elementIDs[j];
2973 "Failed to find geometry with same global id");
2976 for(
int b = 0; b < 3; ++b)
2980 bkeyvec.push_back(bkey);
2991 k = fielddef[i]->m_elementIDs[j];
2993 "Failed to find geometry with same global id");
2996 for(
int b = 0; b < 3; ++b)
3000 bkeyvec.push_back(bkey);
3011 k = fielddef[i]->m_elementIDs[j];
3013 "Failed to find geometry with same global id");
3016 for(
int b = 0; b < 3; ++b)
3020 bkeyvec.push_back(bkey);
3030 ASSERTL0(
false,
"Need to set up for pyramid and prism 3D Expansions");
3034 for(k = 0; k < fields.size(); ++k)
3037 if((*expansionMap).find(
id) != (*expansionMap).end())
3039 (*expansionMap)[id]->m_geomShPtr = geom;
3040 (*expansionMap)[id]->m_basisKeyVector = bkeyvec;
3061 for(expIt = it->second->begin(); expIt != it->second->end(); ++expIt)
3063 for(
int i = 0; i < expIt->second->m_basisKeyVector.size(); ++i)
3081 expIt->second->m_basisKeyVector[i] = bkeynew;
3103 for(expIt = it->second->begin(); expIt != it->second->end(); ++expIt)
3105 for(
int i = 0; i < expIt->second->m_basisKeyVector.size(); ++i)
3113 expIt->second->m_basisKeyVector[i] = bkeynew;
3138 for (expIt = it->second->begin();
3139 expIt != it->second->end();
3143 i < expIt->second->m_basisKeyVector.size();
3147 expIt->second->m_basisKeyVector[i];
3155 expIt->second->m_basisKeyVector[i] = bkeynew;
3182 for (elemIter = expansionMap->begin(); elemIter != expansionMap->end(); ++elemIter)
3184 if ((elemIter->second)->m_geomShPtr->GetShapeType() == shape)
3186 (elemIter->second)->m_basisKeyVector = keys;
3234 returnval.push_back(bkey);
3241 returnval.push_back(bkey);
3242 returnval.push_back(bkey);
3249 returnval.push_back(bkey);
3250 returnval.push_back(bkey);
3251 returnval.push_back(bkey);
3258 returnval.push_back(bkey);
3263 returnval.push_back(bkey1);
3270 returnval.push_back(bkey);
3274 returnval.push_back(bkey1);
3280 returnval.push_back(bkey2);
3286 returnval.push_back(bkey2);
3294 returnval.push_back(bkey);
3295 returnval.push_back(bkey);
3299 returnval.push_back(bkey1);
3306 returnval.push_back(bkey);
3307 returnval.push_back(bkey);
3311 returnval.push_back(bkey1);
3317 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3332 returnval.push_back(bkey);
3339 returnval.push_back(bkey);
3340 returnval.push_back(bkey);
3348 returnval.push_back(bkey);
3352 returnval.push_back(bkey1);
3360 returnval.push_back(bkey);
3361 returnval.push_back(bkey);
3362 returnval.push_back(bkey);
3367 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3383 returnval.push_back(bkey);
3391 returnval.push_back(bkey);
3392 returnval.push_back(bkey);
3400 returnval.push_back(bkey);
3401 returnval.push_back(bkey);
3402 returnval.push_back(bkey);
3407 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3423 returnval.push_back(bkey);
3431 returnval.push_back(bkey);
3436 returnval.push_back(bkey1);
3444 returnval.push_back(bkey);
3445 returnval.push_back(bkey);
3453 returnval.push_back(bkey);
3458 returnval.push_back(bkey1);
3466 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3482 returnval.push_back(bkey);
3490 returnval.push_back(bkey);
3491 returnval.push_back(bkey);
3499 returnval.push_back(bkey);
3500 returnval.push_back(bkey);
3501 returnval.push_back(bkey);
3506 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3522 returnval.push_back(bkey);
3529 returnval.push_back(bkey);
3530 returnval.push_back(bkey);
3537 returnval.push_back(bkey);
3538 returnval.push_back(bkey);
3539 returnval.push_back(bkey);
3544 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3560 returnval.push_back(bkey);
3567 returnval.push_back(bkey);
3568 returnval.push_back(bkey);
3575 returnval.push_back(bkey);
3576 returnval.push_back(bkey);
3577 returnval.push_back(bkey);
3582 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3597 returnval.push_back(bkey);
3604 returnval.push_back(bkey);
3605 returnval.push_back(bkey);
3612 returnval.push_back(bkey);
3613 returnval.push_back(bkey);
3614 returnval.push_back(bkey);
3619 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3634 returnval.push_back(bkey);
3641 returnval.push_back(bkey);
3642 returnval.push_back(bkey);
3649 returnval.push_back(bkey);
3650 returnval.push_back(bkey);
3651 returnval.push_back(bkey);
3656 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3671 returnval.push_back(bkey);
3678 returnval.push_back(bkey);
3679 returnval.push_back(bkey);
3686 returnval.push_back(bkey);
3687 returnval.push_back(bkey);
3688 returnval.push_back(bkey);
3693 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3708 returnval.push_back(bkey);
3712 returnval.push_back(bkey1);
3717 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3732 returnval.push_back(bkey1);
3736 returnval.push_back(bkey);
3741 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3756 returnval.push_back(bkey);
3760 returnval.push_back(bkey1);
3765 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3774 ASSERTL0(
false,
"Expansion type not defined");
3792 const int nummodes_x,
3793 const int nummodes_y,
3794 const int nummodes_z)
3804 ASSERTL0(
false,
"Homogeneous expansion not defined for this shape");
3810 ASSERTL0(
false,
"Homogeneous expansion not defined for this shape");
3822 returnval.push_back(bkey1);
3830 returnval.push_back(bkey1);
3838 returnval.push_back(bkey1);
3846 returnval.push_back(bkey1);
3855 returnval.push_back(bkey1);
3863 ASSERTL0(
false,
"Homogeneous expansion can be of Fourier or Chebyshev type only");
3875 returnval.push_back(bkey2);
3884 returnval.push_back(bkey2);
3892 returnval.push_back(bkey2);
3900 returnval.push_back(bkey2);
3908 returnval.push_back(bkey2);
3914 ASSERTL0(
false,
"Homogeneous expansion can be of Fourier or Chebyshev type only");
3925 returnval.push_back(bkey3);
3933 returnval.push_back(bkey3);
3941 returnval.push_back(bkey3);
3949 returnval.push_back(bkey3);
3957 returnval.push_back(bkey3);
3963 ASSERTL0(
false,
"Homogeneous expansion can be of Fourier or Chebyshev type only");
3972 ASSERTL0(
false,
"Homogeneous expansion not defined for this shape");
3978 ASSERTL0(
false,
"Homogeneous expansion not defined for this shape");
3983 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3996 unsigned int nextId =
m_vertSet.rbegin()->first + 1;
4012 if( curveDefinition )
4032 trigeom->SetGlobalID(indx);
4047 quadgeom->SetGlobalID(indx);
4064 prismgeom->SetGlobalID(index);
4076 unsigned int index =
m_tetGeoms.rbegin()->first + 1;
4078 tetgeom->SetGlobalID(index);
4092 unsigned int index =
m_pyrGeoms.rbegin()->first + 1;
4095 pyrgeom->SetGlobalID(index);
4107 unsigned int index =
m_hexGeoms.rbegin()->first + 1;
4109 hexgeom->SetGlobalID(index);
4127 for(
int d = 0; d <
m_domain.size(); ++d)
4129 CompositeMap::const_iterator compIter;
4131 for (compIter =
m_domain[d].begin(); compIter !=
m_domain[d].end(); ++compIter)
4133 GeometryVector::const_iterator x;
4134 for (x = compIter->second->begin(); x != compIter->second->end(); ++x)
4139 int id = (*x)->GetGlobalID();
4140 (*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...
void ImportFieldDefs(TiXmlDocument &doc, std::vector< FieldDefinitionsSharedPtr > &fielddefs, bool expChild)
Imports the definition of the fields.
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 .
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.
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 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
Class for operating on FLD files.
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