43 namespace SpatialDomains
65 TiXmlDocument doc(infilename);
67 bool loadOkay = doc.LoadFile();
68 std::stringstream errstr;
69 errstr <<
"Unable to load file: " << infilename <<
"\n";
70 errstr << doc.ErrorDesc() <<
" (Line " << doc.ErrorRow()
71 <<
", Column " << doc.ErrorCol() <<
")";
82 TiXmlHandle docHandle(&doc);
84 TiXmlElement* mesh = NULL;
87 mesh = docHandle.FirstChildElement(
"NEKTAR").FirstChildElement(
"GEOMETRY").Element();
89 ASSERTL0(mesh,
"Unable to find GEOMETRY tag in file.");
100 TiXmlHandle docHandle(&doc);
101 TiXmlElement* mesh = docHandle.FirstChildElement(
"NEKTAR").FirstChildElement(
"GEOMETRY").Element();
102 TiXmlElement* field = NULL;
105 field = mesh->FirstChildElement(
"ELEMENT");
107 ASSERTL0(field,
"Unable to find ELEMENT tag in file.");
112 TiXmlElement *segment = field->FirstChildElement(
"S");
118 int err = segment->QueryIntAttribute(
"ID", &indx);
119 ASSERTL0(err == TIXML_SUCCESS,
"Unable to read element attribute ID.");
121 TiXmlNode* elementChild = segment->FirstChild();
122 while(elementChild && elementChild->Type() != TiXmlNode::TINYXML_TEXT)
124 elementChild = elementChild->NextSibling();
127 ASSERTL0(elementChild,
"Unable to read element description body.");
128 std::string elementStr = elementChild->ToText()->ValueStr();
132 int vertex1, vertex2;
133 std::istringstream elementDataStrm(elementStr.c_str());
137 elementDataStrm >> vertex1;
138 elementDataStrm >> vertex2;
140 ASSERTL0(!elementDataStrm.fail(), (std::string(
"Unable to read element data for SEGMENT: ") + elementStr).c_str());
149 seg->SetGlobalID(indx);
154 seg->SetGlobalID(indx);
156 seg->SetGlobalID(indx);
162 (std::string(
"Unable to read element data for segment: ") + elementStr).c_str());
166 segment = segment->NextSiblingElement(
"S");
172 TiXmlHandle docHandle(&doc);
175 TiXmlElement* mesh = docHandle.FirstChildElement(
"NEKTAR").FirstChildElement(
"GEOMETRY").Element();
176 TiXmlElement* field = NULL;
178 ASSERTL0(mesh,
"Unable to find GEOMETRY tag in file.");
181 field = mesh->FirstChildElement(
"COMPOSITE");
183 ASSERTL0(field,
"Unable to find COMPOSITE tag in file.");
185 TiXmlElement *node = field->FirstChildElement(
"C");
188 int nextCompositeNumber = -1;
195 nextCompositeNumber++;
198 int err = node->QueryIntAttribute(
"ID", &indx);
199 ASSERTL0(err == TIXML_SUCCESS,
"Unable to read attribute ID.");
202 TiXmlNode* compositeChild = node->FirstChild();
207 while(compositeChild && compositeChild->Type() != TiXmlNode::TINYXML_TEXT)
209 compositeChild = compositeChild->NextSibling();
212 ASSERTL0(compositeChild,
"Unable to read composite definition body.");
213 std::string compositeStr = compositeChild->ToText()->ValueStr();
217 std::istringstream compositeDataStrm(compositeStr.c_str());
222 std::string prevCompositeElementStr;
224 while (!compositeDataStrm.fail())
226 std::string compositeElementStr;
227 compositeDataStrm >> compositeElementStr;
229 if (!compositeDataStrm.fail())
239 if (compositeElementStr.length() > 0)
243 prevCompositeElementStr = compositeElementStr;
250 (std::string(
"Unable to read COMPOSITE data for composite: ") + compositeStr).c_str());
254 node = node->NextSiblingElement(
"C");
257 ASSERTL0(nextCompositeNumber >= 0,
"At least one composite must be specified.");
270 std::istringstream tokenStream(token);
271 std::istringstream prevTokenStream(prevToken);
278 std::string::size_type indxBeg = token.find_first_of(
'[') + 1;
279 std::string::size_type indxEnd = token.find_last_of(
']') - 1;
281 ASSERTL0(indxBeg <= indxEnd, (std::string(
"Error reading index definition:") + token).c_str());
283 std::string indxStr = token.substr(indxBeg, indxEnd - indxBeg + 1);
285 typedef vector<unsigned int> SeqVectorType;
286 SeqVectorType seqVector;
293 prevTokenStream >> prevType;
296 bool validSequence = (prevToken.empty() ||
297 (type ==
'V' && prevType ==
'V') ||
298 (type ==
'S' && prevType ==
'S'));
300 ASSERTL0(validSequence, (std::string(
"Invalid combination of composite items: ")
301 + type +
" and " + prevType +
".").c_str());
310 char errStr[16] =
"";
311 ::sprintf(errStr,
"%d", *iter);
326 char errStr[16] =
"";
327 ::sprintf(errStr,
"%d", *iter);
#define ASSERTL0(condition, msg)
#define NEKERROR(type, msg)
Assert Level 0 – Fundamental assert which is used whether in FULLDEBUG, DEBUG or OPT compilation mod...
void ResolveGeomRef(const std::string &prevToken, const std::string &token, Composite &composite)
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
void ReadCurves(TiXmlDocument &doc)
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
CompositeMap m_meshComposites
PointGeomSharedPtr GetVertex(int id)
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.
void ReadGeometry(const std::string &infilename)
Read will read the meshgraph vertices given a filename.
boost::shared_ptr< SegGeom > SegGeomSharedPtr
boost::shared_ptr< DomainRange > DomainRangeShPtr
boost::shared_ptr< GeometryVector > Composite
void ReadElements(TiXmlDocument &doc)
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator
Base class for a spectral/hp element mesh.
void ReadDomain(TiXmlDocument &doc)
void ReadComposites(TiXmlDocument &doc)
void ReadExpansions(const std::string &infilename)
Read the expansions given the XML file path.
boost::shared_ptr< PointGeom > PointGeomSharedPtr