From d1e7fd66bc66e74c6ae5bbab299836d0ed9713bd Mon Sep 17 00:00:00 2001 From: azv Date: Thu, 24 Nov 2016 13:01:29 +0300 Subject: [PATCH] Update tolerance for deciding the parameters are same to prevent frequent updates from the solver (issue #1883) --- .../PlaneGCSSolver/PlaneGCSSolver_Storage.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Storage.cpp b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Storage.cpp index 90e25c458..b26213dcc 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Storage.cpp +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_Storage.cpp @@ -672,6 +672,8 @@ void PlaneGCSSolver_Storage::refresh(bool theFixedOnly) const { //blockEvents(true); + const double aTol = 1000. * tolerance; // tolerance to prevent frequent updates + std::map::const_iterator anIt = myAttributeMap.begin(); std::list aParams; std::list::const_iterator aParIt; @@ -698,8 +700,8 @@ void PlaneGCSSolver_Storage::refresh(bool theFixedOnly) const std::shared_ptr aPoint2D = std::dynamic_pointer_cast(anIt->first); if (aPoint2D) { - if ((isUpd[0] && fabs(aPoint2D->x() - aCoords[0]) > tolerance) || - (isUpd[1] && fabs(aPoint2D->y() - aCoords[1]) > tolerance) || isExternal) { + if ((isUpd[0] && fabs(aPoint2D->x() - aCoords[0]) > aTol) || + (isUpd[1] && fabs(aPoint2D->y() - aCoords[1]) > aTol) || isExternal) { // Find points coincident with this one (probably not in GID_OUTOFGROUP) CoincidentPointsMap::const_iterator aCoincIt = myCoincidentPoints.begin(); for (; aCoincIt != myCoincidentPoints.end(); ++aCoincIt) @@ -729,7 +731,7 @@ void PlaneGCSSolver_Storage::refresh(bool theFixedOnly) const } AttributeDoublePtr aScalar = std::dynamic_pointer_cast(anIt->first); if (aScalar && !isExternal) { - if (isUpd[0] && fabs(aScalar->value() - aCoords[0]) > tolerance) + if (isUpd[0] && fabs(aScalar->value() - aCoords[0]) > aTol) aScalar->setValue(aCoords[0]); continue; } -- 2.39.2