[vtkusers] How to read POINTS with double precision in a vtk data file ?

Dominik Szczerba dominik at itis.ethz.ch
Fri Oct 17 10:32:52 EDT 2008


Dont use ascii to store double data - it is evil in every regard.

Dominik

On Friday 17 October 2008 03:16:06 pm Sophie BOUDAUD wrote:
> Hi vtkusers,
>
> I want to read POINTS in a vtk data file with double precision, sadly
> POINTS values are truncated.
> Can someone explain me what is wrong with my program ?
>
> I'm working on Windows and I'm using TclPro1.4 and VTK4.2.
> My reading VTK file is :
>
> # vtk DataFile Version 3.0
>
> ASCII
> DATASET UNSTRUCTURED_GRID
> POINTS  37466 double
>    -0.1214999924E+03    -0.3000000000E+03     0.8236390114E+01
>    -0.1214999847E+03    -0.3000000000E+03     0.1123638916E+02
> ....
> CELLS    69889  378041
>  1 597
>  1 598
> ...
> CELL_TYPES      69889
>        1
>        1
> ...
> CELL_DATA  69889
> SCALARS MATERIAL float
> LOOKUP_TABLE default
>        1
>        1
> ...
> SCALARS GROUP float
> LOOKUP_TABLE default
>        1
>        1
> ...
>
> I'm using vtkUnstructuredGridReader  to  read my VTK file :
>                 vtkUnstructuredGridReader Ureader
>                         Ureader SetFileName $file
>
> A vtkUnstructuredGrid object is created to insert or delete points or
> cells :
>                 vtkUnstructuredGrid usgModel
>                         usgModel ShallowCopy [Ureader GetOutput]
>
> To get the value of the first point :  set coord(0) [usgModel GetPoint 0]
> The coordinates are :  -121.5 -300 8.23639  !!!!
>
>
>
> Best regards,
>
> Sophie



-- 
Dominik Szczerba, Ph.D.
Computational Physics Group
Foundation for Research on Information Technologies in Society
http://www.itis.ethz.ch



More information about the vtkusers mailing list