salvus.mesh.algorithms.point_sorting
salvus.mesh.algorithms.point_sorting salvus mesh algorithms point_sorting Routines to globally sort points.
Functions
compress_connectivity()
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
pointsnpt.NDArray — The points to compress.connectivitynpt.NDArray — The connectivity to compress.return_point_mapbool — Return the point map from the old to new connectivity.assume_uniquebool — Assume the points are already unique. Skips a potentially expensive sort.rtolfloat — The relative tolerance below which points are considered equal. Will be scaled by the range of values inpoints.
Returns tuple[npt.NDArray, ...] — The compressed points and connectivity, along with the point map if requested.
compute_global_numbering()
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
pointsnpt.NDArray — The points to compute the numbering of.rtolfloat — The relative tolerance below which points are considered equal. Will be scaled by the range of values inpoints.
Returns npt.NDArray — The sorted global indices corresponding to the input points.
find_unique_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
pointsnpt.NDArray — The points to make unique.rtolfloat — The relative tolerance below which points are considered equal. Will be scaled by the range of values inpoints.return_indexbool — 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.