[vtkusers] unable to write multiple .pvtu files with split vtkMPIController
Joan Baiges
joan.baiges at upc.edu
Tue Feb 20 13:07:20 EST 2018
Hello,
I am trying to write several .vtu and .pvtu files by using several
MPI_Communicators. For this, I Splitinitialize a vtkMPIController object,
and then set this controller as the controller for a
vtkXMLPUnstructuredGridWriter.
However, when I ask the vtkXMLPUnstructuredGridWriter->Write(), only one
.pvtu file is written, while I would expect that one .pvtu file is written
for each of the communicators the MPI_COMM_WORLD has been subdivided into.
On the other hand, the .vtu files are written properly for all the
processors in all the split mpi controllers.
The code I am writing looks approximately like this:
vtkMPIController* controller;
vtkMPICommunicator* communicator;
vtkSmartPointer<vtkUnstructuredGrid> unstructuredGrid;
vtkSmartPointer<vtkXMLPUnstructuredGridWriter> parallelwriter;
//New communicator and spliting of the communicator
communicator = vtkMPICommunicator::New();
communicator = vtkMPICommunicator::GetWorldCommunicator();
communicator->SplitInitialize(communicator,MulticommColor,MPIrank);
//Setting the split communicator as the communicator for the controller
controller = vtkMPIController::New();
controller->SetCommunicator(communicator);
controller->Initialize();
controller->SetGlobalController(controller);
//Initializing the parallelwriter with the controller
parallelwriter = vtkSmartPointer<vtkXMLPUnstructuredGridWriter>::New();
parallelwriter->SetController(controller);
parallelwriter->SetNumberOfPieces(MPIsize);
parallelwriter->SetGhostLevel(1);
parallelwriter->SetStartPiece(MPIrank);
parallelwriter->SetEndPiece(MPIrank);
//setting file name
fname = std::string(filename);
fname.append(".pvtu");
parallelwriter->SetFileName(fname.c_str());
//Setting the grid
unstructuredGrid = vtkSmartPointer<vtkUnstructuredGrid>::New();
parallelwriter->SetInputData(unstructuredGrid);
//After writing the grid info, we call the parallelwriter to write
parallelwriter->Write();
This final line causes all the processors to write the .vtu files, however
only one processor writes the .pvtu file, while I would expect/like one
.pvtu file per split mpi communicator.
Thank you in advance for your help,
Joan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://vtk.org/pipermail/vtkusers/attachments/20180220/7e67a874/attachment.html>
More information about the vtkusers
mailing list