[vtkusers] Reading from a VTK file

Gaurish Telang gaurish108 at gmail.com
Wed Oct 19 20:41:35 EDT 2011


Thank you for the informative link.

I tried running the
http://www.vtk.org/Wiki/VTK/Examples/Cxx/IO/GenericDataObjectReader on my
data file and it correctly
gave the total number of points viz. 5 points for my program.

However, does this code also read and store the pressure, density, position
vector and velocity vectors somehwere?
If so, how do I access / print them? The vtk documentation looks quite
intimidating and I am not sure of how to do this.

Here is the data file  again.

# vtk DataFile Version 3.0
The actual time is 0.01000000
ASCII
DATASET POLYDATA
POINTS 5 double
1.0 3.0 6.8
2.3 4.5 6.7
4.5 6.7 9.0
1.2 3.4 5.6
2.1 1.5 2.3
POINT_DATA 5
SCALARS pressure double
LOOKUP_TABLE default
3.4
6.7
8.9
3.5
6.9
SCALARS density double
LOOKUP_TABLE default
3
4
5
6
7
VECTORS velocity double
3 4 5
6 7 8
1 2 3
6 7 8
8 9 0







On Wed, Oct 19, 2011 at 5:31 PM, David Doria <daviddoria at gmail.com> wrote:

> On Wed, Oct 19, 2011 at 5:27 PM, Gaurish Telang <gaurish108 at gmail.com>
> wrote:
> > Hi I am new to the VTK toolkit. Is there any standard VTK function/
> library
> > available to read the VTK files. The file which I want to read into my
> C++
> > program looks like
> > # vtk DataFile Version 3.0
> > The actual time is 0.01000000
> > ASCII
> > DATASET POLYDATA
> > POINTS 5 double
> > 1.0 3.0 6.8
> > 2.3 4.5 6.7
> > 4.5 6.7 9.0
> > 1.2 3.4 5.6
> > 2.1 1.5 2.3
> > POINT_DATA 5
> > SCALARS pressure double
> > LOOKUP_TABLE default
> > 3.4
> > 6.7
> > 8.9
> > 3.5
> > 6.9
> > SCALARS density double
> > LOOKUP_TABLE default
> > 3
> > 4
> > 5
> > 6
> > 7
> > VECTORS velocity double
> > 3 4 5
> > 6 7 8
> > 1 2 3
> > 6 7 8
> > 8 9 0
> > I want  to read this information into the arrays
> > xp[5], yp[5], zp[5] (the first block of numbers)
> > pressure[5] (second block)
> > density[5] (third block)
> > velocity_x[5], velocity_y[5] velocity_z[5] (fourth block)
>
> If this is a .vtk "legacy" file, I think you can use:
> http://www.vtk.org/Wiki/VTK/Examples/Cxx/IO/GenericDataObjectReader
>
> David
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20111019/3009d25d/attachment.htm>


More information about the vtkusers mailing list