Commit f131b944 authored by Ned Coltman's avatar Ned Coltman Committed by Timo Koch
Browse files

[vtk] Always require piece node in VTK Reader

parent eaf00052
......@@ -63,12 +63,17 @@ public:
*/
explicit VTKReader(const std::string& fileName)
{
using namespace tinyxml2;
fileName_ = Dune::MPIHelper::getCollectiveCommunication().size() > 1 ?
getProcessFileName_(fileName) : fileName;
const auto eResult = doc_.LoadFile(fileName_.c_str());
if (eResult != tinyxml2::XML_SUCCESS)
DUNE_THROW(Dune::IOError, "Couldn't open XML file " << fileName_ << ".");
const XMLElement* pieceNode = getPieceNode_();
if (pieceNode == nullptr)
DUNE_THROW(Dune::IOError, "Couldn't get 'Piece' node in " << fileName_ << ".");
}
/*!
......@@ -83,9 +88,6 @@ public:
using namespace tinyxml2;
const XMLElement* pieceNode = getPieceNode_();
if (pieceNode == nullptr)
DUNE_THROW(Dune::IOError, "Couldn't get 'Piece' node in " << fileName_ << ".");
const XMLElement* dataNode = getDataNode_(pieceNode, type);
if (dataNode == nullptr)
DUNE_THROW(Dune::IOError, "Couldn't get 'PointData' or 'CellData' node in " << fileName_ << ".");
......@@ -170,9 +172,6 @@ private:
// get the first piece node
const XMLElement* pieceNode = getPieceNode_(pDoc, pvtkFileName);
if (pieceNode == nullptr)
DUNE_THROW(Dune::IOError, "Couldn't get 'Piece' node in " << pvtkFileName << ".");
const auto myrank = Dune::MPIHelper::getCollectiveCommunication().rank();
for (int rank = 0; rank < myrank; ++rank)
{
......@@ -200,9 +199,6 @@ private:
using namespace tinyxml2;
const XMLElement* pieceNode = getPieceNode_();
if (pieceNode == nullptr)
DUNE_THROW(Dune::IOError, "Couldn't get 'Piece' node in " << fileName_ << ".");
const XMLElement* pointsNode = pieceNode->FirstChildElement("Points")->FirstChildElement("DataArray");
if (pointsNode == nullptr)
DUNE_THROW(Dune::IOError, "Couldn't get data array of points in " << fileName_ << ".");
......@@ -291,9 +287,6 @@ private:
using namespace tinyxml2;
const XMLElement* pieceNode = getPieceNode_();
if (pieceNode == nullptr)
DUNE_THROW(Dune::IOError, "Couldn't get 'Piece' node in " << fileName_ << ".");
const XMLElement* cellDataNode = getDataNode_(pieceNode, DataType::cellData);
if (cellDataNode != nullptr)
{
......
Supports Markdown
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