Skip to content

VTKHDFResultReader

VTKHDFResultReader

VTKHDFResultReader(path: Union[str, Path])

Bases: ResultReader

Read one OpenSees VTKHDF partition using lazy HDF5 history access.

Prefer open_results() for ordinary use and for multiple MPI partitions. Direct access is useful for extracting a field at one recorded sample.

Parameters:

Name Type Description Default
path Union[str, Path]

Existing VTKHDF file containing VTKHDF/Points and Steps/Values.

required

Raises:

Type Description
FileNotFoundError

The file does not exist.

ResultFormatError

Required VTKHDF layout entries are missing.

OSError

HDF5 cannot open the file. Wait for the solver to close it; do not bypass file locks to read an active recorder.

Example
from femora.results.readers import VTKHDFResultReader

with VTKHDFResultReader("results/response0.vtkhdf") as reader:
    displacement = reader.point_frame("displacement", step=-1)
    geometry = reader.mesh
Note

Names are the stored field names: displacement, velocity, acceleration, force3D, and localForce3D are typical OpenSees outputs. No alias rewriting, unit conversion, acceleration conversion, or force interpretation occurs. Only fields present in both data and per-step offsets are advertised. Unsupported element responses may be stored as zeros by the solver.

Attributes

capabilities property

capabilities: FrozenSet[str]

Available mesh, history, and frame operations based on stored fields.

times property

times: ndarray

Recorded Steps/Values array; static samples may be pseudo-time.

number_of_steps property

number_of_steps: int

Number of stored samples, not necessarily the solver step count.

number_of_points property

number_of_points: int

Point count for the first mesh, excluding repeated transient counts.

number_of_cells property

number_of_cells: int

Cell count for the first mesh, excluding repeated transient counts.

available_point_responses property

available_point_responses: tuple[str, ...]

Names with both point data and per-step offsets in this file.

available_cell_responses property

available_cell_responses: tuple[str, ...]

Names with both cell data and per-step offsets in this file.

mesh property

mesh: UnstructuredGrid

Cached PyVista mesh; copy it before modifying coordinates or arrays.

Methods:

point_history

point_history(response: str, point_index: int, component: Component = None) -> np.ndarray

Read one local point over all samples.

Parameters:

Name Type Description Default
response str

Stored point field name.

required
point_index int

Zero-based mesh-point index, not a node tag.

required
component Component

None for all components, an integer, or x/y/z.

None

Returns:

Type Description
ndarray

NumPy array of samples, with a component dimension unless selected

ndarray

explicitly or the stored field is scalar.

Raises:

Type Description
KeyError

Field data or its per-step offsets are absent.

IndexError

Point or component index is outside the stored array.

cell_history

cell_history(response: str, cell_index: int, component: Component = None) -> np.ndarray

Read one local cell's recorded history.

Parameters:

Name Type Description Default
response str

Stored cell field name, such as force3D.

required
cell_index int

Zero-based mesh-cell index, not an element tag.

required
component Component

None for all components, or an integer component index.

None

Returns:

Type Description
ndarray

NumPy array of samples and, when applicable, components.

Raises:

Type Description
KeyError

Field data or offsets are absent.

IndexError

Cell or component index is out of range.

point_frame

point_frame(response: str, step: int, component: Component = None) -> np.ndarray

Read all points at one recorded sample, without deforming the mesh.

Parameters:

Name Type Description Default
response str

Stored point field name.

required
step int

Zero-based sample index; -1 selects the last sample.

required
component Component

None for every component, an integer, or x/y/z.

None

Returns:

Type Description
ndarray

Array shaped (points, components), or (points,) for a scalar/selected

ndarray

component. Translational/rotational components are not separated.

Raises:

Type Description
KeyError

Requested field is unavailable.

IndexError

Sample index is out of range.

cell_frame

cell_frame(response: str, step: int, component: Component = None) -> np.ndarray

Read all cells at one recorded sample.

Parameters:

Name Type Description Default
response str

Stored cell field name, such as force3D.

required
step int

Zero-based sample index; negative indices count from the end.

required
component Component

None for all components, or an integer component index.

None

Returns:

Type Description
ndarray

Array shaped (cells, components), or (cells,) for scalar/selected data.

Raises:

Type Description
KeyError

Requested field is unavailable.

IndexError

Sample index is out of range.

close

close() -> None

Close the HDF5 handle; context-manager exit calls this automatically.