[vtkusers] vtkUnstructuredGrid with double precision POINTS

Dominik Szczerba dominik at itis.ethz.ch
Thu Oct 16 05:48:37 EDT 2008


in vtkPoints there is a method like SetTypeToDouble.

But in general, sadly, many algorithms hardcode floats. I have reported it as 
bugs a few times (and they were fixed by letting the user chose the type) but 
very many more filters would require that.

Dominik

On Thursday 16 October 2008 11:36:55 am Sophie BOUDAUD wrote:
> Hello UserGroup,
>
> I'm working on Windows and I'm using TclPro1.4 and VTK4.2.
> I'm using vtkUnstructuredGridReader  to  read a VTK file :
>
>                 vtkUnstructuredGridReader Ureader
>                         Ureader SetFileName $file
>
> Next  a vtkUnstructuredGrid object is created to insert or delete points
> or cells :
>
>                 vtkUnstructuredGrid usgModel
>                         usgModel DeepCopy [Ureader GetOutput]
>                         ...
>
> Then I'm writing a new VTK file using vtkUnstructuredGridWriter :
>
> vtkUnstructuredGridWriter uwriter1
>                 uwriter1 SetInput usgModel
>                 uwriter1 SetFileTypeToASCII
>                 uwriter1 SetFileName  $file
>                 uwriter1 Write
>
> I want to keep the double precision for the POINTS coordinates but
> coordinates are truncated when the file is reading.
>
> The reading VTK file is :
>
> # vtk DataFile Version 3.0
>
> ASCII
> DATASET UNSTRUCTURED_GRID
> POINTS  37466 float
>    -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
> ...
>
>
> If POINTS are double :
>
> # 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
> ....
>
> A VTK error occurs when DeepCopy method is used :
>
> ERROR: In C:\martink\vtk42\VTK\Common\vtkPoints.cxx, line 261
> vtkPoints (0x0518D418): Number of components is different...can't copy
>
>
> Does anybody help me ?
> Thank you in advance.
>
> 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