salvus.mesh.chunked_interface
Build a cartesian mesh chunkwise to avoid memory overflow
Functions
create_mesh_chunkwise()
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
mssalvus.mesh.simple_mesh.config.BaseMesh — One of the following simple_mesh constructors: SphericalChunk3D, Cartesian3D, Cartesian3DHomogeneous, Cartesian2D, Cartesian2DHomogeneousoutput_filenameUnion[str, pathlib.Path] — Filename of the mesh file (h5 format).nchunkxOptional[int] — number of chunks in the first lateral dimensionnchunkyOptional[int] — number of chunks in the second lateral dimension. Ignored in 2D.show_progressbool — show a progress bar while meshing & merging.
Returns None
merge_unstructured_meshes_from_h5()
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
filenamesUnion[List[str], List[pathlib.Path]] — list of filenamestmpdirUnion[str, pathlib.Path] — a temporary directory to store temporary dataoutput_filenameUnion[str, pathlib.Path] — Filename of the mesh file (h5 format).show_progressbool — show a progress bar while meshing & merging.
Returns None