pysdic.Mesh.from_vtk#
- classmethod Mesh.from_vtk(dataset, *, element_type=None, load_properties=True)[source]#
Create a mesh from a VTK dataset with a single cell type (
vtkUnstructuredGrid,vtkPolyData, …, i.e. anyvtkPointSet).A dataset which is not a
vtkUnstructuredGridis first converted withvtkAppendFilter. The following fields are read:the points → vertices (always 3D, \(E = 3\)),
the cells → connectivity,
the point data → vertex properties,
the cell data → element properties.
Note
Requires VTK 9 or later (new layout of
vtkCellArray).- Parameters:
dataset (
vtkPointSet) – The VTK 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
datasetis not avtkPointSet, or if a data array is not numeric (useload_properties=Falseto ignore the data).ValueError – If the dataset has no points, if the cells do not have exactly one type, if a data array has no name, or if
element_typedoes not match the cells.