Suggestion for Python SaveData() method

I was thinking of how often I’m generating Python scripts through the Trace capability and something that often comes up is that the serial VTK XML writers are used in the GUI when generating the trace but when I’m running the trace I really want to use the parallel VTK XML writers. That is, I get the following in the Trace:

SaveData('/home/acbauer/aaaa.vti', proxy=wavelet1, PointDataArrays=['RTData'])

but would have preferred to have:

SaveData('/home/acbauer/aaaa.pvti', proxy=wavelet1, PointDataArrays=['RTData'])

Note the .vti extension instead of the .pvti extension. So if I would run the script in parallel with pvbatch in PV 5.10 I’d get the following error:

(   2.889s) [pvbatch.0       ] vtkSMWriterFactory.cxx:344    ERR| vtkSMWriterFactory (0x18f59c0): No matching writer found for extension: vti
Traceback (most recent call last):
  File "/home/acbauer/testserial.py", line 17, in <module>
    SaveData('/home/acbauer/abc.vti', proxy=wavelet1, PointDataArrays=['RTData'])
  File "/home/acbauer/Code/ParaView/ParaView-5.10.0-MPI-Linux-Python3.9-x86_64/lib/python3.9/site-packages/paraview/simple.py", line 1266, in SaveData
    writer = CreateWriter(filename, proxy, **extraArgs)
  File "/home/acbauer/Code/ParaView/ParaView-5.10.0-MPI-Linux-Python3.9-x86_64/lib/python3.9/site-packages/paraview/simple.py", line 1252, in CreateWriter
    writer_proxy.UnRegister(None)
AttributeError: 'NoneType' object has no attribute 'UnRegister'

So what I’m proposing for the VTK XML writers for SaveData() in parallel is to automatically replace the serial version with the parallel version. A warning could be added in if that seems appropriate but this seems like a convenience thing to do for users for both ease of use as well as for users that haven’t quite picked up on the subtle difference between the serial and parallel versions of the VTK XML writers.

Sounds like a VTK feature request to me. Might require some work on the writer class hierarchy.

@Andy_Bauer , I’m a bit confused. Why not saving as .pvti in ParaView directly ?

Maybe it’s better to implement changes in VTK. I’m just thinking where I’m encountering the issue, not where best to implement a solution. I talked to @utkarsh.ayachit and @cory.quammen about this but really don’t have a preference as to where the solution should be implemented.

Yes, ideally users would save as a .pvti in ParaView. Two reasons this may not happen though:

  1. Users may not understand the difference between the .pvti and .vti formats and thus choose poorly (I’ve had a user do this and this is what brought up this issue). In this case when running in parallel the user didn’t understand why the Python trace output worked in serial but not in parallel.
  2. The user may want to to have a .vti in serial due to being able to skip writing out the meta-file and the actual data file (possibly in a sub-directory).