]> SALOME platform Git repositories - modules/shaper.git/blob - src/SketchSolver/SketchSolver_Solver.h
Salome HOME
Constraint solving methods are implemented
[modules/shaper.git] / src / SketchSolver / SketchSolver_Solver.h
1 // File:    SketchSolver_Solver.h
2 // Created: 07 May 2014
3 // Author:  Artem ZHIDKOV
4
5 #ifndef SketchSolver_Solver_Headerfile
6 #define SketchSolver_Solver_Headerfile
7
8 #include "SketchSolver.h"
9
10 // Need to be defined before including SolveSpace to avoid additional dependances on Windows platform
11 #if defined(WIN32) && !defined(HAVE_C99_INTEGER_TYPES)
12 typedef unsigned int UINT32;
13 #endif
14 #include <string.h>
15 #include <slvs.h>
16
17 #include <vector>
18
19
20 #define SLVS_RESULT_EMPTY_SET -1
21
22
23 class SketchSolver_Solver
24 {
25 public:
26   SketchSolver_Solver();
27   ~SketchSolver_Solver();
28
29   /** \brief Initialize the ID of the group
30    */
31   inline void setGroupID(Slvs_hGroup theGroupID)
32   { myGroupID = theGroupID; }
33
34   /** \brief Change array of parameters
35    *  \param[in] theParameters vector of parameters
36    */
37   void setParameters(const std::vector<Slvs_Param>& theParameters);
38
39   /** \brief Change array of entities
40    *  \param[in] theEntities vector of entities
41    */
42   void setEntities(const std::vector<Slvs_Entity>& theEntities);
43
44   /** \brief Change array of constraints
45    *  \param[in] theConstraints vector of constraints
46    */
47   void setConstraints(const std::vector<Slvs_Constraint>& theConstraints);
48
49   /** \brief Solve the set of equations
50    *  \return identifier whether solution succeeded
51    */
52   int solve();
53
54   /** \brief Updates the list of parameters by calculated values
55    *  \param[in,out] theParameters parameters to be updated
56    *  \return \c true if parameters are updated correctly
57    */
58   bool getResult(std::vector<Slvs_Param>& theParameters);
59
60 private:
61   Slvs_hGroup myGroupID;         ///< identifier of the group to be solved
62   Slvs_System myEquationsSystem; ///< set of equations for solving in SolveSpace
63 };
64
65 #endif