salvus.mesh.data_structures.distributed_mesh.distributed_mesh
The distributed mesh data structure.
Classes
DistributedMesh
DistributedMeshclass DistributedMesh(builtins.object):
def __init__(
self,
comm: int,
embedding: Mesh,
mesh: Mesh,
global_element_map: list[npt.NDArray],
dmplex: bindings.DMPlex | None,
) -> None: ...A mesh distribtuted across multiple MPI ranks.
commint — The MPI communicator.embeddingMesh — The embedding mesh.meshMesh — The local mesh on this rank.global_element_maplist[npt.NDArray] — A list mapping from rank to the global element IDs owned by that rank.dmplexbindings.DMPlex | None — The distributed DMPlex object.
all_nodal_fields set[str]
all_nodal_fields set[str]All nodal fields across all blocks.
global_element_ids_rank npt.NDArray
global_element_ids_rank npt.NDArrayThe global element ids of the elements on this rank.
global_variables dict[str, allowed_global_types]
global_variables dict[str, allowed_global_types]The global variables.
model_order int
model_order intThe model order.
nodal_fields_per_block dict[int, set[str]]
nodal_fields_per_block dict[int, set[str]]The nodal fields per block.
number_of_dimensions int
number_of_dimensions intThe number of spatial dimensions.
number_of_elements int
number_of_elements intThe total number of elements.
side_sets tuple[SideSet, ...]
side_sets tuple[SideSet, ...]The side sets.
reduce_from_mesh()
reduce_from_mesh()def reduce_from_mesh(
self,
element_selection_function: collections.abc.Callable,
mesh: Mesh | None,
reduction_operations_per_field: dict[str, str],
timer: Timer | None = None,
log_to_logger: bool = False,
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.
element_selection_functioncollections.abc.Callable — Function that takes the global element indices returns the indices to keep.meshMesh | None — The mesh to reduce from. Can be None on ranks that have no elements selected by the element selection function.reduction_operations_per_fielddict[str, str] — Dictionary mapping field names to reduction operations. Reduction operations can be “sum”, “min”, “max”, or “replace”.timerTimer | None — Execution timer.log_to_loggerbool — Whether to log timing to the logger.reentrant_timerbool — Whether the timer is reentrant.artifactsArtifactsFromToMesh | None — Optional cached intermediates from a priorto_mesh_with_artifacts()call on the same distributed mesh and selection. When given, the element selection call,discretize_blocks, andget_aperture_sfsare skipped.
to_mesh()
to_mesh()def to_mesh(
self,
element_selection_function: collections.abc.Callable,
timer: Timer | None = None,
log_to_logger: bool = False,
reentrant_timer: bool = False,
) -> Mesh | None: ...Convert to a regular Mesh by selecting elements.
It will gather the selected elements from all ranks.
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.
element_selection_functioncollections.abc.Callable — Function that takes the global element indices returns the indices to keep.timerTimer | None — Execution timer.log_to_loggerbool — Whether to log timing to the logger.reentrant_timerbool — Whether the timer is reentrant.
to_mesh_with_artifacts()
to_mesh_with_artifacts()def to_mesh_with_artifacts(
self,
element_selection_function: collections.abc.Callable,
timer: Timer | None = None,
log_to_logger: bool = False,
reentrant_timer: bool = False,
cached_block_dms: (
list[tuple[bindings.DMPlex, bindings.DMPlex]] | None
) = None,
) -> tuple[Mesh | None, ArtifactsFromToMesh]: ...Like to_mesh but also returns cacheable intermediates.
The returned ArtifactsFromToMesh can be passed back to
reduce_from_mesh() (via its artifacts argument) on the same
distributed mesh and selection to skip redundant work.
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.
element_selection_functioncollections.abc.Callable — Function that takes the global element indices and returns the indices to keep.timerTimer | None — Execution timer.log_to_loggerbool — Whether to log timing to the logger.reentrant_timerbool — Whether the timer is reentrant.cached_block_dmslist[tuple[bindings.DMPlex, bindings.DMPlex]] | None — Optional pre-computed per-block DMPlex objects from a previous call. If given, theDiscretize blocksstep is skipped.
(mesh, artifacts). mesh is None if no elements were selected on this rank.