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 ASSERTL1(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::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::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::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::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::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;
1417 bool returnval =
true;
1429 for(
int i = 0; i < nverts; ++i)
1432 if(xval < m_domainRange->xmin)
1446 if((ncnt_up == nverts)||(ncnt_low == nverts))
1457 for(
int i = 0; i < nverts; ++i)
1460 if(yval < m_domainRange->ymin)
1474 if((ncnt_up == nverts)||(ncnt_low == nverts))
1488 for(
int i = 0; i < nverts; ++i)
1492 if(zval < m_domainRange->zmin)
1506 if((ncnt_up == nverts)||(ncnt_low == nverts))
1520 bool returnval =
true;
1531 for(
int i = 0; i < nverts; ++i)
1534 if(xval < m_domainRange->xmin)
1548 if((ncnt_up == nverts)||(ncnt_low == nverts))
1558 for(
int i = 0; i < nverts; ++i)
1561 if(yval < m_domainRange->ymin)
1575 if((ncnt_up == nverts)||(ncnt_low == nverts))
1585 for(
int i = 0; i < nverts; ++i)
1589 if(zval < m_domainRange->zmin)
1603 if((ncnt_up == nverts)||(ncnt_low == nverts))
1623 if (whichItem >= 0 && whichItem <
int(
m_meshComposites[whichComposite]->size()))
1639 std::ostringstream errStream;
1640 errStream <<
"Unable to access composite item [" << whichComposite <<
"][" << whichItem <<
"].";
1642 std::string testStr = errStream.str();
1657 typedef vector<unsigned int> SeqVector;
1658 SeqVector seqVector;
1661 ASSERTL0(parseGood && !seqVector.empty(), (std::string(
"Unable to read composite index range: ") + compositeStr).c_str());
1663 SeqVector addedVector;
1669 if (
std::find(addedVector.begin(), addedVector.end(), *iter) == addedVector.end())
1680 addedVector.push_back(*iter);
1685 compositeVector[*iter] = composite;
1690 ::sprintf(str,
"%d", *iter);
1736 for (iter = expansionMap->begin(); iter!=expansionMap->end(); ++iter)
1738 if ((iter->second)->m_geomShPtr == geom)
1740 returnval = iter->second;
1752 std::vector<LibUtilities::FieldDefinitionsSharedPtr> &fielddef)
1754 int i, j, k, cnt, id;
1761 for(i = 0; i < fielddef.size(); ++i)
1763 for(j = 0; j < fielddef[i]->m_fields.size(); ++j)
1765 std::string field = fielddef[i]->m_fields[j];
1782 for(
int d = 0; d <
m_domain.size(); ++d)
1784 CompositeMap::const_iterator compIter;
1786 for (compIter =
m_domain[d].begin();
1787 compIter !=
m_domain[d].end(); ++compIter)
1789 GeometryVector::const_iterator x;
1790 for (x = compIter->second->begin();
1791 x != compIter->second->end(); ++x)
1796 int id = (*x)->GetGlobalID();
1797 (*expansionMap)[id] = expansionElementShPtr;
1806 for(i = 0; i < fielddef.size(); ++i)
1809 std::vector<std::string> fields = fielddef[i]->m_fields;
1810 std::vector<unsigned int> nmodes = fielddef[i]->m_numModes;
1811 std::vector<LibUtilities::BasisType> basis = fielddef[i]->m_basis;
1812 bool pointDef = fielddef[i]->m_pointsDef;
1813 bool numPointDef = fielddef[i]->m_numPointsDef;
1816 std::vector<unsigned int> npoints = fielddef[i]->m_numPoints;
1817 std::vector<LibUtilities::PointsType> points = fielddef[i]->m_points;
1819 bool UniOrder = fielddef[i]->m_uniOrder;
1822 for (j=0; j< basis.size(); ++j)
1838 if (check==basis.size())
1840 for (j = 0; j < fielddef[i]->m_elementIDs.size(); ++j)
1844 id = fielddef[i]->m_elementIDs[j];
1846 switch (fielddef[i]->m_shapeType)
1850 if(
m_segGeoms.count(fielddef[i]->m_elementIDs[j]) == 0)
1855 geom =
m_segGeoms[fielddef[i]->m_elementIDs[j]];
1859 if(numPointDef&&pointDef)
1864 else if(!numPointDef&&pointDef)
1869 else if(numPointDef&&!pointDef)
1881 bkeyvec.push_back(bkey);
1886 if(
m_triGeoms.count(fielddef[i]->m_elementIDs[j]) == 0)
1891 geom =
m_triGeoms[fielddef[i]->m_elementIDs[j]];
1894 if(numPointDef&&pointDef)
1899 else if(!numPointDef&&pointDef)
1904 else if(numPointDef&&!pointDef)
1911 bkeyvec.push_back(bkey);
1914 if(numPointDef&&pointDef)
1919 else if(!numPointDef&&pointDef)
1924 else if(numPointDef&&!pointDef)
1930 bkeyvec.push_back(bkey1);
1940 if(
m_quadGeoms.count(fielddef[i]->m_elementIDs[j]) == 0)
1948 for(
int b = 0; b < 2; ++b)
1952 if(numPointDef&&pointDef)
1957 else if(!numPointDef&&pointDef)
1962 else if(numPointDef&&!pointDef)
1968 bkeyvec.push_back(bkey);
1980 k = fielddef[i]->m_elementIDs[j];
1992 for(
int b = 0; b < 3; ++b)
1996 if(numPointDef&&pointDef)
2001 else if(!numPointDef&&pointDef)
2006 else if(numPointDef&&!pointDef)
2014 bkeyvec.push_back(bkey);
2020 if(numPointDef&&pointDef)
2025 else if(!numPointDef&&pointDef)
2030 else if(numPointDef&&!pointDef)
2038 bkeyvec.push_back(bkey);
2043 if(numPointDef&&pointDef)
2048 else if(!numPointDef&&pointDef)
2053 else if(numPointDef&&!pointDef)
2061 bkeyvec.push_back(bkey);
2067 if(numPointDef&&pointDef)
2072 else if(!numPointDef&&pointDef)
2077 else if(numPointDef&&!pointDef)
2085 bkeyvec.push_back(bkey);
2097 k = fielddef[i]->m_elementIDs[j];
2105 for(
int b = 0; b < 3; ++b)
2109 if(numPointDef&&pointDef)
2114 else if(!numPointDef&&pointDef)
2119 else if(numPointDef&&!pointDef)
2126 bkeyvec.push_back(bkey);
2129 for(
int b = 0; b < 2; ++b)
2133 if(numPointDef&&pointDef)
2138 else if(!numPointDef&&pointDef)
2143 else if(numPointDef&&!pointDef)
2150 bkeyvec.push_back(bkey);
2156 if(numPointDef&&pointDef)
2161 else if(!numPointDef&&pointDef)
2166 else if(numPointDef&&!pointDef)
2173 bkeyvec.push_back(bkey);
2184 k = fielddef[i]->m_elementIDs[j];
2186 "Failed to find geometry with same global id");
2189 for(
int b = 0; b < 3; ++b)
2193 if(numPointDef&&pointDef)
2198 else if(!numPointDef&&pointDef)
2203 else if(numPointDef&&!pointDef)
2210 bkeyvec.push_back(bkey);
2221 k = fielddef[i]->m_elementIDs[j];
2229 for(
int b = 0; b < 3; ++b)
2233 if(numPointDef&&pointDef)
2238 else if(!numPointDef&&pointDef)
2243 else if(numPointDef&&!pointDef)
2250 bkeyvec.push_back(bkey);
2260 ASSERTL0(
false,
"Need to set up for pyramid and prism 3D Expansions");
2264 for(k = 0; k < fields.size(); ++k)
2267 if((*expansionMap).find(
id) != (*expansionMap).end())
2269 (*expansionMap)[id]->m_geomShPtr = geom;
2270 (*expansionMap)[id]->m_basisKeyVector = bkeyvec;
2277 ASSERTL0(
false,
"Need to set up for non Modified basis");
2287 std::vector<LibUtilities::FieldDefinitionsSharedPtr> &fielddef,
2288 std::vector< std::vector<LibUtilities::PointsType> > &pointstype)
2290 int i,j,k,g,h,cnt,id;
2297 for(i = 0; i < fielddef.size(); ++i)
2299 for(j = 0; j < fielddef[i]->m_fields.size(); ++j)
2301 std::string field = fielddef[i]->m_fields[j];
2314 for(k = 0; k < fielddef.size(); ++k)
2316 for(h = 0; h < fielddef[k]->m_fields.size(); ++h)
2318 if(fielddef[k]->m_fields[h] == field)
2323 for(g = 0; g < fielddef[k]->m_elementIDs.size(); ++g)
2327 (*expansionMap)[fielddef[k]->m_elementIDs[g]] = tmpexp;
2339 for(i = 0; i < fielddef.size(); ++i)
2342 std::vector<std::string> fields = fielddef[i]->m_fields;
2343 std::vector<unsigned int> nmodes = fielddef[i]->m_numModes;
2344 std::vector<LibUtilities::BasisType> basis = fielddef[i]->m_basis;
2345 bool UniOrder = fielddef[i]->m_uniOrder;
2347 for(j = 0; j < fielddef[i]->m_elementIDs.size(); ++j)
2351 id = fielddef[i]->m_elementIDs[j];
2353 switch(fielddef[i]->m_shapeType)
2357 k = fielddef[i]->m_elementIDs[j];
2359 "Failed to find geometry with same global id.");
2368 bkeyvec.push_back(bkey);
2373 k = fielddef[i]->m_elementIDs[j];
2375 "Failed to find geometry with same global id.");
2377 for(
int b = 0; b < 2; ++b)
2381 bkeyvec.push_back(bkey);
2392 k = fielddef[i]->m_elementIDs[j];
2394 "Failed to find geometry with same global id");
2397 for(
int b = 0; b < 2; ++b)
2401 bkeyvec.push_back(bkey);
2412 k = fielddef[i]->m_elementIDs[j];
2414 "Failed to find geometry with same global id");
2417 for(
int b = 0; b < 3; ++b)
2421 bkeyvec.push_back(bkey);
2432 k = fielddef[i]->m_elementIDs[j];
2434 "Failed to find geometry with same global id");
2437 for(
int b = 0; b < 3; ++b)
2441 bkeyvec.push_back(bkey);
2452 k = fielddef[i]->m_elementIDs[j];
2454 "Failed to find geometry with same global id");
2457 for(
int b = 0; b < 3; ++b)
2461 bkeyvec.push_back(bkey);
2472 k = fielddef[i]->m_elementIDs[j];
2474 "Failed to find geometry with same global id");
2477 for(
int b = 0; b < 3; ++b)
2481 bkeyvec.push_back(bkey);
2491 ASSERTL0(
false,
"Need to set up for pyramid and prism 3D Expansions");
2495 for(k = 0; k < fields.size(); ++k)
2498 if((*expansionMap).find(
id) != (*expansionMap).end())
2500 (*expansionMap)[id]->m_geomShPtr = geom;
2501 (*expansionMap)[id]->m_basisKeyVector = bkeyvec;
2522 for(expIt = it->second->begin(); expIt != it->second->end(); ++expIt)
2524 for(
int i = 0; i < expIt->second->m_basisKeyVector.size(); ++i)
2542 expIt->second->m_basisKeyVector[i] = bkeynew;
2573 for (elemIter = expansionMap->begin(); elemIter != expansionMap->end(); ++elemIter)
2575 if ((elemIter->second)->m_geomShPtr->GetShapeType() == shape)
2577 (elemIter->second)->m_basisKeyVector = keys;
2623 returnval.push_back(bkey);
2630 returnval.push_back(bkey);
2631 returnval.push_back(bkey);
2638 returnval.push_back(bkey);
2639 returnval.push_back(bkey);
2640 returnval.push_back(bkey);
2647 returnval.push_back(bkey);
2652 returnval.push_back(bkey1);
2659 returnval.push_back(bkey);
2663 returnval.push_back(bkey1);
2667 returnval.push_back(bkey2);
2674 returnval.push_back(bkey);
2675 returnval.push_back(bkey);
2679 returnval.push_back(bkey1);
2686 returnval.push_back(bkey);
2687 returnval.push_back(bkey);
2691 returnval.push_back(bkey1);
2697 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
2712 returnval.push_back(bkey);
2719 returnval.push_back(bkey);
2720 returnval.push_back(bkey);
2728 returnval.push_back(bkey);
2732 returnval.push_back(bkey1);
2740 returnval.push_back(bkey);
2741 returnval.push_back(bkey);
2742 returnval.push_back(bkey);
2747 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
2763 returnval.push_back(bkey);
2771 returnval.push_back(bkey);
2772 returnval.push_back(bkey);
2780 returnval.push_back(bkey);
2781 returnval.push_back(bkey);
2782 returnval.push_back(bkey);
2787 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
2803 returnval.push_back(bkey);
2811 returnval.push_back(bkey);
2816 returnval.push_back(bkey1);
2824 returnval.push_back(bkey);
2825 returnval.push_back(bkey);
2833 returnval.push_back(bkey);
2838 returnval.push_back(bkey1);
2846 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
2862 returnval.push_back(bkey);
2870 returnval.push_back(bkey);
2871 returnval.push_back(bkey);
2879 returnval.push_back(bkey);
2880 returnval.push_back(bkey);
2881 returnval.push_back(bkey);
2886 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
2902 returnval.push_back(bkey);
2909 returnval.push_back(bkey);
2910 returnval.push_back(bkey);
2917 returnval.push_back(bkey);
2918 returnval.push_back(bkey);
2919 returnval.push_back(bkey);
2924 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
2940 returnval.push_back(bkey);
2947 returnval.push_back(bkey);
2948 returnval.push_back(bkey);
2955 returnval.push_back(bkey);
2956 returnval.push_back(bkey);
2957 returnval.push_back(bkey);
2962 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
2977 returnval.push_back(bkey);
2984 returnval.push_back(bkey);
2985 returnval.push_back(bkey);
2992 returnval.push_back(bkey);
2993 returnval.push_back(bkey);
2994 returnval.push_back(bkey);
2999 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3014 returnval.push_back(bkey);
3021 returnval.push_back(bkey);
3022 returnval.push_back(bkey);
3029 returnval.push_back(bkey);
3030 returnval.push_back(bkey);
3031 returnval.push_back(bkey);
3036 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3051 returnval.push_back(bkey);
3058 returnval.push_back(bkey);
3059 returnval.push_back(bkey);
3066 returnval.push_back(bkey);
3067 returnval.push_back(bkey);
3068 returnval.push_back(bkey);
3073 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3088 returnval.push_back(bkey);
3092 returnval.push_back(bkey1);
3097 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3112 returnval.push_back(bkey1);
3116 returnval.push_back(bkey);
3121 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3136 returnval.push_back(bkey);
3140 returnval.push_back(bkey1);
3145 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3154 ASSERTL0(
false,
"Expansion type not defined");
3172 const int nummodes_x,
3173 const int nummodes_y,
3174 const int nummodes_z)
3184 ASSERTL0(
false,
"Homogeneous expansion not defined for this shape");
3190 ASSERTL0(
false,
"Homogeneous expansion not defined for this shape");
3202 returnval.push_back(bkey1);
3210 returnval.push_back(bkey1);
3218 returnval.push_back(bkey1);
3226 returnval.push_back(bkey1);
3235 returnval.push_back(bkey1);
3243 ASSERTL0(
false,
"Homogeneous expansion can be of Fourier or Chebyshev type only");
3255 returnval.push_back(bkey2);
3264 returnval.push_back(bkey2);
3272 returnval.push_back(bkey2);
3280 returnval.push_back(bkey2);
3288 returnval.push_back(bkey2);
3294 ASSERTL0(
false,
"Homogeneous expansion can be of Fourier or Chebyshev type only");
3305 returnval.push_back(bkey3);
3313 returnval.push_back(bkey3);
3321 returnval.push_back(bkey3);
3329 returnval.push_back(bkey3);
3337 returnval.push_back(bkey3);
3343 ASSERTL0(
false,
"Homogeneous expansion can be of Fourier or Chebyshev type only");
3352 ASSERTL0(
false,
"Homogeneous expansion not defined for this shape");
3358 ASSERTL0(
false,
"Homogeneous expansion not defined for this shape");
3363 ASSERTL0(
false,
"Expansion not defined in switch for this shape");
3376 unsigned int nextId =
m_vertSet.rbegin()->first + 1;
3393 if( curveDefinition )
3413 trigeom->SetGlobalID(indx);
3428 quadgeom->SetGlobalID(indx);
3445 prismgeom->SetGlobalID(index);
3457 unsigned int index =
m_tetGeoms.rbegin()->first + 1;
3459 tetgeom->SetGlobalID(index);
3473 unsigned int index =
m_pyrGeoms.rbegin()->first + 1;
3476 pyrgeom->SetGlobalID(index);
3488 unsigned int index =
m_hexGeoms.rbegin()->first + 1;
3490 hexgeom->SetGlobalID(index);
3508 for(
int d = 0; d <
m_domain.size(); ++d)
3510 CompositeMap::const_iterator compIter;
3512 for (compIter =
m_domain[d].begin(); compIter !=
m_domain[d].end(); ++compIter)
3514 GeometryVector::const_iterator x;
3515 for (x = compIter->second->begin(); x != compIter->second->end(); ++x)
3520 int id = (*x)->GetGlobalID();
3521 (*returnval)[id] = expansionElementShPtr;