salvus.mesh.data_structures.chunked_mesh.chunked_mesh
Module implemented a mesh object split across multiple files.
Classes
ChunkedMesh
ChunkedMeshclass ChunkedMesh(builtins.object):
def __init__(
self,
root_folder: pathlib.Path,
_embedding: pathlib.Path,
_chunks: list[pathlib.Path],
_global_element_mapping_filename: pathlib.Path,
_meta_contents_cache: dict | None = None,
) -> None: ...A mesh split across multiple files.
All file paths are relative to the root folder.
root_folderpathlib.Path — The root folder containing the chunked mesh._embeddingpathlib.Path — The file containing the embedding mesh._chunkslist[pathlib.Path] — The files containing the mesh chunks._global_element_mapping_filenamepathlib.Path — The file containing the global element mapping._meta_contents_cachedict | None =None— Cache for the meta contents.
blocks list[ChunkedMeshBlock]
blocks list[ChunkedMeshBlock]The blocks of the chunked mesh.
chunk_filenames list[pathlib.Path]
chunk_filenames list[pathlib.Path]The paths to the chunk mesh files.
embedding_filename pathlib.Path
embedding_filename pathlib.PathThe path to the embedding mesh file.
global_element_map_filename pathlib.Path
global_element_map_filename pathlib.PathThe path to the global element map file.
global_variables dict[str, typing.Any]
global_variables dict[str, typing.Any]The global variables of the chunked mesh.
is_fluid list[bool]
is_fluid list[bool]Whether the chunked mesh contains fluid materials.
The list contains a boolean for each block.
Returns: True if the chunked mesh contains fluid materials, False otherwise.
is_visco list[bool]
is_visco list[bool]Whether the chunked mesh contains visco materials.
The list contains a boolean for each block.
Returns: True if the chunked mesh contains visco materials, False otherwise.
linear_solids list[mesh_linear_solids.LinearSolidsOnMesh | None]
linear_solids list[mesh_linear_solids.LinearSolidsOnMesh | None]Get the linear solids per block.
model_order int
model_order intThe model order of the chunked mesh.
nodal_fields_per_block dict[int, set[str]]
nodal_fields_per_block dict[int, set[str]]The nodal fields per block of the chunked mesh.
number_of_blocks int
number_of_blocks intThe number of blocks in the chunked mesh.
number_of_dimensions int
number_of_dimensions intThe number of spatial dimensions of the chunked mesh.
number_of_elements int
number_of_elements intThe total number of elements in the chunked mesh.
number_of_elements_per_block dict[int, int]
number_of_elements_per_block dict[int, int]The total number of elements in the blocks of the chunked mesh.
number_of_nodes_per_element int
number_of_nodes_per_element intThe number of nodes per element of the chunked mesh.
number_of_points_per_element_and_direction int
number_of_points_per_element_and_direction intNumber of GLL points per element and spatial direction.
Also known as the shape mapping order.
from_files()
from_files()def from_files(
embedding: pathlib.Path, chunks: list[pathlib.Path]
) -> ChunkedMesh: ...Create a chunked mesh from an embedding files + a list of chunk files.
They must all be in the same folder, and there must be no other files in that folder.
This functions will add new meta-data files to the folder so this can
only be called once. After this function has been called, the parent
folder of the passed files can be loaded as a chunked mesh with
ChunkedMesh.from_folder().
embeddingpathlib.Path — The file containing the embedding mesh.chunkslist[pathlib.Path] — The files containing the mesh chunks.
from_folder()
from_folder()def from_folder(folder: pathlib.Path | str) -> ChunkedMesh: ...Load a chunked mesh from a folder.
folderpathlib.Path | str — The folder containing the chunked mesh.
compute_file_size()
compute_file_size()def compute_file_size(self) -> int: ...Compute the total file size of the chunked mesh.
move()
move()def move(self, target_folder: pathlib.Path) -> None: ...Move the chunked mesh to a new folder.
If will modify the object in-place to point to the new location.
target_folderpathlib.Path — The folder to move the chunked mesh to.
sum_gradients()
sum_gradients()def sum_gradients(
self,
gradients: list[tuple[pathlib.Path, collections.abc.Callable]],
output_folder: pathlib.Path,
) -> ChunkedMesh: ...Sum gradients stored on the chunked mesh and write to disk.
This function will sum all gradients passed to it and return a new chunked mesh with the same geometry and same chunking as this object. It will sum all gradients for each chunk, elements that are not part of any gradient will be flooded with zeros.
gradientslist[tuple[pathlib.Path, collections.abc.Callable]] — A list of all gradients to sum. Each entry is a tuple with the path to the gradient file and a function that takes the embedding and return the global elements ids for the current gradient file.output_folderpathlib.Path — The folder to store the summed gradients in.
to_mesh()
to_mesh()def to_mesh(
self, element_selection_function: collections.abc.Callable | None
) -> Mesh: ...Assemble the chunked mesh into a single unstructured mesh.
element_selection_functioncollections.abc.Callable | None — Callable that takes the embedding mesh and returns the global element IDs to include in the assembled mesh. IfNone, all elements from the embedding will be included.
to_unstructured_mesh()
to_unstructured_mesh()def to_unstructured_mesh(
self, element_selection_function: collections.abc.Callable | None
) -> UnstructuredMesh: ...Assemble the chunked mesh into a single mesh.
element_selection_functioncollections.abc.Callable | None — Callable that takes the embedding mesh and returns the global element IDs to include in the assembled mesh. IfNone, all elements from the embedding will be included.
ChunkedMeshBlock
ChunkedMeshBlockclass ChunkedMeshBlock(builtins.object):
def __init__(self) -> None: ...A block in a chunked mesh.
Currently not implemented.