00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include <ppl-config.h>
00024
00025 #include "C_Polyhedron.defs.hh"
00026 #include "NNC_Polyhedron.defs.hh"
00027 #include "Grid.defs.hh"
00028 #include "algorithms.hh"
00029
00030 namespace PPL = Parma_Polyhedra_Library;
00031
00032 PPL::C_Polyhedron::C_Polyhedron(const NNC_Polyhedron& y, Complexity_Class)
00033 : Polyhedron(NECESSARILY_CLOSED, y.space_dimension(), UNIVERSE) {
00034 const Constraint_System& cs = y.constraints();
00035 for (Constraint_System::const_iterator i = cs.begin(),
00036 cs_end = cs.end(); i != cs_end; ++i) {
00037 const Constraint& c = *i;
00038 add_constraint(c.is_strict_inequality() ? (Linear_Expression(c) >= 0) : c);
00039 }
00040 assert(OK());
00041 }
00042
00043 PPL::C_Polyhedron::C_Polyhedron(const Congruence_System& cgs)
00044 : Polyhedron(NECESSARILY_CLOSED,
00045 cgs.space_dimension() <= max_space_dimension()
00046 ? cgs.space_dimension()
00047 : (throw_space_dimension_overflow(NECESSARILY_CLOSED,
00048 "C_Polyhedron(cgs)",
00049 "the space dimension of cgs "
00050 "exceeds the maximum allowed "
00051 "space dimension"), 0),
00052 UNIVERSE) {
00053 add_congruences(cgs);
00054 }
00055
00056 PPL::C_Polyhedron::C_Polyhedron(Congruence_System& cgs, Recycle_Input)
00057 : Polyhedron(NECESSARILY_CLOSED,
00058 cgs.space_dimension() <= max_space_dimension()
00059 ? cgs.space_dimension()
00060 : (throw_space_dimension_overflow(NECESSARILY_CLOSED,
00061 "NNC_Polyhedron"
00062 "(cgs, recycle)",
00063 "the space dimension of cgs "
00064 "exceeds the maximum allowed "
00065 "space dimension"), 0),
00066 UNIVERSE) {
00067 add_congruences(cgs);
00068 }
00069
00070 PPL::C_Polyhedron::C_Polyhedron(const Grid& grid, Complexity_Class)
00071 : Polyhedron(NECESSARILY_CLOSED,
00072 grid.space_dimension() <= max_space_dimension()
00073 ? grid.space_dimension()
00074 : (throw_space_dimension_overflow(NECESSARILY_CLOSED,
00075 "C_Polyhedron(grid)",
00076 "the space dimension of grid "
00077 "exceeds the maximum allowed "
00078 "space dimension"), 0),
00079 UNIVERSE) {
00080 add_constraints(grid.constraints());
00081 }
00082
00083 bool
00084 PPL::C_Polyhedron::poly_hull_assign_if_exact(const C_Polyhedron& q) {
00085 return PPL::poly_hull_assign_if_exact(*this, q);
00086 }