vtkmodules.numpy_interface.utils#

Shared utilities for the new VTK array classes.

This module provides common definitions used across VTKAOSArray, VTKSOAArray, VTKCompositeArray, and VTKNoneArray. It is intentionally independent of dataset_adapter so that the new array classes do not depend on the legacy module.

Module Contents#

Classes#

ArrayAssociation

Easy access to vtkDataObject.AttributeTypes.

Functions#

reshape_append_ones

Append trailing 1s to the shorter shape for broadcasting.

API#

class vtkmodules.numpy_interface.utils.ArrayAssociation#

Easy access to vtkDataObject.AttributeTypes.

POINT#

None

CELL#

None

FIELD#

None

ROW#

None

vtkmodules.numpy_interface.utils.reshape_append_ones(a1, a2)#

Append trailing 1s to the shorter shape for broadcasting.

Given two ndarrays, append 1s to the shape of the array with fewer dimensions until both have the same number of dimensions. This allows operations like (n,3) + (n,) that would otherwise fail with a broadcast error.

Returns a list [a1, a2] where one may have been reshaped.