Program listing for file numerics/src/tools/SiconosSets.h

Program listing for file numerics/src/tools/SiconosSets.h#

 1#ifndef SICONOS_SETS_H
 2#define SICONOS_SETS_H
 3
 4
 5
 6#include "NumericsFwd.h"
 7#include "SiconosConfig.h"
 8
 9
10
11typedef struct {
12  int id;
13} generic_set;
14
15
16typedef generic_set positive_orthant;
17
18
19typedef struct
20{
21  int id;
22  double* lb;
23  double* ub;
24} box_constraints;
25
26
27typedef struct
28{
29  int id;
30  unsigned size_ineq;
31  unsigned size_eq;
32  NumericsMatrix* H;
33  double* K;
34  NumericsMatrix* Heq;
35  double* Keq;
36} polyhedron;
37
38
39typedef struct
40{
41  int id;
42  NumericsMatrix* A;
43  double* b;
44  char* type;
45} polyhedron_unified;
46
47typedef union {
48  generic_set* set;
49  polyhedron* split;
50  polyhedron_unified* unif;
51} polyhedron_set;
52
53enum SICONOS_SET_ID { SICONOS_SET_POSITIVE_ORTHANT, SICONOS_SET_BOX, SICONOS_SET_POLYHEDRON, SICONOS_SET_POLYHEDRON_UNIFIED };
54
55enum SICONOS_RELATION_TYPES { SICONOS_LE, SICONOS_EQ, SICONOS_GE };
56
57
58#if defined(__cplusplus) && !defined(BUILD_AS_CPP)
59extern "C"
60{
61#endif
62
63
64  static inline void set_set_id(void* set, int id)
65  {
66    ((generic_set*)set)->id = id;
67  }
68
69
70  void project_on_set(int n, double* x, void* set);
71
72
73  void free_siconos_set(void* set);
74
75
76  void free_box(box_constraints* b);
77
78
79  void free_polyhedron(polyhedron* poly);
80
81
82  void free_polyhedron_unified(polyhedron_unified* poly);
83
84#if defined(__cplusplus) && !defined(BUILD_AS_CPP)
85}
86#endif
87
88#endif