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()
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
meshMesh — Source mesh.global_element_idsnpt.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()
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_blockMeshBlock — Source mesh block.global_element_idsnpt.NDArray — Global element IDs to retain (others are ignored).global_connectivitynpt.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.