Skip to content
Snippets Groups Projects
Commit ea84ec85 authored by Oliver Sander's avatar Oliver Sander Committed by sander
Browse files

Properly construct the full filename in situations with more than one process

[[Imported from SVN: r9907]]
parent 981fbe10
No related branches found
No related tags found
No related merge requests found
...@@ -154,12 +154,18 @@ namespace Dune { ...@@ -154,12 +154,18 @@ namespace Dune {
*/ */
void read(const std::string& filename) void read(const std::string& filename)
{ {
std::string fullfilename = filename + ".vtu";
// Prepend rank and communicator size to the filename, if there are more than one process
if (commSize_ > 1)
fullfilename = getParallelPieceName(filename, "", commRank_, commSize_);
#if ! HAVE_TINYXML2 #if ! HAVE_TINYXML2
DUNE_THROW(Dune::NotImplemented, "You need TinyXML2 for vtk file reading!"); DUNE_THROW(Dune::NotImplemented, "You need TinyXML2 for vtk file reading!");
#else #else
tinyxml2::XMLDocument doc; tinyxml2::XMLDocument doc;
if (doc.LoadFile(filename.c_str()) != tinyxml2::XML_SUCCESS) if (doc.LoadFile(fullfilename.c_str()) != tinyxml2::XML_SUCCESS)
DUNE_THROW(Dune::IOError, "Couldn't open the file '" << filename << "'"); DUNE_THROW(Dune::IOError, "Couldn't open the file '" << fullfilename << "'");
// Get number of cells and number of points // Get number of cells and number of points
tinyxml2::XMLElement* pieceElement = doc.FirstChildElement( "VTKFile" )->FirstChildElement( "UnstructuredGrid" )->FirstChildElement( "Piece" ); tinyxml2::XMLElement* pieceElement = doc.FirstChildElement( "VTKFile" )->FirstChildElement( "UnstructuredGrid" )->FirstChildElement( "Piece" );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment