Mondaic

salvus.mesh.algorithms.point_sorting

salvus.mesh.algorithms.point_sorting salvus mesh algorithms point_sorting

Routines to globally sort points.

Functions

compress_connectivity()

def compress_connectivity(
    points: npt.NDArray,
    connectivity: npt.NDArray,
    return_point_map: bool = False,
    assume_unique: bool = False,
    rtol: float = 1e-12,
) -> tuple[npt.NDArray, ...]: ...

Compress duplicate points and the associated connectivity.

Parameters
  • points npt.NDArray — The points to compress.
  • connectivity npt.NDArray — The connectivity to compress.
  • return_point_map bool — Return the point map from the old to new connectivity.
  • assume_unique bool — Assume the points are already unique. Skips a potentially expensive sort.
  • rtol float — The relative tolerance below which points are considered equal. Will be scaled by the range of values in points.
Returns tuple[npt.NDArray, ...] — The compressed points and connectivity, along with the point map if requested.

compute_global_numbering()

def compute_global_numbering(
    points: npt.NDArray, rtol: float = 1e-12
) -> npt.NDArray: ...

Compute the global numbering of an array of points.

Duplicated points within rtol will be considered identical and their numbering will be consolidated.

Parameters
  • points npt.NDArray — The points to compute the numbering of.
  • rtol float — The relative tolerance below which points are considered equal. Will be scaled by the range of values in points.
Returns npt.NDArray — The sorted global indices corresponding to the input points.

find_unique_points()

def find_unique_points(
    points: npt.NDArray, rtol: float = 1e-12, return_index: bool = False
) -> tuple[npt.NDArray, ...]: ...

Find the unique points in an array.

Points that differ by less than rtol, when scaled by the range of values within points, will be considered identical.

Parameters
  • points npt.NDArray — The points to make unique.
  • rtol float — The relative tolerance below which points are considered equal. Will be scaled by the range of values in points.
  • return_index bool — Additionally return the original indices of the unique points.
Returns tuple[npt.NDArray, ...] — The unique points, the associated global indices, along with any other outputs requested from np.unique via kwargs.