1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: PlaneGCSSolver_Solver.h
4 // Created: 14 Dec 2014
5 // Author: Artem ZHIDKOV
7 #ifndef PlaneGCSSolver_Solver_H_
8 #define PlaneGCSSolver_Solver_H_
10 #include <SketchSolver_ISolver.h>
11 #include <SketchSolver_IConstraintWrapper.h>
12 #include <PlaneGCSSolver_Defs.h>
16 /// \brief The main class that performs the high-level operations for connection to the PlaneGCS.
17 class PlaneGCSSolver_Solver : public SketchSolver_ISolver
20 PlaneGCSSolver_Solver();
21 ~PlaneGCSSolver_Solver();
23 /// \brief Clear system of equations
26 /// \brief Add constraint to the system of equations
27 void addConstraint(GCSConstraintPtr theConstraint);
29 /// \brief Remove constraint from the system of equations
30 void removeConstraint(ConstraintID theID);
32 /// \brief Initialize list of unknowns
33 void setParameters(const GCS::VEC_pD& theParams)
34 { myParameters = theParams; }
36 /// \brief Solve the set of equations
37 /// \return identifier whether solution succeeded
38 virtual SketchSolver_SolveStatus solve();
40 /// \brief Prepare for solving. Store initial values of parameters for undo
41 virtual void prepare()
44 /// \brief Revert solution to initial values
47 /// \brief Check the constraint is conflicted with others
48 virtual bool isConflicting(const ConstraintID& theConstraint) const;
50 /// \brief Degrees of freedom
51 virtual int dof() const;
54 void collectConflicting();
57 GCS::VEC_pD myParameters; ///< list of unknowns
58 std::shared_ptr<GCS::System> myEquationSystem; ///< set of equations for solving in FreeGCS
60 GCS::SET_I myConflictingIDs; ///< list of IDs of conflicting constraints
62 /// specifies the conflicting constraints are already collected
65 /// lists of parameters used in the Equal constraints (to avoid multiple equalities)
66 std::list<GCS::SET_pD> myEqualParameters;
67 /// lists of the Equal constraints
68 std::map<ConstraintID, std::set<GCSConstraintPtr> > myEqualConstraints;