isl_space_reset: rename "dim" argument to "space"
[isl.git] / isl_multi_domain_templ.c
blob6aa97fe320173a01a663ee98b848e215de90adb4
1 /*
2 * Copyright 2013 Ecole Normale Superieure
4 * Use of this software is governed by the MIT license
6 * Written by Sven Verdoolaege,
7 * Ecole Normale Superieure, 45 rue d'Ulm, 75230 Paris, France
8 */
10 #include <isl/set.h>
12 #include <isl_multi_macro.h>
14 /* Return the shared domain of the elements of "multi".
16 * If "multi" has an explicit domain, then return this domain.
18 __isl_give isl_set *FN(MULTI(BASE),domain)(__isl_take MULTI(BASE) *multi)
20 int i;
21 isl_set *dom;
23 if (!multi)
24 return NULL;
26 if (FN(MULTI(BASE),has_explicit_domain)(multi)) {
27 dom = FN(MULTI(BASE),get_explicit_domain)(multi);
28 FN(MULTI(BASE),free)(multi);
29 return dom;
32 dom = isl_set_universe(FN(MULTI(BASE),get_domain_space)(multi));
33 for (i = 0; i < multi->n; ++i) {
34 isl_set *dom_i;
36 dom_i = FN(EL,domain)(FN(FN(MULTI(BASE),get),BASE)(multi, i));
37 dom = isl_set_intersect(dom, dom_i);
40 FN(MULTI(BASE),free)(multi);
41 return dom;