MantisBT - ParaView
View Issue Details
0015889ParaView(No Category)public2015-12-17 05:482016-07-22 19:22
Nico Schlömer 
T.J. Corona 
normalminorhave not tried
closedfixed 
 
 
TBD
incorrect functionality
0015889: classic vtk files written with wrong data type (single instead of double)
When writing double-precision data into a (legacy) VTK file, only single-precision is written out.

MWE:
```
import numpy
numpy.set_printoptions(precision=20)

import vtk
from vtk.util import numpy_support

mesh = vtk.vtkUnstructuredGrid()

# add points to mesh
points = numpy.array([[0.1234567890123456789, 0.0, 0.0]])
print(points)
vtk_points = vtk.vtkPoints()
vtk_array = numpy_support.numpy_to_vtk(points)

print(vtk_array)

p2 = numpy_support.vtk_to_numpy(vtk_array)
print(p2)

vtk_points.SetData(vtk_array)
mesh.SetPoints(vtk_points)

# write to VTK
writer = vtk.vtkUnstructuredGridWriter()
writer.SetFileTypeToASCII()
writer.SetFileName('test.vtk')
writer.SetInputData(mesh)
writer.Write()
```

This gives the file
```
# vtk DataFile Version 4.0
vtk output
ASCII
DATASET UNSTRUCTURED_GRID
POINTS 1 double
0.123457 0 0
CELL_TYPES 0
```
The points array is cut short with `0.123457`, seemingly a single precision float.
Hackathon-July-2016
Issue History
2015-12-17 05:48Nico SchlömerNew Issue
2016-07-12 11:48Utkarsh AyachitTag Attached: Hackathon-July-2016
2016-07-13 14:34T.J. CoronaAssigned To => T.J. Corona
2016-07-13 14:34T.J. CoronaStatusbacklog => active development
2016-07-13 14:34T.J. CoronaResolutionopen => fixed
2016-07-13 15:24T.J. CoronaNote Added: 0036403
2016-07-13 15:24T.J. CoronaStatusactive development => gatekeeper review
2016-07-14 15:36T.J. CoronaNote Added: 0036475
2016-07-14 15:36T.J. CoronaStatusgatekeeper review => customer review
2016-07-22 19:22Alan ScottNote Added: 0036550
2016-07-22 19:22Alan ScottStatuscustomer review => closed

Notes
(0036403)
T.J. Corona   
2016-07-13 15:24   
See merge request: https://gitlab.kitware.com/vtk/vtk/merge_requests/1694 [^]
(0036475)
T.J. Corona   
2016-07-14 15:36   
This issue has been fixed with the following commit: https://gitlab.kitware.com/vtk/vtk/commit/47248b0d194a299e35c67af890fa350121e343c2 [^]
(0036550)
Alan Scott   
2016-07-22 19:22   
Tested master, local server, linux.