00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include <ppl-config.h>
00025
00026 #include "NNC_Polyhedron.defs.hh"
00027 #include "C_Polyhedron.defs.hh"
00028 #include "Grid.defs.hh"
00029 #include "algorithms.hh"
00030
00031 namespace PPL = Parma_Polyhedra_Library;
00032
00033 PPL::NNC_Polyhedron::NNC_Polyhedron(const C_Polyhedron& y, Complexity_Class)
00034 : Polyhedron(NOT_NECESSARILY_CLOSED, y.space_dimension(), UNIVERSE) {
00035 add_constraints(y.constraints());
00036 PPL_ASSERT_HEAVY(OK());
00037 }
00038
00039 PPL::NNC_Polyhedron::NNC_Polyhedron(const Congruence_System& cgs)
00040 : Polyhedron(NOT_NECESSARILY_CLOSED,
00041 cgs.space_dimension() <= max_space_dimension()
00042 ? cgs.space_dimension()
00043 : (throw_space_dimension_overflow(NOT_NECESSARILY_CLOSED,
00044 "NNC_Polyhedron(cgs)",
00045 "the space dimension of cgs "
00046 "exceeds the maximum allowed "
00047 "space dimension"), 0),
00048 UNIVERSE) {
00049 add_congruences(cgs);
00050 PPL_ASSERT_HEAVY(OK());
00051 }
00052
00053 PPL::NNC_Polyhedron::NNC_Polyhedron(Congruence_System& cgs, Recycle_Input)
00054 : Polyhedron(NOT_NECESSARILY_CLOSED,
00055 cgs.space_dimension() <= max_space_dimension()
00056 ? cgs.space_dimension()
00057 : (throw_space_dimension_overflow(NOT_NECESSARILY_CLOSED,
00058 "NNC_Polyhedron"
00059 "(cgs, recycle)",
00060 "the space dimension of cgs "
00061 "exceeds the maximum allowed "
00062 "space dimension"), 0),
00063 UNIVERSE) {
00064 add_congruences(cgs);
00065 PPL_ASSERT_HEAVY(OK());
00066 }
00067
00068 PPL::NNC_Polyhedron::NNC_Polyhedron(const Grid& grid, Complexity_Class)
00069 : Polyhedron(NOT_NECESSARILY_CLOSED,
00070 grid.space_dimension() <= max_space_dimension()
00071 ? grid.space_dimension()
00072 : (throw_space_dimension_overflow(NOT_NECESSARILY_CLOSED,
00073 "C_Polyhedron(grid)",
00074 "the space dimension of grid "
00075 "exceeds the maximum allowed "
00076 "space dimension"), 0),
00077 UNIVERSE) {
00078 add_constraints(grid.constraints());
00079 }
00080
00081 bool
00082 PPL::NNC_Polyhedron::poly_hull_assign_if_exact(const NNC_Polyhedron& y) {
00083 #define USE_BHZ09 1
00084 #if USE_BHZ09 // [BagnaraHZ09]
00085
00086 if (space_dimension() != y.space_dimension())
00087 throw_dimension_incompatible("poly_hull_assign_if_exact(y)", "y", y);
00088 return BHZ09_poly_hull_assign_if_exact(y);
00089 #else // Old implementation.
00090 return PPL::poly_hull_assign_if_exact(*this, y);
00091 #endif
00092 #undef USE_BHZ09
00093 }