Version:

salvus.mesh.algorithms.unstructured_mesh.utils

salvus.mesh.algorithms.unstructured_mesh.utils salvus mesh algorithms unstructured_mesh utils
A set of routines to help with some mesh operations. Moving out of the unstructured mesh class as it is getting too large.

Functions

add_element_nodal_fields()

Sum the element nodal fields with the same name across several meshes.
Meshes must have identical points, element nodal fields names, and connectivity. Only fields with the same names across all mesh instances will be summed.
SIGNATURE
def add_element_nodal_fields(
    meshes: list[UnstructuredMesh],
) -> UnstructuredMesh: ...
ARGUMENTS
Required
meshes
Type:list[UnstructuredMesh]
Description:
List of UnstructuredMesh objects to add together.
EXCEPTIONS
ValueError
If an empty list is passed.
ValueError
If the structure of each passed mesh does not match.
RETURNS
Return type: UnstructuredMesh
A new UnstructuredMesh with the same elemental fields in each summed.

compute_topological_facet_normals()

Compute unit normal vectors for each topological facet on each element.
As topological facets are required for this function, it is not suitable for general normal vector computation (see the salvus.fem.jacobian module for this use case). This function is useful, however, if one wants to cheaply compute the general orientation of a facet.
SIGNATURE
def compute_topological_facet_normals(
    topological_facets: np.ndarray, points: np.ndarray
) -> np.ndarray: ...
ARGUMENTS
Required
topological_facets
Type:np.ndarray
Description:
An array of a mesh's topological facets.
Required
points
Type:np.ndarray
Description:
The point (node) locations of a mesh.
RETURNS
Return type: np.ndarray

create_rotation_matrices()

Create the rotation matrices for rotating vectors_from onto vectors_to. Will always create 3D rotation matrices. If either vectors_from or vectors_to is passed in shape (..., 2), zeros are appended to create 3D vectors in the last index. Follows general broadcasting rules, output shape will be np.broadcast(vectors_A, vectors_B).shape[:-1] + (3, 3). If drop_dimension is True, and one of the original input shapes was 2 dimensional, the returned rotation matrices will be 2D. This might be incorrect, if rotation in 3D is required to fully make the rotation.
SIGNATURE
def create_rotation_matrices(
    vectors_from: npt.NDArray, vectors_to: npt.NDArray
) -> npt.NDArray: ...
ARGUMENTS
Required
vectors_from
Type:npt.NDArray
Description:
Vectors to rotate from. Length of last dimensions should be 2 or 3.
Required
vectors_to
Type:npt.NDArray
Description:
Vectors to rotate to. Length of last dimensions should be 2 or 3, matching vectors_from.
RETURNS
Return type: npt.NDArray
ND Array of rotation matrices in 2 or 3 dimensions, depending on size of last dimension of both inputs -- the last 2 dimensions are of shape (3, 3) or (2, 2).

disconnect_along_side_set()

Disconnect mesh along internal side set, turning it into two free surfaces.
The disconnection is made by using a callback able to tell for any element if it is on side A or side B of the disconnection, in relation to a point.
SIGNATURE
def disconnect_along_side_set(
    mesh: UnstructuredMesh,
    side_set: str,
    disconnection_decider: typing.Callable[
        [UnstructuredMesh, npt.NDArray, npt.NDArray, npt.NDArray, npt.NDArray],
        typing.Iterable[bool],
    ],
) -> UnstructuredMesh: ...
ARGUMENTS
Required
mesh
Type:UnstructuredMesh
Description:
The mesh to disconnect.
Required
side_set
Type:str
Description:
The internal sideset to disconnect.
Required
disconnection_decider
Type:typing.Callable[[UnstructuredMesh, npt.NDArray, npt.NDArray, npt.NDArray, npt.NDArray], typing.Iterable[bool]]
Description:
A function that takes in a mesh, an array containing element and local point indices to candidates to disconnect, an array of sorted overlapping points global ids, an array of their multiplicity, and an array of offsets that indexes into the first two arrays to get the start of grouped elements.
RETURNS
Return type: UnstructuredMesh
A new mesh with duplicated points and broken up connectivity along the desired side set.

edge_lengths()

Compute the edge lengths along each edge of each element.
The ordering, in the reference element, is consistent with the DMPLEX ordering
2-D: bottom, right, top, left 3-D: bottom left, bottom back, bottom right, bottom front, top front, top right, top back, top left, front right, front left, back left, back right
SIGNATURE
def edge_lengths(mesh: UnstructuredMesh) -> np.ndarray: ...
ARGUMENTS
Required
mesh
Type:UnstructuredMesh
Description:
The mesh to compute the edge lengths of.
RETURNS
Return type: np.ndarray
The edge lengths for each edge, returned as an array with dimensions (elm_id, edge_id).

edge_lengths_projected()

Compute the edge lengths for each coordinate direction.
The ordering, in the reference element, is consistent with the DMPLEX ordering
2-D: bottom, right, top, left 3-D: bottom left, bottom back, bottom right, bottom front, top front, top right, top back, top left, front right, front left, back left, back right
SIGNATURE
def edge_lengths_projected(mesh: UnstructuredMesh) -> np.ndarray: ...
ARGUMENTS
Required
mesh
Type:UnstructuredMesh
Description:
The mesh to compute the edge lengths of.
RETURNS
Return type: np.ndarray
The edge lengths for each edge, returned as an array with dimensions (elm_id, edge_id, dim_length).

edges()

Get an ordered list of the first-order edges for each element.
The ordering, in the reference element, is consistent with the DMPLEX ordering
2-D: bottom, right, top, left 3-D: bottom left, bottom back, bottom right, bottom front, top front, top right, top back, top left, front right, front left, back left, back right
SIGNATURE
def edges(mesh: UnstructuredMesh) -> np.ndarray: ...
ARGUMENTS
Required
mesh
Type:UnstructuredMesh
Description:
The mesh to get the ordered edges of.
RETURNS
Return type: np.ndarray
The edge lengths for each edge, as ordered above, concatenated along the first axis, so that the dimensions are (elm_id, edge_id, vertex, crd).

element_ids_to_node_ids()

Get the sorted unique node ids that are attached to the given element ids.
SIGNATURE
def element_ids_to_node_ids(
    mesh: UnstructuredMesh, element_ids: npt.NDArray
) -> npt.NDArray: ...
ARGUMENTS
Required
mesh
Type:UnstructuredMesh
Description:
The mesh.
Required
element_ids
Type:npt.NDArray
Description:
The element ids.
RETURNS
Return type: npt.NDArray
The node ids.

extract_conservative_bm_file()

Get a BM file containing minimum parameter values and discontinuities.
Useful to extract a bm file the preserves discontinuities, and contains the min parameter value in each layer. Can be used, along with a mesh-to-mesh interpolation routine, as a background model when a) re-meshing for a higher frequency, or b) re-meshing because material velocities have reduced below some threshold.
The successful use of this routines requires that the parameter "z_node_1D" be present as an element nodal field in the mesh, and that it represents the normalized z-coordinate. The normalized value of this parameter will be clipped to a maximum value of 1.0, in case intermediate mesh manipulations resulted in the stretching of the 1-D radial values.
SIGNATURE
def extract_conservative_bm_file(
    mesh: UnstructuredMesh,
    max_radius: float = 6371000.0,
    exclude_filter: tuple[str, int] | None = None,
) -> str: ...
ARGUMENTS
Required
mesh
Type:UnstructuredMesh
Description:
The mesh to extract the 1-D model from.
Optional
max_radius
Type:float
Default value:6371000.0
Description:
The maximum radius of the 1-D model. Defaults to 6371e3.
Optional
exclude_filter
Type:tuple[str, int] | None
Default value:None
Description:
An additional flag which can be passed to ensure that certain elements are not considered in BM file generation. In a global mesh with real oceans, a common use for this parameter might be to exclude all fluid elements in the BM file generation. This could be done, for example, by passing the tuple ("fluid", 1).
EXCEPTIONS
ValueError
If the symmetry is not one of 'isotropic' or 'tti'.
ValueError
If the symmetry does not correspond with the parameters in the mesh.
RETURNS
Return type: str
A string which can be immediately written to a BM file and used in re-meshing.

extract_model_to_regular_grid()

Return interpolated model values at locations defined by an xarray dataset.
It is often useful to visualize slices of a 3-D model, or to just in general have a regularly-gridded representation of a model for analysis. This function allows one to generate such a representation. As input, it takes a mesh, an Xarray Dataset, and a list of parameters to extract. The xarray dataset is likely the only parameter which is not self-explanatory. Here one must pass a dataset with one of the following sets of coordinate dimensions:
{"x", "y"},
{"x", "y", "z"},
{"latitude", "longitude", "radius"}, or
{"latitude", "longitude", "depth"}.
An error will be thrown if the dataset's coordinate dimensions do not match exactly one of the above. Additionally, if the "depth" variant is chosen, a "radius_in_meters" global dataset attribute must also be present. Parameters also must, of course, exist in the mesh.
For some troublesome points, it may be a nontrivial task to find an enclosing element in the mesh. In this case, max_tree_doublings controls the maximum amount of times that a search will be retried for a delinquent point; in each pass the number of elements searched will be doubled. If an element truly is outside of the mesh (as it may well be when interpolating from a spherical domain), extracted values at those points after max_tree_doublings tries will be marked with np.nan -- no extrapolation is performed. This convention was chosen to match the standard xarray and CF convention for missing data.
The grids extracted can be visualized in a number of ways, including with xarray directly and with PyGMT. A nice example of how to visualize something with xarray using a map can be found here: http://xarray.pydata.org/en/stable/plotting.html#maps.
SIGNATURE
def extract_model_to_regular_grid(
    mesh: UnstructuredMesh,
    ds: xr.Dataset,
    pars: str | list[str],
    max_tree_doublings: int = 4,
    number_of_threads: int | None = None,
    verbose: bool = False,
    _use_legacy_version: bool = False,
) -> xr.Dataset: ...
ARGUMENTS
Required
mesh
Type:UnstructuredMesh
Description:
The mesh to interpolate from.
Required
ds
Type:xr.Dataset
Description:
Xarray Dataset with coordinates to interpolate to.
Required
pars
Type:str | list[str]
Description:
Parameters to interpolate.
Optional
max_tree_doublings
Type:int
Default value:4
Description:
Maximum number of times the number of closest candidate elements will be doubled. Doubling only occurs for points which were not already claimed by previous passes. Defaults to 4.
Optional
number_of_threads
Type:int | None
Default value:None
Description:
The number of parallel threads to use. If not given it will use the smaller of the total number of cores on the system and 120.
Optional
verbose
Type:bool
Default value:False
Description:
Show a progress bar when extracting models from a spherical mesh. No progress bar will be shown for cartesian meshes as that uses a much faster algorithm.
Optional
_use_legacy_version
Type:bool
Default value:False
Description:
Force the Python version of the regular grid extraction to be used.
RETURNS
Return type: xr.Dataset
Xarray Dataset with values interpolated.

get_enclosing_elements()

Get the indices of the enclosing element given an array of points.
It is often helpful to know within which element a given spatial point lies. Given an array of points and a mesh, this function will return indices that correspond to the elements containing each point in the input array. The second element of the returned tuple contains the point's position in reference coordinates with respect to the corresponding element ID. If an enclosing element is not found and no interrupt is passed, the returned element index will be -(closest_centroid_element_id + 1), and the reference coordinates will be outside of the canonical interval (outside [-1, +1]). This allows for extrapolation if required.
The internal algorithm will begin by trying to quickly extract the closest element to a given point. The points that remain unfound after one pass of this are re-injected into the algorithm with the search size being doubled each time. This continues recursively until max_tree_doublings is reached. For well behaved meshes, the enclosing element should just be found in at most a few passes (likely just one). If you are having issues with unclaimed points, you can try increasing the iteration count. Note: be careful to ensure that most of your points are actually in the domain! The algorithm can get slow at higher iteration counts, so it pays to match up your input point extents with the mesh extents as much as possible.
The behavior of the algorithm in the case where a point is outside all elements can be controlled with the allow_points_outside_mesh flag. If this is set to false, then the function will throw if a single point remains unclaimed after max_tree_doublings. This may suggest that either a) the point is indeed outside the mesh (in which case no extrapolation is performed), or b) more iterations are needed.
SIGNATURE
def get_enclosing_elements(
    mesh: _ElementCollectionProtocol,
    points: np.ndarray,
    max_tree_doublings: str | int = "auto",
    allow_points_outside_mesh: bool = True,
    verbose: bool = False,
    element_restrict: np.ndarray | None = None,
    point_restrict: np.ndarray | None = None,
) -> tuple[np.ndarray, np.ndarray]: ...
ARGUMENTS
Required
mesh
Type:_ElementCollectionProtocol
Description:
Mesh to query.
Required
points
Type:np.ndarray
Description:
Array of query points, dimension [n_points, d].
Optional
max_tree_doublings
Type:str | int
Default value:'auto'
Description:
Finding the enclosing element may be nontrivial in deformed meshes. The internal algorithm will double the number of closest candidate elements considered in each retry. Defaults to 4 doublings.
Optional
allow_points_outside_mesh
Type:bool
Default value:True
Description:
In some cases, it may be acceptable for some points to be located outside of the queried mesh. If this flag is set to true, an exception will not be thrown if this is the case. Points which are flagged as outside the mesh will have their corresponding element indices set to -(closet_centroid_element_id + 1). Defaults to True.
Optional
verbose
Type:bool
Default value:False
Description:
Show a progress bar. Also, if the query fails, setting verbose to true will print the indices of the failed points. Defaults to False.
Optional
element_restrict
Type:np.ndarray | None
Default value:None
Description:
Only interpolate from elements with these ids.
Optional
point_restrict
Type:np.ndarray | None
Default value:None
Description:
Only interpolate to these point indices.
RETURNS
Return type: tuple[np.ndarray, np.ndarray]
An tuple with 1. an array of indices with enclosing element IDs in the same order as points, and 2. the corresponding location in reference coordinates.

get_hierarchical_map()

Find the hierarchical map between two meshes.
SIGNATURE
def get_hierarchical_map(
    m_coarse: UnstructuredMesh,
    m_fine: UnstructuredMesh,
    number_of_neighbours: int = 8,
    verify: bool = True,
) -> np.ndarray: ...
ARGUMENTS
Required
m_coarse
Type:UnstructuredMesh
Description:
the coarser mesh
Required
m_fine
Type:UnstructuredMesh
Description:
the finer mesh
Optional
number_of_neighbours
Type:int
Default value:8
Description:
number of neighbours to use in tree search
Optional
verify
Type:bool
Default value:True
Description:
verify that m_fine actually is a refinement of m_coarse.
RETURNS
Return type: np.ndarray

get_internal_side_set_facets()

Get the internal facets of a sideset, i.e. those that have two surrounding elements, and the respective elements.
SIGNATURE
def get_internal_side_set_facets(
    mesh: UnstructuredMesh, side_set: str
) -> tuple[npt.NDArray, npt.NDArray]: ...
ARGUMENTS
Required
mesh
Type:UnstructuredMesh
Description:
The mesh.
Required
side_set
Type:str
Description:
The sideset.
RETURNS
Return type: tuple[npt.NDArray, npt.NDArray]
A tuple of 2d arrays with facet pair ids and element pair ids respectively.

get_interpolation_coefficients()

Get the interpolation coefficients for a series of reference coordinates.
SIGNATURE
def get_interpolation_coefficients(
    mesh: _ElementCollectionProtocol, points: np.ndarray
) -> npt.NDArray: ...
ARGUMENTS
Required
mesh
Type:_ElementCollectionProtocol
Description:
The mesh object to query.
Required
points
Type:np.ndarray
Description:
The points to get the interpolation coordinates for.
RETURNS
Return type: npt.NDArray
The interpolation coefficients for each point.

get_side_set_elevations()

Get the elevation values on a side set.
This routine:
- Finds the elements that enclose a set of points
- Interpolates the vertical coordinate value from the nodes of element
  to those points.
For Cartesian and 2-D spherical domains this is done using the Lagrange basis of the element itself, so the elevation values returned are an accurate representation of the side set's elevation as discretized by a given mesh. For 3-D spherical domains the result is an approximation built by projecting the points to a set of triangles that span each element.
SIGNATURE
def get_side_set_elevations(
    mesh: UnstructuredMesh,
    side_set: str,
    points: npt.NDArray,
    execution_policy: bindings.ExecutionPolicy = salvus._core.lib.salvus_core_python_bindings.ExecutionPolicy,
) -> npt.NDArray: ...
ARGUMENTS
Required
mesh
Type:UnstructuredMesh
Description:
The mesh to extract a side set from.
Required
side_set
Type:str
Description:
The side set to extract.
Required
points
Type:npt.NDArray
Description:
The points to extract to. Should be an array of shape [n_pnt, n_dim_mesh - 1], i.e. only horizontal coordinates should be passed.
Optional
execution_policy
Type:bindings.ExecutionPolicy
Default value:<salvus._core.lib.salvus_core_python_bindings.ExecutionPolicy object at 0x7c032d004e30>
Description:
Execution policy governing the maximum allowable parallelism of child routines.
RETURNS
Return type: npt.NDArray
A 1-D coordiante array of the elevations evaluated at each horizontal point location.

get_surface_unit_vectors()

Get the surface unit vectors of a mesh relative to a side set, for specific points.
SIGNATURE
def get_surface_unit_vectors(
    points: npt.NDArray,
    mesh: UnstructuredMesh,
    side_set: str,
    num_threads: int = 2,
) -> npt.NDArray: ...
ARGUMENTS
Required
points
Type:npt.NDArray
Description:
Points to return surface vectors on. Need to lie on the sideset. Should be of shape (N, mesh.ndim).
Required
mesh
Type:UnstructuredMesh
Description:
Mesh to calculate surface vectors on.
Required
side_set
Type:str
Description:
Side set to calculate surface vectors relative to.
Optional
num_threads
Type:int
Default value:2
Description:
Number of threads to use for the computation.
EXCEPTIONS
ValueError
If any passed point does not lie inside the mesh.
KeyError
If any passed point does not lie on the side set.
RETURNS
Return type: npt.NDArray
Surface vectors.

get_topological_facets()

Get an array of node ids corresponding to each facet in the mesh.
The facets returned here are "topological" in that they only consider the mesh's first-order connectivity. Returns an array of shape (n_elem, n_facet_per_elem, n_nodes_per_facet). Facet ordering is as followings:
2D Quad: bottom, top, right, left. 3D Hex: Left, right, bottom, top, back, front.
SIGNATURE
def get_topological_facets(mesh: UnstructuredMesh) -> npt.NDArray: ...
ARGUMENTS
Required
mesh
Type:UnstructuredMesh
Description:
The mesh.
RETURNS
Return type: npt.NDArray

get_unique_facets()

Find the unique facets in a mesh.
SIGNATURE
def get_unique_facets(mesh: UnstructuredMesh) -> npt.NDArray: ...
ARGUMENTS
Required
mesh
Type:UnstructuredMesh
Description:
The mesh.
RETURNS
Return type: npt.NDArray

interpolate_from_element_nodes()

Interpolate values from element nodes to reference coordinates.
This function also returns polynomials evaluated at each point in reference coordinates as these are useful for further calculations.
SIGNATURE
def interpolate_from_element_nodes(
    ref: npt.NDArray, values: npt.NDArray, n_dim: int, num_threads: int = 2
) -> tuple[npt.NDArray, npt.NDArray]: ...
ARGUMENTS
Required
ref
Type:npt.NDArray
Description:
An array of shape [n_pnt, n_dim] reference coordinates.
Required
values
Type:npt.NDArray
Description:
An array of shape [n_pnt, n_ctrl], or [n_pnt, n_ctrl, n_par], containing the values of the field to interpolate.
Required
n_dim
Type:int
Description:
The number of dimensions.
Optional
num_threads
Type:int
Default value:2
Description:
The number of threads to use in parallel execution.
RETURNS
Return type: tuple[npt.NDArray, npt.NDArray]
A tuple consisting of the transformed coordinates and the evaluated lagrange polynomials.

inverse_coordinate_transform()

Find the reference coordinates of a point w.r.t. a given element geometry.
SIGNATURE
def inverse_coordinate_transform(
    control_nodes: npt.NDArray,
    points: npt.NDArray,
    max_iter: int = 100,
    rtol: float = 1e-08,
    atol: float = 1e-11,
    atol_ref: float = 0.001,
    num_threads: int = 2,
) -> tuple[npt.NDArray[np.float64], npt.NDArray[np.int64]]: ...
ARGUMENTS
Required
control_nodes
Type:npt.NDArray
Description:
The tensorized control nodes defining the element's (or it's facet's, or ridge's) geometry. Should be of dimension [n_trial_points, n_ctrl_nodes, n_dim].
Required
points
Type:npt.NDArray
Description:
The point to locate within the element. Should be of dimension [n_trial_pnts, d_dim].
Optional
max_iter
Type:int
Default value:100
Description:
The maximum number of iterations to attempt.
Optional
rtol
Type:float
Default value:1e-08
Description:
The relative tolerance that determines whether a point is considered as inside an element.
Optional
atol
Type:float
Default value:1e-11
Description:
The absolute tolerance that determines whether a point is considered as inside the element.
Optional
atol_ref
Type:float
Default value:0.001
Description:
The tolerance in reference coordinates that determines whether a point is considered inside the element.
Optional
num_threads
Type:int
Default value:2
Description:
The number of threads to use for parallel opertions.
RETURNS
Return type: tuple[npt.NDArray[np.float64], npt.NDArray[np.int64]]
A tuple containing: - an array of each point's reference coordinte, and - an array of the indices of the enlcosing elements, the ordering of which is determined by the leading axes of pnts and cntrl, respectively.

name_free_side_set()

Assign a side set to all facets on a mesh's surface that aren't in one.
SIGNATURE
def name_free_side_set(mesh: UnstructuredMesh, name: str) -> None: ...
ARGUMENTS
Required
mesh
Type:UnstructuredMesh
Description:
The mesh to assign the new side set to. Will be mutated in place.
Required
name
Type:str
Description:
The name of the new side set.
RETURNS
Return type: None
Nothing, mesh is mutated in place.

normalize_block_coordinates()

Normalize vertical coordinates between two side sets.
It is sometimes desirable to rescale the vertical coordinates of a collection of elements to the range [0, 1] to, for instance, interpolate material parameters defined in terms of thickness or relative coordinates. This function performs that rescaling.
SIGNATURE
def normalize_block_coordinates(
    mesh: UnstructuredMesh,
    block: int | list[int],
    top_side_set: str,
    bot_side_set: str,
    execution_policy: bindings.ExecutionPolicy = salvus._core.lib.salvus_core_python_bindings.ExecutionPolicy,
    interior_deformation_order: int = 1,
) -> tuple[npt.NDArray, npt.NDArray, npt.NDArray]: ...
ARGUMENTS
Required
mesh
Type:UnstructuredMesh
Description:
The mesh to normalize coordinates from.
Required
block
Type:int | list[int]
Description:
The block ID, or a list of block IDS, of the elements to be normalized.
Required
top_side_set
Type:str
Description:
The top side set of the normalized region.
Required
bot_side_set
Type:str
Description:
The bottom side set of the normalized region.
Optional
execution_policy
Type:bindings.ExecutionPolicy
Default value:<salvus._core.lib.salvus_core_python_bindings.ExecutionPolicy object at 0x7c032c766bf0>
Description:
Execution policy object controlling parallelization options.
Optional
interior_deformation_order
Type:int
Default value:1
Description:
The polynomial order used to interpolate boundary deformations from a mesh's side sets to its interior nodes. The default order of 1 (linear interpolation) is sufficient for most cases. If the resulting mesh has geometric issues (like invalid Jacobians), increasing this value to match the mesh's model order may help create a valid mesh with smoother internal deformations. Only considered for Cartesian meshes.
RETURNS
Return type: tuple[npt.NDArray, npt.NDArray, npt.NDArray]
A tuple containing: 1. The coordinates with the vertical values normalized to the range [0, 1]. A vertical coordinate of 0.0 indicates that the point is coincident with the bottom side set, while 1.0 marks the top side set. 2. The elevation of the top side set. 3. The elevation of the bottom side set.

read_model_from_h5()

Read a model from a mesh file and return it as a dictionary. The function supports reading only a subset of fields using the optional argument fields.
SIGNATURE
def read_model_from_h5(
    filename: pathlib.Path | str, fields: typing.Sequence[str] | None = None
) -> dict[str, np.ndarray]: ...
ARGUMENTS
Required
filename
Type:pathlib.Path | str
Description:
Mesh file.
Optional
fields
Type:typing.Sequence[str] | None
Default value:None
Description:
Optional field names to read.
RETURNS
Return type: dict[str, np.ndarray]

remove_from_side_set()

Remove or retain facets from side set by index, operating on the passed mesh. Facets are indexed according to their order of appearance in mesh.side_sets[side_set].
SIGNATURE
def remove_from_side_set(
    mesh: UnstructuredMesh,
    side_set: str,
    indices_to_remove: npt.NDArray | None = None,
    indices_to_retain: npt.NDArray | None = None,
) -> None: ...
ARGUMENTS
Required
mesh
Type:UnstructuredMesh
Description:
The mesh to modify.
Required
side_set
Type:str
Description:
The side set to modify.
Optional
indices_to_remove
Type:npt.NDArray | None
Default value:None
Description:
Facets to be removed. Must be None if indices_to_retain is not.
Optional
indices_to_retain
Type:npt.NDArray | None
Default value:None
Description:
Facets to be retained. Must be None if indices_to_remove is not.

retain_unique_facets()

Retain only facets in side set that don't appear in other sidesets, deleting the side set if it becomes empty.
SIGNATURE
def retain_unique_facets(
    mesh: UnstructuredMesh, side_set: str, verbosity: int = 0
) -> None: ...
ARGUMENTS
Required
mesh
Type:UnstructuredMesh
Description:
Mesh.
Required
side_set
Type:str
Description:
Sideset to reduce to uniquely appearing facets.
Optional
verbosity
Type:int
Default value:0
Description:
Verbosity of the operation, informing how side-set is altered.

uniquefy_side_sets()

Retain only unique facets in side sets, deleting empty side sets.
The order influences what elements are retained. The algorithm will remove facets from sidesets in this order, i.e. the first side set has all facets subtracted that occur in other side sets. Side sets appearing earlier will have more facets removed. Empty side sets will not be retained.
SIGNATURE
def uniquefy_side_sets(
    mesh: UnstructuredMesh,
    order: typing.Iterable[str] | None = None,
    verbosity: int = 0,
) -> None: ...
ARGUMENTS
Required
mesh
Type:UnstructuredMesh
Description:
Mesh.
Optional
order
Type:typing.Iterable[str] | None
Default value:None
Description:
Order in which the sidesets are parsed.
Optional
verbosity
Type:int
Default value:0
Description:
Verbosity of the operation, informing how side-sets are altered.
EXCEPTIONS
ValueError
description
PAGE CONTENTS