CommonArrayValue#

class ansys.tools.variableinterop.variable_value.CommonArrayValue(shape, dtype=float, buffer=None, offset=0, strides=None, order=None)#

Bases: Generic[T], numpy.ndarray[Any, numpy.dtype[T]], IVariableValue, abc.ABC

Defines an interface for the behavior common among all array types.

This class inherits the IVariableValue class.

The numpy.ndarray base is spelled out rather than written as numpy.typing.NDArray[T]. NumPy 2.5 redefined NDArray as a PEP 695 type alias, which cannot be used as a base class: at runtime its __mro_entries__ no longer resolves to numpy.ndarray, which raises a metaclass conflict against ABCMeta. Writing the parameterized ndarray directly resolves to numpy.ndarray on every supported NumPy version while keeping the element type visible to type checkers.

Overview#

get_lengths

Get the dimension sizes of the array.

rank

Get the number of dimensions in the array.

Import detail#

from ansys.tools.variableinterop.variable_value import CommonArrayValue

Method detail#

CommonArrayValue.get_lengths() → Tuple[int]#

Get the dimension sizes of the array.

Returns:
Tuple[int]

Dimension sizes of the array.

CommonArrayValue.rank() → int#

Get the number of dimensions in the array.

Returns:
int

Number of dimensions in the array.