Salome HOME
updated copyright message
[modules/shaper.git] / src / SketchSolver / PlaneGCSSolver / PlaneGCSSolver_Solver.h
index 2e49798a1c90b052a563a735d35c8cfe921f57f1..b3714e55c17e8819c6d1f2c529937ba2e9c93eb2 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2023  CEA, EDF
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 //
 // 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
+// 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>
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
 #ifndef PlaneGCSSolver_Solver_H_
@@ -35,6 +34,7 @@ public:
     STATUS_OK,
     STATUS_INCONSISTENT,
     STATUS_EMPTYSET,
+    STATUS_DEGENERATED,
     STATUS_FAILED, // set if no one other status is applicable
     STATUS_UNKNOWN // set for newly created groups
   };
@@ -46,10 +46,14 @@ public:
   void clear();
 
   /// \brief Add constraint to the system of equations
-  void addConstraint(GCSConstraintPtr theConstraint);
+  /// \param[in] theMultiConstraintID  ID of the multi constraint which may consists of
+  ///                                  several primitive constraints
+  /// \param[in] theConstraints        list of primitive constraints
+  void addConstraint(const ConstraintID& theMultiConstraintID,
+                     const std::list<GCSConstraintPtr>& theConstraints);
 
-  /// \brief Remove constraint from the system of equations
-  void removeConstraint(ConstraintID theID);
+  /// \brief Remove constraints from the system of equations
+  void removeConstraint(const ConstraintID& theID);
 
   /// \brief Initialize memory for new solver's parameter
   double* createParameter();
@@ -73,16 +77,24 @@ public:
   bool isConflicting(const ConstraintID& theConstraint) const;
 
   /// \brief Check conflicting/redundant constraints and DoF
-  void diagnose();
+  void diagnose(const GCS::Algorithm& theAlgo = GCS::DogLeg);
+
+  /// \brief Return the list of modifiable parameters
+  void getFreeParameters(GCS::SET_pD& theFreeParams);
 
   /// \brief Degrees of freedom
   int dof();
 
 private:
-  void collectConflicting();
+  void collectConflicting(bool withRedundant = true);
+
+  /// \brief Add fictive constraint if the sketch contains temporary constraints only
+  void addFictiveConstraintIfNecessary();
+  /// \brief Remove previously added fictive constraint
+  void removeFictiveConstraint();
 
 private:
-  typedef std::map<ConstraintID, std::set<GCSConstraintPtr> > ConstraintMap;
+  typedef std::map<ConstraintID, std::list<GCSConstraintPtr> > ConstraintMap;
 
   GCS::VEC_pD                  myParameters;     ///< list of unknowns
   ConstraintMap                myConstraints;    ///< list of constraints
@@ -96,6 +108,8 @@ private:
   bool                         myConfCollected;
 
   int                          myDOF;            ///< degrees of freedom
+
+  GCS::Constraint*             myFictiveConstraint;
 };
 
 typedef std::shared_ptr<PlaneGCSSolver_Solver> SolverPtr;