sgio.core.mesh.renumber_elements#

sgio.core.mesh.renumber_elements(mesh: SGMesh | Mesh)#

Renumber elements sequentially starting from 1.

Renumbers all element IDs in the mesh to consecutive integers starting from 1, ordered by cell block. Modifies the mesh in-place.

Parameters:

mesh (SGMesh or Mesh) – Mesh object to renumber. Must have cell_data[‘element_id’].

Raises:

ValueError – If mesh does not have cell_data or cell_data[‘element_id’].

Examples

>>> mesh = SGMesh(points, cells, cell_data={'element_id': [[10, 20, 30]]})
>>> renumber_elements(mesh)
>>> print(mesh.cell_data['element_id'])
[[1, 2, 3]]

Notes

This function modifies the mesh in-place. Element IDs are renumbered consecutively starting from 1, across all cell blocks in order.