[Paraview] dataset_adapter with tensors
Magician
f_magician at mac.com
Sun Dec 13 09:07:52 EST 2015
Hi all,
I'm trying to add 3x3 tensor data to vtkPolyData with Python.
The version of ParaView is 5.0.0 RC1 and 4.4.0.
The smallest example is here:
> import vtk
> import numpy as np
> from paraview.vtk.numpy_interface.dataset_adapter import numpyTovtkDataArray as da
> from paraview.vtk.numpy_interface.dataset_adapter import vtkDataArrayToVTKArray as va
>
> m0 = np.array((
> (0, 1, 2, 3, 4, 5, 6, 7, 8),
> ))
>
> d = vtk.vtkPolyData()
> d.GetPointData().AddArray(da(m0, 'data'))
>
> m1 = []
> for i in range(9):
> m1.append(d.GetPointData().GetArray('data').GetValue(i))
> print(m1)
>
> m2 = va(d.GetPointData().GetArray('data'))
> print(m2)
m1 is good, but m2 is transposed.
Is this a bug of vtkDataArrayToVTKArray?
Magician
More information about the ParaView
mailing list