5 #include <polylib/polylibgmp.h>
7 #include <barvinok/evalue.h>
8 #include <barvinok/options.h>
10 struct EDomain_floor
{
11 bool substituted
; // see substitute method
14 /* first element is denominator */
17 EDomain_floor(const evalue
*f
, int dim
);
23 EDomain_floor
*ref() {
27 static void unref(EDomain_floor
* floor
) {
28 if (!--floor
->refcount
)
31 void print(std::ostream
& os
, char **p
) const;
32 void eval(Value
*values
, Value
*res
) const;
33 void substitute(evalue
**sub
, Matrix
*T
);
39 std::vector
<EDomain_floor
*> floors
;
41 EDomain(Polyhedron
*D
) {
42 this->D
= Polyhedron_Copy(D
);
45 EDomain(Polyhedron
*D
, std::vector
<EDomain_floor
*>floors
) {
46 this->D
= Polyhedron_Copy(D
);
50 EDomain(EDomain
*ED
) {
51 this->D
= Polyhedron_Copy(ED
->D
);
52 add_floors(ED
->floors
);
55 EDomain(Polyhedron
*D
, EDomain
*ED
, std::vector
<EDomain_floor
*>floors
) {
56 this->D
= Polyhedron_Copy(D
);
57 add_floors(ED
->floors
);
61 void add_floors(std::vector
<EDomain_floor
*>floors
) {
62 for (int i
= 0; i
< floors
.size(); ++i
)
63 this->floors
.push_back(floors
[i
]->ref());
65 int find_floor(evalue
*needle
) const {
66 for (int i
= 0; i
< floors
.size(); ++i
)
67 if (eequal(needle
, floors
[i
]->e
))
71 void print(FILE *out
, char **p
);
72 void print_constraints(std::ostream
& os
, char **p
,
73 barvinok_options
*options
) const;
75 for (int i
= 0; i
< floors
.size(); ++i
)
76 EDomain_floor::unref(floors
[i
]);
82 unsigned dimension() const {
83 return D
->Dimension
- floors
.size();
85 bool contains(Value
*point
, int len
) const;
87 Matrix
*add_ge_constraint(evalue
*constraint
,
88 std::vector
<EDomain_floor
*>& new_floors
) const;
89 void substitute(evalue
**sub
, Matrix
*T
, Matrix
*Eq
, unsigned MaxRays
);
92 int evalue2constraint(EDomain
*D
, evalue
*E
, Value
*cons
, int len
);
93 void evalue_substitute(evalue
*e
, evalue
**subs
);