[vtkusers] Choosing time for vtkOpenFOAMReader
David E DeMarle
dave.demarle at kitware.com
Wed Nov 9 09:39:25 EST 2016
The problem appears to be that SetUpdateTimeStep helper method on the
vtkAlgorithm was not wrapped in python for some reason so you can't get it
directly from reader (or any other algorithm).
This is the vtk 6.3 python API.
outinfo = reader.GetExecutive().GetOutputInformation(0)
infkey = vtk.vtkStreamingDemandDrivenPipeline.UPDATE_TIME_STEP()
And no worries about being new to VTK, even for an old timer like me it
took me some head scratching to figure it out.
Yet another reason to try 7.1 if you can. The new API is just:
David E DeMarle
21 Corporate Drive
Clifton Park, NY 12065-8662
On Thu, Nov 3, 2016 at 7:21 AM, Timofey Mukha <timofey.mukha at it.uu.se>
> Dear David,
> Thank you for the fast reply! I am trying to use your tip, but since I am
> very new to VTK it is not working out well for me.
> Could you elaborate a bit, what would "anAlgorithm" be. A child to
> vtkAlgorithm? The thing is none of the objects I create seem to have the
> SetUpdateTimeStep() as a member. Browsing doxygen made me think that it is
> a member of vtkStreamingDemandDrivenPipeline, is that something I should
> have in the script?
> Kind regards,
> On 2016-11-02 18:40, David E DeMarle wrote:
> In vtk 6.3 it was:
> Try that.
> In vtk 7.1 it is:
> Since Berk cleaned up the parts of the pipeline that caused issues like
> you are seeing.
> David E DeMarle
> Kitware, Inc.
> R&D Engineer
> 21 Corporate Drive
> Clifton Park, NY 12065-8662
> Phone: 518-881-4909
> On Wed, Nov 2, 2016 at 12:43 PM, Timofey Mukha <timofey.mukha at it.uu.se>
>> I am trying to write a python script for doing some stuff with an
>> OpenFOAM case. Everything works great, except that I can't choose the
>> time-value that I want the reader to get the data for.
>> I have found the SetTimeValue() function which is supposed to do the job
>> I think, but it doesn't -- the first availbale time-value is always used.
>> Here is how I use the reader:
>> reader = vtk.vtkOpenFOAMReader()
>> print(vtk_to_numpy(reader.GetTimeValues())) # Grab the available
>> reader.SetTimeValue(vtk_to_numpy(reader.GetTimeValues())[-1]) # Try to
>> load the latest time
>> I use the version provided by the Anaconda python disstro, 6.3.0 I
>> Thanks in advance,
>> Powered by www.kitware.com
>> Visit other Kitware open-source projects at
>> Please keep messages on-topic and check the VTK FAQ at:
>> Search the list archives at: http://markmail.org/search/?q=vtkusers
>> Follow this link to subscribe/unsubscribe:
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the vtkusers