59 #include <boost/archive/iterators/base64_from_binary.hpp>
60 #include <boost/archive/iterators/binary_from_base64.hpp>
61 #include <boost/archive/iterators/transform_width.hpp>
62 #include <boost/iostreams/copy.hpp>
63 #include <boost/iostreams/filter/zlib.hpp>
64 #include <boost/iostreams/filtering_stream.hpp>
68 namespace SpatialDomains
85 unsigned int meshDimension,
86 unsigned int spaceDimension) :
87 m_meshDimension(meshDimension),
88 m_spaceDimension(spaceDimension),
122 boost::shared_ptr<MeshGraph> returnval;
126 TiXmlElement* geometry_tag = pSession->GetElement(
"NEKTAR/GEOMETRY");
127 TiXmlAttribute *attr = geometry_tag->FirstAttribute();
131 std::string attrName(attr->Name());
132 if (attrName ==
"DIM")
134 int err = attr->QueryIntValue(&meshDim);
135 ASSERTL0(err==TIXML_SUCCESS,
"Unable to read mesh dimension.");
140 std::string errstr(
"Unknown attribute: ");
166 std::string err =
"Invalid mesh dimension: ";
167 std::stringstream strstrm;
169 err += strstrm.str();
180 const std::string& infilename,
181 bool pReadExpansions)
183 boost::shared_ptr<MeshGraph> returnval;
205 std::string err =
"Invalid mesh dimension: ";
206 std::stringstream strstrm;
208 err += strstrm.str();
214 returnval->ReadGeometry(infilename);
215 returnval->ReadGeometryInfo(infilename);
218 returnval->ReadExpansions(infilename);
231 TiXmlDocument doc(infilename);
232 bool loadOkay = doc.LoadFile();
234 std::stringstream errstr;
235 errstr <<
"Unable to load file: " << infilename <<
" (";
236 errstr << doc.ErrorDesc() <<
", line " << doc.ErrorRow()
237 <<
", column " << doc.ErrorCol() <<
")";
249 TiXmlHandle docHandle(&doc);
250 TiXmlElement* mesh = NULL;
251 TiXmlElement* master = NULL;
255 master = doc.FirstChildElement(
"NEKTAR");
256 ASSERTL0(master,
"Unable to find NEKTAR tag in file.");
259 mesh = master->FirstChildElement(
"GEOMETRY");
261 ASSERTL0(mesh,
"Unable to find GEOMETRY tag in file.");
262 TiXmlAttribute *attr = mesh->FirstAttribute();
273 std::string attrName(attr->Name());
274 if (attrName ==
"DIM")
277 ASSERTL1(err==TIXML_SUCCESS,
"Unable to read mesh dimension.");
279 else if (attrName ==
"SPACE")
282 ASSERTL1(err==TIXML_SUCCESS,
"Unable to read space dimension.");
284 else if (attrName ==
"PARTITION")
287 ASSERTL1(err==TIXML_SUCCESS,
"Unable to read partition.");
292 std::string errstr(
"Unknown attribute: ");
304 TiXmlElement* element = mesh->FirstChildElement(
"VERTEX");
305 ASSERTL0(element,
"Unable to find mesh VERTEX tag in file.");
313 const char *xscal = element->Attribute(
"XSCALE");
320 std::string xscalstr = xscal;
322 xscale = expEvaluator.
Evaluate(expr_id);
325 const char *yscal = element->Attribute(
"YSCALE");
332 std::string yscalstr = yscal;
334 yscale = expEvaluator.
Evaluate(expr_id);
337 const char *zscal = element->Attribute(
"ZSCALE");
344 std::string zscalstr = zscal;
346 zscale = expEvaluator.
Evaluate(expr_id);
356 const char *xmov = element->Attribute(
"XMOVE");
363 std::string xmovstr = xmov;
365 xmove = expEvaluator.
Evaluate(expr_id);
368 const char *ymov = element->Attribute(
"YMOVE");
375 std::string ymovstr = ymov;
377 ymove = expEvaluator.
Evaluate(expr_id);
380 const char *zmov = element->Attribute(
"ZMOVE");
387 std::string zmovstr = zmov;
389 zmove = expEvaluator.
Evaluate(expr_id);
392 TiXmlElement *vertex = element->FirstChildElement(
"V");
395 int nextVertexNumber = -1;
401 TiXmlAttribute *vertexAttr = vertex->FirstAttribute();
402 std::string attrName(vertexAttr->Name());
404 ASSERTL0(attrName ==
"ID", (std::string(
"Unknown attribute name: ") + attrName).c_str());
406 err = vertexAttr->QueryIntValue(&indx);
407 ASSERTL0(err == TIXML_SUCCESS,
"Unable to read attribute ID.");
410 std::string vertexBodyStr;
412 TiXmlNode *vertexBody = vertex->FirstChild();
417 if (vertexBody->Type() == TiXmlNode::TINYXML_TEXT)
419 vertexBodyStr += vertexBody->ToText()->Value();
420 vertexBodyStr +=
" ";
423 vertexBody = vertexBody->NextSibling();
426 ASSERTL0(!vertexBodyStr.empty(),
"Vertex definitions must contain vertex data.");
430 std::istringstream vertexDataStrm(vertexBodyStr.c_str());
434 while(!vertexDataStrm.fail())
436 vertexDataStrm >> xval >> yval >> zval;
438 xval = xval*xscale + xmove;
439 yval = yval*yscale + ymove;
440 zval = zval*zscale + zmove;
445 if (!vertexDataStrm.fail())
448 vert->SetGlobalID(indx);
455 ASSERTL0(
false,
"Unable to read VERTEX data.");
458 vertex = vertex->NextSiblingElement(
"V");
471 TiXmlDocument doc(infilename);
472 bool loadOkay = doc.LoadFile();
474 std::stringstream errstr;
475 errstr <<
"Unable to load file: " << infilename << std::endl;
476 errstr <<
"Reason: " << doc.ErrorDesc() << std::endl;
477 errstr <<
"Position: Line " << doc.ErrorRow() <<
", Column " << doc.ErrorCol() << std::endl;
492 TiXmlElement *master = doc.FirstChildElement(
"NEKTAR");
493 ASSERTL0(master,
"Unable to find NEKTAR tag in file.");
496 TiXmlElement *geomTag = master->FirstChildElement(
"GEOMETRY");
497 ASSERTL0(geomTag,
"Unable to find GEOMETRY tag in file.");
500 TiXmlElement *geomInfoTag = geomTag->FirstChildElement(
"GEOMINFO");
501 if (!geomInfoTag)
return;
503 TiXmlElement *infoItem = geomInfoTag->FirstChildElement(
"I");
509 std::string geomProperty = infoItem->Attribute(
"PROPERTY");
510 std::string geomValue = infoItem->Attribute(
"VALUE");
514 "Property " + geomProperty +
" already specified.");
516 infoItem = infoItem->NextSiblingElement(
"I");
526 TiXmlDocument doc(infilename);
527 bool loadOkay = doc.LoadFile();
529 std::stringstream errstr;
530 errstr <<
"Unable to load file: " << infilename << std::endl;
531 errstr <<
"Reason: " << doc.ErrorDesc() << std::endl;
532 errstr <<
"Position: Line " << doc.ErrorRow() <<
", Column " << doc.ErrorCol() << std::endl;
544 TiXmlElement *master = doc.FirstChildElement(
"NEKTAR");
545 ASSERTL0(master,
"Unable to find NEKTAR tag in file.");
548 TiXmlElement *expansionTypes = master->FirstChildElement(
"EXPANSIONS");
549 ASSERTL0(expansionTypes,
"Unable to find EXPANSIONS tag in file.");
554 TiXmlElement *expansion = expansionTypes->FirstChildElement();
555 std::string expType = expansion->Value();
575 const char *fStr = expansion->Attribute(
"FIELDS");
576 std::vector<std::string> fieldStrings;
580 std::string fieldStr = fStr;
582 ASSERTL0(valid,
"Unable to correctly parse the field string in ExpansionTypes.");
596 for(i = 0; i < fieldStrings.size(); ++i)
604 if(fieldStrings.size())
616 for(i = 0; i < fieldStrings.size(); ++i)
624 ASSERTL0(
false,
"Expansion vector for this field is already setup");
637 std::string compositeStr = expansion->Attribute(
"COMPOSITE");
638 ASSERTL0(compositeStr.length() > 3,
"COMPOSITE must be specified in expansion definition");
639 int beg = compositeStr.find_first_of(
"[");
640 int end = compositeStr.find_first_of(
"]");
641 std::string compositeListStr = compositeStr.substr(beg+1,end-beg-1);
646 bool useExpansionType =
false;
651 const char * tStr = expansion->Attribute(
"TYPE");
655 std::string typeStr = tStr;
658 const std::string* expStr =
std::find(begStr, endStr, typeStr);
660 ASSERTL0(expStr != endStr,
"Invalid expansion type.");
671 const char *nStr = expansion->Attribute(
"NUMMODES");
672 ASSERTL0(nStr,
"NUMMODES was not defined in EXPANSION section of input");
673 std::string nummodesStr = nStr;
679 num_modes = (int) nummodesEqn.
Evaluate();
683 num_modes = boost::lexical_cast<
int>(nummodesStr);
686 useExpansionType =
true;
691 const char *bTypeStr = expansion->Attribute(
"BASISTYPE");
692 ASSERTL0(bTypeStr,
"TYPE or BASISTYPE was not defined in EXPANSION section of input");
693 std::string basisTypeStr = bTypeStr;
696 std::vector<std::string> basisStrings;
697 std::vector<LibUtilities::BasisType> basis;
699 ASSERTL0(valid,
"Unable to correctly parse the basis types.");
700 for (vector<std::string>::size_type i = 0; i < basisStrings.size(); i++)
712 ASSERTL0(valid, std::string(
"Unable to correctly parse the basis type: ").append(basisStrings[i]).c_str());
714 const char *nModesStr = expansion->Attribute(
"NUMMODES");
715 ASSERTL0(nModesStr,
"NUMMODES was not defined in EXPANSION section of input");
717 std::string numModesStr = nModesStr;
718 std::vector<unsigned int> numModes;
720 ASSERTL0(valid,
"Unable to correctly parse the number of modes.");
721 ASSERTL0(numModes.size() == basis.size(),
"information for num modes does not match the number of basis");
723 const char *pTypeStr = expansion->Attribute(
"POINTSTYPE");
724 ASSERTL0(pTypeStr,
"POINTSTYPE was not defined in EXPANSION section of input");
725 std::string pointsTypeStr = pTypeStr;
727 std::vector<std::string> pointsStrings;
728 std::vector<LibUtilities::PointsType> points;
730 ASSERTL0(valid,
"Unable to correctly parse the points types.");
731 for (vector<std::string>::size_type i = 0; i < pointsStrings.size(); i++)
743 ASSERTL0(valid, std::string(
"Unable to correctly parse the points type: ").append(pointsStrings[i]).c_str());
746 const char *nPointsStr = expansion->Attribute(
"NUMPOINTS");
747 ASSERTL0(nPointsStr,
"NUMPOINTS was not defined in EXPANSION section of input");
748 std::string numPointsStr = nPointsStr;
749 std::vector<unsigned int> numPoints;
751 ASSERTL0(valid,
"Unable to correctly parse the number of points.");
752 ASSERTL0(numPoints.size() == numPoints.size(),
"information for num points does not match the number of basis");
754 for(
int i = 0; i < basis.size(); ++i)
767 for (compVecIter = compositeVector.begin(); compVecIter != compositeVector.end(); ++compVecIter)
770 for (geomVecIter = (compVecIter->second)->begin(); geomVecIter != (compVecIter->second)->end(); ++geomVecIter)
773 ASSERTL0(x != expansionMap->end(),
"Expansion not found!!");
780 ASSERTL0((*geomVecIter)->GetShapeDim() == basiskeyvec.size(),
" There is an incompatible expansion dimension with geometry dimension");
781 (x->second)->m_basisKeyVector = basiskeyvec;
786 expansion = expansion->NextSiblingElement(
"E");
789 else if(expType ==
"H")
797 const char *fStr = expansion->Attribute(
"FIELDS");
798 std::vector<std::string> fieldStrings;
802 std::string fieldStr = fStr;
804 ASSERTL0(valid,
"Unable to correctly parse the field string in ExpansionTypes.");
818 for(i = 0; i < fieldStrings.size(); ++i)
826 if(fieldStrings.size())
838 for(i = 0; i < fieldStrings.size(); ++i)
846 ASSERTL0(
false,
"Expansion vector for this field is already setup");
859 std::string compositeStr = expansion->Attribute(
"COMPOSITE");
860 ASSERTL0(compositeStr.length() > 3,
"COMPOSITE must be specified in expansion definition");
861 int beg = compositeStr.find_first_of(
"[");
862 int end = compositeStr.find_first_of(
"]");
863 std::string compositeListStr = compositeStr.substr(beg+1,end-beg-1);
877 const char * tStr_x = expansion->Attribute(
"TYPE-X");
881 std::string typeStr = tStr_x;
884 const std::string* expStr =
std::find(begStr, endStr, typeStr);
886 ASSERTL0(expStr != endStr,
"Invalid expansion type.");
889 const char *nStr = expansion->Attribute(
"NUMMODES-X");
890 ASSERTL0(nStr,
"NUMMODES-X was not defined in EXPANSION section of input");
891 std::string nummodesStr = nStr;
898 num_modes_x = (int) nummodesEqn.
Evaluate();
902 num_modes_x = boost::lexical_cast<
int>(nummodesStr);
907 const char * tStr_y = expansion->Attribute(
"TYPE-Y");
911 std::string typeStr = tStr_y;
914 const std::string* expStr =
std::find(begStr, endStr, typeStr);
916 ASSERTL0(expStr != endStr,
"Invalid expansion type.");
919 const char *nStr = expansion->Attribute(
"NUMMODES-Y");
920 ASSERTL0(nStr,
"NUMMODES-Y was not defined in EXPANSION section of input");
921 std::string nummodesStr = nStr;
927 num_modes_y = (int) nummodesEqn.
Evaluate();
931 num_modes_y = boost::lexical_cast<
int>(nummodesStr);
936 const char * tStr_z = expansion->Attribute(
"TYPE-Z");
940 std::string typeStr = tStr_z;
943 const std::string* expStr =
std::find(begStr, endStr, typeStr);
945 ASSERTL0(expStr != endStr,
"Invalid expansion type.");
948 const char *nStr = expansion->Attribute(
"NUMMODES-Z");
949 ASSERTL0(nStr,
"NUMMODES-Z was not defined in EXPANSION section of input");
950 std::string nummodesStr = nStr;
956 num_modes_z = (int) nummodesEqn.
Evaluate();
960 num_modes_z = boost::lexical_cast<
int>(nummodesStr);
966 for (compVecIter = compositeVector.begin(); compVecIter != compositeVector.end(); ++compVecIter)
969 for (geomVecIter = (compVecIter->second)->begin(); geomVecIter != (compVecIter->second)->end(); ++geomVecIter)
972 for (expVecIter = expansionMap->begin(); expVecIter != expansionMap->end(); ++expVecIter)
986 expansion = expansion->NextSiblingElement(
"H");
989 else if(expType ==
"ELEMENTS")
991 std::vector<LibUtilities::FieldDefinitionsSharedPtr> fielddefs;
994 cout <<
" Number of elements: " << fielddefs.size() << endl;
999 ASSERTL0(
false,
"Expansion type not defined");
1010 TiXmlHandle docHandle(&doc);
1012 TiXmlElement* mesh = docHandle.FirstChildElement(
"NEKTAR").FirstChildElement(
"GEOMETRY").Element();
1013 TiXmlElement* domain = NULL;
1015 ASSERTL0(mesh,
"Unable to find GEOMETRY tag in file.");
1018 domain = mesh->FirstChildElement(
"DOMAIN");
1020 ASSERTL0(domain,
"Unable to find DOMAIN tag in file.");
1024 TiXmlElement *multidomains = domain->FirstChildElement(
"D");
1028 int nextDomainNumber = 0;
1029 while (multidomains)
1032 int err = multidomains->QueryIntAttribute(
"ID", &indx);
1034 "Unable to read attribute ID in Domain.");
1037 TiXmlNode* elementChild = multidomains->FirstChild();
1038 while(elementChild && elementChild->Type() != TiXmlNode::TINYXML_TEXT)
1040 elementChild = elementChild->NextSibling();
1043 ASSERTL0(elementChild,
"Unable to read DOMAIN body.");
1044 std::string elementStr = elementChild->ToText()->ValueStr();
1046 elementStr = elementStr.substr(elementStr.find_first_not_of(
" "));
1048 std::string::size_type indxBeg = elementStr.find_first_of(
'[') + 1;
1049 std::string::size_type indxEnd = elementStr.find_last_of(
']') - 1;
1050 std::string indxStr = elementStr.substr(indxBeg, indxEnd - indxBeg + 1);
1052 ASSERTL0(!indxStr.empty(),
"Unable to read domain's composite index (index missing?).");
1060 ASSERTL0(!
m_domain[nextDomainNumber++].empty(), (std::string(
"Unable to obtain domain's referenced composite: ") + indxStr).c_str());
1063 multidomains = multidomains->NextSiblingElement(
"D");
1071 TiXmlNode* elementChild = domain->FirstChild();
1072 while(elementChild && elementChild->Type() != TiXmlNode::TINYXML_TEXT)
1074 elementChild = elementChild->NextSibling();
1077 ASSERTL0(elementChild,
"Unable to read DOMAIN body.");
1078 std::string elementStr = elementChild->ToText()->ValueStr();
1080 elementStr = elementStr.substr(elementStr.find_first_not_of(
" "));
1082 std::string::size_type indxBeg = elementStr.find_first_of(
'[') + 1;
1083 std::string::size_type indxEnd = elementStr.find_last_of(
']') - 1;
1084 std::string indxStr = elementStr.substr(indxBeg, indxEnd - indxBeg + 1);
1086 ASSERTL0(!indxStr.empty(),
"Unable to read domain's composite index (index missing?).");
1094 ASSERTL0(!
m_domain[0].empty(), (std::string(
"Unable to obtain domain's referenced composite: ") + indxStr).c_str());
1105 TiXmlHandle docHandle(&doc);
1106 TiXmlElement* mesh = docHandle.FirstChildElement(
"NEKTAR").FirstChildElement(
"GEOMETRY").Element();
1107 TiXmlElement* field = NULL;
1111 TiXmlElement* element = mesh->FirstChildElement(
"VERTEX");
1112 ASSERTL0(element,
"Unable to find mesh VERTEX tag in file.");
1117 const char *xscal = element->Attribute(
"XSCALE");
1124 std::string xscalstr = xscal;
1126 xscale = expEvaluator.
Evaluate(expr_id);
1129 const char *yscal = element->Attribute(
"YSCALE");
1136 std::string yscalstr = yscal;
1138 yscale = expEvaluator.
Evaluate(expr_id);
1141 const char *zscal = element->Attribute(
"ZSCALE");
1148 std::string zscalstr = zscal;
1150 zscale = expEvaluator.
Evaluate(expr_id);
1156 field = mesh->FirstChildElement(
"CURVED");
1167 TiXmlElement *edgelement = field->FirstChildElement(
"E");
1169 int edgeindx, edgeid;
1170 int nextEdgeNumber = -1;
1177 std::string edge(edgelement->ValueStr());
1178 ASSERTL0(edge ==
"E", (std::string(
"Unknown 3D curve type:") + edge).c_str());
1181 err = edgelement->QueryIntAttribute(
"ID", &edgeindx);
1182 ASSERTL0(err == TIXML_SUCCESS,
"Unable to read curve attribute ID.");
1185 err = edgelement->QueryIntAttribute(
"EDGEID", &edgeid);
1186 ASSERTL0(err == TIXML_SUCCESS,
"Unable to read curve attribute EDGEID.");
1189 std::string elementStr;
1190 TiXmlNode* elementChild = edgelement->FirstChild();
1195 if (elementChild->Type() == TiXmlNode::TINYXML_TEXT)
1197 elementStr += elementChild->ToText()->ValueStr();
1200 elementChild = elementChild->NextSibling();
1203 ASSERTL0(!elementStr.empty(),
"Unable to read curve description body.");
1210 std::string typeStr = edgelement->Attribute(
"TYPE");
1211 ASSERTL0(!typeStr.empty(),
"TYPE must be specified in " "points definition");
1216 const std::string* ptsStr =
std::find(begStr, endStr, typeStr);
1218 ASSERTL0(ptsStr != endStr,
"Invalid points type.");
1222 err = edgelement->QueryIntAttribute(
"NUMPOINTS", &numPts);
1223 ASSERTL0(err == TIXML_SUCCESS,
"Unable to read curve attribute NUMPOINTS.");
1228 std::istringstream elementDataStrm(elementStr.c_str());
1231 while(!elementDataStrm.fail())
1233 elementDataStrm >> xval >> yval >> zval;
1241 if (!elementDataStrm.fail())
1245 curve->m_points.push_back(vert);
1253 (std::string(
"Unable to read curve data for EDGE: ") + elementStr).c_str());
1257 ASSERTL0(curve->m_points.size() == numPts,
"Number of points specificed by attribute NUMPOINTS is different from number of points in list");
1261 edgelement = edgelement->NextSiblingElement(
"E");
1268 TiXmlElement *facelement = field->FirstChildElement(
"F");
1269 int faceindx, faceid;
1273 std::string face(facelement->ValueStr());
1274 ASSERTL0(face ==
"F", (std::string(
"Unknown 3D curve type: ") + face).c_str());
1277 err = facelement->QueryIntAttribute(
"ID", &faceindx);
1278 ASSERTL0(err == TIXML_SUCCESS,
"Unable to read curve attribute ID.");
1281 err = facelement->QueryIntAttribute(
"FACEID", &faceid);
1282 ASSERTL0(err == TIXML_SUCCESS,
"Unable to read curve attribute FACEID.");
1285 std::string elementStr;
1286 TiXmlNode* elementChild = facelement->FirstChild();
1291 if (elementChild->Type() == TiXmlNode::TINYXML_TEXT)
1293 elementStr += elementChild->ToText()->ValueStr();
1296 elementChild = elementChild->NextSibling();
1299 ASSERTL0(!elementStr.empty(),
"Unable to read curve description body.");
1304 std::string typeStr = facelement->Attribute(
"TYPE");
1305 ASSERTL0(!typeStr.empty(),
"TYPE must be specified in " "points definition");
1309 const std::string* ptsStr =
std::find(begStr, endStr, typeStr);
1311 ASSERTL0(ptsStr != endStr,
"Invalid points type.");
1314 std::string numptsStr = facelement->Attribute(
"NUMPOINTS");
1315 ASSERTL0(!numptsStr.empty(),
"NUMPOINTS must be specified in points definition");
1317 std::stringstream s;
1323 ASSERTL0(numPts >= 3,
"NUMPOINTS for face must be greater than 2");
1327 ASSERTL0(ptsStr != endStr,
"Invalid points type.");
1332 std::istringstream elementDataStrm(elementStr.c_str());
1335 while(!elementDataStrm.fail())
1337 elementDataStrm >> xval >> yval >> zval;
1341 if (!elementDataStrm.fail())
1344 curve->m_points.push_back(vert);
1351 (std::string(
"Unable to read curve data for FACE: ")
1352 + elementStr).c_str());
1356 facelement = facelement->NextSiblingElement(
"F");
1368 TiXmlDocument doc(infilename);
1369 bool loadOkay = doc.LoadFile();
1371 std::stringstream errstr;
1372 errstr <<
"Unable to load file: " << infilename << std::endl;
1373 errstr <<
"Reason: " << doc.ErrorDesc() << std::endl;
1374 errstr <<
"Position: Line " << doc.ErrorRow() <<
", Column " << doc.ErrorCol() << std::endl;
1419 bool returnval =
true;
1431 for(
int i = 0; i < nverts; ++i)
1434 if(xval < m_domainRange->m_xmin)
1448 if((ncnt_up == nverts)||(ncnt_low == nverts))
1459 for(
int i = 0; i < nverts; ++i)
1462 if(yval < m_domainRange->m_ymin)
1476 if((ncnt_up == nverts)||(ncnt_low == nverts))
1490 for(
int i = 0; i < nverts; ++i)
1494 if(zval < m_domainRange->m_zmin)
1508 if((ncnt_up == nverts)||(ncnt_low == nverts))
1522 bool returnval =
true;
1533 for(
int i = 0; i < nverts; ++i)
1536 if(xval < m_domainRange->m_xmin)
1550 if((ncnt_up == nverts)||(ncnt_low == nverts))
1560 for(
int i = 0; i < nverts; ++i)
1563 if(yval < m_domainRange->m_ymin)
1577 if((ncnt_up == nverts)||(ncnt_low == nverts))
1587 for(
int i = 0; i < nverts; ++i)
1591 if(zval < m_domainRange->m_zmin)
1605 if((ncnt_up == nverts)||(ncnt_low == nverts))
1634 if (whichItem >= 0 && whichItem <
int(
m_meshComposites[whichComposite]->size()))
1650 std::ostringstream errStream;
1651 errStream <<
"Unable to access composite item [" << whichComposite <<
"][" << whichItem <<
"].";
1653 std::string testStr = errStream.str();
1668 typedef vector<unsigned int> SeqVector;
1669 SeqVector seqVector;
1672 ASSERTL0(parseGood && !seqVector.empty(), (std::string(
"Unable to read composite index range: ") + compositeStr).c_str());
1674 SeqVector addedVector;
1680 if (
std::find(addedVector.begin(), addedVector.end(), *iter) == addedVector.end())
1691 addedVector.push_back(*iter);
1696 compositeVector[*iter] = composite;
1701 ::sprintf(str,
"%d", *iter);
1747 for (iter = expansionMap->begin(); iter!=expansionMap->end(); ++iter)
1749 if ((iter->second)->m_geomShPtr == geom)
1751 returnval = iter->second;
1763 std::vector<LibUtilities::FieldDefinitionsSharedPtr> &fielddef)
1765 int i, j, k, cnt, id;
1772 for(i = 0; i < fielddef.size(); ++i)
1774 for(j = 0; j < fielddef[i]->m_fields.size(); ++j)
1776 std::string field = fielddef[i]->m_fields[j];
1793 for(
int d = 0; d <
m_domain.size(); ++d)
1795 CompositeMap::const_iterator compIter;
1797 for (compIter =
m_domain[d].begin();
1798 compIter !=
m_domain[d].end(); ++compIter)
1800 GeometryVector::const_iterator x;
1801 for (x = compIter->second->begin();
1802 x != compIter->second->end(); ++x)
1807 int id = (*x)->GetGlobalID();
1808 (*expansionMap)[id] = expansionElementShPtr;
1817 for(i = 0; i < fielddef.size(); ++i)
1820 std::vector<std::string> fields = fielddef[i]->m_fields;
1821 std::vector<unsigned int> nmodes = fielddef[i]->m_numModes;
1822 std::vector<LibUtilities::BasisType> basis = fielddef[i]->m_basis;
1823 bool pointDef = fielddef[i]->m_pointsDef;
1824 bool numPointDef = fielddef[i]->m_numPointsDef;
1827 std::vector<unsigned int> npoints = fielddef[i]->m_numPoints;
1828 std::vector<LibUtilities::PointsType> points = fielddef[i]->m_points;
1830 bool UniOrder = fielddef[i]->m_uniOrder;
1833 for (j=0; j< basis.size(); ++j)
1849 if (check==basis.size())
1851 for (j = 0; j < fielddef[i]->m_elementIDs.size(); ++j)
1855 id = fielddef[i]->m_elementIDs[j];
1857 switch (fielddef[i]->m_shapeType)
1861 if(
m_segGeoms.count(fielddef[i]->m_elementIDs[j]) == 0)
1866 geom =
m_segGeoms[fielddef[i]->m_elementIDs[j]];
1870 if(numPointDef&&pointDef)
1875 else if(!numPointDef&&pointDef)
1880 else if(numPointDef&&!pointDef)
1892 bkeyvec.push_back(bkey);
1897 if(
m_triGeoms.count(fielddef[i]->m_elementIDs[j]) == 0)
1902 geom =
m_triGeoms[fielddef[i]->m_elementIDs[j]];
1905 if(numPointDef&&pointDef)
1910 else if(!numPointDef&&pointDef)
1915 else if(numPointDef&&!pointDef)
1922 bkeyvec.push_back(bkey);
1925 if(numPointDef&&pointDef)
1930 else if(!numPointDef&&pointDef)
1935 else if(numPointDef&&!pointDef)
1941 bkeyvec.push_back(bkey1);
1951 if(
m_quadGeoms.count(fielddef[i]->m_elementIDs[j]) == 0)
1959 for(
int b = 0; b < 2; ++b)
1963 if(numPointDef&&pointDef)
1968 else if(!numPointDef&&pointDef)
1973 else if(numPointDef&&!pointDef)
1979 bkeyvec.push_back(bkey);
1991 k = fielddef[i]->m_elementIDs[j];
2003 for(
int b = 0; b < 3; ++b)
2007 if(numPointDef&&pointDef)
2012 else if(!numPointDef&&pointDef)
2017 else if(numPointDef&&!pointDef)
2025 bkeyvec.push_back(bkey);
2031 if(numPointDef&&pointDef)
2036 else if(!numPointDef&&pointDef)
2041 else if(numPointDef&&!pointDef)
2049 bkeyvec.push_back(bkey);
2054 if(numPointDef&&pointDef)
2059 else if(!numPointDef&&pointDef)
2064 else if(numPointDef&&!pointDef)
2072 bkeyvec.push_back(bkey);
2078 if(numPointDef&&pointDef)
2083 else if(!numPointDef&&pointDef)
2088 else if(numPointDef&&!pointDef)
2096 bkeyvec.push_back(bkey);
2108 k = fielddef[i]->m_elementIDs[j];
2116 for(
int b = 0; b < 3; ++b)
2120 if(numPointDef&&pointDef)
2125 else if(!numPointDef&&pointDef)
2130 else if(numPointDef&&!pointDef)
2137 bkeyvec.push_back(bkey);
2140 for(
int b = 0; b < 2; ++b)
2144 if(numPointDef&&pointDef)
2149 else if(!numPointDef&&pointDef)
2154 else if(numPointDef&&!pointDef)
2161 bkeyvec.push_back(bkey);
2167 if(numPointDef&&pointDef)
2172 else if(!numPointDef&&pointDef)
2177 else if(numPointDef&&!pointDef)
2184 bkeyvec.push_back(bkey);
2195 k = fielddef[i]->m_elementIDs[j];
2197 "Failed to find geometry with same global id");
2200 for(
int b = 0; b < 3; ++b)
2204 if(numPointDef&&pointDef)
2209 else if(!numPointDef&&pointDef)
2214 else if(numPointDef&&!pointDef)
2221 bkeyvec.push_back(bkey);
2232 k = fielddef[i]->m_elementIDs[j];
2240 for(
int b = 0; b < 3; ++b)
2244 if(numPointDef&&pointDef)
2249 else if(!numPointDef&&pointDef)
2254 else if(numPointDef&&!pointDef)
2261 bkeyvec.push_back(bkey);
2271 ASSERTL0(
false,
"Need to set up for pyramid and prism 3D Expansions");
2275 for(k = 0; k < fields.size(); ++k)
2278 if((*expansionMap).find(
id) != (*expansionMap).end())
2280 (*expansionMap)[id]->m_geomShPtr = geom;
2281 (*expansionMap)[id]->m_basisKeyVector = bkeyvec;
2288 ASSERTL0(
false,
"Need to set up for non Modified basis");
2298 std::vector<LibUtilities::FieldDefinitionsSharedPtr> &fielddef,
2299 std::vector< std::vector<LibUtilities::PointsType> > &pointstype)
2301 int i,j,k,g,h,cnt,id;
2308 for(i = 0; i < fielddef.size(); ++i)
2310 for(j = 0; j < fielddef[i]->m_fields.size(); ++j)
2312 std::string field = fielddef[i]->m_fields[j];
2325 for(k = 0; k < fielddef.size(); ++k)
2327 for(h = 0; h < fielddef[k]->m_fields.size(); ++h)
2329 if(fielddef[k]->m_fields[h] == field)
2334 for(g = 0; g < fielddef[k]->m_elementIDs.size(); ++g)
2338 (*expansionMap)[fielddef[k]->m_elementIDs[g]] = tmpexp;
2350 for(i = 0; i < fielddef.size(); ++i)
2353 std::vector<std::string> fields = fielddef[i]->m_fields;
2354 std::vector<unsigned int> nmodes = fielddef[i]->m_numModes;
2355 std::vector<LibUtilities::BasisType> basis = fielddef[i]->m_basis;
2356 bool UniOrder = fielddef[i]->m_uniOrder;
2358 for(j = 0; j < fielddef[i]->m_elementIDs.size(); ++j)
2362 id = fielddef[i]->m_elementIDs[j];
2364 switch(fielddef[i]->m_shapeType)
2368 k = fielddef[i]->m_elementIDs[j];
2370 "Failed to find geometry with same global id.");
2379 bkeyvec.push_back(bkey);
2384 k = fielddef[i]->m_elementIDs[j];
2386 "Failed to find geometry with same global id.");
2388 for(
int b = 0; b < 2; ++b)
2392 bkeyvec.push_back(bkey);
2403 k = fielddef[i]->m_elementIDs[j];
2405 "Failed to find geometry with same global id");
2408 for(
int b = 0; b < 2; ++b)
2412 bkeyvec.push_back(bkey);
2423 k = fielddef[i]->m_elementIDs[j];
2425 "Failed to find geometry with same global id");
2428 for(
int b = 0; b < 3; ++b)
2432 bkeyvec.push_back(bkey);
2443 k = fielddef[i]->m_elementIDs[j];
2445 "Failed to find geometry with same global id");
2448 for(
int b = 0; b < 3; ++b)
2452 bkeyvec.push_back(bkey);
2463 k = fielddef[i]->m_elementIDs[j];
2465 "Failed to find geometry with same global id");
2468 for(
int b = 0; b < 3; ++b)
2472 bkeyvec.push_back(bkey);
2483 k = fielddef[i]->m_elementIDs[j];
2485 "Failed to find geometry with same global id");
2488 for(
int b = 0; b < 3; ++b)
2492 bkeyvec.push_back(bkey);
2502 ASSERTL0(
false,
"Need to set up for pyramid and prism 3D Expansions");
2506 for(k = 0; k < fields.size(); ++k)
2509 if((*expansionMap).find(
id) != (*expansionMap).end())
2511 (*expansionMap)[id]->m_geomShPtr = geom;
2512 (*expansionMap)[id]->m_basisKeyVector = bkeyvec;
2533 for(expIt = it->second->begin(); expIt != it->second->end(); ++expIt)
2535 for(
int i = 0; i < expIt->second->m_basisKeyVector.size(); ++i)
2553 expIt->second->m_basisKeyVector[i] = bkeynew;
2582 for (elemIter = expansionMap->begin(); elemIter != expansionMap->end(); ++elemIter)
2584 if ((elemIter->second)->m_geomShPtr->GetShapeType() == shape)
2586 (elemIter->second)->m_basisKeyVector = keys;
2632 returnval.push_back(bkey);
2639 returnval.push_back(bkey);
2640 returnval.push_back(bkey);
2647 returnval.push_back(bkey);
2648 returnval.push_back(bkey);
2649 returnval.push_back(bkey);
2656 returnval.push_back(bkey);
2661 returnval.push_back(bkey1);
2668 returnval.push_back(bkey);
2672 returnval.push_back(bkey1);
2676 returnval.push_back(bkey2);
2683 returnval.push_back(bkey);
2684 returnval.push_back(bkey);
2688 returnval.push_back(bkey1);
2695 returnval.push_back(bkey);
2696 returnval.push_back(bkey);
2700 returnval.push_back(bkey1);
2706 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
2721 returnval.push_back(bkey);
2728 returnval.push_back(bkey);
2729 returnval.push_back(bkey);
2737 returnval.push_back(bkey);
2741 returnval.push_back(bkey1);
2749 returnval.push_back(bkey);
2750 returnval.push_back(bkey);
2751 returnval.push_back(bkey);
2756 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
2772 returnval.push_back(bkey);
2780 returnval.push_back(bkey);
2781 returnval.push_back(bkey);
2789 returnval.push_back(bkey);
2790 returnval.push_back(bkey);
2791 returnval.push_back(bkey);
2796 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
2812 returnval.push_back(bkey);
2820 returnval.push_back(bkey);
2825 returnval.push_back(bkey1);
2833 returnval.push_back(bkey);
2834 returnval.push_back(bkey);
2842 returnval.push_back(bkey);
2847 returnval.push_back(bkey1);
2855 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
2871 returnval.push_back(bkey);
2879 returnval.push_back(bkey);
2880 returnval.push_back(bkey);
2888 returnval.push_back(bkey);
2889 returnval.push_back(bkey);
2890 returnval.push_back(bkey);
2895 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
2911 returnval.push_back(bkey);
2918 returnval.push_back(bkey);
2919 returnval.push_back(bkey);
2926 returnval.push_back(bkey);
2927 returnval.push_back(bkey);
2928 returnval.push_back(bkey);
2933 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
2949 returnval.push_back(bkey);
2956 returnval.push_back(bkey);
2957 returnval.push_back(bkey);
2964 returnval.push_back(bkey);
2965 returnval.push_back(bkey);
2966 returnval.push_back(bkey);
2971 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
2986 returnval.push_back(bkey);
2993 returnval.push_back(bkey);
2994 returnval.push_back(bkey);
3001 returnval.push_back(bkey);
3002 returnval.push_back(bkey);
3003 returnval.push_back(bkey);
3008 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3023 returnval.push_back(bkey);
3030 returnval.push_back(bkey);
3031 returnval.push_back(bkey);
3038 returnval.push_back(bkey);
3039 returnval.push_back(bkey);
3040 returnval.push_back(bkey);
3045 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3060 returnval.push_back(bkey);
3067 returnval.push_back(bkey);
3068 returnval.push_back(bkey);
3075 returnval.push_back(bkey);
3076 returnval.push_back(bkey);
3077 returnval.push_back(bkey);
3082 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3097 returnval.push_back(bkey);
3101 returnval.push_back(bkey1);
3106 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3121 returnval.push_back(bkey1);
3125 returnval.push_back(bkey);
3130 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3145 returnval.push_back(bkey);
3149 returnval.push_back(bkey1);
3154 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3163 ASSERTL0(
false,
"Expansion type not defined");
3181 const int nummodes_x,
3182 const int nummodes_y,
3183 const int nummodes_z)
3193 ASSERTL0(
false,
"Homogeneous expansion not defined for this shape");
3199 ASSERTL0(
false,
"Homogeneous expansion not defined for this shape");
3211 returnval.push_back(bkey1);
3219 returnval.push_back(bkey1);
3227 returnval.push_back(bkey1);
3235 returnval.push_back(bkey1);
3244 returnval.push_back(bkey1);
3252 ASSERTL0(
false,
"Homogeneous expansion can be of Fourier or Chebyshev type only");
3264 returnval.push_back(bkey2);
3273 returnval.push_back(bkey2);
3281 returnval.push_back(bkey2);
3289 returnval.push_back(bkey2);
3297 returnval.push_back(bkey2);
3303 ASSERTL0(
false,
"Homogeneous expansion can be of Fourier or Chebyshev type only");
3314 returnval.push_back(bkey3);
3322 returnval.push_back(bkey3);
3330 returnval.push_back(bkey3);
3338 returnval.push_back(bkey3);
3346 returnval.push_back(bkey3);
3352 ASSERTL0(
false,
"Homogeneous expansion can be of Fourier or Chebyshev type only");
3361 ASSERTL0(
false,
"Homogeneous expansion not defined for this shape");
3367 ASSERTL0(
false,
"Homogeneous expansion not defined for this shape");
3372 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3385 unsigned int nextId =
m_vertSet.rbegin()->first + 1;
3402 if( curveDefinition )
3422 trigeom->SetGlobalID(indx);
3437 quadgeom->SetGlobalID(indx);
3454 prismgeom->SetGlobalID(index);
3466 unsigned int index =
m_tetGeoms.rbegin()->first + 1;
3468 tetgeom->SetGlobalID(index);
3482 unsigned int index =
m_pyrGeoms.rbegin()->first + 1;
3485 pyrgeom->SetGlobalID(index);
3497 unsigned int index =
m_hexGeoms.rbegin()->first + 1;
3499 hexgeom->SetGlobalID(index);
3517 for(
int d = 0; d <
m_domain.size(); ++d)
3519 CompositeMap::const_iterator compIter;
3521 for (compIter =
m_domain[d].begin(); compIter !=
m_domain[d].end(); ++compIter)
3523 GeometryVector::const_iterator x;
3524 for (x = compIter->second->begin(); x != compIter->second->end(); ++x)
3529 int id = (*x)->GetGlobalID();
3530 (*returnval)[id] = expansionElementShPtr;