Home | History | Annotate | Line # | Download | only in dist
      1  1.1  mrg /*
      2  1.1  mrg  * Copyright 2012,2014 Ecole Normale Superieure
      3  1.1  mrg  *
      4  1.1  mrg  * Use of this software is governed by the MIT license
      5  1.1  mrg  *
      6  1.1  mrg  * Written by Sven Verdoolaege,
      7  1.1  mrg  * Ecole Normale Superieure, 45 rue d'Ulm, 75230 Paris, France
      8  1.1  mrg  */
      9  1.1  mrg 
     10  1.1  mrg #include <isl/space.h>
     11  1.1  mrg 
     12  1.1  mrg #include <isl_multi_macro.h>
     13  1.1  mrg 
     14  1.1  mrg /* Create a multiple expression with a single output/set dimension
     15  1.1  mrg  * equal to "el".
     16  1.1  mrg  * For most multiple expression types, the base type has a single
     17  1.1  mrg  * output/set dimension and the space of the result is therefore
     18  1.1  mrg  * the same as the space of the input.
     19  1.1  mrg  * In the case of isl_multi_union_pw_aff, however, the base type
     20  1.1  mrg  * lives in a parameter space and we therefore need to add
     21  1.1  mrg  * a single set dimension.
     22  1.1  mrg  */
     23  1.1  mrg __isl_give MULTI(BASE) *FN(FN(MULTI(BASE),from),BASE)(__isl_take EL *el)
     24  1.1  mrg {
     25  1.1  mrg 	isl_space *space;
     26  1.1  mrg 	MULTI(BASE) *multi;
     27  1.1  mrg 
     28  1.1  mrg 	space = FN(EL,get_space(el));
     29  1.1  mrg 	if (isl_space_is_params(space)) {
     30  1.1  mrg 		space = isl_space_set_from_params(space);
     31  1.1  mrg 		space = isl_space_add_dims(space, isl_dim_set, 1);
     32  1.1  mrg 	}
     33  1.1  mrg 	multi = FN(MULTI(BASE),alloc)(space);
     34  1.1  mrg 	multi = FN(FN(MULTI(BASE),set),BASE)(multi, 0, el);
     35  1.1  mrg 
     36  1.1  mrg 	return multi;
     37  1.1  mrg }
     38