Parma_Polyhedra_Library::C_Polyhedron Class Reference
[C++ Language Interface]

A closed convex polyhedron. More...

#include <C_Polyhedron.defs.hh>

Inheritance diagram for Parma_Polyhedra_Library::C_Polyhedron:

Inheritance graph
[legend]
Collaboration diagram for Parma_Polyhedra_Library::C_Polyhedron:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 C_Polyhedron (dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
 Builds either the universe or the empty C polyhedron.
 C_Polyhedron (const Constraint_System &cs)
 Builds a C polyhedron from a system of constraints.
 C_Polyhedron (Constraint_System &cs, Recycle_Input dummy)
 Builds a C polyhedron recycling a system of constraints.
 C_Polyhedron (const Generator_System &gs)
 Builds a C polyhedron from a system of generators.
 C_Polyhedron (Generator_System &gs, Recycle_Input dummy)
 Builds a C polyhedron recycling a system of generators.
 C_Polyhedron (const Congruence_System &cgs)
 Builds a C polyhedron from a system of congruences.
 C_Polyhedron (Congruence_System &cgs, Recycle_Input dummy)
 Builds a C polyhedron recycling a system of congruences.
 C_Polyhedron (const NNC_Polyhedron &y, Complexity_Class complexity=ANY_COMPLEXITY)
 Builds a C polyhedron representing the topological closure of the NNC polyhedron y.
template<typename Interval>
 C_Polyhedron (const Box< Interval > &box, Complexity_Class complexity=ANY_COMPLEXITY)
 Builds a C polyhedron out of a box.
template<typename U>
 C_Polyhedron (const BD_Shape< U > &bd, Complexity_Class complexity=ANY_COMPLEXITY)
 Builds a C polyhedron out of a BD shape.
template<typename U>
 C_Polyhedron (const Octagonal_Shape< U > &os, Complexity_Class complexity=ANY_COMPLEXITY)
 Builds a C polyhedron out of an octagonal shape.
 C_Polyhedron (const Grid &grid, Complexity_Class complexity=ANY_COMPLEXITY)
 Builds a C polyhedron out of a grid.
 C_Polyhedron (const C_Polyhedron &y, Complexity_Class complexity=ANY_COMPLEXITY)
 Ordinary copy-constructor.
C_Polyhedronoperator= (const C_Polyhedron &y)
 The assignment operator. (*this and y can be dimension-incompatible.).
C_Polyhedronoperator= (const NNC_Polyhedron &y)
 Assigns to *this the topological closure of the NNC polyhedron y.
 ~C_Polyhedron ()
 Destructor.
bool poly_hull_assign_if_exact (const C_Polyhedron &y)
 If the poly-hull of *this and y is exact it is assigned to *this and true is returned, otherwise false is returned.
bool upper_bound_assign_if_exact (const C_Polyhedron &y)
 Same as poly_hull_assign_if_exact(y).


Detailed Description

A closed convex polyhedron.

An object of the class C_Polyhedron represents a topologically closed convex polyhedron in the vector space $\Rset^n$.

When building a closed polyhedron starting from a system of constraints, an exception is thrown if the system contains a strict inequality constraint. Similarly, an exception is thrown when building a closed polyhedron starting from a system of generators containing a closure point.

Note:
Such an exception will be obtained even if the system of constraints (resp., generators) actually defines a topologically closed subset of the vector space, i.e., even if all the strict inequalities (resp., closure points) in the system happen to be redundant with respect to the system obtained by removing all the strict inequality constraints (resp., all the closure points). In contrast, when building a closed polyhedron starting from an object of the class NNC_Polyhedron, the precise topological closure test will be performed.

Definition at line 58 of file C_Polyhedron.defs.hh.


Constructor & Destructor Documentation

Parma_Polyhedra_Library::C_Polyhedron::C_Polyhedron ( dimension_type  num_dimensions = 0,
Degenerate_Element  kind = UNIVERSE 
) [inline, explicit]

Builds either the universe or the empty C polyhedron.

Parameters:
num_dimensions The number of dimensions of the vector space enclosing the C polyhedron;
kind Specifies whether a universe or an empty C polyhedron should be built.
Exceptions:
std::length_error Thrown if num_dimensions exceeds the maximum allowed space dimension.
Both parameters are optional: by default, a 0-dimension space universe C polyhedron is built.

Definition at line 36 of file C_Polyhedron.inlines.hh.

00038   : Polyhedron(NECESSARILY_CLOSED,
00039                num_dimensions <= max_space_dimension()
00040                ? num_dimensions
00041                : (throw_space_dimension_overflow(NECESSARILY_CLOSED,
00042                                                  "C_Polyhedron(n, k)",
00043                                                  "n exceeds the maximum "
00044                                                  "allowed space dimension"),
00045                   num_dimensions),
00046                kind) {
00047 }

Parma_Polyhedra_Library::C_Polyhedron::C_Polyhedron ( const Constraint_System cs  )  [inline, explicit]

Builds a C polyhedron from a system of constraints.

The polyhedron inherits the space dimension of the constraint system.

Parameters:
cs The system of constraints defining the polyhedron.
Exceptions:
std::invalid_argument Thrown if the system of constraints contains strict inequalities.

Definition at line 50 of file C_Polyhedron.inlines.hh.

00051   : Polyhedron(NECESSARILY_CLOSED,
00052                cs.space_dimension() <= max_space_dimension()
00053                ? cs
00054                : (throw_space_dimension_overflow(NECESSARILY_CLOSED,
00055                                                  "C_Polyhedron(cs)",
00056                                                  "the space dimension of cs "
00057                                                  "exceeds the maximum allowed "
00058                                                  "space dimension"), cs)) {
00059 }

Parma_Polyhedra_Library::C_Polyhedron::C_Polyhedron ( Constraint_System cs,
Recycle_Input  dummy 
) [inline]

Builds a C polyhedron recycling a system of constraints.

The polyhedron inherits the space dimension of the constraint system.

Parameters:
cs The system of constraints defining the polyhedron. It is not declared const because its data-structures may be recycled to build the polyhedron.
dummy A dummy tag to syntactically differentiate this one from the other constructors.
Exceptions:
std::invalid_argument Thrown if the system of constraints contains strict inequalities.

Definition at line 62 of file C_Polyhedron.inlines.hh.

00063   : Polyhedron(NECESSARILY_CLOSED,
00064                cs.space_dimension() <= max_space_dimension()
00065                ? cs
00066                : (throw_space_dimension_overflow(NECESSARILY_CLOSED,
00067                                                  "C_Polyhedron(cs, recycle)",
00068                                                  "the space dimension of cs "
00069                                                  "exceeds the maximum allowed "
00070                                                  "space dimension"), cs),
00071                Recycle_Input()) {
00072 }

Parma_Polyhedra_Library::C_Polyhedron::C_Polyhedron ( const Generator_System gs  )  [inline, explicit]

Builds a C polyhedron from a system of generators.

The polyhedron inherits the space dimension of the generator system.

Parameters:
gs The system of generators defining the polyhedron.
Exceptions:
std::invalid_argument Thrown if the system of generators is not empty but has no points, or if it contains closure points.

Definition at line 75 of file C_Polyhedron.inlines.hh.

00076   : Polyhedron(NECESSARILY_CLOSED,
00077                gs.space_dimension() <= max_space_dimension()
00078                ? gs
00079                : (throw_space_dimension_overflow(NECESSARILY_CLOSED,
00080                                                  "C_Polyhedron(gs)",
00081                                                  "the space dimension of gs "
00082                                                  "exceeds the maximum allowed "
00083                                                  "space dimension"), gs)) {
00084 }

Parma_Polyhedra_Library::C_Polyhedron::C_Polyhedron ( Generator_System gs,
Recycle_Input  dummy 
) [inline]

Builds a C polyhedron recycling a system of generators.

The polyhedron inherits the space dimension of the generator system.

Parameters:
gs The system of generators defining the polyhedron. It is not declared const because its data-structures may be recycled to build the polyhedron.
dummy A dummy tag to syntactically differentiate this one from the other constructors.
Exceptions:
std::invalid_argument Thrown if the system of generators is not empty but has no points, or if it contains closure points.

Definition at line 87 of file C_Polyhedron.inlines.hh.

00088   : Polyhedron(NECESSARILY_CLOSED,
00089                gs.space_dimension() <= max_space_dimension()
00090                ? gs
00091                : (throw_space_dimension_overflow(NECESSARILY_CLOSED,
00092                                                  "C_Polyhedron(gs, recycle)",
00093                                                  "the space dimension of gs "
00094                                                  "exceeds the maximum allowed "
00095                                                  "space dimension"), gs),
00096                Recycle_Input()) {
00097 }

Parma_Polyhedra_Library::C_Polyhedron::C_Polyhedron ( const Congruence_System cgs  )  [explicit]

Builds a C polyhedron from a system of congruences.

The polyhedron inherits the space dimension of the congruence system.

Parameters:
cgs The system of congruences defining the polyhedron.

Definition at line 43 of file C_Polyhedron.cc.

References Parma_Polyhedra_Library::Polyhedron::add_congruences().

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 }

Parma_Polyhedra_Library::C_Polyhedron::C_Polyhedron ( Congruence_System cgs,
Recycle_Input  dummy 
)

Builds a C polyhedron recycling a system of congruences.

The polyhedron inherits the space dimension of the congruence system.

Parameters:
cgs The system of congruences defining the polyhedron. It is not declared const because its data-structures may be recycled to build the polyhedron.
dummy A dummy tag to syntactically differentiate this one from the other constructors.

Definition at line 56 of file C_Polyhedron.cc.

References Parma_Polyhedra_Library::Polyhedron::add_congruences().

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 }

Parma_Polyhedra_Library::C_Polyhedron::C_Polyhedron ( const NNC_Polyhedron y,
Complexity_Class  complexity = ANY_COMPLEXITY 
) [explicit]

Builds a C polyhedron representing the topological closure of the NNC polyhedron y.

Parameters:
y The NNC polyhedron to be used;
complexity This argument is ignored.

Definition at line 32 of file C_Polyhedron.cc.

References Parma_Polyhedra_Library::Polyhedron::add_constraint(), Parma_Polyhedra_Library::Constraint_System::begin(), Parma_Polyhedra_Library::Polyhedron::constraints(), Parma_Polyhedra_Library::Constraint_System::end(), Parma_Polyhedra_Library::Constraint::is_strict_inequality(), and Parma_Polyhedra_Library::Polyhedron::OK().

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 }

template<typename Interval>
Parma_Polyhedra_Library::C_Polyhedron::C_Polyhedron ( const Box< Interval > &  box,
Complexity_Class  complexity = ANY_COMPLEXITY 
) [inline, explicit]

Builds a C polyhedron out of a box.

The polyhedron inherits the space dimension of the box and is the most precise that includes the box. The algorithm used has polynomial complexity.

Parameters:
box The box representing the polyhedron to be approximated;
complexity This argument is ignored.
Exceptions:
std::length_error Thrown if the space dimension of box exceeds the maximum allowed space dimension.

Definition at line 101 of file C_Polyhedron.inlines.hh.

00102   : Polyhedron(NECESSARILY_CLOSED,
00103                box.space_dimension() <= max_space_dimension()
00104                ? box
00105                : (throw_space_dimension_overflow(NECESSARILY_CLOSED,
00106                                                  "C_Polyhedron(box): ",
00107                                                  "the space dimension of box "
00108                                                  "exceeds the maximum allowed "
00109                                                  "space dimension"), box)) {
00110 }

template<typename U>
Parma_Polyhedra_Library::C_Polyhedron::C_Polyhedron ( const BD_Shape< U > &  bd,
Complexity_Class  complexity = ANY_COMPLEXITY 
) [inline, explicit]

Builds a C polyhedron out of a BD shape.

The polyhedron inherits the space dimension of the BDS and is the most precise that includes the BDS.

Parameters:
bd The BDS used to build the polyhedron.
complexity This argument is ignored as the algorithm used has polynomial complexity.

Definition at line 114 of file C_Polyhedron.inlines.hh.

References Parma_Polyhedra_Library::Polyhedron::add_constraints(), and Parma_Polyhedra_Library::BD_Shape< T >::constraints().

00115   : Polyhedron(NECESSARILY_CLOSED,
00116                bd.space_dimension() <= max_space_dimension()
00117                ? bd.space_dimension()
00118                : (throw_space_dimension_overflow(NECESSARILY_CLOSED,
00119                                                  "C_Polyhedron(bd): ",
00120                                                  "the space dimension of bd "
00121                                                  "exceeds the maximum allowed "
00122                                                  "space dimension"), 0),
00123                UNIVERSE) {
00124   add_constraints(bd.constraints());
00125 }

template<typename U>
Parma_Polyhedra_Library::C_Polyhedron::C_Polyhedron ( const Octagonal_Shape< U > &  os,
Complexity_Class  complexity = ANY_COMPLEXITY 
) [inline, explicit]

Builds a C polyhedron out of an octagonal shape.

The polyhedron inherits the space dimension of the octagonal shape and is the most precise that includes the octagonal shape.

Parameters:
os The octagonal shape used to build the polyhedron.
complexity This argument is ignored as the algorithm used has polynomial complexity.

Definition at line 129 of file C_Polyhedron.inlines.hh.

References Parma_Polyhedra_Library::Polyhedron::add_constraints(), and Parma_Polyhedra_Library::Octagonal_Shape< T >::constraints().

00130   : Polyhedron(NECESSARILY_CLOSED,
00131                os.space_dimension() <= max_space_dimension()
00132                ? os.space_dimension()
00133                : (throw_space_dimension_overflow(NECESSARILY_CLOSED,
00134                                                  "C_Polyhedron(os): ",
00135                                                  "the space dimension of os "
00136                                                  "exceeds the maximum allowed "
00137                                                  "space dimension"), 0),
00138                UNIVERSE) {
00139   add_constraints(os.constraints());
00140 }

Parma_Polyhedra_Library::C_Polyhedron::C_Polyhedron ( const Grid grid,
Complexity_Class  complexity = ANY_COMPLEXITY 
) [explicit]

Builds a C polyhedron out of a grid.

The polyhedron inherits the space dimension of the grid and is the most precise that includes the grid.

Parameters:
grid The grid used to build the polyhedron.
complexity This argument is ignored as the algorithm used has polynomial complexity.

Definition at line 70 of file C_Polyhedron.cc.

References Parma_Polyhedra_Library::Polyhedron::add_constraints(), and Parma_Polyhedra_Library::Grid::constraints().

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 }

Parma_Polyhedra_Library::C_Polyhedron::C_Polyhedron ( const C_Polyhedron y,
Complexity_Class  complexity = ANY_COMPLEXITY 
) [inline]

Ordinary copy-constructor.

The complexity argument is ignored.

Definition at line 143 of file C_Polyhedron.inlines.hh.

00144   : Polyhedron(y) {
00145 }

Parma_Polyhedra_Library::C_Polyhedron::~C_Polyhedron (  )  [inline]

Destructor.

Definition at line 32 of file C_Polyhedron.inlines.hh.

00032                             {
00033 }


Member Function Documentation

C_Polyhedron & Parma_Polyhedra_Library::C_Polyhedron::operator= ( const C_Polyhedron y  )  [inline]

The assignment operator. (*this and y can be dimension-incompatible.).

Definition at line 148 of file C_Polyhedron.inlines.hh.

References Parma_Polyhedra_Library::Polyhedron::operator=().

00148                                              {
00149   Polyhedron::operator=(y);
00150   return *this;
00151 }

C_Polyhedron & Parma_Polyhedra_Library::C_Polyhedron::operator= ( const NNC_Polyhedron y  )  [inline]

Assigns to *this the topological closure of the NNC polyhedron y.

Definition at line 154 of file C_Polyhedron.inlines.hh.

References Parma_Polyhedra_Library::Polyhedron::swap().

00154                                                {
00155   C_Polyhedron c_y(y);
00156   swap(c_y);
00157   return *this;
00158 }

bool Parma_Polyhedra_Library::C_Polyhedron::poly_hull_assign_if_exact ( const C_Polyhedron y  ) 

If the poly-hull of *this and y is exact it is assigned to *this and true is returned, otherwise false is returned.

Exceptions:
std::invalid_argument Thrown if *this and y are dimension-incompatible.

Definition at line 84 of file C_Polyhedron.cc.

Referenced by upper_bound_assign_if_exact().

00084                                                                 {
00085   return PPL::poly_hull_assign_if_exact(*this, q);
00086 }

bool Parma_Polyhedra_Library::C_Polyhedron::upper_bound_assign_if_exact ( const C_Polyhedron y  )  [inline]

Same as poly_hull_assign_if_exact(y).

Definition at line 161 of file C_Polyhedron.inlines.hh.

References poly_hull_assign_if_exact().

00161                                                                {
00162   return poly_hull_assign_if_exact(y);
00163 }


The documentation for this class was generated from the following files:

Generated on Sat Oct 11 10:41:13 2008 for PPL by  doxygen 1.5.6