From ab8c61a2c7dcf302ec9c8dcfa26a8cdaa4ea55ba Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Sun, 7 Mar 2010 18:57:57 +0100 Subject: [PATCH] add isl_set_from_point --- doc/user.pod | 7 ++++++- include/isl_set.h | 1 + isl_point.c | 27 +++++++++++++++------------ 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/doc/user.pod b/doc/user.pod index b8fe52f..3f9129d 100644 --- a/doc/user.pod +++ b/doc/user.pod @@ -1070,7 +1070,12 @@ Points can be copied or freed using __isl_keep isl_point *pnt); void isl_point_free(__isl_take isl_point *pnt); -A box can be created from two opposite extremal points using +A singleton set can be created from a point using + + __isl_give isl_set *isl_set_from_point( + __isl_take isl_point *pnt); + +and a box can be created from two opposite extremal points using __isl_give isl_set *isl_set_box_from_points( __isl_take isl_point *pnt1, diff --git a/include/isl_set.h b/include/isl_set.h index 772839e..1f71275 100644 --- a/include/isl_set.h +++ b/include/isl_set.h @@ -308,6 +308,7 @@ int isl_set_foreach_point(__isl_keep isl_set *set, int (*fn)(__isl_take isl_point *pnt, void *user), void *user); int isl_set_count(__isl_keep isl_set *set, isl_int *count); +__isl_give isl_set *isl_set_from_point(__isl_take isl_point *pnt); __isl_give isl_set *isl_set_box_from_points(__isl_take isl_point *pnt1, __isl_take isl_point *pnt2); diff --git a/isl_point.c b/isl_point.c index a8f278e..9177c34 100644 --- a/isl_point.c +++ b/isl_point.c @@ -319,6 +319,19 @@ int isl_set_contains_point(__isl_keep isl_set *set, __isl_keep isl_point *point) return isl_map_contains_point((isl_map *)set, point); } +__isl_give isl_set *isl_set_from_point(__isl_take isl_point *pnt) +{ + isl_basic_set *bset; + isl_basic_set *model; + + model = isl_basic_set_empty(isl_dim_copy(pnt->dim)); + bset = isl_basic_set_from_vec(isl_vec_copy(pnt->vec)); + bset = isl_basic_set_from_underlying_set(bset, model); + isl_point_free(pnt); + + return isl_set_from_basic_set(bset); +} + __isl_give isl_set *isl_set_box_from_points(__isl_take isl_point *pnt1, __isl_take isl_point *pnt2) { @@ -344,24 +357,14 @@ __isl_give isl_set *isl_set_box_from_points(__isl_take isl_point *pnt1, return isl_set_empty(dim); } if (isl_point_is_void(pnt1)) { - isl_basic_set *model; - model = isl_basic_set_empty(isl_dim_copy(pnt2->dim)); - bset = isl_basic_set_from_vec(isl_vec_copy(pnt2->vec)); - bset = isl_basic_set_from_underlying_set(bset, model); isl_point_free(pnt1); - isl_point_free(pnt2); isl_int_clear(t); - return isl_set_from_basic_set(bset); + return isl_set_from_point(pnt2); } if (isl_point_is_void(pnt2)) { - isl_basic_set *model; - model = isl_basic_set_empty(isl_dim_copy(pnt1->dim)); - bset = isl_basic_set_from_vec(isl_vec_copy(pnt1->vec)); - bset = isl_basic_set_from_underlying_set(bset, model); - isl_point_free(pnt1); isl_point_free(pnt2); isl_int_clear(t); - return isl_set_from_basic_set(bset); + return isl_set_from_point(pnt1); } total = isl_dim_total(pnt1->dim); -- 2.7.4