mesh.Mesh.split_degenerate#

Mesh.split_degenerate(reduce=True, return_indices=False)#

Split a Mesh in non-degenerate and degenerate elements.

Splits a Mesh in non-degenerate elements and degenerate elements, and tries to reduce degenerate elements to lower plexitude elements.

Parameters#

reduce: bool or ElementType name

If True, the degenerate elements will be tested against known degeneration patterns, and the matching elements will be transformed to non-degenerate elements of a lower plexitude. If a string, it is an element name and only transforms to this element type will be considered. If False, no reduction of the degenerate elements will be attempted.

return_indices: bool, optional

If True, also returns the element indices in the original Mesh for all of the elements in the derived Meshes.

Returns#

list of Mesh objects

The list of Meshes resulting from the split operation. The first holds the non-degenerate elements of the original Mesh. The last holds the remaining degenerate elements. The intermediate Meshes, if any, hold elements of a lower plexitude than the original.

Warning#

The Meshes that hold reduced elements may still contain degenerate elements for the new element type.

Examples#

>>> M = Mesh(np.zeros((4,3)),
...     [[0,0,0,0],
...      [0,0,0,1],
...      [0,0,1,2],
...      [0,1,2,3],
...      [1,2,3,3],
...      [2,3,3,3],
...     ],eltype='quad4')
>>> M.elems.listDegenerate()
array([0, 1, 2, 4, 5])
>>> for Mi in M.split_degenerate(): print(Mi)
Mesh: n_nodes: 4, n_elems: 1, plexitude: 4, level: 2, eltype: quad4
  BBox: [0.  0.  0.], [0.  0.  0.]
  Size: [0.  0.  0.]
  Length: 0.0  Area: 0.0
Mesh: n_nodes: 4, n_elems: 5, plexitude: 3, level: 2, eltype: tri3
  BBox: [0.  0.  0.], [0.  0.  0.]
  Size: [0.  0.  0.]
  Length: 0.0  Area: 0.0
>>> conn,ind = M.split_degenerate(return_indices=True)
>>> print(ind[0],ind[1])
[3] [0 1 2 5 4]
>>> print(conn[1].elems)
[[0 0 0]
 [0 0 1]
 [0 1 2]
 [2 3 3]
 [1 2 3]]
>>> print(M.split_degenerate(reduce=False)[1])
Mesh: n_nodes: 4, n_elems: 5, plexitude: 4, level: 2, eltype: quad4
  BBox: [0. 0. 0.], [0. 0. 0.]
  Size: [0. 0. 0.]
  Length: 0.0  Area: 0.0