Writing pvtu files from Catalyst ...

Dear All,
I am having difficulties with writing out pvtu files from a Catalyst process. Writing them out directly using for instance a threshold defined within the python script works great, but I do have another function for processing the data directly. I can access all fields and perform the computation and in the end would like to write out the results as a vtkIntArray. Using one thread and vtkXMLUnstructuredGridWriter this works great, but in parallel from within Catalyst and using vtkXMLPUnstructuredGridWriter it writes out data to disk, the *.pvtu file also looks correct, but when reading the data back with ParaView, the XML reader complains about wrong formed tokens etc. Here is the part of C++ code I use to write out the files. The input data is a unstructured grid with one vtkUnsignedIntArray.:

vtkMultiProcessController* ctrl = vtkMultiProcessController::GetGlobalController();

vtkNew completeArrays;
completeArrays->SetController(ctrl);
completeArrays->SetInputData(isccpData);

vtkNew writer;
writer->SetInputConnection(completeArrays->GetOutputPort());
writer->SetNumberOfPieces(ctrl->GetNumberOfProcesses());
writer->SetStartPiece(0);
writer->SetEndPiece(ctrl->GetNumberOfProcesses()-1);
//writer->SetController(ctrl);
writer->SetUseSubdirectory(true);
writer->SetFileName(outputFile.c_str());
writer->Update();

I also looked into the Catalyst example and the test for vtkXMLPUnstructuredGridWriter. I also tried without using vtkCompleteArrays, but as it very well may be that process 0 does not have any points, I thought this will be on the safe side.

Thanks for any hints and Cheers,
Niklas

Hi Niklas,

Have you looked at using the vtkCPXMLPWriterPipeline? That along with maybe the CxxVTKPipelineExample under the Examples/Catalyst subdirectory of the source code may get you where you want to go, which I assume is using Catalyst without Python.

Good luck!
Andy

ps. I think the mistake you’re making with the vtkXMLPUnstructuredGridWriter is that it should be:

writer->SetStartPiece(ctrl->GetLocalProcessId());
writer->SetEndPiece(ctrl->GetLocalProcessId());

Also, I don’t think vtkCompleteArrays should be necessary here anymore, i.e. with ParaView 5.6.

1 Like

Thank you Andy, you are awesome!!!