pysdic.Mesh.filter_vertices#
- Mesh.filter_vertices(mask, *, propagate_properties=True)[source]#
Keep only the vertices selected by a boolean mask.
The elements using a removed vertex are removed too, and the indices of the remaining elements are renumbered.
- Parameters:
mask (ArrayLike) – A boolean array of shape \((N_v,)\), True for the vertices to keep.
propagate_properties (bool, optional (default:
True)) – If False, the new mesh has no vertex and element properties.
- Returns:
The mesh with the selected vertices.
- Return type:
Examples
1import numpy 2from pysdic import Mesh 3 4points = numpy.array([[0, 0, 0], [1, 0, 0], [0, 1, 0], [0, 0, 1]]) 5elements = numpy.array([[0, 1, 2], [0, 1, 3], [0, 2, 3], [1, 2, 3]]) 6mesh = Mesh(points, elements, element_type="triangle_3") 7 8filtered = mesh.filter_vertices([True, True, False, True]) 9print(filtered.n_vertices) # 3 10print(filtered.elements) # [[0 1 2]] (the old element [0, 1, 3])