X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSketchSolver%2FSolveSpaceSolver%2FSolveSpaceSolver_Solver.cpp;h=d98440bae804772a75ef9c2cfc861d0060296fae;hb=b857d9ea753bef79dbbadaeb990b54aae56e488d;hp=a7a83a13d91a1be1a282572b8fc63fa3d9615862;hpb=45d7a2bd3a8c6f9de2927a53bea219ade14a733c;p=modules%2Fshaper.git diff --git a/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Solver.cpp b/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Solver.cpp index a7a83a13d..d98440bae 100644 --- a/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Solver.cpp +++ b/src/SketchSolver/SolveSpaceSolver/SolveSpaceSolver_Solver.cpp @@ -1,8 +1,21 @@ -// Copyright (C) 2014-20xx CEA/DEN, EDF R&D - -// File: SolveSpaceSolver_Solver.cpp -// Created: 07 May 2014 -// Author: Artem ZHIDKOV +// Copyright (C) 2014-2020 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// #include "SolveSpaceSolver_Solver.h" #include @@ -90,10 +103,14 @@ SketchSolver_SolveStatus SolveSpaceSolver_Solver::solve() //if (myEquationsSystem.constraints <= 0) // return STATUS_EMPTYSET; - myEquationsSystem.calculateFaileds = myFindFaileds ? 1 : 0; + myEquationsSystem.calculateFaileds = 0; + if (myFindFaileds) { + myEquationsSystem.calculateFaileds = 1; + myEquationsSystem.faileds = myEquationsSystem.constraints; + } Events_LongOp::start(this); - Slvs_Solve(&myEquationsSystem, myGroup); + Slvs_Solve(&myEquationsSystem, (Slvs_hGroup)myGroup); Events_LongOp::end(this); SketchSolver_SolveStatus aStatus; @@ -155,6 +172,10 @@ bool SolveSpaceSolver_Solver::hasDegeneratedArcs() const const int aShift = anEntity.point[aPnt] - anEntity.h; int aPntInd = anEnt + aShift; int aStep = 1; + if (aPntInd < 0) + aPntInd = 0; + else if (aPntInd >= myEquationsSystem.entities) + aPntInd = myEquationsSystem.entities - 1; if (myEquationsSystem.entity[aPntInd].h > anEntity.point[aPnt]) aStep = -1; for (; aPntInd >=0 && aPntInd < myEquationsSystem.entities; aPntInd += aStep) @@ -189,3 +210,16 @@ bool SolveSpaceSolver_Solver::hasDegeneratedArcs() const } return false; } + +bool SolveSpaceSolver_Solver::isConflicting(const ConstraintID& theConstraint) const +{ + for (int i = 0; i < myEquationsSystem.faileds; ++i) + if (myEquationsSystem.failed[i] == (Slvs_hConstraint)theConstraint) + return true; + return false; +} + +int SolveSpaceSolver_Solver::dof() const +{ + return myEquationsSystem.dof; +}