From: azv Date: Thu, 17 Sep 2015 13:49:13 +0000 (+0300) Subject: Improve performance of sketch solver by disabling by default the search of failed... X-Git-Tag: V_1.4.0~32 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=13bbe3426159f4407fc058bb1a1b3427e31a94ba;p=modules%2Fshaper.git Improve performance of sketch solver by disabling by default the search of failed constraints --- diff --git a/src/SketchSolver/SketchSolver_Group.cpp b/src/SketchSolver/SketchSolver_Group.cpp index 560550f6e..cc60f0c25 100644 --- a/src/SketchSolver/SketchSolver_Group.cpp +++ b/src/SketchSolver/SketchSolver_Group.cpp @@ -549,6 +549,7 @@ bool SketchSolver_Group::resolveConstraints() bool aResolved = false; if (myStorage->isNeedToResolve() && !isEmpty()) { myConstrSolver.setGroupID(myID); + myConstrSolver.calculateFailedConstraints(false); myStorage->initializeSolver(myConstrSolver); int aResult = SLVS_RESULT_OKAY; @@ -572,6 +573,7 @@ bool SketchSolver_Group::resolveConstraints() isLastChance = true; } else aNbTemp = myStorage->deleteTemporaryConstraint(); + myConstrSolver.calculateFailedConstraints(true); // something failed => need to find it myStorage->initializeSolver(myConstrSolver); } } diff --git a/src/SketchSolver/SketchSolver_Solver.cpp b/src/SketchSolver/SketchSolver_Solver.cpp index a14fa2365..36979d747 100644 --- a/src/SketchSolver/SketchSolver_Solver.cpp +++ b/src/SketchSolver/SketchSolver_Solver.cpp @@ -27,7 +27,7 @@ SketchSolver_Solver::SketchSolver_Solver() // If the set of constraints is inconsistent, // the failed field will contain wrong constraints - myEquationsSystem.calculateFaileds = 1; + myEquationsSystem.calculateFaileds = 0; } SketchSolver_Solver::~SketchSolver_Solver() diff --git a/src/SketchSolver/SketchSolver_Solver.h b/src/SketchSolver/SketchSolver_Solver.h index 46e83afd0..f90d71fd2 100644 --- a/src/SketchSolver/SketchSolver_Solver.h +++ b/src/SketchSolver/SketchSolver_Solver.h @@ -75,6 +75,11 @@ class SketchSolver_Solver */ void setDraggedParameters(const Slvs_hParam* theDragged); + /** \brief Set or unset the flag which allows to find all failed constraints + */ + void calculateFailedConstraints(bool theSic) + { myEquationsSystem.calculateFaileds = theSic ? 1 : 0; } + /** \brief Solve the set of equations * \return identifier whether solution succeeded */