From 19f00acd736a84a19db1b1a25bba9fa1f82ec1df Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Fri, 27 Oct 2006 17:15:05 +0200 Subject: [PATCH] scarf.cc: use barvinok_options instead of MaxRays --- 4coins.cc | 2 +- barvinok_enumerate_e.cc | 8 ++++++-- scarf.cc | 39 +++++++++++++++++++++------------------ scarf.h | 6 ++++-- 4 files changed, 32 insertions(+), 23 deletions(-) diff --git a/4coins.cc b/4coins.cc index 3871e52..9eed191 100644 --- a/4coins.cc +++ b/4coins.cc @@ -121,7 +121,7 @@ int main(int argc, char **argv) up[0] = 1; up[1] = 0; - S = barvinok_enumerate_scarf_series(P, 2, 2, options->MaxRays); + S = barvinok_enumerate_scarf_series(P, 2, 2, options); S->print(std::cerr, 0, NULL); cerr << endl; diff --git a/barvinok_enumerate_e.cc b/barvinok_enumerate_e.cc index 5e3d294..2c30b33 100644 --- a/barvinok_enumerate_e.cc +++ b/barvinok_enumerate_e.cc @@ -226,16 +226,20 @@ int main(int argc, char **argv) } if (series) { gen_fun *gf; + barvinok_options *options = barvinok_options_new_with_defaults(); assert(scarf); - gf = barvinok_enumerate_scarf_series(A, exist, nparam, MAXRAYS); + gf = barvinok_enumerate_scarf_series(A, exist, nparam, options); if (print_solution) { gf->print(std::cout, nparam, param_name); puts(""); } delete gf; + free(options); } else { if (scarf) { - EP = barvinok_enumerate_scarf(A, exist, nparam, MAXRAYS); + barvinok_options *options = barvinok_options_new_with_defaults(); + EP = barvinok_enumerate_scarf(A, exist, nparam, options); + free(options); } else if (pip && exist > 0) EP = barvinok_enumerate_pip(A, exist, nparam, MAXRAYS); else diff --git a/scarf.cc b/scarf.cc index a7b39e1..667526f 100644 --- a/scarf.cc +++ b/scarf.cc @@ -863,11 +863,12 @@ void scarf_complex::print(FILE *out) } struct scarf_collector { - virtual void add(Polyhedron *P, int sign, Polyhedron *C, unsigned MaxRays) = 0; + virtual void add(Polyhedron *P, int sign, Polyhedron *C, + barvinok_options *options) = 0; }; -static void scarf(Polyhedron *P, unsigned exist, unsigned nparam, unsigned MaxRays, - scarf_collector& col) +static void scarf(Polyhedron *P, unsigned exist, unsigned nparam, + barvinok_options *options, scarf_collector& col) { Matrix *A, *B; int dim = P->Dimension - exist - nparam; @@ -901,12 +902,12 @@ static void scarf(Polyhedron *P, unsigned exist, unsigned nparam, unsigned MaxRa scarf.add(B, pos, l); U = Universe_Polyhedron(nparam); - col.add(P, 0, U, MaxRays); + col.add(P, 0, U, options); for (int i = 0; i < scarf.simplices.size(); ++i) { Polyhedron *Q; int sign = (scarf.simplices[i].M->NbRows % 2) ? -1 : 1; - Q = scarf.simplices[i].shrunk_polyhedron(P, dim, A, MaxRays); - col.add(Q, sign, U, MaxRays); + Q = scarf.simplices[i].shrunk_polyhedron(P, dim, A, options->MaxRays); + col.add(Q, sign, U, options); Polyhedron_Free(Q); } Polyhedron_Free(U); @@ -923,28 +924,29 @@ struct scarf_collector_gf : public scarf_collector { scarf_collector_gf() { c.d = 1; } - virtual void add(Polyhedron *P, int sign, Polyhedron *C, unsigned MaxRays); + virtual void add(Polyhedron *P, int sign, Polyhedron *C, + barvinok_options *options); }; void scarf_collector_gf::add(Polyhedron *P, int sign, Polyhedron *C, - unsigned MaxRays) + barvinok_options *options) { if (!sign) - gf = barvinok_series(P, C, MaxRays); + gf = barvinok_series_with_options(P, C, options); else { gen_fun *gf2; c.n = sign; - gf2 = barvinok_series(P, C, MaxRays); + gf2 = barvinok_series_with_options(P, C, options); gf->add(c, gf2); delete gf2; } } gen_fun *barvinok_enumerate_scarf_series(Polyhedron *P, - unsigned exist, unsigned nparam, unsigned MaxRays) + unsigned exist, unsigned nparam, barvinok_options *options) { scarf_collector_gf scgf; - scarf(P, exist, nparam, MaxRays, scgf); + scarf(P, exist, nparam, options, scgf); return scgf.gf; } @@ -959,17 +961,18 @@ struct scarf_collector_ev : public scarf_collector { ~scarf_collector_ev() { free_evalue_refs(&mone); } - virtual void add(Polyhedron *P, int sign, Polyhedron *C, unsigned MaxRays); + virtual void add(Polyhedron *P, int sign, Polyhedron *C, + barvinok_options *options); }; void scarf_collector_ev::add(Polyhedron *P, int sign, Polyhedron *C, - unsigned MaxRays) + barvinok_options *options) { if (!sign) - EP = barvinok_enumerate_ev(P, C, MaxRays); + EP = barvinok_enumerate_with_options(P, C, options); else { evalue *E2; - E2 = barvinok_enumerate_ev(P, C, MaxRays); + E2 = barvinok_enumerate_with_options(P, C, options); if (sign < 0) emul(&mone, E2); eadd(E2, EP); @@ -979,9 +982,9 @@ void scarf_collector_ev::add(Polyhedron *P, int sign, Polyhedron *C, } evalue *barvinok_enumerate_scarf(Polyhedron *P, - unsigned exist, unsigned nparam, unsigned MaxRays) + unsigned exist, unsigned nparam, barvinok_options *options) { scarf_collector_ev scev; - scarf(P, exist, nparam, MaxRays, scev); + scarf(P, exist, nparam, options, scev); return scev.EP; } diff --git a/scarf.h b/scarf.h index 6e6a8cd..dec0cd1 100644 --- a/scarf.h +++ b/scarf.h @@ -4,8 +4,10 @@ #include evalue *barvinok_enumerate_scarf(Polyhedron *P, - unsigned exist, unsigned nparam, unsigned MaxRays); + unsigned exist, unsigned nparam, + barvinok_options *options); gen_fun *barvinok_enumerate_scarf_series(Polyhedron *P, - unsigned exist, unsigned nparam, unsigned MaxRays); + unsigned exist, unsigned nparam, + barvinok_options *options); #endif -- 2.11.4.GIT