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);
2332 for (iter = expansionMap->begin(); iter!=expansionMap->end(); ++iter)
2334 if ((iter->second)->m_geomShPtr == geom)
2336 returnval = iter->second;
2348 std::vector<LibUtilities::FieldDefinitionsSharedPtr> &fielddef)
2350 int i, j, k, cnt, id;
2357 for(i = 0; i < fielddef.size(); ++i)
2359 for(j = 0; j < fielddef[i]->m_fields.size(); ++j)
2361 std::string field = fielddef[i]->m_fields[j];
2375 for(k = 0; k < fielddef.size(); ++k)
2377 for(
int h = 0; h < fielddef[k]->m_fields.size(); ++h)
2379 if(fielddef[k]->m_fields[h] == field)
2384 for(
int g = 0; g < fielddef[k]->m_elementIDs.size(); ++g)
2388 (*expansionMap)[fielddef[k]->m_elementIDs[g]] = tmpexp;
2399 for(i = 0; i < fielddef.size(); ++i)
2402 std::vector<std::string> fields = fielddef[i]->m_fields;
2403 std::vector<unsigned int> nmodes = fielddef[i]->m_numModes;
2404 std::vector<LibUtilities::BasisType> basis = fielddef[i]->m_basis;
2405 bool pointDef = fielddef[i]->m_pointsDef;
2406 bool numPointDef = fielddef[i]->m_numPointsDef;
2409 std::vector<unsigned int> npoints = fielddef[i]->m_numPoints;
2410 std::vector<LibUtilities::PointsType> points = fielddef[i]->m_points;
2412 bool UniOrder = fielddef[i]->m_uniOrder;
2414 for (j = 0; j < fielddef[i]->m_elementIDs.size(); ++j)
2418 id = fielddef[i]->m_elementIDs[j];
2420 switch (fielddef[i]->m_shapeType)
2424 if(
m_segGeoms.count(fielddef[i]->m_elementIDs[j]) == 0)
2429 geom =
m_segGeoms[fielddef[i]->m_elementIDs[j]];
2433 if(numPointDef&&pointDef)
2438 else if(!numPointDef&&pointDef)
2443 else if(numPointDef&&!pointDef)
2454 cnt += fielddef[i]->m_numHomogeneousDir;
2456 bkeyvec.push_back(bkey);
2461 if(
m_triGeoms.count(fielddef[i]->m_elementIDs[j]) == 0)
2466 geom =
m_triGeoms[fielddef[i]->m_elementIDs[j]];
2469 if(numPointDef&&pointDef)
2474 else if(!numPointDef&&pointDef)
2479 else if(numPointDef&&!pointDef)
2486 bkeyvec.push_back(bkey);
2489 if(numPointDef&&pointDef)
2494 else if(!numPointDef&&pointDef)
2499 else if(numPointDef&&!pointDef)
2505 bkeyvec.push_back(bkey1);
2510 cnt += fielddef[i]->m_numHomogeneousDir;
2516 if(
m_quadGeoms.count(fielddef[i]->m_elementIDs[j]) == 0)
2524 for(
int b = 0; b < 2; ++b)
2528 if(numPointDef&&pointDef)
2533 else if(!numPointDef&&pointDef)
2538 else if(numPointDef&&!pointDef)
2544 bkeyvec.push_back(bkey);
2550 cnt += fielddef[i]->m_numHomogeneousDir;
2557 k = fielddef[i]->m_elementIDs[j];
2571 if(numPointDef&&pointDef)
2576 else if(!numPointDef&&pointDef)
2581 else if(numPointDef&&!pointDef)
2589 bkeyvec.push_back(bkey);
2594 if(numPointDef&&pointDef)
2599 else if(!numPointDef&&pointDef)
2604 else if(numPointDef&&!pointDef)
2612 bkeyvec.push_back(bkey);
2618 if(numPointDef&&pointDef)
2623 else if(!numPointDef&&pointDef)
2628 else if(numPointDef&&!pointDef)
2636 bkeyvec.push_back(bkey);
2647 k = fielddef[i]->m_elementIDs[j];
2654 for(
int b = 0; b < 2; ++b)
2658 if(numPointDef&&pointDef)
2663 else if(!numPointDef&&pointDef)
2668 else if(numPointDef&&!pointDef)
2675 bkeyvec.push_back(bkey);
2681 if(numPointDef&&pointDef)
2686 else if(!numPointDef&&pointDef)
2691 else if(numPointDef&&!pointDef)
2698 bkeyvec.push_back(bkey);
2709 k = fielddef[i]->m_elementIDs[j];
2711 "Failed to find geometry with same global id");
2715 for(
int b = 0; b < 2; ++b)
2719 if(numPointDef&&pointDef)
2724 else if(!numPointDef&&pointDef)
2729 else if(numPointDef&&!pointDef)
2736 bkeyvec.push_back(bkey);
2742 if(numPointDef&&pointDef)
2747 else if(!numPointDef&&pointDef)
2752 else if(numPointDef&&!pointDef)
2759 bkeyvec.push_back(bkey);
2770 k = fielddef[i]->m_elementIDs[j];
2778 for(
int b = 0; b < 3; ++b)
2782 if(numPointDef&&pointDef)
2787 else if(!numPointDef&&pointDef)
2792 else if(numPointDef&&!pointDef)
2799 bkeyvec.push_back(bkey);
2809 ASSERTL0(
false,
"Need to set up for pyramid and prism 3D Expansions");
2813 for(k = 0; k < fields.size(); ++k)
2816 if((*expansionMap).find(
id) != (*expansionMap).end())
2818 (*expansionMap)[id]->m_geomShPtr = geom;
2819 (*expansionMap)[id]->m_basisKeyVector = bkeyvec;
2831 std::vector<LibUtilities::FieldDefinitionsSharedPtr> &fielddef,
2832 std::vector< std::vector<LibUtilities::PointsType> > &pointstype)
2834 int i,j,k,g,h,cnt,id;
2841 for(i = 0; i < fielddef.size(); ++i)
2843 for(j = 0; j < fielddef[i]->m_fields.size(); ++j)
2845 std::string field = fielddef[i]->m_fields[j];
2859 for(k = 0; k < fielddef.size(); ++k)
2861 for(h = 0; h < fielddef[k]->m_fields.size(); ++h)
2863 if(fielddef[k]->m_fields[h] == field)
2868 for(g = 0; g < fielddef[k]->m_elementIDs.size(); ++g)
2872 (*expansionMap)[fielddef[k]->m_elementIDs[g]] = tmpexp;
2884 for(i = 0; i < fielddef.size(); ++i)
2887 std::vector<std::string> fields = fielddef[i]->m_fields;
2888 std::vector<unsigned int> nmodes = fielddef[i]->m_numModes;
2889 std::vector<LibUtilities::BasisType> basis = fielddef[i]->m_basis;
2890 bool UniOrder = fielddef[i]->m_uniOrder;
2892 for(j = 0; j < fielddef[i]->m_elementIDs.size(); ++j)
2895 id = fielddef[i]->m_elementIDs[j];
2897 switch(fielddef[i]->m_shapeType)
2901 k = fielddef[i]->m_elementIDs[j];
2903 "Failed to find geometry with same global id.");
2912 bkeyvec.push_back(bkey);
2917 k = fielddef[i]->m_elementIDs[j];
2919 "Failed to find geometry with same global id.");
2921 for(
int b = 0; b < 2; ++b)
2925 bkeyvec.push_back(bkey);
2936 k = fielddef[i]->m_elementIDs[j];
2938 "Failed to find geometry with same global id");
2941 for(
int b = 0; b < 2; ++b)
2945 bkeyvec.push_back(bkey);
2956 k = fielddef[i]->m_elementIDs[j];
2958 "Failed to find geometry with same global id");
2961 for(
int b = 0; b < 3; ++b)
2965 bkeyvec.push_back(bkey);
2976 k = fielddef[i]->m_elementIDs[j];
2978 "Failed to find geometry with same global id");
2981 for(
int b = 0; b < 3; ++b)
2985 bkeyvec.push_back(bkey);
2996 k = fielddef[i]->m_elementIDs[j];
2998 "Failed to find geometry with same global id");
3001 for(
int b = 0; b < 3; ++b)
3005 bkeyvec.push_back(bkey);
3016 k = fielddef[i]->m_elementIDs[j];
3018 "Failed to find geometry with same global id");
3021 for(
int b = 0; b < 3; ++b)
3025 bkeyvec.push_back(bkey);
3035 ASSERTL0(
false,
"Need to set up for pyramid and prism 3D Expansions");
3039 for(k = 0; k < fields.size(); ++k)
3042 if((*expansionMap).find(
id) != (*expansionMap).end())
3044 (*expansionMap)[id]->m_geomShPtr = geom;
3045 (*expansionMap)[id]->m_basisKeyVector = bkeyvec;
3066 for(expIt = it->second->begin(); expIt != it->second->end(); ++expIt)
3068 for(
int i = 0; i < expIt->second->m_basisKeyVector.size(); ++i)
3086 expIt->second->m_basisKeyVector[i] = bkeynew;
3108 for(expIt = it->second->begin(); expIt != it->second->end(); ++expIt)
3110 for(
int i = 0; i < expIt->second->m_basisKeyVector.size(); ++i)
3118 expIt->second->m_basisKeyVector[i] = bkeynew;
3143 for (expIt = it->second->begin();
3144 expIt != it->second->end();
3148 i < expIt->second->m_basisKeyVector.size();
3152 expIt->second->m_basisKeyVector[i];
3160 expIt->second->m_basisKeyVector[i] = bkeynew;
3187 for (elemIter = expansionMap->begin(); elemIter != expansionMap->end(); ++elemIter)
3189 if ((elemIter->second)->m_geomShPtr->GetShapeType() == shape)
3191 (elemIter->second)->m_basisKeyVector = keys;
3239 returnval.push_back(bkey);
3246 returnval.push_back(bkey);
3247 returnval.push_back(bkey);
3254 returnval.push_back(bkey);
3255 returnval.push_back(bkey);
3256 returnval.push_back(bkey);
3263 returnval.push_back(bkey);
3268 returnval.push_back(bkey1);
3275 returnval.push_back(bkey);
3279 returnval.push_back(bkey1);
3285 returnval.push_back(bkey2);
3291 returnval.push_back(bkey2);
3299 returnval.push_back(bkey);
3300 returnval.push_back(bkey);
3304 returnval.push_back(bkey1);
3311 returnval.push_back(bkey);
3312 returnval.push_back(bkey);
3316 returnval.push_back(bkey1);
3322 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3337 returnval.push_back(bkey);
3344 returnval.push_back(bkey);
3345 returnval.push_back(bkey);
3353 returnval.push_back(bkey);
3357 returnval.push_back(bkey1);
3365 returnval.push_back(bkey);
3366 returnval.push_back(bkey);
3367 returnval.push_back(bkey);
3372 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3388 returnval.push_back(bkey);
3396 returnval.push_back(bkey);
3397 returnval.push_back(bkey);
3405 returnval.push_back(bkey);
3406 returnval.push_back(bkey);
3407 returnval.push_back(bkey);
3412 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3428 returnval.push_back(bkey);
3436 returnval.push_back(bkey);
3441 returnval.push_back(bkey1);
3449 returnval.push_back(bkey);
3450 returnval.push_back(bkey);
3458 returnval.push_back(bkey);
3463 returnval.push_back(bkey1);
3471 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3487 returnval.push_back(bkey);
3495 returnval.push_back(bkey);
3496 returnval.push_back(bkey);
3504 returnval.push_back(bkey);
3505 returnval.push_back(bkey);
3506 returnval.push_back(bkey);
3511 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3527 returnval.push_back(bkey);
3534 returnval.push_back(bkey);
3535 returnval.push_back(bkey);
3542 returnval.push_back(bkey);
3543 returnval.push_back(bkey);
3544 returnval.push_back(bkey);
3549 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3565 returnval.push_back(bkey);
3572 returnval.push_back(bkey);
3573 returnval.push_back(bkey);
3580 returnval.push_back(bkey);
3581 returnval.push_back(bkey);
3582 returnval.push_back(bkey);
3587 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3602 returnval.push_back(bkey);
3609 returnval.push_back(bkey);
3610 returnval.push_back(bkey);
3617 returnval.push_back(bkey);
3618 returnval.push_back(bkey);
3619 returnval.push_back(bkey);
3624 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3639 returnval.push_back(bkey);
3646 returnval.push_back(bkey);
3647 returnval.push_back(bkey);
3654 returnval.push_back(bkey);
3655 returnval.push_back(bkey);
3656 returnval.push_back(bkey);
3661 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3676 returnval.push_back(bkey);
3683 returnval.push_back(bkey);
3684 returnval.push_back(bkey);
3691 returnval.push_back(bkey);
3692 returnval.push_back(bkey);
3693 returnval.push_back(bkey);
3698 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3713 returnval.push_back(bkey);
3717 returnval.push_back(bkey1);
3722 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3737 returnval.push_back(bkey1);
3741 returnval.push_back(bkey);
3746 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3761 returnval.push_back(bkey);
3765 returnval.push_back(bkey1);
3770 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3779 ASSERTL0(
false,
"Expansion type not defined");
3797 const int nummodes_x,
3798 const int nummodes_y,
3799 const int nummodes_z)
3809 ASSERTL0(
false,
"Homogeneous expansion not defined for this shape");
3815 ASSERTL0(
false,
"Homogeneous expansion not defined for this shape");
3827 returnval.push_back(bkey1);
3835 returnval.push_back(bkey1);
3843 returnval.push_back(bkey1);
3851 returnval.push_back(bkey1);
3860 returnval.push_back(bkey1);
3868 ASSERTL0(
false,
"Homogeneous expansion can be of Fourier or Chebyshev type only");
3880 returnval.push_back(bkey2);
3889 returnval.push_back(bkey2);
3897 returnval.push_back(bkey2);
3905 returnval.push_back(bkey2);
3913 returnval.push_back(bkey2);
3919 ASSERTL0(
false,
"Homogeneous expansion can be of Fourier or Chebyshev type only");
3930 returnval.push_back(bkey3);
3938 returnval.push_back(bkey3);
3946 returnval.push_back(bkey3);
3954 returnval.push_back(bkey3);
3962 returnval.push_back(bkey3);
3968 ASSERTL0(
false,
"Homogeneous expansion can be of Fourier or Chebyshev type only");
3977 ASSERTL0(
false,
"Homogeneous expansion not defined for this shape");
3983 ASSERTL0(
false,
"Homogeneous expansion not defined for this shape");
3988 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
4001 unsigned int nextId =
m_vertSet.rbegin()->first + 1;
4017 if( curveDefinition )
4037 trigeom->SetGlobalID(indx);
4052 quadgeom->SetGlobalID(indx);
4069 prismgeom->SetGlobalID(index);
4081 unsigned int index =
m_tetGeoms.rbegin()->first + 1;
4083 tetgeom->SetGlobalID(index);
4097 unsigned int index =
m_pyrGeoms.rbegin()->first + 1;
4100 pyrgeom->SetGlobalID(index);
4112 unsigned int index =
m_hexGeoms.rbegin()->first + 1;
4114 hexgeom->SetGlobalID(index);
4132 for(
int d = 0; d <
m_domain.size(); ++d)
4134 CompositeMap::const_iterator compIter;
4136 for (compIter =
m_domain[d].begin(); compIter !=
m_domain[d].end(); ++compIter)
4138 GeometryVector::const_iterator x;
4139 for (x = compIter->second->begin(); x != compIter->second->end(); ++x)
4144 int id = (*x)->GetGlobalID();
4145 (*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