[vtkusers] Reading from a VTK file
David Doria
daviddoria at gmail.com
Wed Oct 19 17:31:39 EDT 2011
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
More information about the vtkusers
mailing list