Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix Network Constant
[simgrid.git] / src / surf / surf_c.h
1 #include <xbt.h>
2
3 #ifndef SURF_SOLVER_H_
4 #define SURF_SOLVER_H_
5
6 static double MAXMIN_PRECISION = 0.001;
7
8
9 #ifdef __cplusplus
10 #include <vector>
11 #include <boost/smart_ptr.hpp>
12 #include <boost/pool/object_pool.hpp>
13 #include <boost/bind.hpp>
14
15 static void double_update(double *variable, double value)
16 {
17   *variable -= value;
18   if (*variable < MAXMIN_PRECISION)
19     *variable = 0.0;
20 }
21
22 using namespace std;
23
24 class Solver;
25 typedef boost::shared_ptr<Solver> SolverPtr;
26
27 class Element;
28 typedef boost::shared_ptr<Element> ElementPtr;
29
30 class Constraint;
31 typedef boost::shared_ptr<Constraint> ConstraintPtr;
32
33 class ConstraintLight;
34 typedef boost::shared_ptr<ConstraintLight> ConstraintLightPtr;
35
36 class Variable;
37 typedef boost::shared_ptr<Variable> VariablePtr;
38
39 struct ElementPtrOps
40 {
41   bool operator()( const ElementPtr & a, const ElementPtr & b )
42     { return true; } //a > b; }
43 };
44
45 #else
46   typedef struct Solver Solver;
47   typedef struct Element Element;
48   typedef struct Constraint Constraint;
49   typedef struct ConstraintLight ConstraintLight;
50   typedef struct Variable Variable;
51
52 #endif
53
54 typedef Element *lmm_element_t;
55 typedef Variable *lmm_variable_t;
56 typedef Constraint *lmm_constraint_t;
57 typedef ConstraintLight *lmm_constraint_light_t;
58 typedef Solver *lmm_system_t;
59
60 #ifdef __cplusplus
61 extern "C" {
62 #endif
63
64 #if defined(__STDC__) || defined(__cplusplus)
65   extern lmm_system_t lmm_system_new(int selective_update);
66
67   extern void c_function(Solver*);   /* ANSI C prototypes */
68   extern Solver* cplusplus_callback_function(Solver*);
69
70 #else
71   extern lmm_system_t lmm_system_new(int selective_update);
72
73   extern void c_function();        /* K&R style */
74   extern Solver* cplusplus_callback_function();
75 #endif
76
77 #ifdef __cplusplus
78 }
79 #endif
80
81
82
83
84
85 #endif /* SURF_SOLVER_H_ */