PPL  1.2
NNC_Polyhedron.cc
Go to the documentation of this file.
1 /* NNC_Polyhedron class implementation (non-inline functions).
2  Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it>
3  Copyright (C) 2010-2016 BUGSENG srl (http://bugseng.com)
4 
5 This file is part of the Parma Polyhedra Library (PPL).
6 
7 The PPL is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 3 of the License, or (at your
10 option) any later version.
11 
12 The PPL is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software Foundation,
19 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307, USA.
20 
21 For the most up-to-date information see the Parma Polyhedra Library
22 site: http://bugseng.com/products/ppl/ . */
23 
24 #include "ppl-config.h"
25 #include "NNC_Polyhedron_defs.hh"
26 #include "C_Polyhedron_defs.hh"
27 #include "Grid_defs.hh"
28 #include "algorithms.hh"
29 
30 namespace PPL = Parma_Polyhedra_Library;
31 
33  : Polyhedron(NOT_NECESSARILY_CLOSED, y.space_dimension(), UNIVERSE) {
35  PPL_ASSERT_HEAVY(OK());
36 }
37 
40  check_space_dimension_overflow(cgs.space_dimension(),
42  "NNC_Polyhedron(cgs)",
43  "the space dimension of cgs "
44  "exceeds the maximum allowed "
45  "space dimension"),
46  UNIVERSE) {
47  add_congruences(cgs);
48  PPL_ASSERT_HEAVY(OK());
49 }
50 
53  check_space_dimension_overflow(cgs.space_dimension(),
55  "NNC_Polyhedron(cgs, recycle)",
56  "the space dimension of cgs "
57  "exceeds the maximum allowed "
58  "space dimension"),
59  UNIVERSE) {
60  add_congruences(cgs);
61  PPL_ASSERT_HEAVY(OK());
62 }
63 
66  check_space_dimension_overflow(grid.space_dimension(),
68  "NNC_Polyhedron(grid)",
69  "the space dimension of grid "
70  "exceeds the maximum allowed "
71  "space dimension"),
72  UNIVERSE) {
74 }
75 
76 bool
78 #define USE_BHZ09 1
79 #if USE_BHZ09 // [BagnaraHZ09]
80  // Dimension-compatibility check.
81  if (space_dimension() != y.space_dimension()) {
82  throw_dimension_incompatible("poly_hull_assign_if_exact(y)", "y", y);
83  }
84  return BHZ09_poly_hull_assign_if_exact(y);
85 #else // Old implementation.
86  return PPL::poly_hull_assign_if_exact(*this, y);
87 #endif
88 #undef USE_BHZ09
89 }
void add_congruences(const Congruence_System &cgs)
Adds a copy of the congruences in cgs to *this, if all the congruences can be exactly represented by ...
const Constraint_System & constraints() const
Returns the system of constraints.
Complexity_Class
Complexity pseudo-classes.
The base class for convex polyhedra.
NNC_Polyhedron(dimension_type num_dimensions=0, Degenerate_Element kind=UNIVERSE)
Builds either the universe or the empty NNC polyhedron.
dimension_type check_space_dimension_overflow(const dimension_type dim, const dimension_type max, const char *domain, const char *method, const char *reason)
Definition: globals.cc:48
A not necessarily closed convex polyhedron.
A closed convex polyhedron.
The universe element, i.e., the whole vector space.
void add_constraints(const Constraint_System &cs)
Adds a copy of the constraints in cs to the system of constraints of *this (without minimizing the re...
Constraint_System constraints() const
Returns a system of equality constraints satisfied by *this with the same affine dimension as *this...
The entire library is confined to this namespace.
Definition: version.hh:61
bool poly_hull_assign_if_exact(const NNC_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 OK(bool check_not_empty=false) const
Checks if all the invariants are satisfied.
dimension_type space_dimension() const
Returns the dimension of the vector space enclosing *this.