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
27 // Fillet constraint identifier
28 #define SLVS_C_FILLET 100100
30 #define SLVS_E_UNKNOWN 0
33 * The main class that performs the high-level operations for connection to the SolveSpace.
35 class SketchSolver_Solver
38 SketchSolver_Solver();
39 ~SketchSolver_Solver();
41 /** \brief Initialize the ID of the group
43 inline void setGroupID(Slvs_hGroup theGroupID)
45 myGroupID = theGroupID;
48 /** \brief Change array of parameters
49 * \param[in] theParameters vector of parameters
51 void setParameters(const std::vector<Slvs_Param>& theParameters);
53 /** \brief Change array of entities
54 * \param[in] theEntities vector of entities
56 void setEntities(const std::vector<Slvs_Entity>& theEntities);
58 /** \brief Change array of constraints
59 * \param[in] theConstraints vector of constraints
61 void setConstraints(const std::vector<Slvs_Constraint>& theConstraints);
63 /** \brief Store the parameters of the point which was moved by user.
64 * The solver will watch this items to be constant
65 * \param[in] theDragged list of parameters (not more than 4) which should not be changed during solving
67 void setDraggedParameters(const std::vector<Slvs_hParam>& theDragged);
69 /** \brief Solve the set of equations
70 * \return identifier whether solution succeeded
74 /** \brief Updates the list of parameters by calculated values
75 * \param[in,out] theParameters parameters to be updated
76 * \return \c true if parameters are updated correctly
78 bool getResult(std::vector<Slvs_Param>& theParameters);
81 Slvs_hGroup myGroupID; ///< identifier of the group to be solved
82 Slvs_System myEquationsSystem; ///< set of equations for solving in SolveSpace