mesh.Mesh.connected_to#

Mesh.connected_to(entities, level=0)#

Find the elements connected to specific lower entities.

Parameters#

entities: int or int array_like

The indices of the lower entities to which connection should exist.

level: int

The level of the entities to which connection should exist. 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 the elements that contain at least one of the specified lower entities.

Examples#

>>> M = Mesh(eltype='quad4').subdivide(2,1)
>>> print(M.report(full=True))
Mesh: n_nodes: 6, n_elems: 2, plexitude: 4, level: 2, eltype: quad4
  BBox: [0. 0. 0.], [1. 1. 0.]
  Size: [1. 1. 0.]
  Length: 4.0  Area: 1.0
  Coords: [[0.  0.  0. ]
           [0.5 0.  0. ]
           [1.  0.  0. ]
           [0.  1.  0. ]
           [0.5 1.  0. ]
           [1.  1.  0. ]]
  Elems: [[0 1 4 3]
          [1 2 5 4]]
>>> print(M.edges)
[[0 1]
 [3 0]
 [1 2]
 [1 4]
 [2 5]
 [4 3]
 [5 4]]

The edge [1 4] (index 3) is shared by the 2 elements.

>>> print(M.connected_to(3,level=1))
[0 1]
>>> print(M.connected_to(0,level=0))
[0]