[Paraview] Import time steps using C++ reader

David E DeMarle dave.demarle at kitware.com
Tue Jul 31 10:57:44 EDT 2012


On Mon, Jul 30, 2012 at 4:43 PM, Nehme Bilal <nehmebilal at gmail.com> wrote:
> Hello,
>
> I am trying to make a C++ reader for a point set file containing time steps.
> The output of the reader is a vtkPolyData.
>
> The file format is similar to:
> x1,y1,z1,prop1,prop2,...,time
>
> I would like to import the field "time" as time steps, in order to animate
> using "snap to time steps" mode.
>
> The code looks like:
>
>     vtkPolyData *output =
> vtkPolyData::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT()));
>
>     Loop:
>             time = readTime();
>             coords = readCoords();
>
>             vtkIdType id = outPoints->InsertNextPoint(coords[0], coords[1],
> coords[2]);
>             outCells->InsertNextCell(1);
>             outCells->InsertCellPoint(id);
>
>     output->SetPoints(outPoints);
>     output->SetVerts(outCells);
>
> Assuming time is an integer, how do I insert the time steps into the output
> ?

You might want to make your reader tell VTK about the time in the
standard way instead of encoding it as a separate point associated
array. Then the time aware filters and animation controls will know
what to do with it. To do so, make your reader announce the time steps
it can produce in the RequestInformation method and respond with data
for any particular requested time RequestData. See the
vtkTimeSourceExample in the VTK source code for hints.

> I tried to import the time as an "int property" instead of time steps and
> animate using threshold, but I can't display one time step at a time because
> only one slider is animated.

I can't reproduce that. Use the + button twice on the animation view
to two tracks. For one pick the threshold filter and it's threshold
range (0) property. For the second choose it's threshold range (1)
property. Using the pv binary on my system I can animate a dynamic
threshold front with the wavelet source without any problem that way.

>
> Thank you,
>
> Nehme
>
> _______________________________________________
> 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