Wrap vtkSOADataArrayTemplate
This MR provides python wrapping for vtkSOADataArrayTemplate, so that people can use code like this:
print(vtk.vtkSOADataArrayTemplate.keys())
a = vtk.vtkSOADataArrayTemplate['float64']()
a.SetNumberOfComponents(3)
a.SetNumberOfTuples(1)
a.SetTuple(0, (1,2,3))
a.GetTuple(0)
It is also possible to use a vtkSOADataArray as a zerocopy interface to a numpy array:
b = numpy.array([1,2,3],'d')
c = numpy.array([4,5,6],'d')
a = vtk.vtkSOADataArrayTemplate['d']()
a.SetNumberOfComponents(2)
a.SetArray(0, b, len(b), True, True)
a.SetArray(1, c, len(c), True, True)
This has to be done with care, however, because the numpy array still "owns" the memory, and the memory will be deleted when the numpy array destructs. It is possible to keep the numpy arrays alive by setting them as attributes of the VTK array:
a.arrays = [b, c]
Edited by David Gobbi