-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-// File: PlaneGCSSolver_Solver.cpp
-// Created: 14 Dec 2014
-// Author: Artem ZHIDKOV
+// Copyright (C) 2014-2017 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<mailto:webmaster.salome@opencascade.com>
+//
#include <PlaneGCSSolver_Solver.h>
#include <Events_LongOp.h>
{
myEquationSystem->addConstraint(theConstraint.get());
myConstraints[theConstraint->getTag()].insert(theConstraint);
- myDOF = -1;
+ if (theConstraint->getTag() >= 0)
+ myDOF = -1;
+ myInitilized = false;
}
void PlaneGCSSolver_Solver::removeConstraint(ConstraintID theID)
myDOF = (int)myParameters.size();
} else {
myEquationSystem->clearByTag(theID);
- myDOF = -1;
+ if (theID >= 0)
+ myDOF = -1;
}
+ myInitilized = false;
}
double* PlaneGCSSolver_Solver::createParameter()
return aResult;
}
+void PlaneGCSSolver_Solver::addParameters(const GCS::SET_pD& theParams)
+{
+ GCS::SET_pD aParams(theParams);
+ // leave new parameters only
+ GCS::VEC_pD::iterator anIt = myParameters.begin();
+ for (; anIt != myParameters.end(); ++anIt)
+ if (aParams.find(*anIt) != aParams.end())
+ aParams.erase(*anIt);
+
+ myParameters.insert(myParameters.end(), aParams.begin(), aParams.end());
+ if (myConstraints.empty() && myDOF >=0)
+ myDOF += (int)aParams.size(); // calculate DoF by hand only if there is no constraints yet
+ else
+ myDiagnoseBeforeSolve = true;
+}
+
void PlaneGCSSolver_Solver::removeParameters(const GCS::SET_pD& theParams)
{
for (int i = (int)myParameters.size() - 1; i >= 0; --i)
myParameters.erase(myParameters.begin() + i);
--myDOF;
}
+ if (!myConstraints.empty())
+ myDiagnoseBeforeSolve = true;
}
void PlaneGCSSolver_Solver::initialize()