mesh.Mesh.get_lower_entities#

Mesh.get_lower_entities(level=-1)#

Get the entities of a lower dimensionality.

Parameters#

level: int

The level of the entities to return. If negative, it is a value relative to the level of the caller. If non-negative, it specifies the absolute level. Thus, for a Mesh with a 3D element type, get_lower_entities(-1) returns the faces, while for a 2D element type, it returns the edges. For both Meshes however, get_lower_entities(+1) returns the edges.

Returns#

Elems

An Elems object defining the lower entities of the specified level in terms of the nodes of the Mesh.

The return value may be an empty table, if the element type does not have the requested entities (e.g. ‘quad4’ Mesh does not have entities of level 3).

If the targeted entity level is outside the range 0..3, the return value is None.

Notes#

This returns all entities for all elements and entities shared by multiple elements will appear multiple times. If you only want the unique lower entities, apply connectivity.Connectivity.remove_duplicate() on the result.

See Also#

  • level(): return the dimensionality of the Mesh

  • connectivity.Connectivity.insertLevel(): returns two tables: elems vs. lower entities, lower enitites vs. nodes.

Examples#

Mesh with one ‘quad4’ element and 4 nodes.

>>> M = Mesh(eltype='quad4')

The element defined in function of the nodes.

>>> print(M.elems)
[[0 1 2 3]]

The edges of the element defined in function of the nodes.

>>> print(M.get_lower_entities(-1))
[[0 1]
 [1 2]
 [2 3]
 [3 0]]

And finally, the nodes themselves: not very useful, but works.

>>> print(M.get_lower_entities(-2))
[[0]
 [1]
 [2]
 [3]]