pysdic.Mesh.from_pyvista#
- classmethod Mesh.from_pyvista(mesh, *, element_type=None, load_properties=True)[source]#
Create a mesh from a
pyvista.DataSetwith a single cell type (pyvista.UnstructuredGrid,pyvista.PolyData, …).A dataset which is not a
pyvista.UnstructuredGridis first converted withcast_to_unstructured_grid. The following fields are read:mesh.points→ vertices (always 3D, \(E = 3\)),the cells → connectivity,
mesh.point_data→ vertex properties,mesh.cell_data→ element properties.
See also
to_pyvista()for the reverse operation.
- Parameters:
mesh (
pyvista.DataSet) – The dataset to read. All its cells must have the same type.element_type (Optional[str], optional) – The type of the elements. By default, it is inferred from the VTK cell type when this type is implemented (otherwise the mesh has no element type).
load_properties (bool, optional (default:
True)) – If False, the point and cell data are ignored.
- Returns:
The new mesh.
- Return type:
- Raises:
TypeError – If
meshis not apyvista.DataSet.ValueError – If the cells do not have exactly one type, or if
element_typedoes not match the cells.