pysdic.Mesh.filter_connectivity#

Mesh.filter_connectivity(mask, *, propagate_properties=True)[source]#

Keep only the elements selected by a boolean mask. The vertices are unchanged (see remove_unused_vertices()).

Parameters:
  • mask (ArrayLike) – A boolean array of shape \((N_e,)\), True for the elements to keep.

  • propagate_properties (bool, optional (default: True)) – If False, the new mesh has no element properties.

Returns:

The mesh with the selected elements.

Return type:

pysdic.Mesh

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_connectivity([True, False, True, False])
9print(filtered.elements)  # [[0 1 2] [0 2 3]]