{
TiXmlElement* master = NULL;
TiXmlElement* domain = NULL;
TiXmlElement* boundary = NULL;
master = doc.FirstChildElement("NEKTAR");
ASSERTL0(master,
"Unable to find NEKTAR tag in file");
domain = master->FirstChildElement("DOMAIN");
ASSERTL0(domain,
"Unable to find DOMAIN tag in file.");
TiXmlNode *node = domain->FirstChild();
std::string components(node->ValueStr());
std::istringstream domainStrm(components);
std::string entry;
if(domainStrm)
{
domainStrm >> entry;
if (entry.length())
{
ASSERTL0(entry[0] ==
'C',
"Only composites are allowed in a definition of a domain.");
std::string::size_type indxBeg = entry.find_first_of('[') + 1;
std::string::size_type indxEnd = entry.find_last_of(']') - 1;
ASSERTL0(indxBeg <= indxEnd, (std::string(
"Error reading DOMAIN definition:") + entry).c_str());
std::string indxStr = entry.substr(indxBeg, indxEnd - indxBeg + 1);
std::istringstream indexStrm(indxStr);
int indx1=-1, indx2=-1;
if (indexStrm)
{
indexStrm >> indx1;
ASSERTL0(indx1 >= 0, (std::string(
"Error reading collection range: ") + indxStr).c_str());
indx2 = indx1;
std::string::size_type dashLoc=indxStr.find('-');
if (dashLoc != std::string::npos)
{
indexStrm.seekg(dashLoc+1);
indexStrm >> indx2;
(std::string("Error reading collection range: ") + indxStr).c_str());
}
for (int i=indx1; i<=indx2; ++i)
{
}
}
}
}
boundary = master->FirstChildElement("BOUNDARY");
ASSERTL0(boundary,
"Unable to find BOUNDARY tag in file.");
TiXmlElement *bc = boundary->FirstChildElement();
while(bc)
{
std::string bcType(bc->ValueStr());
TiXmlNode *node = bc->FirstChild();
std::string components(node->ValueStr());
std::istringstream boundaryStrm(components);
std::string entry;
const char* indx =
std::find(beginName, endName, bcType[0]);
ASSERTL0(indx != endName, (std::string(
"Unable to read boundary type tag: ") + bcType).c_str());
if(boundaryStrm)
{
domainStrm >> entry;
if (entry.length())
{
ASSERTL0(entry[0] ==
'C',
"Only composites are allowed in a definition of a boundary condition.");
std::string::size_type indxBeg = entry.find_first_of('[') + 1;
std::string::size_type indxEnd = entry.find_last_of(']') - 1;
ASSERTL0(indxBeg <= indxEnd, (std::string(
"Error reading BOUNDARY definition:") + entry).c_str());
std::string indxStr = entry.substr(indxBeg, indxEnd - indxBeg + 1);
std::istringstream indexStrm(indxStr);
int indx1=-1, indx2=-1;
if(indexStrm)
{
indexStrm >> indx1;
ASSERTL0(indx1 >= 0, (std::string(
"Error reading collection range: ") + indxStr).c_str());
std::string::size_type dashLoc=indxStr.find('-');
if (dashLoc != std::string::npos)
{
while(indexStrm.get() != '-');
indexStrm >> indx2;
(std::string("Error reading collection range: ") + indxStr).c_str());
}
for (int i=indx1; i<=indx2; ++i)
{
boundary->m_BoundaryComposites.push_back(composite);
}
}
}
}
bc = bc->NextSiblingElement();
}
}