[Paraview] Help with LoadingState and python scripting

John Moore johnpmooreiv at gmail.com
Wed Feb 18 23:09:09 EST 2015


I think I have it working. It turns out that I only needed to add :

Delete(GetRenderView())

after generating the screenshots.

But now, I have another question: is it possible to generate the
screenshots on the remote server instead of the client? It would be nice if
the screenshots didn't pop up on my local machine whenever the python
script (run on my local machine) needs to take s screenshot.

Thanks,
John

On Wed, Feb 18, 2015 at 6:56 PM, John Moore <johnpmooreiv at gmail.com> wrote:

> Sorry about the pre-mature end to the last message. Apparently in gmail
> Tab takes you directly to the send button. Here's the pseudo-code:
>
>
>     import paraview.simple;
>     pv = paraview.simple;
>     pv.Connect('Server');
>
>     for timestep in range(timestep_start,timestep_end):
>
>       % Do the refinement on the server
>       % Copy the parallel mesh file "dgsolution.pvtu" to "temp.pvtu", the
> same name what was read in by the GUI and then saved in the .pvsm file.
>
>        pv.servermanager.LoadState('dgsolution.pvsm');
>        pv.SetActiveView(pv.GetRenderedView());
>        pv.Render();
>        pv.SaveScreenshot('screenshot_timestep%06d' % timestep);
>
>     pv.Disconnect();
>
>     When I run the script, I get the solution at the first time step
> written out for each time step. So it seems that LoadState() is not
> re-loading the state, even though it's remote source files have changed.
> Another idea is that perhaps there is new view created for each time step,
> and I am only saving the first.
>
>
>     I'm confident I'm doing something fundamentally wrong here, I just
> don't know what. Also, I want to be sure that the old data is deleted at
> each time step, otherwise the memory requirement would be huge.
>
> Any suggestions would be greatly appreciated.
>
> Thank you for your time!
>
> John
>
>
>
>
> On Wed, Feb 18, 2015 at 6:41 PM, John Moore <johnpmooreiv at gmail.com>
> wrote:
>
>> So, this is what I would like to do, but am new to ParaView and can't
>> figure out how to proceed. Any pointers would be greatly appreciated.
>>
>> I have unsteady data that that represents high-order finite elements. In
>> order to visualize the high order elements, I subdivide them Nref times,
>> and write the data in .pvtu format. In order to save disk space, I only
>> write the high order data at each time step. For Nref refinements, if the
>> elements are tets, this equates to a savings of 8^Nref in disk space.
>>
>> In order to visualize the data, I would first like to load a
>> representative timestep (after re-naming the file to temp.pvtu), do all the
>> manipulation in the GUI, and then save the state in a .pvsm file once
>> satisfied.
>>
>> I would then like to loop over all the time steps, first creating the
>> refined mesh and then post-processing said file for each timestep, and
>> finally deleting the refined mesh files. The post processing at each
>> timestep should use the same state as saved with the gui.
>>
>> I would like to script this all in python, and do the mesh refinement and
>> post-processing on a remote server.
>>
>> I've managed to implement most of this, but the view does not seem to
>> update after every call to pv.servermanager.LoadState().
>>
>> Below is a pseudo-code:
>>
>>     import paraview.simple;
>>     pv = paraview.simple;
>>     pv.Connect('Server');
>>
>>     for timestep in range(timestep_start,timestep_end+1):
>> pv.servermanager.LoadState('dgsolution.pvsm');
>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview/attachments/20150218/8ddd9463/attachment.html>


More information about the ParaView mailing list