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
32 #define SLVS_G_UNKNOWN 0
35 * The main class that performs the high-level operations for connection to the SolveSpace.
37 class SketchSolver_Solver
40 SketchSolver_Solver();
41 ~SketchSolver_Solver();
43 /** \brief Initialize the ID of the group
45 inline void setGroupID(Slvs_hGroup theGroupID)
47 myGroupID = theGroupID;
50 /** \brief Change array of parameters
51 * \param[in] theParameters pointer to the array of parameters
52 * \param[in] theSize size of this array
54 void setParameters(Slvs_Param* theParameters, int theSize);
56 /** \brief Change array of entities
57 * \param[in] theEntities pointer to the array of entities
58 * \param[in] theSize size of this array
60 void setEntities(Slvs_Entity* theEntities, int theSize);
62 /** \brief Change array of constraints
63 * \param[in] theConstraints pointer to the array of constraints
64 * \param[in] theSize size of this array
66 void setConstraints(Slvs_Constraint* theConstraints, int theSize);
68 /** \brief Store the parameters of the point which was moved by user.
69 * The solver will watch this items to be constant
70 * \param[in] theDragged list of parameters (not more than 4) which should not be changed during solving
72 void setDraggedParameters(const Slvs_hParam* theDragged);
74 /** \brief Solve the set of equations
75 * \return identifier whether solution succeeded
79 /** \brief Updates the list of parameters by calculated values
80 * \param[in,out] theParameters parameters to be updated
81 * \return \c true if parameters are updated correctly
83 bool getResult(std::vector<Slvs_Param>& theParameters);
86 Slvs_hGroup myGroupID; ///< identifier of the group to be solved
87 Slvs_System myEquationsSystem; ///< set of equations for solving in SolveSpace