_BaseFrameMesh

Contents

_BaseFrameMesh#

class _BaseFrameMesh(*args, data=None, dataid=None, iformat=None, **kwargs)[source]#

Bases: ABC

Abstract base class shared by SphericalMesh and CartesianMesh.

Provides:

  • A @singledispatchmethod dispatch mechanism (_dispatch_input) that accepts str / pathlib.Path (HDF file), raw arrays or scalars, or an existing pyvista.DataSet.

  • The full NumPy arithmetic operator suite (+, -, *, /, //, %, **, unary neg/pos/abs) operating element-wise on the active scalar field.

  • __array_ufunc__() so that NumPy ufuncs (e.g. np.sqrt(mesh)) work transparently.

  • Convenient data and scales properties.

Subclasses must define MESH_FRAME, _parse_iformat(), _set_arrays(), and _dispatch_pyvista().

Attributes:
MESH_FRAMEstr

Class-level canonical frame name ('spherical' or 'cartesian').

Methods

_(uinput, *args, iformat, **kwargs)

Handle PyVista dataset input by forwarding to _dispatch_pyvista().

_binary_op(other, ufunc[, swap])

Apply a binary ufunc to self.data and other.

_dispatch_input()

Dispatch constructor input to the appropriate parsing handler.

_dispatch_pyvista(uinput, iformat, deep)

Populate this mesh from an existing pyvista.DataSet.

_parse_iformat(iformat)

Parse iformat into a detected format string and the canonical axis order.

_parse_input(iformat, data, *scales, **kwargs)

Normalise the format string, reorder scales, and call _set_arrays().

_set_arrays(sorder, data, *scales)

Assign coordinate arrays and scalar data to the underlying PyVista dataset.

Properties

data

The active scalar field reshaped to the mesh dimensions in Fortran order.

scales

The three coordinate axis arrays as a tuple (x, y, z).