[vtkusers] exporting numpy array to unstructured grid

Florian Bruckner e0425375 at gmail.com
Mon Jun 7 03:31:22 EDT 2010


hi all,

i want to write a simple filter that does some calculates with an vtk
unstructured grid input data and finally writes it again to a vtk file.
Thanks to your help up to now i can read the unstructured grid data,
transfrom it to a numpy array and process it:

from vtk.util import numpy_support as VN

data = ug.GetPointData()
vtk_array = data.GetArray(array_id)
numpy_array = VN.vtk_to_numpy(vtk_array)

then i can process the numpy data but unfortunately vtk_to_numpy() seems
to copy the given array so i need a method to put to the calculated data
back in the vtk data structure. I don't see a SetArray() function that
would correspond the the GetArray() from the upper example!? there is a
SetVoidArray() function but this seems like a dirty solution.

which method can i use for this problem? is their a possiblity to change
the data directly without copying it?

thanks
FloB





More information about the vtkusers mailing list