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

Prepend communicator rank and size to the filename when writing a distributed grid

Otherwise, all processes will write into the same file --> not a good idea.

[[Imported from SVN: r9776]]
parent e55ffb63
No related branches found
No related tags found
No related merge requests found
......@@ -202,7 +202,17 @@ public:
#elif defined SECOND_ORDER // Write as P2 space
std::ofstream outFile(filename + ".vtu");
std::stringstream fullfilename;
// Prepend rank and communicator size to the filename, if there are more than one process
if (gridView.comm().size() > 1)
{
fullfilename << 's' << std::setw(4) << std::setfill('0') << gridView.comm().size() << '-';
fullfilename << 'p' << std::setw(4) << std::setfill('0') << gridView.comm().rank() << '-';
fullfilename << filename;
}
std::ofstream outFile(fullfilename.str() + ".vtu");
// Write header
outFile << "<?xml version=\"1.0\"?>" << std::endl;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment