Commit a34a25cb authored by Kenneth Leiter's avatar Kenneth Leiter

ENH: Modify reading of TopologyType to ignore case.

parent 63a0aff0
......@@ -207,20 +207,21 @@ boost::shared_ptr<const XdmfTopologyType> XdmfTopologyType::New(const std::map<s
std::map<std::string, std::string>::const_iterator nodesPerElement = itemProperties.find("NodesPerElement");
if(type != itemProperties.end())
{
const std::string typeVal = type->second;
if(typeVal.compare("NoTopology") == 0)
std::string typeVal = type->second;
std::transform(typeVal.begin(), typeVal.end(), typeVal.begin(), (int(*)(int))std::toupper);
if(typeVal.compare("NOTOPOLOGY") == 0)
{
return NoTopologyType();
}
else if(typeVal.compare("Polyvertex") == 0)
else if(typeVal.compare("POLYVERTEX") == 0)
{
return Polyvertex();
}
else if(typeVal.compare("Polyline") == 0)
else if(typeVal.compare("POLYLINE") == 0)
{
return Polyline();
}
else if(typeVal.compare("Polygon") == 0)
else if(typeVal.compare("POLYGON") == 0)
{
if(nodesPerElement != itemProperties.end())
{
......@@ -228,95 +229,95 @@ boost::shared_ptr<const XdmfTopologyType> XdmfTopologyType::New(const std::map<s
}
assert(false);
}
else if(typeVal.compare("Triangle") == 0)
else if(typeVal.compare("TRIANGLE") == 0)
{
return Triangle();
}
else if(typeVal.compare("Quadrilateral") == 0)
else if(typeVal.compare("QUADRILATERAL") == 0)
{
return Quadrilateral();
}
else if(typeVal.compare("Tetrahedron") == 0)
else if(typeVal.compare("TETRAHEDRON") == 0)
{
return Tetrahedron();
}
else if(typeVal.compare("Pyramid") == 0)
else if(typeVal.compare("PYRAMID") == 0)
{
return Pyramid();
}
else if(typeVal.compare("Wedge") == 0)
else if(typeVal.compare("WEDGE") == 0)
{
return Wedge();
}
else if(typeVal.compare("Hexahedron") == 0)
else if(typeVal.compare("HEXAHEDRON") == 0)
{
return Hexahedron();
}
else if(typeVal.compare("Edge_3") == 0)
else if(typeVal.compare("EDGE_3") == 0)
{
return Edge_3();
}
else if(typeVal.compare("Triangle_6") == 0)
else if(typeVal.compare("TRIANGLE_6") == 0)
{
return Triangle_6();
}
else if(typeVal.compare("Quadrilateral_8") == 0)
else if(typeVal.compare("QUADRILATERAL_8") == 0)
{
return Quadrilateral_8();
}
else if(typeVal.compare("Tetrahedron_10") == 0)
else if(typeVal.compare("TETRAHEDRON_10") == 0)
{
return Tetrahedron_10();
}
else if(typeVal.compare("Pyramid_13") == 0)
else if(typeVal.compare("PYRAMID_13") == 0)
{
return Pyramid_13();
}
else if(typeVal.compare("Wedge_15") == 0)
else if(typeVal.compare("WEDGE_15") == 0)
{
return Wedge_15();
}
else if(typeVal.compare("Hexahedron_20") == 0)
else if(typeVal.compare("HEXAHEDRON_20") == 0)
{
return Hexahedron_20();
}
else if(typeVal.compare("Hexahedron_24") == 0)
else if(typeVal.compare("HEXAHEDRON_24") == 0)
{
return Hexahedron_24();
}
else if(typeVal.compare("Hexahedron_27") == 0)
else if(typeVal.compare("HEXAHEDRON_27") == 0)
{
return Hexahedron_27();
}
else if(typeVal.compare("Hexahedron_64") == 0)
else if(typeVal.compare("HEXAHEDRON_64") == 0)
{
return Hexahedron_64();
}
else if(typeVal.compare("Mixed") == 0)
else if(typeVal.compare("MIXED") == 0)
{
return Mixed();
}
else if(typeVal.compare("2DSMesh") == 0)
else if(typeVal.compare("2DSMESH") == 0)
{
return TwoDSMesh();
}
else if(typeVal.compare("2DRectMesh") == 0)
else if(typeVal.compare("2DRECTMESH") == 0)
{
return TwoDRectMesh();
}
else if(typeVal.compare("2DCoRectMesh") == 0)
else if(typeVal.compare("2DCORECTMESH") == 0)
{
return TwoDCoRectMesh();
}
else if(typeVal.compare("3DSMesh") == 0)
else if(typeVal.compare("3DSMESH") == 0)
{
return ThreeDSMesh();
}
else if(typeVal.compare("3DRectMesh") == 0)
else if(typeVal.compare("3DRECTMESH") == 0)
{
return ThreeDRectMesh();
}
else if(typeVal.compare("3DCoRectMesh") == 0)
else if(typeVal.compare("3DCORECTMESH") == 0)
{
return ThreeDCoRectMesh();
}
......
......@@ -23,7 +23,7 @@ public:
/**
* Read an Xdmf file from disk into memory.
*
* @param filePath the path on disk to the Xdmf file to read in.
* @param filePath the path of the Xdmf file to read in from disk.
* @return an XdmfItem at the root of the Xdmf tree.
*/
virtual boost::shared_ptr<XdmfItem> read(const std::string & filePath) const;
......
......@@ -35,7 +35,21 @@ void XdmfDataItem::populateItem(const std::map<std::string, std::string> & itemP
{
if(boost::shared_ptr<XdmfArray> array = boost::shared_dynamic_cast<XdmfArray>(*iter))
{
this->setArray(array);
if(mArray->getSize() == 0)
{
this->setArray(array);
}
else
{
// Support old Xdmf format that could contain multiple data items. Just append the values to the first array.
if(!mArray->isInitialized())
{
mArray->read();
}
const unsigned int oldSize = mArray->getSize();
mArray->resize(oldSize + array->getSize(), 0);
mArray->copyValues(oldSize, array, 0, array->getSize(), 1, 1);
}
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment