mesh.Mesh.connected_elements#

Mesh.connected_elements(startat, mask, level=0)#

Return the elements reachable from startat.

Finds the elements which can be reached from startat by walking along a mask (a subset of elements). Walking is possible over nodes, edges or faces, as specified in level.

Parameters#

startat: int or array_like, int.

The starting element number(s).

level: int

Specifies how elements can be reached: via node (0), edge (1) or face (2).

mask: array_like, bool or int

Flags the elements that are considered walkable. It is an int array with the walkable element numbers, or a bool array flagging these elements with a value True. If none of the start elements is in mask, the result will obviously be nil.

Returns#

array

List of element indices that can be reached from any of the start elements by walking only over elements in mask.

Examples#

>>> M = Mesh(eltype='quad4').subdivide(3,2)
>>> ind = M.connected_elements(startat=0, mask=[0,3,5])
>>> print(ind)
[0 3]
>>> mask = [True, False, True, True, True, False]
>>> ind = M.connected_elements(startat=0, mask=mask, level=1)
>>> print(ind)
[0 3 4]