pysdic.Connectivity.all_close#
- Connectivity.all_close(other, *, rtol=1e-05, atol=1e-08, equal_nan=True, ordered=True)[source]#
Check if the elements are equal to the elements of another connectivity (see
numpy.allclose).Connectivities with different shapes are never close. The element types and the properties are not compared.
Note
With
ordered=False, the elements (rows) are sorted before the comparison, but the order of the vertices inside each element still matters:[0, 1, 2]and[1, 2, 0]are different elements.- Parameters:
other (Union[
pysdic.Connectivity, ArrayLike]) – Another connectivity or an array of shape \((N_e, N_{vpe})\).rtol (Real, optional (default:
1e-05)) – The relative tolerance (non-negative and finite).atol (Real, optional (default:
1e-08)) – The absolute tolerance (non-negative and finite).equal_nan (bool, optional (default:
True)) – If True, NaN values are considered equal (only relevant for a float arrayother).ordered (bool, optional (default:
True)) – If False, the order of the elements is ignored (see the note above).
- Returns:
True if all the elements are close, False otherwise.
- Return type:
Examples
1import numpy 2from pysdic import Connectivity 3 4connectivity = Connectivity([[0, 1, 2], [1, 3, 2]]) 5 6print(connectivity.all_close([[1, 3, 2], [0, 1, 2]])) # False 7print(connectivity.all_close([[1, 3, 2], [0, 1, 2]], ordered=False)) # True