Skip to content
Snippets Groups Projects
Commit cffef8e8 authored by Christoph Schwarzmeier's avatar Christoph Schwarzmeier
Browse files

Merge branch 'Fix-cli_assertion' into 'master'

Fix too narrow CLI boundary condition assertion

See merge request walberla/walberla!205
parents a8afd77d a96c137b
No related merge requests found
...@@ -22,8 +22,11 @@ ...@@ -22,8 +22,11 @@
#include "pe_coupling/geometry/PeIntersectionRatio.h" #include "pe_coupling/geometry/PeIntersectionRatio.h"
#include "core/math/Limits.h"
#include "core/math/Matrix3.h" #include "core/math/Matrix3.h"
#include <algorithm>
namespace walberla { namespace walberla {
namespace lbm { namespace lbm {
...@@ -48,9 +51,9 @@ real_t intersectionRatioSpherePe( const pe::Sphere & sphere, ...@@ -48,9 +51,9 @@ real_t intersectionRatioSpherePe( const pe::Sphere & sphere,
delta /= dirLength; delta /= dirLength;
WALBERLA_ASSERT_GREATER_EQUAL( delta, real_t( 0 ) ); WALBERLA_ASSERT_GREATER_EQUAL( delta, real_t( 0 ) );
WALBERLA_ASSERT_LESS_EQUAL( delta, real_t( 1 ) ); WALBERLA_ASSERT_LESS_EQUAL( delta - real_t(1), math::Limits<real_t>::accuracy(), delta );
return delta; return std::min(std::max(delta, real_c(0)), real_c(1));
} }
...@@ -74,9 +77,9 @@ real_t intersectionRatioPlanePe( const pe::Plane & plane, ...@@ -74,9 +77,9 @@ real_t intersectionRatioPlanePe( const pe::Plane & plane,
real_t delta = diff * planeNormal / denom; real_t delta = diff * planeNormal / denom;
WALBERLA_ASSERT_GREATER_EQUAL( delta, real_t( 0 ) ); WALBERLA_ASSERT_GREATER_EQUAL( delta, real_t( 0 ) );
WALBERLA_ASSERT_LESS_EQUAL( delta, real_t( 1 ) ); WALBERLA_ASSERT_LESS_EQUAL( delta - real_t(1), math::Limits<real_t>::accuracy(), delta );
return delta; return std::min(std::max(delta, real_c(0)), real_c(1));
} }
...@@ -110,9 +113,9 @@ real_t intersectionRatioEllipsoidPe( const pe::Ellipsoid & ellipsoid, ...@@ -110,9 +113,9 @@ real_t intersectionRatioEllipsoidPe( const pe::Ellipsoid & ellipsoid,
real_t delta = (-b - root) / (real_t(2) * a); real_t delta = (-b - root) / (real_t(2) * a);
WALBERLA_ASSERT_GREATER_EQUAL( delta, real_t( 0 ) ); WALBERLA_ASSERT_GREATER_EQUAL( delta, real_t( 0 ) );
WALBERLA_ASSERT_LESS_EQUAL( delta, real_t( 1 ) ); WALBERLA_ASSERT_LESS_EQUAL( delta - real_t(1), math::Limits<real_t>::accuracy(), delta );
return delta; return std::min(std::max(delta, real_c(0)), real_c(1));
} }
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment