Salome HOME
PlaneGCS: Fix the problem regarding update of a distance during moving of a line...
[modules/shaper.git] / src / SketchSolver / PlaneGCSSolver / PlaneGCSSolver_Solver.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:    PlaneGCSSolver_Solver.h
4 // Created: 14 Dec 2014
5 // Author:  Artem ZHIDKOV
6
7 #ifndef PlaneGCSSolver_Solver_H_
8 #define PlaneGCSSolver_Solver_H_
9
10 #include <SketchSolver_ISolver.h>
11 #include <PlaneGCSSolver_Defs.h>
12
13 #include <GCS.h>
14
15 /**
16  * The main class that performs the high-level operations for connection to the PlaneGCS.
17  */
18 class PlaneGCSSolver_Solver : public SketchSolver_ISolver
19 {
20 public:
21   PlaneGCSSolver_Solver() {}
22   ~PlaneGCSSolver_Solver();
23
24   /// \brief Clear system of equations
25   void clear();
26
27   /// \brief Add constraint to the system of equations
28   void addConstraint(GCSConstraintPtr theConstraint);
29
30   /// \brief Remove constraint from the system of equations
31   void removeConstraint(GCSConstraintPtr theConstraint);
32
33   /// \brief Initialize list of unknowns
34   void setParameters(const GCS::VEC_pD& theParams)
35   { myParameters = theParams; }
36
37   /** \brief Solve the set of equations
38    *  \return identifier whether solution succeeded
39    */
40   virtual SketchSolver_SolveStatus solve();
41
42   /// \brief Prepare for solving. Store initial values of parameters for undo
43   virtual void prepare()
44   { /* do nothing */ }
45
46   /// \brief Revert solution to initial values
47   virtual void undo();
48
49   /// \brief Check the constraint is conflicted with others
50   virtual bool isConflicting(const ConstraintID& theConstraint) const;
51
52   /// \brief Degrees of freedom
53   virtual int dof() const;
54
55 private:
56   void collectConflicting();
57
58 private:
59   GCS::VEC_pD                myParameters;     ///< list of unknowns
60   std::set<GCS::Constraint*> myConstraints;    ///< list of constraints already processed by the system
61   GCS::System                myEquationSystem; ///< set of equations for solving in FreeGCS
62
63   GCS::VEC_I                 myConflictingIDs; ///< list of IDs of conflicting constraints
64   bool                       myConfCollected;  ///< specifies the conflicting constraints are already collected
65 };
66
67 #endif