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 memory for new solver's parameter
33 double* createParameter();
34 /// \brief Release memory occupied by parameters
35 void removeParameters(const GCS::SET_pD& theParams);
37 /// \brief Solve the set of equations
38 /// \return identifier whether solution succeeded
39 virtual SketchSolver_SolveStatus solve();
41 /// \brief Prepare for solving. Store initial values of parameters for undo
42 virtual void prepare()
45 /// \brief Revert solution to initial values
48 /// \brief Check the constraint is conflicted with others
49 virtual bool isConflicting(const ConstraintID& theConstraint) const;
51 /// \brief Degrees of freedom
55 void collectConflicting();
58 typedef std::map<ConstraintID, std::set<GCSConstraintPtr> > ConstraintMap;
60 GCS::VEC_pD myParameters; ///< list of unknowns
61 ConstraintMap myConstraints; ///< list of constraints
63 std::shared_ptr<GCS::System> myEquationSystem; ///< set of equations for solving in FreeGCS
65 GCS::SET_I myConflictingIDs; ///< list of IDs of conflicting constraints
67 /// specifies the conflicting constraints are already collected
70 int myDOF; ///< degrees of freedom