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 <PlaneGCSSolver_Defs.h>
16 * The main class that performs the high-level operations for connection to the PlaneGCS.
18 class PlaneGCSSolver_Solver : public SketchSolver_ISolver
21 PlaneGCSSolver_Solver() {}
22 ~PlaneGCSSolver_Solver();
24 /// \brief Clear system of equations
27 /// \brief Add constraint to the system of equations
28 void addConstraint(GCSConstraintPtr theConstraint);
30 /// \brief Remove constraint from the system of equations
31 void removeConstraint(GCSConstraintPtr theConstraint);
33 /// \brief Initialize list of unknowns
34 void setParameters(const GCS::VEC_pD& theParams)
35 { myParameters = theParams; }
37 /** \brief Solve the set of equations
38 * \return identifier whether solution succeeded
40 virtual SketchSolver_SolveStatus solve();
42 /// \brief Prepare for solving. Store initial values of parameters for undo
43 virtual void prepare()
46 /// \brief Revert solution to initial values
49 /// \brief Check the constraint is conflicted with others
50 virtual bool isConflicting(const ConstraintID& theConstraint) const;
52 /// \brief Degrees of freedom
53 virtual int dof() const;
56 void collectConflicting();
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
63 GCS::VEC_I myConflictingIDs; ///< list of IDs of conflicting constraints
64 bool myConfCollected; ///< specifies the conflicting constraints are already collected