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

salvus.mesh.layered_meshing.layered_model.filters

Built-in partitioning filters.

Functions

enclosing_elements()

def enclosing_elements(
    um: salvus.mesh.data_structures.unstructured_mesh.unstructured_mesh.UnstructuredMesh,
    p: numpy.ndarray,
) -> numpy.ndarray: ...

Get the unique elements in um that enclose the points p.

No points outside the mesh will be considered, and are removed from the results of salvus_mesh_utils.get_enclosing_elements. Duplicates are also removed from the element list.

Kwargs is a list of keyword arguments to pass to `get_enclosing_elements.

Parameters
  • um salvus.mesh.data_structures.unstructured_mesh.unstructured_mesh.UnstructuredMesh — The unstructured mesh.
  • p numpy.ndarray — The points.
Returns numpy.ndarray

first_and_last()

def first_and_last(
    i: salvus.mesh.layered_meshing.interface.Interface,
) -> salvus.mesh.layered_meshing.interface.Interface: ...

Create a new interface containing only the first and last DEM values.

Parameters
  • i salvus.mesh.layered_meshing.interface.Interface — The interface.
Returns salvus.mesh.layered_meshing.interface.Interface — A new interface with only the first and last values.

force_monotonic_top_down()

def force_monotonic_top_down(
    transform: Callable[
        [salvus.material.base_materials.Material],
        xarray.core.dataarray.DataArray,
    ]
) -> Callable[
    [salvus.material.base_materials.Material], xarray.core.dataarray.DataArray
]: ...

Ensure that a transformed model is monotonic in the negative vertical direction.

This is useful when the partitioning field is known a-priori to be primarily monotonically increasing in the negative vertical direction, especially when slight variations in the model lead to local deviations from monotonicity. Without applying this transform a naive partitioning may behave unexpectedly as variations in monotonicity can cause holes in simple predicates (i.e., those based on threshold velocity values) which will in turn prevent the partitioning algorithms from forming a clean partition.

Note: This function assumes that a material has been realized, that is expanded across all dimensions in a domain and sorted by dimension name.

Parameters
  • transform Callable[[salvus.material.base_materials.Material], xarray.core.dataarray.DataArray] — A function transforming a material to a xarray.DataArray, to be used as a partitioning predicate.
Returns Callable[[salvus.material.base_materials.Material], xarray.core.dataarray.DataArray] — The result of transform applied to a material and subsequently made monotonic along the vertical direction by performing a rolling minimum reduction along the positive vertical axis.

no_filter()

def no_filter(
    p: salvus.material._details.parameter.parameter_types.GenericParameterType,
) -> (
    salvus.material._details.parameter.parameter_types.GenericParameterType
): ...

Identity function returning the oracle as-is.

Parameters
  • p salvus.material._details.parameter.parameter_types.GenericParameterType — The oracle.
Returns salvus.material._details.parameter.parameter_types.GenericParameterType

remove_consecutive_duplicates()

def remove_consecutive_duplicates(
    i: salvus.mesh.layered_meshing.interface.Interface,
) -> salvus.mesh.layered_meshing.interface.Interface: ...

Remove consecutive duplicate DEM values from an interface.

Parameters
  • i salvus.mesh.layered_meshing.interface.Interface — The interface.
Returns salvus.mesh.layered_meshing.interface.Interface — An interface with consecutive duplicates removed.

Classes

OracleFilter

class OracleFilter(typing.Protocol):
    def __init__(self):
        ...

A protocol which wavelength oracle filter callbacks must respect.