1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: SketchSolver_Solver.h
4 // Created: 07 May 2014
5 // Author: Artem ZHIDKOV
7 #ifndef SketchSolver_Solver_H_
8 #define SketchSolver_Solver_H_
10 #include "SketchSolver.h"
12 // Need to be defined before including SolveSpace to avoid additional dependances on Windows platform
13 #if defined(WIN32) && !defined(HAVE_C99_INTEGER_TYPES)
14 typedef unsigned int UINT32;
23 #define SLVS_RESULT_EMPTY_SET -1
25 // Unknown constraint (for error reporting)
26 #define SLVS_C_UNKNOWN 0
28 #define SLVS_E_UNKNOWN 0
30 class SketchSolver_Solver
33 SketchSolver_Solver();
34 ~SketchSolver_Solver();
36 /** \brief Initialize the ID of the group
38 inline void setGroupID(Slvs_hGroup theGroupID)
40 myGroupID = theGroupID;
43 /** \brief Change array of parameters
44 * \param[in] theParameters vector of parameters
46 void setParameters(const std::vector<Slvs_Param>& theParameters);
48 /** \brief Change array of entities
49 * \param[in] theEntities vector of entities
51 void setEntities(const std::vector<Slvs_Entity>& theEntities);
53 /** \brief Change array of constraints
54 * \param[in] theConstraints vector of constraints
56 void setConstraints(const std::vector<Slvs_Constraint>& theConstraints);
58 /** \brief Store the parameters of the point which was moved by user.
59 * The solver will watch this items to be constant
60 * \param[in] theDragged list of parameters (not more than 4) which should not be changed during solving
62 void setDraggedParameters(const std::vector<Slvs_hParam>& theDragged);
64 /** \brief Solve the set of equations
65 * \return identifier whether solution succeeded
69 /** \brief Updates the list of parameters by calculated values
70 * \param[in,out] theParameters parameters to be updated
71 * \return \c true if parameters are updated correctly
73 bool getResult(std::vector<Slvs_Param>& theParameters);
76 Slvs_hGroup myGroupID; ///< identifier of the group to be solved
77 Slvs_System myEquationsSystem; ///< set of equations for solving in SolveSpace