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>
69 namespace SpatialDomains
86 unsigned int meshDimension,
87 unsigned int spaceDimension) :
88 m_meshDimension(meshDimension),
89 m_spaceDimension(spaceDimension),
123 boost::shared_ptr<MeshGraph> returnval;
127 TiXmlElement* geometry_tag = pSession->GetElement(
"NEKTAR/GEOMETRY");
128 TiXmlAttribute *attr = geometry_tag->FirstAttribute();
132 std::string attrName(attr->Name());
133 if (attrName ==
"DIM")
135 int err = attr->QueryIntValue(&meshDim);
136 ASSERTL0(err==TIXML_SUCCESS,
"Unable to read mesh dimension.");
141 std::string errstr(
"Unknown attribute: ");
167 std::string err =
"Invalid mesh dimension: ";
168 std::stringstream strstrm;
170 err += strstrm.str();
181 const std::string& infilename,
182 bool pReadExpansions)
184 boost::shared_ptr<MeshGraph> returnval;
206 std::string err =
"Invalid mesh dimension: ";
207 std::stringstream strstrm;
209 err += strstrm.str();
215 returnval->ReadGeometry(infilename);
216 returnval->ReadGeometryInfo(infilename);
219 returnval->ReadExpansions(infilename);
232 TiXmlDocument doc(infilename);
233 bool loadOkay = doc.LoadFile();
235 std::stringstream errstr;
236 errstr <<
"Unable to load file: " << infilename <<
" (";
237 errstr << doc.ErrorDesc() <<
", line " << doc.ErrorRow()
238 <<
", column " << doc.ErrorCol() <<
")";
250 TiXmlHandle docHandle(&doc);
251 TiXmlElement* mesh = NULL;
252 TiXmlElement* master = NULL;
256 master = doc.FirstChildElement(
"NEKTAR");
257 ASSERTL0(master,
"Unable to find NEKTAR tag in file.");
260 mesh = master->FirstChildElement(
"GEOMETRY");
262 ASSERTL0(mesh,
"Unable to find GEOMETRY tag in file.");
263 TiXmlAttribute *attr = mesh->FirstAttribute();
274 std::string attrName(attr->Name());
275 if (attrName ==
"DIM")
278 ASSERTL1(err==TIXML_SUCCESS,
"Unable to read mesh dimension.");
280 else if (attrName ==
"SPACE")
283 ASSERTL1(err==TIXML_SUCCESS,
"Unable to read space dimension.");
285 else if (attrName ==
"PARTITION")
288 ASSERTL1(err==TIXML_SUCCESS,
"Unable to read partition.");
293 std::string errstr(
"Unknown attribute: ");
305 TiXmlElement* element = mesh->FirstChildElement(
"VERTEX");
306 ASSERTL0(element,
"Unable to find mesh VERTEX tag in file.");
314 const char *xscal = element->Attribute(
"XSCALE");
321 std::string xscalstr = xscal;
323 xscale = expEvaluator.
Evaluate(expr_id);
326 const char *yscal = element->Attribute(
"YSCALE");
333 std::string yscalstr = yscal;
335 yscale = expEvaluator.
Evaluate(expr_id);
338 const char *zscal = element->Attribute(
"ZSCALE");
345 std::string zscalstr = zscal;
347 zscale = expEvaluator.
Evaluate(expr_id);
357 const char *xmov = element->Attribute(
"XMOVE");
364 std::string xmovstr = xmov;
366 xmove = expEvaluator.
Evaluate(expr_id);
369 const char *ymov = element->Attribute(
"YMOVE");
376 std::string ymovstr = ymov;
378 ymove = expEvaluator.
Evaluate(expr_id);
381 const char *zmov = element->Attribute(
"ZMOVE");
388 std::string zmovstr = zmov;
390 zmove = expEvaluator.
Evaluate(expr_id);
394 element->QueryStringAttribute(
"COMPRESSED",&IsCompressed);
396 if(IsCompressed.size())
398 if(boost::iequals(IsCompressed,
402 TiXmlNode* vertexChild = element->FirstChild();
404 "Unable to extract the data from the compressed "
407 std::string vertexStr;
408 if (vertexChild->Type() == TiXmlNode::TINYXML_TEXT)
410 vertexStr += vertexChild->ToText()->ValueStr();
413 std::vector<LibUtilities::MeshVertex> vertData;
419 for(
int i = 0; i < vertData.size(); ++i)
421 indx = vertData[i].id;
422 xval = vertData[i].x;
423 yval = vertData[i].y;
424 zval = vertData[i].z;
426 xval = xval*xscale + xmove;
427 yval = yval*yscale + ymove;
428 zval = zval*zscale + zmove;
434 vert->SetGlobalID(indx);
440 ASSERTL0(
false,
"Compressed formats do not match. Expected :"
442 +
" but got " + std::string(IsCompressed));
447 TiXmlElement *vertex = element->FirstChildElement(
"V");
450 int nextVertexNumber = -1;
456 TiXmlAttribute *vertexAttr = vertex->FirstAttribute();
457 std::string attrName(vertexAttr->Name());
459 ASSERTL0(attrName ==
"ID", (std::string(
"Unknown attribute name: ") + attrName).c_str());
461 err = vertexAttr->QueryIntValue(&indx);
462 ASSERTL0(err == TIXML_SUCCESS,
"Unable to read attribute ID.");
465 std::string vertexBodyStr;
467 TiXmlNode *vertexBody = vertex->FirstChild();
472 if (vertexBody->Type() == TiXmlNode::TINYXML_TEXT)
474 vertexBodyStr += vertexBody->ToText()->Value();
475 vertexBodyStr +=
" ";
478 vertexBody = vertexBody->NextSibling();
481 ASSERTL0(!vertexBodyStr.empty(),
"Vertex definitions must contain vertex data.");
485 std::istringstream vertexDataStrm(vertexBodyStr.c_str());
489 while(!vertexDataStrm.fail())
491 vertexDataStrm >> xval >> yval >> zval;
493 xval = xval*xscale + xmove;
494 yval = yval*yscale + ymove;
495 zval = zval*zscale + zmove;
500 if (!vertexDataStrm.fail())
503 vert->SetGlobalID(indx);
510 ASSERTL0(
false,
"Unable to read VERTEX data.");
513 vertex = vertex->NextSiblingElement(
"V");
527 TiXmlDocument doc(infilename);
528 bool loadOkay = doc.LoadFile();
530 std::stringstream errstr;
531 errstr <<
"Unable to load file: " << infilename << std::endl;
532 errstr <<
"Reason: " << doc.ErrorDesc() << std::endl;
533 errstr <<
"Position: Line " << doc.ErrorRow() <<
", Column " << doc.ErrorCol() << std::endl;
548 TiXmlElement *master = doc.FirstChildElement(
"NEKTAR");
549 ASSERTL0(master,
"Unable to find NEKTAR tag in file.");
552 TiXmlElement *geomTag = master->FirstChildElement(
"GEOMETRY");
553 ASSERTL0(geomTag,
"Unable to find GEOMETRY tag in file.");
556 TiXmlElement *geomInfoTag = geomTag->FirstChildElement(
"GEOMINFO");
557 if (!geomInfoTag)
return;
559 TiXmlElement *infoItem = geomInfoTag->FirstChildElement(
"I");
565 std::string geomProperty = infoItem->Attribute(
"PROPERTY");
566 std::string geomValue = infoItem->Attribute(
"VALUE");
570 "Property " + geomProperty +
" already specified.");
572 infoItem = infoItem->NextSiblingElement(
"I");
582 TiXmlDocument doc(infilename);
583 bool loadOkay = doc.LoadFile();
585 std::stringstream errstr;
586 errstr <<
"Unable to load file: " << infilename << std::endl;
587 errstr <<
"Reason: " << doc.ErrorDesc() << std::endl;
588 errstr <<
"Position: Line " << doc.ErrorRow() <<
", Column " << doc.ErrorCol() << std::endl;
600 TiXmlElement *master = doc.FirstChildElement(
"NEKTAR");
601 ASSERTL0(master,
"Unable to find NEKTAR tag in file.");
604 TiXmlElement *expansionTypes = master->FirstChildElement(
"EXPANSIONS");
605 ASSERTL0(expansionTypes,
"Unable to find EXPANSIONS tag in file.");
610 TiXmlElement *expansion = expansionTypes->FirstChildElement();
611 std::string expType = expansion->Value();
631 const char *fStr = expansion->Attribute(
"FIELDS");
632 std::vector<std::string> fieldStrings;
636 std::string fieldStr = fStr;
638 ASSERTL0(valid,
"Unable to correctly parse the field string in ExpansionTypes.");
652 for(i = 0; i < fieldStrings.size(); ++i)
660 if(fieldStrings.size())
672 for(i = 0; i < fieldStrings.size(); ++i)
680 ASSERTL0(
false,
"Expansion vector for this field is already setup");
693 std::string compositeStr = expansion->Attribute(
"COMPOSITE");
694 ASSERTL0(compositeStr.length() > 3,
"COMPOSITE must be specified in expansion definition");
695 int beg = compositeStr.find_first_of(
"[");
696 int end = compositeStr.find_first_of(
"]");
697 std::string compositeListStr = compositeStr.substr(beg+1,end-beg-1);
702 bool useExpansionType =
false;
707 const char * tStr = expansion->Attribute(
"TYPE");
711 std::string typeStr = tStr;
714 const std::string* expStr =
std::find(begStr, endStr, typeStr);
716 ASSERTL0(expStr != endStr,
"Invalid expansion type.");
727 const char *nStr = expansion->Attribute(
"NUMMODES");
728 ASSERTL0(nStr,
"NUMMODES was not defined in EXPANSION section of input");
729 std::string nummodesStr = nStr;
735 num_modes = (int) nummodesEqn.
Evaluate();
739 num_modes = boost::lexical_cast<
int>(nummodesStr);
742 useExpansionType =
true;
747 const char *bTypeStr = expansion->Attribute(
"BASISTYPE");
748 ASSERTL0(bTypeStr,
"TYPE or BASISTYPE was not defined in EXPANSION section of input");
749 std::string basisTypeStr = bTypeStr;
752 std::vector<std::string> basisStrings;
753 std::vector<LibUtilities::BasisType> basis;
755 ASSERTL0(valid,
"Unable to correctly parse the basis types.");
756 for (vector<std::string>::size_type i = 0; i < basisStrings.size(); i++)
768 ASSERTL0(valid, std::string(
"Unable to correctly parse the basis type: ").append(basisStrings[i]).c_str());
770 const char *nModesStr = expansion->Attribute(
"NUMMODES");
771 ASSERTL0(nModesStr,
"NUMMODES was not defined in EXPANSION section of input");
773 std::string numModesStr = nModesStr;
774 std::vector<unsigned int> numModes;
776 ASSERTL0(valid,
"Unable to correctly parse the number of modes.");
777 ASSERTL0(numModes.size() == basis.size(),
"information for num modes does not match the number of basis");
779 const char *pTypeStr = expansion->Attribute(
"POINTSTYPE");
780 ASSERTL0(pTypeStr,
"POINTSTYPE was not defined in EXPANSION section of input");
781 std::string pointsTypeStr = pTypeStr;
783 std::vector<std::string> pointsStrings;
784 std::vector<LibUtilities::PointsType> points;
786 ASSERTL0(valid,
"Unable to correctly parse the points types.");
787 for (vector<std::string>::size_type i = 0; i < pointsStrings.size(); i++)
799 ASSERTL0(valid, std::string(
"Unable to correctly parse the points type: ").append(pointsStrings[i]).c_str());
802 const char *nPointsStr = expansion->Attribute(
"NUMPOINTS");
803 ASSERTL0(nPointsStr,
"NUMPOINTS was not defined in EXPANSION section of input");
804 std::string numPointsStr = nPointsStr;
805 std::vector<unsigned int> numPoints;
807 ASSERTL0(valid,
"Unable to correctly parse the number of points.");
808 ASSERTL0(numPoints.size() == numPoints.size(),
"information for num points does not match the number of basis");
810 for(
int i = 0; i < basis.size(); ++i)
823 for (compVecIter = compositeVector.begin(); compVecIter != compositeVector.end(); ++compVecIter)
826 for (geomVecIter = (compVecIter->second)->begin(); geomVecIter != (compVecIter->second)->end(); ++geomVecIter)
829 ASSERTL0(x != expansionMap->end(),
"Expansion not found!!");
836 ASSERTL0((*geomVecIter)->GetShapeDim() == basiskeyvec.size(),
" There is an incompatible expansion dimension with geometry dimension");
837 (x->second)->m_basisKeyVector = basiskeyvec;
842 expansion = expansion->NextSiblingElement(
"E");
845 else if(expType ==
"H")
853 const char *fStr = expansion->Attribute(
"FIELDS");
854 std::vector<std::string> fieldStrings;
858 std::string fieldStr = fStr;
860 ASSERTL0(valid,
"Unable to correctly parse the field string in ExpansionTypes.");
874 for(i = 0; i < fieldStrings.size(); ++i)
882 if(fieldStrings.size())
894 for(i = 0; i < fieldStrings.size(); ++i)
902 ASSERTL0(
false,
"Expansion vector for this field is already setup");
915 std::string compositeStr = expansion->Attribute(
"COMPOSITE");
916 ASSERTL0(compositeStr.length() > 3,
"COMPOSITE must be specified in expansion definition");
917 int beg = compositeStr.find_first_of(
"[");
918 int end = compositeStr.find_first_of(
"]");
919 std::string compositeListStr = compositeStr.substr(beg+1,end-beg-1);
933 const char * tStr_x = expansion->Attribute(
"TYPE-X");
937 std::string typeStr = tStr_x;
940 const std::string* expStr =
std::find(begStr, endStr, typeStr);
942 ASSERTL0(expStr != endStr,
"Invalid expansion type.");
945 const char *nStr = expansion->Attribute(
"NUMMODES-X");
946 ASSERTL0(nStr,
"NUMMODES-X was not defined in EXPANSION section of input");
947 std::string nummodesStr = nStr;
954 num_modes_x = (int) nummodesEqn.
Evaluate();
958 num_modes_x = boost::lexical_cast<
int>(nummodesStr);
963 const char * tStr_y = expansion->Attribute(
"TYPE-Y");
967 std::string typeStr = tStr_y;
970 const std::string* expStr =
std::find(begStr, endStr, typeStr);
972 ASSERTL0(expStr != endStr,
"Invalid expansion type.");
975 const char *nStr = expansion->Attribute(
"NUMMODES-Y");
976 ASSERTL0(nStr,
"NUMMODES-Y was not defined in EXPANSION section of input");
977 std::string nummodesStr = nStr;
983 num_modes_y = (int) nummodesEqn.
Evaluate();
987 num_modes_y = boost::lexical_cast<
int>(nummodesStr);
992 const char * tStr_z = expansion->Attribute(
"TYPE-Z");
996 std::string typeStr = tStr_z;
999 const std::string* expStr =
std::find(begStr, endStr, typeStr);
1001 ASSERTL0(expStr != endStr,
"Invalid expansion type.");
1004 const char *nStr = expansion->Attribute(
"NUMMODES-Z");
1005 ASSERTL0(nStr,
"NUMMODES-Z was not defined in EXPANSION section of input");
1006 std::string nummodesStr = nStr;
1012 num_modes_z = (int) nummodesEqn.
Evaluate();
1016 num_modes_z = boost::lexical_cast<
int>(nummodesStr);
1022 for (compVecIter = compositeVector.begin(); compVecIter != compositeVector.end(); ++compVecIter)
1025 for (geomVecIter = (compVecIter->second)->begin(); geomVecIter != (compVecIter->second)->end(); ++geomVecIter)
1028 for (expVecIter = expansionMap->begin(); expVecIter != expansionMap->end(); ++expVecIter)
1042 expansion = expansion->NextSiblingElement(
"H");
1045 else if(expType ==
"ELEMENTS")
1047 std::vector<LibUtilities::FieldDefinitionsSharedPtr> fielddefs;
1050 cout <<
" Number of elements: " << fielddefs.size() << endl;
1055 ASSERTL0(
false,
"Expansion type not defined");
1066 TiXmlHandle docHandle(&doc);
1068 TiXmlElement* mesh = docHandle.FirstChildElement(
"NEKTAR").FirstChildElement(
"GEOMETRY").Element();
1069 TiXmlElement* domain = NULL;
1071 ASSERTL0(mesh,
"Unable to find GEOMETRY tag in file.");
1074 domain = mesh->FirstChildElement(
"DOMAIN");
1076 ASSERTL0(domain,
"Unable to find DOMAIN tag in file.");
1080 TiXmlElement *multidomains = domain->FirstChildElement(
"D");
1084 int nextDomainNumber = 0;
1085 while (multidomains)
1088 int err = multidomains->QueryIntAttribute(
"ID", &indx);
1090 "Unable to read attribute ID in Domain.");
1093 TiXmlNode* elementChild = multidomains->FirstChild();
1094 while(elementChild && elementChild->Type() != TiXmlNode::TINYXML_TEXT)
1096 elementChild = elementChild->NextSibling();
1099 ASSERTL0(elementChild,
"Unable to read DOMAIN body.");
1100 std::string elementStr = elementChild->ToText()->ValueStr();
1102 elementStr = elementStr.substr(elementStr.find_first_not_of(
" "));
1104 std::string::size_type indxBeg = elementStr.find_first_of(
'[') + 1;
1105 std::string::size_type indxEnd = elementStr.find_last_of(
']') - 1;
1106 std::string indxStr = elementStr.substr(indxBeg, indxEnd - indxBeg + 1);
1108 ASSERTL0(!indxStr.empty(),
"Unable to read domain's composite index (index missing?).");
1116 ASSERTL0(!
m_domain[nextDomainNumber++].empty(), (std::string(
"Unable to obtain domain's referenced composite: ") + indxStr).c_str());
1119 multidomains = multidomains->NextSiblingElement(
"D");
1127 TiXmlNode* elementChild = domain->FirstChild();
1128 while(elementChild && elementChild->Type() != TiXmlNode::TINYXML_TEXT)
1130 elementChild = elementChild->NextSibling();
1133 ASSERTL0(elementChild,
"Unable to read DOMAIN body.");
1134 std::string elementStr = elementChild->ToText()->ValueStr();
1136 elementStr = elementStr.substr(elementStr.find_first_not_of(
" "));
1138 std::string::size_type indxBeg = elementStr.find_first_of(
'[') + 1;
1139 std::string::size_type indxEnd = elementStr.find_last_of(
']') - 1;
1140 std::string indxStr = elementStr.substr(indxBeg, indxEnd - indxBeg + 1);
1142 ASSERTL0(!indxStr.empty(),
"Unable to read domain's composite index (index missing?).");
1150 ASSERTL0(!
m_domain[0].empty(), (std::string(
"Unable to obtain domain's referenced composite: ") + indxStr).c_str());
1161 TiXmlHandle docHandle(&doc);
1162 TiXmlElement* mesh = docHandle.FirstChildElement(
"NEKTAR").FirstChildElement(
"GEOMETRY").Element();
1163 TiXmlElement* field = NULL;
1167 TiXmlElement* element = mesh->FirstChildElement(
"VERTEX");
1168 ASSERTL0(element,
"Unable to find mesh VERTEX tag in file.");
1173 const char *xscal = element->Attribute(
"XSCALE");
1180 std::string xscalstr = xscal;
1182 xscale = expEvaluator.
Evaluate(expr_id);
1185 const char *yscal = element->Attribute(
"YSCALE");
1192 std::string yscalstr = yscal;
1194 yscale = expEvaluator.
Evaluate(expr_id);
1197 const char *zscal = element->Attribute(
"ZSCALE");
1204 std::string zscalstr = zscal;
1206 zscale = expEvaluator.
Evaluate(expr_id);
1215 const char *xmov = element->Attribute(
"XMOVE");
1222 std::string xmovstr = xmov;
1224 xmove = expEvaluator.
Evaluate(expr_id);
1227 const char *ymov = element->Attribute(
"YMOVE");
1234 std::string ymovstr = ymov;
1236 ymove = expEvaluator.
Evaluate(expr_id);
1239 const char *zmov = element->Attribute(
"ZMOVE");
1246 std::string zmovstr = zmov;
1248 zmove = expEvaluator.
Evaluate(expr_id);
1254 field = mesh->FirstChildElement(
"CURVED");
1261 string IsCompressed;
1262 field->QueryStringAttribute(
"COMPRESSED",&IsCompressed);
1264 if(IsCompressed.size())
1266 ASSERTL0(boost::iequals(IsCompressed,
1268 "Compressed formats do not match. Expected :"
1271 + boost::lexical_cast<std::string>(IsCompressed));
1273 std::vector<LibUtilities::MeshCurvedInfo> edginfo;
1274 std::vector<LibUtilities::MeshCurvedInfo> facinfo;
1278 TiXmlElement *x = field->FirstChildElement();
1281 const char *entitytype = x->Value();
1283 if(boost::iequals(entitytype,
"E"))
1286 std::string elmtStr;
1287 TiXmlNode* child = x->FirstChild();
1289 if (child->Type() == TiXmlNode::TINYXML_TEXT)
1291 elmtStr += child->ToText()->ValueStr();
1297 else if(boost::iequals(entitytype,
"F"))
1300 std::string elmtStr;
1301 TiXmlNode* child = x->FirstChild();
1303 if (child->Type() == TiXmlNode::TINYXML_TEXT)
1305 elmtStr += child->ToText()->ValueStr();
1311 else if(boost::iequals(entitytype,
"DATAPOINTS"))
1315 "Failed to get ID from PTS section");
1319 std::string elmtStr;
1321 TiXmlElement* DataIdx =
1322 x->FirstChildElement(
"INDEX");
1324 "Cannot read data index tag in compressed "
1327 TiXmlNode* child = DataIdx->FirstChild();
1328 if (child->Type() == TiXmlNode::TINYXML_TEXT)
1330 elmtStr = child->ToText()->ValueStr();
1334 elmtStr,cpts.
index);
1336 TiXmlElement* DataPts =
1337 x->FirstChildElement(
"POINTS");
1339 "Cannot read data pts tag in compressed "
1342 child = DataPts->FirstChild();
1343 if (child->Type() == TiXmlNode::TINYXML_TEXT)
1345 elmtStr = child->ToText()->ValueStr();
1353 ASSERTL0(
false,
"Unknown tag in curved section");
1355 x = x->NextSiblingElement();
1359 for(
int i = 0; i > cpts.
pts.size(); ++i)
1361 cpts.
pts[i].x = xscale*cpts.
pts[i].x + xmove;
1362 cpts.
pts[i].y = yscale*cpts.
pts[i].y + ymove;
1363 cpts.
pts[i].z = zscale*cpts.
pts[i].z + zmove;
1366 for(
int i = 0; i < edginfo.size(); ++i)
1368 int edgeid = edginfo[i].entityid;
1377 int offset = edginfo[i].ptoffset;
1378 for(
int j = 0; j < edginfo[i].npoints; ++j)
1380 int idx = cpts.
index[offset+j];
1385 cpts.
pts[idx].x, cpts.
pts[idx].y,
1387 curve->m_points.push_back(vert);
1393 for(
int i = 0; i < facinfo.size(); ++i)
1395 int faceid = facinfo[i].entityid;
1403 int offset = facinfo[i].ptoffset;
1404 for(
int j = 0; j < facinfo[i].npoints; ++j)
1406 int idx = cpts.
index[offset+j];
1414 curve->m_points.push_back(vert);
1426 TiXmlElement *edgelement = field->FirstChildElement(
"E");
1428 int edgeindx, edgeid;
1429 int nextEdgeNumber = -1;
1436 std::string edge(edgelement->ValueStr());
1437 ASSERTL0(edge ==
"E", (std::string(
"Unknown 3D curve type:") + edge).c_str());
1440 err = edgelement->QueryIntAttribute(
"ID", &edgeindx);
1441 ASSERTL0(err == TIXML_SUCCESS,
"Unable to read curve attribute ID.");
1444 err = edgelement->QueryIntAttribute(
"EDGEID", &edgeid);
1445 ASSERTL0(err == TIXML_SUCCESS,
"Unable to read curve attribute EDGEID.");
1448 std::string elementStr;
1449 TiXmlNode* elementChild = edgelement->FirstChild();
1454 if (elementChild->Type() == TiXmlNode::TINYXML_TEXT)
1456 elementStr += elementChild->ToText()->ValueStr();
1459 elementChild = elementChild->NextSibling();
1462 ASSERTL0(!elementStr.empty(),
"Unable to read curve description body.");
1469 std::string typeStr = edgelement->Attribute(
"TYPE");
1470 ASSERTL0(!typeStr.empty(),
"TYPE must be specified in " "points definition");
1475 const std::string* ptsStr =
std::find(begStr, endStr, typeStr);
1477 ASSERTL0(ptsStr != endStr,
"Invalid points type.");
1481 err = edgelement->QueryIntAttribute(
"NUMPOINTS", &numPts);
1482 ASSERTL0(err == TIXML_SUCCESS,
"Unable to read curve attribute NUMPOINTS.");
1487 std::istringstream elementDataStrm(elementStr.c_str());
1490 while(!elementDataStrm.fail())
1492 elementDataStrm >> xval >> yval >> zval;
1494 xval = xval*xscale + xmove;
1495 yval = yval*yscale + ymove;
1496 zval = zval*zscale + zmove;
1501 if (!elementDataStrm.fail())
1505 curve->m_points.push_back(vert);
1513 (std::string(
"Unable to read curve data for EDGE: ") + elementStr).c_str());
1517 ASSERTL0(curve->m_points.size() == numPts,
1518 "Number of points specificed by attribute "
1519 "NUMPOINTS is different from number of points "
1520 "in list (edgeid = " +
1521 boost::lexical_cast<
string>(edgeid));
1525 edgelement = edgelement->NextSiblingElement(
"E");
1531 TiXmlElement *facelement = field->FirstChildElement(
"F");
1532 int faceindx, faceid;
1536 std::string face(facelement->ValueStr());
1537 ASSERTL0(face ==
"F", (std::string(
"Unknown 3D curve type: ") + face).c_str());
1540 err = facelement->QueryIntAttribute(
"ID", &faceindx);
1541 ASSERTL0(err == TIXML_SUCCESS,
"Unable to read curve attribute ID.");
1544 err = facelement->QueryIntAttribute(
"FACEID", &faceid);
1545 ASSERTL0(err == TIXML_SUCCESS,
"Unable to read curve attribute FACEID.");
1548 std::string elementStr;
1549 TiXmlNode* elementChild = facelement->FirstChild();
1554 if (elementChild->Type() == TiXmlNode::TINYXML_TEXT)
1556 elementStr += elementChild->ToText()->ValueStr();
1559 elementChild = elementChild->NextSibling();
1562 ASSERTL0(!elementStr.empty(),
"Unable to read curve description body.");
1567 std::string typeStr = facelement->Attribute(
"TYPE");
1568 ASSERTL0(!typeStr.empty(),
"TYPE must be specified in " "points definition");
1572 const std::string* ptsStr =
std::find(begStr, endStr, typeStr);
1574 ASSERTL0(ptsStr != endStr,
"Invalid points type.");
1577 std::string numptsStr = facelement->Attribute(
"NUMPOINTS");
1578 ASSERTL0(!numptsStr.empty(),
"NUMPOINTS must be specified in points definition");
1580 std::stringstream s;
1586 ASSERTL0(numPts >= 3,
"NUMPOINTS for face must be greater than 2");
1590 ASSERTL0(ptsStr != endStr,
"Invalid points type.");
1595 std::istringstream elementDataStrm(elementStr.c_str());
1598 while(!elementDataStrm.fail())
1600 elementDataStrm >> xval >> yval >> zval;
1606 if (!elementDataStrm.fail())
1609 curve->m_points.push_back(vert);
1616 (std::string(
"Unable to read curve data for FACE: ")
1617 + elementStr).c_str());
1621 facelement = facelement->NextSiblingElement(
"F");
1633 TiXmlDocument doc(infilename);
1634 bool loadOkay = doc.LoadFile();
1636 std::stringstream errstr;
1637 errstr <<
"Unable to load file: " << infilename << std::endl;
1638 errstr <<
"Reason: " << doc.ErrorDesc() << std::endl;
1639 errstr <<
"Position: Line " << doc.ErrorRow() <<
", Column " << doc.ErrorCol() << std::endl;
1656 TiXmlElement *root = doc.FirstChildElement(
"NEKTAR");
1657 TiXmlElement *geomTag;
1662 root =
new TiXmlElement(
"NEKTAR");
1663 doc.LinkEndChild(root);
1665 geomTag =
new TiXmlElement(
"GEOMETRY");
1666 root->LinkEndChild(geomTag);
1671 geomTag = root->FirstChildElement(
"GEOMETRY");
1675 geomTag =
new TiXmlElement(
"GEOMETRY");
1676 root->LinkEndChild(geomTag);
1688 TiXmlElement *vertTag =
new TiXmlElement(
"VERTEX");
1694 s << scientific << setprecision(8)
1695 << (*pIt->second)(0) <<
" " << (*pIt->second)(1) <<
" "
1696 << (*pIt->second)(2);
1697 TiXmlElement * v =
new TiXmlElement(
"V");
1698 v->SetAttribute(
"ID", pIt->second->GetVid());
1699 v->LinkEndChild(
new TiXmlText(s.str()));
1700 vertTag->LinkEndChild(v);
1703 geomTag->LinkEndChild(vertTag);
1706 TiXmlElement *edgeTag =
new TiXmlElement(
1715 s << seg->GetVid(0) <<
" " << seg->GetVid(1);
1716 TiXmlElement *e =
new TiXmlElement(tag);
1717 e->SetAttribute(
"ID", sIt->first);
1718 e->LinkEndChild(
new TiXmlText(s.str()));
1719 edgeTag->LinkEndChild(e);
1722 geomTag->LinkEndChild(edgeTag);
1727 TiXmlElement *faceTag =
new TiXmlElement(
1737 s << tri->GetEid(0) <<
" " << tri->GetEid(1) <<
" "
1739 TiXmlElement *t =
new TiXmlElement(tag);
1740 t->SetAttribute(
"ID", tIt->first);
1741 t->LinkEndChild(
new TiXmlText(s.str()));
1742 faceTag->LinkEndChild(t);
1752 s << quad->GetEid(0) <<
" " << quad->GetEid(1) <<
" "
1753 << quad->GetEid(2) <<
" " << quad->GetEid(3);
1754 TiXmlElement *q =
new TiXmlElement(tag);
1755 q->SetAttribute(
"ID", qIt->first);
1756 q->LinkEndChild(
new TiXmlText(s.str()));
1757 faceTag->LinkEndChild(q);
1760 geomTag->LinkEndChild(faceTag);
1765 TiXmlElement *elmtTag =
new TiXmlElement(
"ELEMENT");
1774 s << hex->GetFid(0) <<
" " << hex->GetFid(1) <<
" "
1775 << hex->GetFid(2) <<
" " << hex->GetFid(3) <<
" "
1776 << hex->GetFid(4) <<
" " << hex->GetFid(5) <<
" ";
1777 TiXmlElement *h =
new TiXmlElement(tag);
1778 h->SetAttribute(
"ID", hIt->first);
1779 h->LinkEndChild(
new TiXmlText(s.str()));
1780 elmtTag->LinkEndChild(h);
1790 s << prism->GetFid(0) <<
" " << prism->GetFid(1) <<
" "
1791 << prism->GetFid(2) <<
" " << prism->GetFid(3) <<
" "
1792 << prism->GetFid(4) <<
" ";
1793 TiXmlElement *p =
new TiXmlElement(tag);
1794 p->SetAttribute(
"ID", rIt->first);
1795 p->LinkEndChild(
new TiXmlText(s.str()));
1796 elmtTag->LinkEndChild(p);
1806 s << pyr->GetFid(0) <<
" " << pyr->GetFid(1) <<
" "
1807 << pyr->GetFid(2) <<
" " << pyr->GetFid(3) <<
" "
1808 << pyr->GetFid(4) <<
" ";
1809 TiXmlElement *p =
new TiXmlElement(tag);
1810 p->SetAttribute(
"ID", pIt->first);
1811 p->LinkEndChild(
new TiXmlText(s.str()));
1812 elmtTag->LinkEndChild(p);
1822 s << tet->GetFid(0) <<
" " << tet->GetFid(1) <<
" "
1823 << tet->GetFid(2) <<
" " << tet->GetFid(3) <<
" ";
1824 TiXmlElement *t =
new TiXmlElement(tag);
1825 t->SetAttribute(
"ID", tIt->first);
1826 t->LinkEndChild(
new TiXmlText(s.str()));
1827 elmtTag->LinkEndChild(t);
1830 geomTag->LinkEndChild(elmtTag);
1834 TiXmlElement *curveTag =
new TiXmlElement(
"CURVED");
1842 TiXmlElement *c =
new TiXmlElement(
"E");
1846 for (
int j = 0; j < curve->m_points.size(); ++j)
1849 s << scientific << (*p)(0) <<
" " << (*p)(1) <<
" " << (*p)(2) <<
" ";
1852 c->SetAttribute(
"ID", curveId++);
1853 c->SetAttribute(
"EDGEID", curve->m_curveID);
1854 c->SetAttribute(
"NUMPOINTS", curve->m_points.size());
1856 c->LinkEndChild(
new TiXmlText(s.str()));
1857 curveTag->LinkEndChild(c);
1864 TiXmlElement *c =
new TiXmlElement(
"F");
1868 for (
int j = 0; j < curve->m_points.size(); ++j)
1871 s << scientific << (*p)(0) <<
" " << (*p)(1) <<
" " << (*p)(2) <<
" ";
1874 c->SetAttribute(
"ID", curveId++);
1875 c->SetAttribute(
"FACEID", curve->m_curveID);
1876 c->SetAttribute(
"NUMPOINTS", curve->m_points.size());
1878 c->LinkEndChild(
new TiXmlText(s.str()));
1879 curveTag->LinkEndChild(c);
1882 geomTag->LinkEndChild(curveTag);
1885 TiXmlElement *compTag =
new TiXmlElement(
"COMPOSITE");
1890 map<LibUtilities::ShapeType, pair<string, string> > compMap;
1899 std::vector<unsigned int> idxList;
1904 TiXmlElement *c =
new TiXmlElement(
"C");
1906 int shapeDim = firstGeom->GetShapeDim();
1908 compMap[firstGeom->GetShapeType()].second :
1909 compMap[firstGeom->GetShapeType()].first;
1912 s <<
" " << tag <<
"[";
1914 for (
int i = 0; i < cIt->second->size(); ++i)
1916 idxList.push_back((*cIt->second)[i]->GetGlobalID());
1921 c->SetAttribute(
"ID", cIt->first);
1922 c->LinkEndChild(
new TiXmlText(s.str()));
1923 compTag->LinkEndChild(c);
1926 geomTag->LinkEndChild(compTag);
1929 TiXmlElement *domTag =
new TiXmlElement(
"DOMAIN");
1930 stringstream domString;
1936 idxList.push_back(cIt->first);
1940 domTag->LinkEndChild(
new TiXmlText(domString.str()));
1941 geomTag->LinkEndChild(domTag);
1952 TiXmlDeclaration* decl =
new TiXmlDeclaration(
"1.0",
"utf-8",
"");
1953 doc.LinkEndChild(decl);
1959 doc.SaveFile(outfilename);
2002 bool returnval =
true;
2014 for(
int i = 0; i < nverts; ++i)
2017 if(xval < m_domainRange->m_xmin)
2031 if((ncnt_up == nverts)||(ncnt_low == nverts))
2042 for(
int i = 0; i < nverts; ++i)
2045 if(yval < m_domainRange->m_ymin)
2059 if((ncnt_up == nverts)||(ncnt_low == nverts))
2073 for(
int i = 0; i < nverts; ++i)
2077 if(zval < m_domainRange->m_zmin)
2091 if((ncnt_up == nverts)||(ncnt_low == nverts))
2105 bool returnval =
true;
2116 for(
int i = 0; i < nverts; ++i)
2119 if(xval < m_domainRange->m_xmin)
2133 if((ncnt_up == nverts)||(ncnt_low == nverts))
2143 for(
int i = 0; i < nverts; ++i)
2146 if(yval < m_domainRange->m_ymin)
2160 if((ncnt_up == nverts)||(ncnt_low == nverts))
2170 for(
int i = 0; i < nverts; ++i)
2174 if(zval < m_domainRange->m_zmin)
2188 if((ncnt_up == nverts)||(ncnt_low == nverts))
2217 if (whichItem >= 0 && whichItem <
int(
m_meshComposites[whichComposite]->size()))
2233 std::ostringstream errStream;
2234 errStream <<
"Unable to access composite item [" << whichComposite <<
"][" << whichItem <<
"].";
2236 std::string testStr = errStream.str();
2251 typedef vector<unsigned int> SeqVector;
2252 SeqVector seqVector;
2255 ASSERTL0(parseGood && !seqVector.empty(), (std::string(
"Unable to read composite index range: ") + compositeStr).c_str());
2257 SeqVector addedVector;
2263 if (
std::find(addedVector.begin(), addedVector.end(), *iter) == addedVector.end())
2274 addedVector.push_back(*iter);
2279 compositeVector[*iter] = composite;
2284 ::sprintf(str,
"%d", *iter);
2330 for (iter = expansionMap->begin(); iter!=expansionMap->end(); ++iter)
2332 if ((iter->second)->m_geomShPtr == geom)
2334 returnval = iter->second;
2346 std::vector<LibUtilities::FieldDefinitionsSharedPtr> &fielddef)
2348 int i, j, k, cnt, id;
2355 for(i = 0; i < fielddef.size(); ++i)
2357 for(j = 0; j < fielddef[i]->m_fields.size(); ++j)
2359 std::string field = fielddef[i]->m_fields[j];
2373 for(k = 0; k < fielddef.size(); ++k)
2375 for(
int h = 0; h < fielddef[k]->m_fields.size(); ++h)
2377 if(fielddef[k]->m_fields[h] == field)
2382 for(
int g = 0; g < fielddef[k]->m_elementIDs.size(); ++g)
2386 (*expansionMap)[fielddef[k]->m_elementIDs[g]] = tmpexp;
2397 for(i = 0; i < fielddef.size(); ++i)
2400 std::vector<std::string> fields = fielddef[i]->m_fields;
2401 std::vector<unsigned int> nmodes = fielddef[i]->m_numModes;
2402 std::vector<LibUtilities::BasisType> basis = fielddef[i]->m_basis;
2403 bool pointDef = fielddef[i]->m_pointsDef;
2404 bool numPointDef = fielddef[i]->m_numPointsDef;
2407 std::vector<unsigned int> npoints = fielddef[i]->m_numPoints;
2408 std::vector<LibUtilities::PointsType> points = fielddef[i]->m_points;
2410 bool UniOrder = fielddef[i]->m_uniOrder;
2412 for (j = 0; j < fielddef[i]->m_elementIDs.size(); ++j)
2416 id = fielddef[i]->m_elementIDs[j];
2418 switch (fielddef[i]->m_shapeType)
2422 if(
m_segGeoms.count(fielddef[i]->m_elementIDs[j]) == 0)
2427 geom =
m_segGeoms[fielddef[i]->m_elementIDs[j]];
2431 if(numPointDef&&pointDef)
2436 else if(!numPointDef&&pointDef)
2441 else if(numPointDef&&!pointDef)
2452 cnt += fielddef[i]->m_numHomogeneousDir;
2454 bkeyvec.push_back(bkey);
2459 if(
m_triGeoms.count(fielddef[i]->m_elementIDs[j]) == 0)
2464 geom =
m_triGeoms[fielddef[i]->m_elementIDs[j]];
2467 if(numPointDef&&pointDef)
2472 else if(!numPointDef&&pointDef)
2477 else if(numPointDef&&!pointDef)
2484 bkeyvec.push_back(bkey);
2487 if(numPointDef&&pointDef)
2492 else if(!numPointDef&&pointDef)
2497 else if(numPointDef&&!pointDef)
2503 bkeyvec.push_back(bkey1);
2508 cnt += fielddef[i]->m_numHomogeneousDir;
2514 if(
m_quadGeoms.count(fielddef[i]->m_elementIDs[j]) == 0)
2522 for(
int b = 0; b < 2; ++b)
2526 if(numPointDef&&pointDef)
2531 else if(!numPointDef&&pointDef)
2536 else if(numPointDef&&!pointDef)
2542 bkeyvec.push_back(bkey);
2548 cnt += fielddef[i]->m_numHomogeneousDir;
2555 k = fielddef[i]->m_elementIDs[j];
2569 if(numPointDef&&pointDef)
2574 else if(!numPointDef&&pointDef)
2579 else if(numPointDef&&!pointDef)
2587 bkeyvec.push_back(bkey);
2592 if(numPointDef&&pointDef)
2597 else if(!numPointDef&&pointDef)
2602 else if(numPointDef&&!pointDef)
2610 bkeyvec.push_back(bkey);
2616 if(numPointDef&&pointDef)
2621 else if(!numPointDef&&pointDef)
2626 else if(numPointDef&&!pointDef)
2634 bkeyvec.push_back(bkey);
2645 k = fielddef[i]->m_elementIDs[j];
2652 for(
int b = 0; b < 2; ++b)
2656 if(numPointDef&&pointDef)
2661 else if(!numPointDef&&pointDef)
2666 else if(numPointDef&&!pointDef)
2673 bkeyvec.push_back(bkey);
2679 if(numPointDef&&pointDef)
2684 else if(!numPointDef&&pointDef)
2689 else if(numPointDef&&!pointDef)
2696 bkeyvec.push_back(bkey);
2707 k = fielddef[i]->m_elementIDs[j];
2709 "Failed to find geometry with same global id");
2713 for(
int b = 0; b < 2; ++b)
2717 if(numPointDef&&pointDef)
2722 else if(!numPointDef&&pointDef)
2727 else if(numPointDef&&!pointDef)
2734 bkeyvec.push_back(bkey);
2740 if(numPointDef&&pointDef)
2745 else if(!numPointDef&&pointDef)
2750 else if(numPointDef&&!pointDef)
2757 bkeyvec.push_back(bkey);
2768 k = fielddef[i]->m_elementIDs[j];
2776 for(
int b = 0; b < 3; ++b)
2780 if(numPointDef&&pointDef)
2785 else if(!numPointDef&&pointDef)
2790 else if(numPointDef&&!pointDef)
2797 bkeyvec.push_back(bkey);
2807 ASSERTL0(
false,
"Need to set up for pyramid and prism 3D Expansions");
2811 for(k = 0; k < fields.size(); ++k)
2814 if((*expansionMap).find(
id) != (*expansionMap).end())
2816 (*expansionMap)[id]->m_geomShPtr = geom;
2817 (*expansionMap)[id]->m_basisKeyVector = bkeyvec;
2829 std::vector<LibUtilities::FieldDefinitionsSharedPtr> &fielddef,
2830 std::vector< std::vector<LibUtilities::PointsType> > &pointstype)
2832 int i,j,k,g,h,cnt,id;
2839 for(i = 0; i < fielddef.size(); ++i)
2841 for(j = 0; j < fielddef[i]->m_fields.size(); ++j)
2843 std::string field = fielddef[i]->m_fields[j];
2857 for(k = 0; k < fielddef.size(); ++k)
2859 for(h = 0; h < fielddef[k]->m_fields.size(); ++h)
2861 if(fielddef[k]->m_fields[h] == field)
2866 for(g = 0; g < fielddef[k]->m_elementIDs.size(); ++g)
2870 (*expansionMap)[fielddef[k]->m_elementIDs[g]] = tmpexp;
2882 for(i = 0; i < fielddef.size(); ++i)
2885 std::vector<std::string> fields = fielddef[i]->m_fields;
2886 std::vector<unsigned int> nmodes = fielddef[i]->m_numModes;
2887 std::vector<LibUtilities::BasisType> basis = fielddef[i]->m_basis;
2888 bool UniOrder = fielddef[i]->m_uniOrder;
2890 for(j = 0; j < fielddef[i]->m_elementIDs.size(); ++j)
2893 id = fielddef[i]->m_elementIDs[j];
2895 switch(fielddef[i]->m_shapeType)
2899 k = fielddef[i]->m_elementIDs[j];
2901 "Failed to find geometry with same global id.");
2910 bkeyvec.push_back(bkey);
2915 k = fielddef[i]->m_elementIDs[j];
2917 "Failed to find geometry with same global id.");
2919 for(
int b = 0; b < 2; ++b)
2923 bkeyvec.push_back(bkey);
2934 k = fielddef[i]->m_elementIDs[j];
2936 "Failed to find geometry with same global id");
2939 for(
int b = 0; b < 2; ++b)
2943 bkeyvec.push_back(bkey);
2954 k = fielddef[i]->m_elementIDs[j];
2956 "Failed to find geometry with same global id");
2959 for(
int b = 0; b < 3; ++b)
2963 bkeyvec.push_back(bkey);
2974 k = fielddef[i]->m_elementIDs[j];
2976 "Failed to find geometry with same global id");
2979 for(
int b = 0; b < 3; ++b)
2983 bkeyvec.push_back(bkey);
2994 k = fielddef[i]->m_elementIDs[j];
2996 "Failed to find geometry with same global id");
2999 for(
int b = 0; b < 3; ++b)
3003 bkeyvec.push_back(bkey);
3014 k = fielddef[i]->m_elementIDs[j];
3016 "Failed to find geometry with same global id");
3019 for(
int b = 0; b < 3; ++b)
3023 bkeyvec.push_back(bkey);
3033 ASSERTL0(
false,
"Need to set up for pyramid and prism 3D Expansions");
3037 for(k = 0; k < fields.size(); ++k)
3040 if((*expansionMap).find(
id) != (*expansionMap).end())
3042 (*expansionMap)[id]->m_geomShPtr = geom;
3043 (*expansionMap)[id]->m_basisKeyVector = bkeyvec;
3064 for(expIt = it->second->begin(); expIt != it->second->end(); ++expIt)
3066 for(
int i = 0; i < expIt->second->m_basisKeyVector.size(); ++i)
3084 expIt->second->m_basisKeyVector[i] = bkeynew;
3106 for(expIt = it->second->begin(); expIt != it->second->end(); ++expIt)
3108 for(
int i = 0; i < expIt->second->m_basisKeyVector.size(); ++i)
3116 expIt->second->m_basisKeyVector[i] = bkeynew;
3141 for (expIt = it->second->begin();
3142 expIt != it->second->end();
3146 i < expIt->second->m_basisKeyVector.size();
3150 expIt->second->m_basisKeyVector[i];
3158 expIt->second->m_basisKeyVector[i] = bkeynew;
3185 for (elemIter = expansionMap->begin(); elemIter != expansionMap->end(); ++elemIter)
3187 if ((elemIter->second)->m_geomShPtr->GetShapeType() == shape)
3189 (elemIter->second)->m_basisKeyVector = keys;
3237 returnval.push_back(bkey);
3244 returnval.push_back(bkey);
3245 returnval.push_back(bkey);
3252 returnval.push_back(bkey);
3253 returnval.push_back(bkey);
3254 returnval.push_back(bkey);
3261 returnval.push_back(bkey);
3266 returnval.push_back(bkey1);
3273 returnval.push_back(bkey);
3277 returnval.push_back(bkey1);
3283 returnval.push_back(bkey2);
3289 returnval.push_back(bkey2);
3297 returnval.push_back(bkey);
3298 returnval.push_back(bkey);
3302 returnval.push_back(bkey1);
3309 returnval.push_back(bkey);
3310 returnval.push_back(bkey);
3314 returnval.push_back(bkey1);
3320 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3335 returnval.push_back(bkey);
3342 returnval.push_back(bkey);
3343 returnval.push_back(bkey);
3351 returnval.push_back(bkey);
3355 returnval.push_back(bkey1);
3363 returnval.push_back(bkey);
3364 returnval.push_back(bkey);
3365 returnval.push_back(bkey);
3370 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3386 returnval.push_back(bkey);
3394 returnval.push_back(bkey);
3395 returnval.push_back(bkey);
3403 returnval.push_back(bkey);
3404 returnval.push_back(bkey);
3405 returnval.push_back(bkey);
3410 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3426 returnval.push_back(bkey);
3434 returnval.push_back(bkey);
3439 returnval.push_back(bkey1);
3447 returnval.push_back(bkey);
3448 returnval.push_back(bkey);
3456 returnval.push_back(bkey);
3461 returnval.push_back(bkey1);
3469 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3485 returnval.push_back(bkey);
3493 returnval.push_back(bkey);
3494 returnval.push_back(bkey);
3502 returnval.push_back(bkey);
3503 returnval.push_back(bkey);
3504 returnval.push_back(bkey);
3509 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3525 returnval.push_back(bkey);
3532 returnval.push_back(bkey);
3533 returnval.push_back(bkey);
3540 returnval.push_back(bkey);
3541 returnval.push_back(bkey);
3542 returnval.push_back(bkey);
3547 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3563 returnval.push_back(bkey);
3570 returnval.push_back(bkey);
3571 returnval.push_back(bkey);
3578 returnval.push_back(bkey);
3579 returnval.push_back(bkey);
3580 returnval.push_back(bkey);
3585 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3600 returnval.push_back(bkey);
3607 returnval.push_back(bkey);
3608 returnval.push_back(bkey);
3615 returnval.push_back(bkey);
3616 returnval.push_back(bkey);
3617 returnval.push_back(bkey);
3622 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3637 returnval.push_back(bkey);
3644 returnval.push_back(bkey);
3645 returnval.push_back(bkey);
3652 returnval.push_back(bkey);
3653 returnval.push_back(bkey);
3654 returnval.push_back(bkey);
3659 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3674 returnval.push_back(bkey);
3681 returnval.push_back(bkey);
3682 returnval.push_back(bkey);
3689 returnval.push_back(bkey);
3690 returnval.push_back(bkey);
3691 returnval.push_back(bkey);
3696 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3711 returnval.push_back(bkey);
3715 returnval.push_back(bkey1);
3720 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3735 returnval.push_back(bkey1);
3739 returnval.push_back(bkey);
3744 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3759 returnval.push_back(bkey);
3763 returnval.push_back(bkey1);
3768 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3777 ASSERTL0(
false,
"Expansion type not defined");
3795 const int nummodes_x,
3796 const int nummodes_y,
3797 const int nummodes_z)
3807 ASSERTL0(
false,
"Homogeneous expansion not defined for this shape");
3813 ASSERTL0(
false,
"Homogeneous expansion not defined for this shape");
3825 returnval.push_back(bkey1);
3833 returnval.push_back(bkey1);
3841 returnval.push_back(bkey1);
3849 returnval.push_back(bkey1);
3858 returnval.push_back(bkey1);
3866 ASSERTL0(
false,
"Homogeneous expansion can be of Fourier or Chebyshev type only");
3878 returnval.push_back(bkey2);
3887 returnval.push_back(bkey2);
3895 returnval.push_back(bkey2);
3903 returnval.push_back(bkey2);
3911 returnval.push_back(bkey2);
3917 ASSERTL0(
false,
"Homogeneous expansion can be of Fourier or Chebyshev type only");
3928 returnval.push_back(bkey3);
3936 returnval.push_back(bkey3);
3944 returnval.push_back(bkey3);
3952 returnval.push_back(bkey3);
3960 returnval.push_back(bkey3);
3966 ASSERTL0(
false,
"Homogeneous expansion can be of Fourier or Chebyshev type only");
3975 ASSERTL0(
false,
"Homogeneous expansion not defined for this shape");
3981 ASSERTL0(
false,
"Homogeneous expansion not defined for this shape");
3986 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3999 unsigned int nextId =
m_vertSet.rbegin()->first + 1;
4015 if( curveDefinition )
4035 trigeom->SetGlobalID(indx);
4050 quadgeom->SetGlobalID(indx);
4067 prismgeom->SetGlobalID(index);
4079 unsigned int index =
m_tetGeoms.rbegin()->first + 1;
4081 tetgeom->SetGlobalID(index);
4095 unsigned int index =
m_pyrGeoms.rbegin()->first + 1;
4098 pyrgeom->SetGlobalID(index);
4110 unsigned int index =
m_hexGeoms.rbegin()->first + 1;
4112 hexgeom->SetGlobalID(index);
4130 for(
int d = 0; d <
m_domain.size(); ++d)
4132 CompositeMap::const_iterator compIter;
4134 for (compIter =
m_domain[d].begin(); compIter !=
m_domain[d].end(); ++compIter)
4136 GeometryVector::const_iterator x;
4137 for (x = compIter->second->begin(); x != compIter->second->end(); ++x)
4142 int id = (*x)->GetGlobalID();
4143 (*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