[vtkusers] VtkIdList and SetArray, allocation error
foufara
foufara at yahoo.fr
Fri Apr 28 13:53:20 EDT 2017
Hi All,
First, thank you Kitware for VTK ! It is really great ! A real pleasure to
use it in my everyday work.
I'm using vtk 7.1.0 with Python bindings on a Mac with Sierra (OS 10.12).
Since quite recently (VTK 7.0 ?), vtkIdList has a new method SetArray which
should allow us to link it to an numpy array.
I suppose that this should enable us to create large vtkIdList more
efficiently than when using InsertNextId or another similar method (like
when using numpy_support for vtkDataArrays)
So I tried something like this :
a=np.arange(10)
l=vtk.vtkIdList()
l.SetArray(a,len(a))
print l.GetNumberOfIds()
for i in range(l.GetNumberOfIds()):
print i,l.GetId(i)
It seems to work fine, but when I quit python, I get en error message saying
"Python(13731,0x7fff9714b3c0) malloc: *** error for object 0x7fe9611a4c80:
pointer being freed was not allocated"
And I really don't know how to prevent this.
I tried to call the Allocate or the SetNumberOfIds methods first. But this
does not change anything.
Besides, the error does not occur everytime.
Can you help me on that ? Try that code on another OS (several times) ?
Thank you for your help !
Raphaël
--
View this message in context: http://vtk.1045678.n5.nabble.com/VtkIdList-and-SetArray-allocation-error-tp5743017.html
Sent from the VTK - Users mailing list archive at Nabble.com.
More information about the vtkusers
mailing list