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

salvus.mesh.algorithms.unstructured_mesh.basic

Basic operations.

Functions

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.

Parameters
  • mesh_a UnstructuredMesh — First mesh.
  • mesh_b UnstructuredMesh — Second mesh.
  • make_unique_points bool — 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.
Returns UnstructuredMesh

get_element_centroid()

def get_element_centroid(
    mesh: UnstructuredMesh, spherical: bool = False
) -> npt.NDArray: ...

For each element, compute its centroid.

Parameters
  • mesh UnstructuredMesh — The mesh.
  • spherical bool — Assume a spherical mesh to perform a spherical computation.
Returns npt.NDArray

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()

Parameters
  • mesh UnstructuredMesh — The mesh.
Returns npt.NDArray

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.

Parameters
  • mesh UnstructuredMesh — The mesh.
  • mask typing.Union[typing.Tuple, npt.NDArray] — An optional mask to apply to the connectivity before returning the points.
Returns npt.NDArray