1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: SketchSolver_ISolver.h
4 // Created: 30 Nov 2015
5 // Author: Artem ZHIDKOV
7 #ifndef SketchSolver_ISolver_H_
8 #define SketchSolver_ISolver_H_
10 #include <SketchSolver.h>
14 /// The result of constraints solution
15 enum SketchSolver_SolveStatus {
19 STATUS_FAILED, // set if no one other status is applicable
20 STATUS_UNKNOWN // set for newly created groups
25 * Interface providing operations to solve sketches.
27 class SketchSolver_ISolver
30 virtual ~SketchSolver_ISolver() {}
32 /// \brief Set or unset the flag which allows to find all failed constraints
33 void calculateFailedConstraints(bool theSic)
34 { myFindFaileds = theSic; }
36 /// \brief Prepare for solving. Store initial values of parameters for undo
37 virtual void prepare() = 0;
39 /// \brief Solve the set of equations
40 /// \return identifier whether solution succeeded
41 virtual SketchSolver_SolveStatus solve() = 0;
43 /// \brief Revert solution to initial values
44 virtual void undo() = 0;
46 /// \brief Check the constraint is conflicted with others
47 virtual bool isConflicting(const ConstraintID& theConstraint) const = 0;
49 /// \brief Degrees of freedom
50 virtual int dof() = 0;
53 bool myFindFaileds; ///< flag to find conflicting or inappropriate constraints
56 typedef std::shared_ptr<SketchSolver_ISolver> SolverPtr;