Mondaic

salvus.mesh.algorithms.distributed_mesh.reduce

salvus.mesh.algorithms.distributed_mesh.reduce salvus mesh algorithms distributed_mesh reduce

Convert an MPI distributed mesh to a regular Mesh on a single rank.

Functions

from_mesh()

def from_mesh(
    distributed_mesh: DistributedMesh,
    element_selection_function: collections.abc.Callable,
    mesh: Mesh | None,
    reduction_operations_per_field: dict[str, str],
    timer: Timer | None = None,
    log_to_logger: bool = True,
    reentrant_timer: bool = False,
    artifacts: ArtifactsFromToMesh | None = None,
) -> None: ...

Reduce a mesh into the distributed mesh.

This function needs to be called on all ranks of a distributed mesh’s communicator. Each rank usually will define its own element selection function.

Parameters
  • distributed_mesh DistributedMesh — The distributed mesh to reduce into.
  • element_selection_function collections.abc.Callable — Function that takes the global element indices returns the indices to keep.
  • mesh Mesh | None — The mesh to reduce from. Can be None on ranks that have no elements selected by the element selection function.
  • reduction_operations_per_field dict[str, str] — Dictionary mapping field names to reduction operations. Reduction operations can be “sum”, “min”, “max”, or “replace”. This must be the same per rank.
  • timer Timer | None — Execution timer.
  • log_to_logger bool — Whether to log timing to the logger.
  • reentrant_timer bool — Whether the timer is reentrant.
  • artifacts ArtifactsFromToMesh | None — Optional cached intermediates from a previous to_mesh_with_artifacts() call on the same distributed mesh and selection. When provided, the element selection call, discretize_blocks, and get_aperture_sfs are skipped. Ignored on the legacy code path.
Returns None