mesh.Mesh.reachable_from#

Mesh.reachable_from(elements, level=0)#

Select the elements reachable from the specified elements.

Elements are reachable if one can travel from one of the origin elements to the target, by only following the specified level of connections.

Parameters#

elements: int or int array_like

Element number(s) from where to start the walk.

level: int

The level of the entities used to define connections. If negative, it is a value relative to the level of the caller. If non-negative, it specifies the absolute level. Default is 0 (nodes).

Returns#

int array

A list of the numbers of all the elements in the Mesh reachable from any of the specified elements by walking over entities of the specified level. The list will include the original set of elements.

Examples#

>>> M1 = Mesh(eltype='quad4').subdivide(2)
>>> M2 = Mesh(eltype='quad4')
>>> M = M1 + M2.translate([1.0, 1.0, 0.0])
>>> print(M.reachable_from(0,level=0))
[0 1 2 3 4]
>>> print(M.reachable_from(0,level=1))
[0 1 2 3]