Skip to content

cycle_builder

CycleBuilder

Builds pyvista PolyData from cycle DataFrame and updates data based on timestep.

Attributes:

Name Type Description
coords ndarray

Coordinates of the scalar field.

cycles DataFrame

DataFrame containing cycle data.

scalar_column str

Name of the column containing scalar data.

pv_object PolyData

Built pyvista object.

coords = coords instance-attribute

cycles = cycles instance-attribute

pv_object = pv.PolyData() instance-attribute

scalar_column = scalar_column instance-attribute

__init__(coords, cycles, scalar_column=None)

Initialize a CycleBuilder with coordinates and cycle data.

Parameters:

Name Type Description Default
coords ndarray

Array of vertex coordinates with shape (N, 3).

required
cycles DataFrame

DataFrame containing cycle data for each vertex.

required
scalar_column str | None

Name of the column in cycles to use as scalar values. If None, no scalar column is assigned. Defaults to None.

None

Attributes:

Name Type Description
coords ndarray

Stored vertex coordinates.

cycles DataFrame

Stored cycle data.

scalar_column str | None

Column used for scalar values, if provided.

pv_object PolyData | None

PyVista PolyData object, initially None.

build()

Build pyvista object from cycle data.

Returns:

Type Description
PolyData

pv.PolyData: Built pyvista object.

update(timestep, prev_time=-1.0)

Update pyvista object based on timestep.

Parameters:

Name Type Description Default
timestep int

Timestep to update the object for.

required
prev_time float

Previous timestep value for updates.

-1.0

Returns:

Type Description
PolyData

pv.PolyData: Updated pyvista object.