Mondaic
This API reference is not for the latest stable Salvus version.

salvus.mesh.chunked_interface

Build a cartesian mesh chunkwise to avoid memory overflow

Functions

create_mesh_chunkwise()

def create_mesh_chunkwise(
    ms: salvus.mesh.simple_mesh.config.BaseMesh,
    output_filename: Union[str, pathlib.Path],
    nchunkx: Optional[int] = None,
    nchunky: Optional[int] = None,
    show_progress: bool = True,
) -> None:
    ...

Create the mesh chunkwise to avoid memory bottlenecks.

First creates each chunk of the mesh and writes it to a temporary file and then merges the chunks into a single mesh file while only reading the surface of each chunk to memory. The resulting mesh should be equivalent to the one created by ms.create_mesh()

Parameters
  • ms salvus.mesh.simple_mesh.config.BaseMesh — One of the following simple_mesh constructors: SphericalChunk3D, Cartesian3D, Cartesian3DHomogeneous, Cartesian2D, Cartesian2DHomogeneous
  • output_filename Union[str, pathlib.Path] — Filename of the mesh file (h5 format).
  • nchunkx Optional[int] — number of chunks in the first lateral dimension
  • nchunky Optional[int] — number of chunks in the second lateral dimension. Ignored in 2D.
  • show_progress bool — show a progress bar while meshing & merging.
Returns None

merge_unstructured_meshes_from_h5()

def merge_unstructured_meshes_from_h5(
    filenames: Union[List[str], List[pathlib.Path]],
    tmpdir: Union[str, pathlib.Path],
    output_filename: Union[str, pathlib.Path],
    show_progress: bool = True,
) -> None:
    ...

Merges meshes from a list of files, only keeping the surface of each chunk in memory to avoid memory bottlenecks. Assumes that the chunks are not overlapping but share surfaces. This assumption is not verified and if violated may lead to unusable output.

Parameters
  • filenames Union[List[str], List[pathlib.Path]] — list of filenames
  • tmpdir Union[str, pathlib.Path] — a temporary directory to store temporary data
  • output_filename Union[str, pathlib.Path] — Filename of the mesh file (h5 format).
  • show_progress bool — show a progress bar while meshing & merging.
Returns None