pyfebiopt.visualization.plotter
Helpers for translating FEBio meshes to PyVista geometries and fields.
Classes
Build per-domain grids and attach pre-sliced results to PyVista. |
Module Contents
- class pyfebiopt.visualization.plotter.PVBridge
Build per-domain grids and attach pre-sliced results to PyVista.
- domain_grid(domain: str) Any
Build the unstructured grid for the requested domain.
- Parameters:
domain – Domain/part name from the mesh.
- Returns:
PyVista
UnstructuredGridfor the domain.- Return type:
Any
Example
grid = PVBridge(mesh).domain_grid("artery")
- surface_mesh(surface: str) Any
Build the surface mesh for the requested surface.
- Parameters:
surface – Surface name from the mesh.
- Returns:
PyVista
PolyDatafor the surface.- Return type:
Any
- add_node_result_array(ds: pyvista.DataSet, *, view: pyfebiopt.xplt.views.NodeResultView, data: numpy.ndarray, name: str | None = None, set_active: bool = True) str
Attach nodal results to the dataset with appropriate structure.
- Parameters:
ds – Target PyVista dataset.
view – Source view that describes the nodal result.
data – Nodal array (N or N x C).
name – Optional field name override.
set_active – Whether to set scalars/vectors/tensors active.
- Returns:
Name of the attached field.
- Return type:
str
Example
bridge.add_node_result_array(grid, view=U_view, data=U, name="U")
- add_elem_item_array(ds: pyvista.UnstructuredGrid, *, view: pyfebiopt.xplt.views.ItemResultView, domain: str, data: numpy.ndarray, name: str | None = None, set_active: bool = True) str
Attach the provided element array to the cell data.
- Parameters:
ds – Target unstructured grid.
view – Item view describing the result.
domain – Domain label (unused; kept for symmetry with callers).
data – Element result array.
name – Optional field name override.
set_active – Whether to set the field active.
- Returns:
Name of the attached field.
- Return type:
str
- add_face_item_array(ds: pyvista.PolyData | pyvista.UnstructuredGrid, *, view: pyfebiopt.xplt.views.ItemResultView, surface: str, data: numpy.ndarray, name: str | None = None, set_active: bool = True) str
Attach the provided face array to the surface or cell data.
- Parameters:
ds – Target polydata or unstructured grid.
view – Item view describing the result.
surface – Surface name (unused; for API symmetry).
data – Face result array.
name – Optional field name override.
set_active – Whether to set the field active.
- Returns:
Name of the attached field.
- Return type:
str
- add_elem_mult_reduced_array(ds: pyvista.UnstructuredGrid, *, view: pyfebiopt.xplt.views.MultResultView, domain: str, data: numpy.ndarray, reducer: str = 'mean', name: str | None = None, set_active: bool = True) str
Reduce node-wise element arrays to one value per cell then attach.
- Parameters:
ds – Target unstructured grid.
view – Mult result view.
domain – Domain label (unused; for API symmetry).
data – Block array shaped (R, Kmax[, C]).
reducer – Reduction method (mean, max, min, first).
name – Optional field name override.
set_active – Whether to set the field active.
- Returns:
Name of the attached field.
- Return type:
str
- region_series_array(*, data: numpy.ndarray) numpy.ndarray
Normalize region time series data to float32 arrays.
- Parameters:
data – Array shaped (T, C…) to be flattened on the last axes.
- Returns:
Array shaped (T, -1) in float32.
- Return type:
np.ndarray
- Usage:
flattened = bridge.region_series_array(data=series_block)