salvus.mesh.data_structures.distributed_mesh.serialization
salvus.mesh.data_structures.distributed_mesh.serialization salvus mesh data_structures distributed_mesh serialization Serialization of distributed meshes to and from disk.
A distributed mesh is written to a directory with one local mesh file per
rank plus a few shared files (the replicated embedding, the global element
map, and a small JSON metadata file). The dmplex attribute is not
serialized but reconstructed when reading.
Functions
read_distributed_mesh()
read_distributed_mesh()def read_distributed_mesh(
source: str | pathlib.Path, comm: int, timer: Timer | None = None
) -> DistributedMesh: ...Read a distributed mesh from a directory.
This is a collective operation that must be called on all ranks of the
reading communicator. Reading is only supported when the reading
communicator has the same size as the communicator the mesh was written
with. The dmplex attribute is reconstructed from the embedding and this
rank’s selection.
sourcestr | pathlib.Path — The directory containing the distributed mesh.commint — The MPI communicator to read into.timerTimer | None — Execution timer.
write_distributed_mesh_to_h5()
write_distributed_mesh_to_h5()def write_distributed_mesh_to_h5(
distributed_mesh: DistributedMesh,
path: str | pathlib.Path,
timer: Timer | None = None,
) -> None: ...Write a distributed mesh to a directory.
This is a collective operation that must be called on all ranks of the
distributed mesh’s communicator. The target directory must not yet exist
and is created by rank 0. Each rank writes its local mesh to
mesh_rank_<rank>.h5. Rank 0 additionally writes the replicated
embedding, the global element map, and a small JSON metadata file. The
dmplex attribute is not written; it is reconstructed when reading.
distributed_meshDistributedMesh — The distributed mesh to write.pathstr | pathlib.Path — The target directory. Must not already exist.timerTimer | None — Execution timer.