pysdic.Mesh.from_pyvista#

classmethod Mesh.from_pyvista(mesh, *, element_type=None, load_properties=True)[source]#

Create a mesh from a pyvista.DataSet with a single cell type (pyvista.UnstructuredGrid, pyvista.PolyData, …).

A dataset which is not a pyvista.UnstructuredGrid is first converted with cast_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

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:

pysdic.Mesh

Raises:
  • TypeError – If mesh is not a pyvista.DataSet.

  • ValueError – If the cells do not have exactly one type, or if element_type does not match the cells.