pysdic.Mesh.remove_vertices_by_index#
- Mesh.remove_vertices_by_index(indices, *, propagate_properties=True)[source]#
Remove the vertices with the given indices.
The elements using a removed vertex are removed too, and the indices of the remaining elements are renumbered.
- Parameters:
indices (Union[Integral, ArrayLike]) – An index or an integer array of shape \((R,)\) with indices in \([0, N_v)\). Duplicates are allowed.
propagate_properties (bool, optional (default:
True)) – If False, the new mesh has no vertex and element properties.
- Returns:
The mesh without the given 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.remove_vertices_by_index(2) 9print(filtered.n_vertices) # 3 10print(filtered.elements) # [[0 1 2]] (the old element [0, 1, 3])