[Paraview] Python scripting: Updating PVDReader source when pvd file has changed and rendering latest time step

Florian Rathgeber frat at kth.se
Fri Mar 26 12:47:31 EDT 2010


Translating that to Python as I understand it would correspond to:
reader.FileName = ""
reader.FileName = original

That does the trick, thank you! I had tried that before and had hoped
there is a nicer way, since I get VTK errors about not being able to
open the file and read the file information on the terminal and the
output window.

Florian

On 22.03.2010 14:57, Utkarsh Ayachit wrote:
> The vtkPVDReader (you may want to look at it's superclasses as well)
> does not re-read the XML file, unless the reader is modified. What you
> really need, is somehow call "Modified()" on the reader. One way would
> be setting the filename to empty (then call
> vtkSMPRoxy::UpdateVTKObjects()) and then setting it back  (and again
> calling vtkSMProxy::UpdateVTKObjects()".
> 
> Utkarsh
> 
> On Fri, Mar 19, 2010 at 8:40 AM, Florian Rathgeber <frat at kth.se> wrote:
>> Hi,
>>
>> I'm trying to get ParaView to work in an interactive context for
>> numerical simulations. The first goal is to have ParaView visualize time
>> steps as they are output by the solver (vtu for individual steps, pvd as
>> collection). I searched the wiki, mailing lists etc. and it seems this
>> cannot be done easily.
>>
>> My current approach uses the python scripting interface. I open a socket
>> in python and wait for messages from the solver that a time step was
>> finished and a new file written out. When this happens for the first
>> time I initialize the visualization, i.e. load the pvd file and set some
>> basic properties. For every subsequent event I set ViewTime to the
>> latest sample and re-render the view. Is there a more elegant way to do
>> that?
>>
>> This works as long as the pvd file contains all the expected time steps
>> from the beginning. But the solver updates the pvd file for every vtu
>> file written out and appends it to the collection. Hence, when I
>> initially load the pvd, I only have the first time step. I tried all
>> methods PVDReader provides but there seems to be no way to re-read the
>> file of a PVDReader source. Did I miss something?
>>
>> I wonder if it might be a better option to try to realize this as a
>> plugin, since in the end is should also be possible to send messages
>> back to the solver to trigger a parameter change for the next time step
>> while the simulation is running. As I'm not so familiar with the VTK /
>> ParaView source and have no experience writing ParaView plugins I'd be
>> happy to get some input or estimate if that is achievable in a
>> reasonable amount of time.
>>
>> Best regards,
>> Florian
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the ParaView Wiki at: http://paraview.org/Wiki/ParaView
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.paraview.org/mailman/listinfo/paraview
>>


More information about the ParaView mailing list