Wrapping vtkImplicitArray for python use
vtkImplicitArray
s are not wrapped in python.
I'm going to add some support, so here is an issue to discuss on it before.
Background on implicit arrays
The vtkImplicitArray framework allows to create some vtkDataArray
relying on a Backend, which is given as template class for the implicit array. This backend is also templated on data type.
Usually, it looks like:
vtkImplicitArray<BackendType<DataType>>
Then we have some predefined backend, so we have some dedicated implicit array classes, eg
vtkConstantArray<DataType>
Propositions
vtkDoubleArray
way: create non-templated subclasses
The Create an intermediate, non templated class that can be (automatically) wrapped.
class vtkConstantDoubleArray : vtkConstantArray<double>
This leads to a bunch of new classes, vtkBackendTypeArray
, to fill the whole matrix of [Backend * type]
we would like to support.
vtkSOADataArray
way: modify wrapping code
The The wrapping code should be updated. Also some work needs to be done to mark implicit arrays as wrappable in cmakelists.
This way, concrete class is instantiated through some type dictionary, as described here: https://docs.vtk.org/en/latest/advanced/PythonWrappers.html#class-templates
c = vtkSOADataArrayTemplate['float64']
This looks less userfriendly than previous method.
edit: add option from Spiros comment
vtkTypeFloat64Array
way: generate non-templated class at build time
The Similar to the first option but using cmake
configure_file
to generate the non-templated classes at build time. Avoids bloating the sources with to much wrapping classes.
I'm in favor of the first last method, i.e. create subclasses at build time. Inputs are welcome!
@dgobbi @ben.boeckel @christos.tsolakis @jaswant.panchumarti @mwestphal