fieldconverter.py¶
This module provides functions for manipulating simulation data objects to be compatible with the underlying machinery of pyvale.
- simdata_to_pyvista_interp(sim_data, components, spatial_dims)[source]¶
Converts the mesh and field data in a SimData object into a pyvista UnstructuredGrid for interpolating the data.
- Parameters:
sim_data (
SimData) – Object containing a mesh and associated field data from a simulation.components (
tuple[str,...] | None) – String keys for the components of the field to extract from the simulation data.elem_dim (
EDim) – Number of spatial dimensions in the simulation (TWOD or THREED). For mesh-based data this is used to determine the element type and distinguish between 4 node quads in 2D and 4 node tets in 3D. For point cloud data this determines if 2D or 3D Delaunay triangulation is used.
- Returns:
pv.UnstructuredGrid– As pyvista grid with attached field data to allow for interpolation on the mesh using the element shape functions.
- simdata_to_pyvista_vis(sim_data, spatial_dims)[source]¶
Converts the mesh and field data in a SimData object into a pyvista UnstructuredGrid or PolyData object for visualisation.
- Parameters:
sim_data (
SimData) – Object containing a mesh and associated field data from a simulation.elem_dim (
EDim) – Number of spatial dimensions in the simulation (TWOD or THREED). For mesh-based data this is used to determine the element type and distinguish between 4 node quads in 2D and 4 node tets in 3D. For point cloud data this determines if 2D or 3D Delaunay triangulation is used.
- Returns:
pv.UnstructuredGrid | pv.PolyData– A pyvista unstructured grid or poly data object that has no field data attached for visualisation purposes.