SHAPER 9.16.0
SolveSpaceSolver_Solver.h
1// Copyright (C) 2014-2026 CEA, EDF
2//
3// This library is free software; you can redistribute it and/or
4// modify it under the terms of the GNU Lesser General Public
5// License as published by the Free Software Foundation; either
6// version 2.1 of the License, or (at your option) any later version.
7//
8// This library is distributed in the hope that it will be useful,
9// but WITHOUT ANY WARRANTY; without even the implied warranty of
10// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11// Lesser General Public License for more details.
12//
13// You should have received a copy of the GNU Lesser General Public
14// License along with this library; if not, write to the Free Software
15// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16//
17// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18//
19
20#ifndef SolveSpaceSolver_Solver_H_
21#define SolveSpaceSolver_Solver_H_
22
23#include <SketchSolver_ISolver.h>
24
25// Need to be defined before including SolveSpace to avoid additional
26// dependences on Windows platform
27#if defined(WIN32) && !defined(HAVE_C99_INTEGER_TYPES)
28typedef unsigned int UINT32;
29#else
30#include <stdint.h>
31#endif
32#include <string.h>
33#include <slvs.h>
34
35#include <vector>
36
37// Unknown constraint (for error reporting)
38#define SLVS_C_UNKNOWN 0
39// Fillet constraint identifier
40#define SLVS_C_FILLET 100100
41// Multi-rotation constraint identifier
42#define SLVS_C_MULTI_ROTATION 100101
43// Multi-translation constraint identifier
44#define SLVS_C_MULTI_TRANSLATION 100102
45// Unknown entity
46#define SLVS_E_UNKNOWN 0
47// Unknown group
48#define SLVS_G_UNKNOWN 0
49// Group ID to store external objects
50#define SLVS_G_OUTOFGROUP 1
51
57{
58public:
61
66 void setParameters(Slvs_Param* theParameters, int theSize);
67
72 void setEntities(Slvs_Entity* theEntities, int theSize);
73
78 void setConstraints(Slvs_Constraint* theConstraints, int theSize);
79
84 void setDraggedParameters(const Slvs_hParam* theDragged);
85
89 virtual SketchSolver_SolveStatus solve();
90
92 virtual void prepare();
93
95 virtual void undo();
96
98 virtual bool isConflicting(const ConstraintID& theConstraint) const;
99
101 virtual int dof() const;
102
103private:
105 bool hasDegeneratedArcs() const;
106
107private:
108 Slvs_System myEquationsSystem;
109 Slvs_Param* myParamsCopy;
110};
111
112#endif
Performs high-level operations to solve sketch in SolveSpace.
Definition: SolveSpaceSolver_Solver.h:57
virtual SketchSolver_SolveStatus solve()
Solve the set of equations.
Definition: SolveSpaceSolver_Solver.cpp:101
virtual void prepare()
Prepare for solving. Store initial values of parameters for undo.
Definition: SolveSpaceSolver_Solver.cpp:141
void setParameters(Slvs_Param *theParameters, int theSize)
Change array of parameters.
Definition: SolveSpaceSolver_Solver.cpp:60
void setDraggedParameters(const Slvs_hParam *theDragged)
Store the parameters of the point which was moved by user.
Definition: SolveSpaceSolver_Solver.cpp:67
virtual int dof() const
Degrees of freedom.
Definition: SolveSpaceSolver_Solver.cpp:222
virtual void undo()
Revert solution to initial values.
Definition: SolveSpaceSolver_Solver.cpp:150
void setEntities(Slvs_Entity *theEntities, int theSize)
Change array of entities.
Definition: SolveSpaceSolver_Solver.cpp:73
void setConstraints(Slvs_Constraint *theConstraints, int theSize)
Change array of constraints.
Definition: SolveSpaceSolver_Solver.cpp:79
virtual bool isConflicting(const ConstraintID &theConstraint) const
Check the constraint is conflicted with others.
Definition: SolveSpaceSolver_Solver.cpp:214