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 segment->QueryStringAttribute(
"COMPRESSED",&IsCompressed);
120 if(IsCompressed.size())
122 ASSERTL0(boost::iequals(IsCompressed,
124 "Compressed formats do not match. Expected :"
126 +
" but got " + std::string(IsCompressed));
129 TiXmlNode* child = segment->FirstChild();
130 ASSERTL0(child,
"Unable to extract the data from "
131 "the compressed face tag.");
134 if (child->Type() == TiXmlNode::TINYXML_TEXT)
136 str += child->ToText()->ValueStr();
141 std::vector<LibUtilities::MeshEdge> data;
145 for(
int i = 0; i < data.size(); ++i)
160 seg->SetGlobalID(indx);
166 vertices, it->second);
167 seg->SetGlobalID(indx);
169 seg->SetGlobalID(indx);
177 int err = segment->QueryIntAttribute(
"ID", &indx);
178 ASSERTL0(err == TIXML_SUCCESS,
"Unable to read element attribute ID.");
180 TiXmlNode* elementChild = segment->FirstChild();
181 while(elementChild && elementChild->Type() != TiXmlNode::TINYXML_TEXT)
183 elementChild = elementChild->NextSibling();
186 ASSERTL0(elementChild,
"Unable to read element description body.");
187 std::string elementStr = elementChild->ToText()->ValueStr();
191 int vertex1, vertex2;
192 std::istringstream elementDataStrm(elementStr.c_str());
196 elementDataStrm >> vertex1;
197 elementDataStrm >> vertex2;
199 ASSERTL0(!elementDataStrm.fail(), (std::string(
"Unable to read element data for SEGMENT: ") + elementStr).c_str());
208 seg->SetGlobalID(indx);
213 seg->SetGlobalID(indx);
215 seg->SetGlobalID(indx);
221 (std::string(
"Unable to read element data for segment: ") + elementStr).c_str());
225 segment = segment->NextSiblingElement(
"S");
231 TiXmlHandle docHandle(&doc);
234 TiXmlElement* mesh = docHandle.FirstChildElement(
"NEKTAR").FirstChildElement(
"GEOMETRY").Element();
235 TiXmlElement* field = NULL;
237 ASSERTL0(mesh,
"Unable to find GEOMETRY tag in file.");
240 field = mesh->FirstChildElement(
"COMPOSITE");
242 ASSERTL0(field,
"Unable to find COMPOSITE tag in file.");
244 TiXmlElement *node = field->FirstChildElement(
"C");
247 int nextCompositeNumber = -1;
254 nextCompositeNumber++;
257 int err = node->QueryIntAttribute(
"ID", &indx);
258 ASSERTL0(err == TIXML_SUCCESS,
"Unable to read attribute ID.");
261 TiXmlNode* compositeChild = node->FirstChild();
266 while(compositeChild && compositeChild->Type() != TiXmlNode::TINYXML_TEXT)
268 compositeChild = compositeChild->NextSibling();
271 ASSERTL0(compositeChild,
"Unable to read composite definition body.");
272 std::string compositeStr = compositeChild->ToText()->ValueStr();
276 std::istringstream compositeDataStrm(compositeStr.c_str());
281 std::string prevCompositeElementStr;
283 while (!compositeDataStrm.fail())
285 std::string compositeElementStr;
286 compositeDataStrm >> compositeElementStr;
288 if (!compositeDataStrm.fail())
298 if (compositeElementStr.length() > 0)
302 prevCompositeElementStr = compositeElementStr;
309 (std::string(
"Unable to read COMPOSITE data for composite: ") + compositeStr).c_str());
313 node = node->NextSiblingElement(
"C");
316 ASSERTL0(nextCompositeNumber >= 0,
"At least one composite must be specified.");
329 std::istringstream tokenStream(token);
330 std::istringstream prevTokenStream(prevToken);
337 std::string::size_type indxBeg = token.find_first_of(
'[') + 1;
338 std::string::size_type indxEnd = token.find_last_of(
']') - 1;
340 ASSERTL0(indxBeg <= indxEnd, (std::string(
"Error reading index definition:") + token).c_str());
342 std::string indxStr = token.substr(indxBeg, indxEnd - indxBeg + 1);
344 typedef vector<unsigned int> SeqVectorType;
345 SeqVectorType seqVector;
352 prevTokenStream >> prevType;
355 bool validSequence = (prevToken.empty() ||
356 (type ==
'V' && prevType ==
'V') ||
357 (type ==
'S' && prevType ==
'S'));
359 ASSERTL0(validSequence, (std::string(
"Invalid combination of composite items: ")
360 + type +
" and " + prevType +
".").c_str());
369 char errStr[16] =
"";
370 ::sprintf(errStr,
"%d", *iter);
385 char errStr[16] =
"";
386 ::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.
std::string GetCompressString(void)
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
int ZlibDecodeFromBase64Str(std::string &in64, std::vector< T > &out)