From: azv Date: Wed, 23 Sep 2015 06:04:26 +0000 (+0300) Subject: Optimize performance of the sketch solver X-Git-Tag: 1.4.0_demo1~4 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=c75015faf7af6add60229fadf6b0472c65192b5d;p=modules%2Fshaper.git Optimize performance of the sketch solver --- diff --git a/src/SketchSolver/SketchSolver_Constraint.cpp b/src/SketchSolver/SketchSolver_Constraint.cpp index c1d0558f4..187a7cae5 100644 --- a/src/SketchSolver/SketchSolver_Constraint.cpp +++ b/src/SketchSolver/SketchSolver_Constraint.cpp @@ -221,8 +221,11 @@ void SketchSolver_Constraint::update(ConstraintPtr theConstraint) std::vector::iterator aCIter = mySlvsConstraints.begin(); for (; aCIter != mySlvsConstraints.end(); aCIter++) { Slvs_Constraint aConstraint = myStorage->getConstraint(*aCIter); - if (aValueAttr) + if (aValueAttr) { aConstraint.valA = aValue; + if (aConstraint.type == SLVS_C_DIAMETER) + aConstraint.valA *= 2.0; + } Slvs_hEntity* aCoeffs[6] = { &aConstraint.ptA, &aConstraint.ptB, &aConstraint.entityA, &aConstraint.entityB, diff --git a/src/SketchSolver/SketchSolver_Constraint.h b/src/SketchSolver/SketchSolver_Constraint.h index f4a15db60..974143246 100644 --- a/src/SketchSolver/SketchSolver_Constraint.h +++ b/src/SketchSolver/SketchSolver_Constraint.h @@ -12,6 +12,7 @@ #include +#include #include #include @@ -223,8 +224,10 @@ public: virtual void adjustConstraint() { + AttributeDoublePtr aValueAttr = std::dynamic_pointer_cast( + myBaseConstraint->attribute(SketchPlugin_Constraint::VALUE())); Slvs_Constraint aConstraint = myStorage->getConstraint(mySlvsConstraints.front()); - aConstraint.valA *= 2.0; + aConstraint.valA = 2.0 * aValueAttr->value(); myStorage->updateConstraint(aConstraint); } };