vtkmodules.numpy_interface._vtk_array_mixin#
Shared base mixin and utilities for VTK data array Python wrappers.
Provides:
VTKDataArrayMixin— base class with metadata management, shape properties, reduction method stubs, and shape/layout methods shared across the VTK array mixins (AOS, SOA).make_override_registry()— create an__array_function__override dict and decorator pair.register_template_overrides()— register a mixin as override for all dtype instantiations of a VTK template class.
Module Contents#
Classes#
Shared base for VTK data array Python mixins (AOS, SOA). |
Functions#
Create an override dict + decorator for |
|
Register a mixin as override for all dtype instantiations of a VTK template. |
API#
- class vtkmodules.numpy_interface._vtk_array_mixin.VTKDataArrayMixin#
Shared base for VTK data array Python mixins (AOS, SOA).
Subclasses must provide
__array__(),GetNumberOfTuples(),GetNumberOfComponents(), andGetDataType()(inherited from the VTK base class in the MRO).- _set_dataset(dataset)#
Store a weak reference to the owning dataset.
- property dataset#
Return the owning dataset (dereferenced from weak ref).
- property association#
Return the association type (POINT, CELL, etc.).
- _wrap_result(result)#
Wrap a numpy result as VTKAOSArray preserving metadata.
Only wraps if result is an ndarray with same number of tuples. Returns plain ndarray/scalar otherwise.
- property shape#
- property ndim#
- property size#
- property T#
- __hash__#
None
- __len__()#
- sum(axis=None, **kwargs)#
- mean(axis=None, **kwargs)#
- min(axis=None, **kwargs)#
- max(axis=None, **kwargs)#
- std(axis=None, **kwargs)#
- var(axis=None, **kwargs)#
- any(axis=None, **kwargs)#
- all(axis=None, **kwargs)#
- prod(axis=None, **kwargs)#
- argmin(axis=None, **kwargs)#
- argmax(axis=None, **kwargs)#
- cumsum(axis=None, **kwargs)#
- cumprod(axis=None, **kwargs)#
- reshape(*args, **kwargs)#
- flatten(order='C')#
- ravel(order='C')#
- copy(order='C')#
- squeeze(axis=None)#
- transpose(*axes)#
- tolist()#
- clip(a_min=None, a_max=None, **kwargs)#
- round(decimals=0, **kwargs)#
- sort(axis=0, **kwargs)#
- dot(other)#
- astype(dtype)#
- vtkmodules.numpy_interface._vtk_array_mixin.make_override_registry()#
Create an override dict + decorator for
__array_function__dispatch.Returns
(registry_dict, register_decorator).Usage::
MY_OVERRIDE, _override_mine = make_override_registry() @_override_mine(numpy.sum) def _my_sum(a, axis=None, **kw): ...
- vtkmodules.numpy_interface._vtk_array_mixin.register_template_overrides(mixin_cls, template_cls, name_prefix, concrete_classes=None)#
Register a mixin as override for all dtype instantiations of a VTK template.
Parameters
mixin_cls : type The Python mixin class (e.g. VTKAOSArray). template_cls : VTK template class The VTK template (e.g. vtkAOSDataArrayTemplate). name_prefix : str Prefix for the generated class names (e.g. ‘VTKAOSArray’). concrete_classes : list of type, optional Additional concrete VTK classes to override (e.g. vtkFloatArray).