Skip to content

ResultReader

ResultReader

ResultReader(path: Union[str, Path])

Bases: ABC

Advanced interface for implementing a new recorder-file reader.

Most users should use open_results(), not subclass this interface. A reader supplies a single file/partition's geometry, sample coordinates, and fields. Advertise only implemented capabilities; unsupported operations raise UnsupportedResultOperation by default.

Parameters:

Name Type Description Default
path Union[str, Path]

File path stored by the base class. Concrete readers own validation and file handles, and must release resources in close().

required
Note

Indices passed to history/frame methods are zero-based mesh indices, not solver entity tags. Fields and sample coordinates retain file units. Register an implementation with femora.results.register_reader() to use it through open_results(). Context-manager exit calls close().

Attributes

capabilities abstractmethod property

capabilities: FrozenSet[str]

Operations supported by this reader.

times abstractmethod property

times: Optional[ndarray]

Return recorded times, or None when time was not recorded.

number_of_steps abstractmethod property

number_of_steps: int

Return the number of recorded samples independently of time data.

available_point_responses abstractmethod property

available_point_responses: tuple[str, ...]

Return available transient point-response names.

available_cell_responses abstractmethod property

available_cell_responses: tuple[str, ...]

Return available transient cell-response names.

mesh property

mesh

Return this reader's mesh when geometry is supported.

Methods:

supports

supports(capability: str) -> bool

Return whether the reader supports an operation.

point_history

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

Return one point's response over all recorded times.

cell_history

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

Return one cell's response over all recorded times.

point_frame

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

Return a point-response field at one recorded step.

cell_frame

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

Return a cell-response field at one recorded step.

close

close() -> None

Release resources held by the reader.