Mondaic

salvus.mesh.data_structures.salvus_mesh.algorithms.itertools

salvus.mesh.data_structures.salvus_mesh.algorithms.itertools salvus mesh data_structures salvus_mesh algorithms itertools

Take elements from a mesh.

Functions

take()

def take(mesh: Mesh, global_element_ids: npt.NDArray) -> Mesh | None: ...

Return a mesh containing only the elements whose global ids appear in global_element_ids.

Parameters
  • mesh Mesh — Source mesh.
  • global_element_ids npt.NDArray — Iterable / array of global element ids to retain. Ids not present in the source mesh are silently ignored.
Returns Mesh | None — A new mesh consisting solely of the retained elements, or None if none of the requested ids are present. Mesh-level metadata, attributes, and side sets are propagated and pruned to match the reduced mesh; side sets that become empty are removed.

take_block()

def take_block(
    mesh_block: MeshBlock,
    global_element_ids: npt.NDArray,
    global_connectivity: npt.NDArray,
) -> MeshBlock | None: ...

Extract a new mesh block containing only the elements whose global IDs appear in global_element_ids.

Parameters
  • mesh_block MeshBlock — Source mesh block.
  • global_element_ids npt.NDArray — Global element IDs to retain (others are ignored).
  • global_connectivity npt.NDArray — Connectivity array (already compacted) for all retained elements across all blocks.
Returns MeshBlock | None — A new mesh block consisting solely of the retained elements, or None if none of the requested ids are present. Block-level metadata and attributes are propagated to the reduced block.