From 1105392dcaa8271ee0b7d23779ea564b40d2c1d5 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Tue, 8 Apr 2008 13:18:22 +0200 Subject: [PATCH] verify.c: export functions for setting and clearing scanning polyhedra --- verify.c | 64 +++++++++++++++++++++++++++++++++++++++------------------------- verify.h | 3 +++ 2 files changed, 42 insertions(+), 25 deletions(-) diff --git a/verify.c b/verify.c index 10b59aa..69375dd 100644 --- a/verify.c +++ b/verify.c @@ -317,6 +317,43 @@ int check_poly(Polyhedron *CS, const struct check_poly_data *data, return 1; } /* check_poly */ +void check_EP_set_scan(struct check_EP_data *data, Polyhedron *C, + unsigned MaxRays) +{ + const evalue *EP = data->EP; + int i; + int n_S = 0; + + for (i = 0; i < EP->x.p->size/2; ++i) { + Polyhedron *A = EVALUE_DOMAIN(EP->x.p->arr[2*i]); + for (; A; A = A->next) + ++n_S; + } + + data->n_S = n_S; + data->S = ALLOCN(Polyhedron *, n_S); + n_S = 0; + for (i = 0; i < EP->x.p->size/2; ++i) { + Polyhedron *A = EVALUE_DOMAIN(EP->x.p->arr[2*i]); + for (; A; A = A->next) { + Polyhedron *next = A->next; + A->next = NULL; + data->S[n_S++] = Polyhedron_Scan(A, C, + MaxRays & POL_NO_DUAL ? 0 : MaxRays); + A->next = next; + } + } +} + +void check_EP_clear_scan(struct check_EP_data *data) +{ + int i; + + for (i = 0; i < data->n_S; ++i) + Domain_Free(data->S[i]); + free(data->S); +} + static int check_EP_on_poly(Polyhedron *P, struct check_EP_data *data, unsigned nvar, unsigned nparam, @@ -332,32 +369,9 @@ static int check_EP_on_poly(Polyhedron *P, check_poly_init(P, options); if (!(CS && emptyQ2(CS))) { - int i; - int n_S = 0; - - for (i = 0; i < EP->x.p->size/2; ++i) { - Polyhedron *A = EVALUE_DOMAIN(EP->x.p->arr[2*i]); - for (; A; A = A->next) - ++n_S; - } - - data->n_S = n_S; - data->S = ALLOCN(Polyhedron *, n_S); - n_S = 0; - for (i = 0; i < EP->x.p->size/2; ++i) { - Polyhedron *A = EVALUE_DOMAIN(EP->x.p->arr[2*i]); - for (; A; A = A->next) { - Polyhedron *next = A->next; - A->next = NULL; - data->S[n_S++] = Polyhedron_Scan(A, P, - MaxRays & POL_NO_DUAL ? 0 : MaxRays); - A->next = next; - } - } + check_EP_set_scan(data, P, MaxRays); ok = check_poly(CS, &data->cp, nparam, 0, data->cp.z+1+nvar, options); - for (i = 0; i < data->n_S; ++i) - Domain_Free(data->S[i]); - free(data->S); + check_EP_clear_scan(data); } if (!options->print_all) diff --git a/verify.h b/verify.h index 461f120..683644b 100644 --- a/verify.h +++ b/verify.h @@ -61,6 +61,9 @@ struct check_EP_data { int check_EP(struct check_EP_data *data, unsigned nvar, unsigned nparam, struct verify_options *options); void evalue_optimum(const struct check_EP_data *data, Value *opt, int sign); +void check_EP_set_scan(struct check_EP_data *data, Polyhedron *C, + unsigned MaxRays); +void check_EP_clear_scan(struct check_EP_data *data); #if defined(__cplusplus) } -- 2.11.4.GIT