2 * Copyright 2010 INRIA Saclay
4 * Use of this software is governed by the MIT license
6 * Written by Sven Verdoolaege, INRIA Saclay - Ile-de-France,
7 * Parc Club Orsay Universite, ZAC des vignes, 4 rue Jacques Monod,
11 #include <isl_pw_macro.h>
13 static isl_bool
any_divs(__isl_keep isl_set
*set
)
18 return isl_bool_error
;
20 for (i
= 0; i
< set
->n
; ++i
)
21 if (set
->p
[i
]->n_div
> 0)
24 return isl_bool_false
;
27 static isl_stat
foreach_lifted_subset(__isl_take isl_set
*set
,
29 isl_stat (*fn
)(__isl_take isl_set
*set
, __isl_take EL
*el
,
30 void *user
), void *user
)
37 for (i
= 0; i
< set
->n
; ++i
) {
41 lift
= isl_set_from_basic_set(isl_basic_set_copy(set
->p
[i
]));
42 lift
= isl_set_lift(lift
);
44 copy
= FN(EL
,copy
)(el
);
45 copy
= FN(EL
,lift
)(copy
, isl_set_get_space(lift
));
47 if (fn(lift
, copy
, user
) < 0)
58 return isl_stat_error
;
61 isl_stat
FN(PW
,foreach_lifted_piece
)(__isl_keep PW
*pw
,
62 isl_stat (*fn
)(__isl_take isl_set
*set
, __isl_take EL
*el
,
63 void *user
), void *user
)
68 return isl_stat_error
;
70 for (i
= 0; i
< pw
->n
; ++i
) {
75 any
= any_divs(pw
->p
[i
].set
);
77 return isl_stat_error
;
78 set
= isl_set_copy(pw
->p
[i
].set
);
79 el
= FN(EL
,copy
)(pw
->p
[i
].FIELD
);
81 if (fn(set
, el
, user
) < 0)
82 return isl_stat_error
;
85 if (foreach_lifted_subset(set
, el
, fn
, user
) < 0)
86 return isl_stat_error
;