View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0015889ParaView(No Category)public2015-12-17 05:482016-07-22 19:22
ReporterNico Schlömer 
Assigned ToT.J. Corona 
PrioritynormalSeverityminorReproducibilityhave not tried
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0015889: classic vtk files written with wrong data type (single instead of double)
DescriptionWhen 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.
TagsHackathon-July-2016
ProjectTBD
Topic Name
Typeincorrect functionality
Attached Files

 Relationships

  Notes
(0036403)
T.J. Corona (developer)
2016-07-13 15:24

See merge request: https://gitlab.kitware.com/vtk/vtk/merge_requests/1694 [^]
(0036475)
T.J. Corona (developer)
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 (manager)
2016-07-22 19:22

Tested master, local server, linux.

 Issue History
Date Modified Username Field Change
2015-12-17 05:48 Nico Schlömer New Issue
2016-07-12 11:48 Utkarsh Ayachit Tag Attached: Hackathon-July-2016
2016-07-13 14:34 T.J. Corona Assigned To => T.J. Corona
2016-07-13 14:34 T.J. Corona Status backlog => active development
2016-07-13 14:34 T.J. Corona Resolution open => fixed
2016-07-13 15:24 T.J. Corona Note Added: 0036403
2016-07-13 15:24 T.J. Corona Status active development => gatekeeper review
2016-07-14 15:36 T.J. Corona Note Added: 0036475
2016-07-14 15:36 T.J. Corona Status gatekeeper review => customer review
2016-07-22 19:22 Alan Scott Note Added: 0036550
2016-07-22 19:22 Alan Scott Status customer review => closed


Copyright © 2000 - 2018 MantisBT Team