salvus.mesh.algorithms.point_sorting
Routines to globally sort points.
Functions
compress_connectivity()
compress_connectivity()def compress_connectivity(
points: numpy.ndarray,
connectivity: numpy.ndarray,
return_point_map: bool = False,
assume_unique: bool = False,
rtol: float = 1e-12,
) -> Tuple[numpy.ndarray[Any, numpy.dtype[+_ScalarType_co]], ...]: ...Compress duplicate points and the associated connectivity.
Parameters
pointsnumpy.ndarray — The points to compress.connectivitynumpy.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[numpy.ndarray[Any, numpy.dtype[+_ScalarType_co]], ...] — The compressed points and connectivity, along with the point map if requested.
compute_global_numbering()
compute_global_numbering()def compute_global_numbering(
points: numpy.ndarray, rtol: float = 1e-12
) -> numpy.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
pointsnumpy.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 numpy.ndarray — The sorted global indices corresponding to the input points.
find_unique_points()
find_unique_points()def find_unique_points(
points: numpy.ndarray, rtol: float = 1e-12, return_index: bool = False
) -> Tuple[numpy.ndarray[Any, numpy.dtype[+_ScalarType_co]], ...]: ...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
pointsnumpy.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[numpy.ndarray[Any, numpy.dtype[+_ScalarType_co]], ...] — The unique points, the associated global indices, along with any other outputs requested from
np.unique via kwargs.