18 #ifndef LIBMESH_FUZZY_EQUAL_H 19 #define LIBMESH_FUZZY_EQUAL_H 21 #include "libmesh/libmesh_common.h" 22 #include "libmesh/tensor_tools.h" 23 #include "libmesh/compare_types.h" 24 #include "libmesh/int_range.h" 26 #ifdef LIBMESH_HAVE_METAPHYSICL 27 #include "metaphysicl/raw_type.h" 54 #ifdef LIBMESH_HAVE_METAPHYSICL 62 template <
typename T,
typename T2>
66 return MetaPhysicL::raw_value(
l1_norm_diff(var1, var2)) <= tol;
76 template <
typename T,
typename T2>
83 tol * (MetaPhysicL::raw_value(
l1_norm(var1)) + MetaPhysicL::raw_value(
l1_norm(var2))));
93 template <
typename T,
typename T2>
107 template <
typename T,
typename T2>
117 #endif // LIBMESH_FUZZY_EQUAL_H static constexpr Real TOLERANCE
The libMesh namespace provides an interface to certain functionality in the library.
auto l1_norm(const NumericVector< T > &vec)
auto l1_norm_diff(const NumericVector< T > &vec1, const NumericVector< T > &vec2)
bool absolute_fuzzy_equals(const T &var1, const T2 &var2, const Real tol=TOLERANCE *TOLERANCE)
Function to check whether two variables are equal within an absolute tolerance.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
bool relative_fuzzy_equals(const T &var1, const T2 &var2, const Real tol=TOLERANCE *TOLERANCE)
Function to check whether two variables are equal within a relative tolerance.