salvus.mesh.algorithms.unstructured_mesh.basic
Basic operations.
Functions
add_two_meshes()
add_two_meshes()def add_two_meshes(
mesh_a: UnstructuredMesh,
mesh_b: UnstructuredMesh,
make_unique_points: bool = True,
) -> UnstructuredMesh: ...Add two meshes together.
Only fields that exist in both meshes, will be in the combined mesh, others will be discarded.
mesh_aUnstructuredMesh — First mesh.mesh_bUnstructuredMesh — Second mesh.make_unique_pointsbool — If True, duplicate points in both meshes will be discarded. This should be True in most cases, only set this to False for performance reasons if you know what you are doing.
get_element_centroid()
get_element_centroid()def get_element_centroid(
mesh: UnstructuredMesh, spherical: bool = False
) -> npt.NDArray: ...For each element, compute its centroid.
meshUnstructuredMesh — The mesh.sphericalbool — Assume a spherical mesh to perform a spherical computation.
get_element_centroid_radius()
get_element_centroid_radius()def get_element_centroid_radius(mesh: UnstructuredMesh) -> npt.NDArray: ...Get the radius of the centroid of each element for spherical meshes.
Compute the centroids of all elements on the fly from the nodes of the mesh. Useful to determine which domain in a layered medium an element belongs to or to compute elemental properties from the model. This function computes the spherical radius directly and is hence more memory efficient than UnstructuredMesh.get_element_centroid()
meshUnstructuredMesh — The mesh.
get_element_nodes()
get_element_nodes()def get_element_nodes(
mesh: UnstructuredMesh,
mask: typing.Union[typing.Tuple, npt.NDArray] = (slice(None, None, None),),
) -> npt.NDArray: ...Get the nodes for each element in the mesh.
Get duplicated nodes, i.e. an array with shape (nelem, nodes_per_element, ndim) containing the node locations for all elements for all nodes. This can be significant in terms of memory requirements.
meshUnstructuredMesh — The mesh.masktyping.Union[typing.Tuple, npt.NDArray] — An optional mask to apply to the connectivity before returning the points.