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