PPL  1.2
Grid_Generator_System_defs.hh
Go to the documentation of this file.
1 /* Grid_Generator_System class declaration.
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 #ifndef PPL_Grid_Generator_System_defs_hh
25 #define PPL_Grid_Generator_System_defs_hh 1
26 
28 
29 #include "Linear_System_defs.hh"
30 #include "Grid_Generator_defs.hh"
31 #include "Variables_Set_types.hh"
32 #include "Polyhedron_types.hh"
33 #include <iosfwd>
34 #include <cstddef>
35 
36 namespace Parma_Polyhedra_Library {
37 
38 namespace IO_Operators {
39 
41 
46 std::ostream& operator<<(std::ostream& s, const Grid_Generator_System& gs);
47 
48 } // namespace IO_Operators
49 
51 
52 void swap(Grid_Generator_System& x, Grid_Generator_System& y);
53 
55 
56 bool operator==(const Grid_Generator_System& x,
57  const Grid_Generator_System& y);
58 
59 } // namespace Parma_Polyhedra_Library
60 
62 
176 public:
178 
180 
182  explicit Grid_Generator_System(Representation r = default_representation);
183 
185  explicit Grid_Generator_System(const Grid_Generator& g,
186  Representation r = default_representation);
187 
190  Representation r = default_representation);
191 
195 
198 
201 
204 
207 
210 
213 
216 
221  void clear();
222 
231  void insert(const Grid_Generator& g);
232 
238 
244 
246  static void initialize();
247 
249  static void finalize();
250 
255  static const Grid_Generator_System& zero_dim_univ();
256 
258 
279  : public std::iterator<std::forward_iterator_tag,
280  Grid_Generator,
281  std::ptrdiff_t,
282  const Grid_Generator*,
283  const Grid_Generator&> {
284  public:
286  const_iterator();
287 
289  const_iterator(const const_iterator& y);
290 
292  ~const_iterator();
293 
296 
298  const Grid_Generator& operator*() const;
299 
301  const Grid_Generator* operator->() const;
302 
305 
308 
313  bool operator==(const const_iterator& y) const;
314 
319  bool operator!=(const const_iterator& y) const;
320 
321  private:
322  friend class Grid_Generator_System;
323 
325 
328  };
329 
331  bool empty() const;
332 
338  const_iterator begin() const;
339 
341  const_iterator end() const;
342 
344  dimension_type num_rows() const;
345 
348 
350  dimension_type num_lines() const;
351 
356  bool has_points() const;
357 
359  bool is_equal_to(const Grid_Generator_System& y) const;
360 
362  bool OK() const;
363 
365 
375  bool ascii_load(std::istream& s);
376 
379 
382 
384  void m_swap(Grid_Generator_System& y);
385 
386 private:
388  const Grid_Generator& operator[](dimension_type k) const;
389 
391 
419  void affine_image(Variable v,
420  const Linear_Expression& expr,
421  Coefficient_traits::const_reference denominator);
422 
424  void set_sorted(bool b);
425 
442 
444  void set_space_dimension(dimension_type space_dim);
445 
447 
452  void remove_space_dimensions(const Variables_Set& vars);
453 
457 
459  void unset_pending_rows();
460 
462  /*
463  \param cycle
464  A vector representing a cycle of the permutation according to which the
465  columns must be rearranged.
466 
467  The \p cycle vector represents a cycle of a permutation of space
468  dimensions.
469  For example, the permutation
470  \f$ \{ x_1 \mapsto x_2, x_2 \mapsto x_3, x_3 \mapsto x_1 \}\f$ can be
471  represented by the vector containing \f$ x_1, x_2, x_3 \f$.
472  */
473  void permute_space_dimensions(const std::vector<Variable>& cycle);
474 
475  bool has_no_rows() const;
476 
479 
480  void insert_verbatim(const Grid_Generator& g);
481 
483  Topology topology() const;
484 
487 
489 
495 
496  friend bool
498 
501 
503 
508 
509  friend class Polyhedron;
510  friend class Grid;
511 };
512 
513 // Grid_Generator_System_inlines.hh is not included here on purpose.
514 
515 #endif // !defined(PPL_Grid_Generator_System_defs_hh)
static const Grid_Generator_System * zero_dim_univ_p
Holds (between class initialization and finalization) a pointer to the singleton system containing on...
friend bool operator==(const Grid_Generator_System &x, const Grid_Generator_System &y)
Representation representation() const
Returns the current representation of *this.
bool ascii_load(std::istream &s)
Loads from s an ASCII representation (as produced by ascii_dump(std::ostream&) const) and sets *this ...
void swap(CO_Tree &x, CO_Tree &y)
bool operator==(const const_iterator &y) const
Returns true if and only if *this and y are identical.
The base class for systems of constraints and generators.
size_t dimension_type
An unsigned integral type for representing space dimensions.
bool empty() const
Returns true if and only if *this has no generators.
void permute_space_dimensions(const std::vector< Variable > &cycle)
Permutes the space dimensions of the matrix.
An std::set of variables' indexes.
const_iterator end() const
Returns the past-the-end const_iterator.
bool operator!=(const const_iterator &y) const
Returns true if and only if *this and y are different.
bool is_equal_to(const Grid_Generator_System &y) const
Returns true if *this is identical to y.
void clear()
Removes all the generators from the generator system and sets its space dimension to 0...
std::ostream & operator<<(std::ostream &s, const Ask_Tell< D > &x)
bool has_points() const
Returns true if and only if *this contains one or more points.
dimension_type num_lines() const
Returns the number of lines in the system.
const_iterator begin() const
Returns the const_iterator pointing to the first generator, if this is not empty; otherwise...
void add_universe_rows_and_columns(dimension_type dims)
Adds dims rows and dims columns of zeroes to the matrix, initializing the added rows as in the univer...
const Grid_Generator & operator*() const
Dereference operator.
void set_representation(Representation r)
Converts *this to the specified representation.
void set_space_dimension(dimension_type space_dim)
Resizes the system to the specified space dimension.
void m_swap(Grid_Generator_System &y)
Swaps *this with y.
static dimension_type max_space_dimension()
Returns the maximum space dimension a Grid_Generator_System can handle.
A dimension of the vector space.
const_iterator & operator=(const const_iterator &y)
Assignment operator.
The base class for convex polyhedra.
memory_size_type external_memory_in_bytes() const
Returns the size in bytes of the memory managed by *this.
#define PPL_OUTPUT_DECLARATIONS
dimension_type first_pending_row() const
Returns the index of the first pending row.
bool OK() const
Checks if all the invariants are satisfied.
const Grid_Generator & operator[](dimension_type k) const
Returns a constant reference to the k- th generator of the system.
const Grid_Generator * operator->() const
Indirect member selector.
Swapping_Vector< Row >::const_iterator const_iterator
void set_sorted(bool b)
Sets the sortedness flag of the system to b.
Topology topology() const
Returns the system topology.
void affine_image(Variable v, const Linear_Expression &expr, Coefficient_traits::const_reference denominator)
Assigns to a given variable an affine expression.
void unset_pending_rows()
Sets the index to indicate that the system has no pending rows.
void remove_space_dimensions(const Variables_Set &vars)
Removes all the specified dimensions from the generator system.
void remove_invalid_lines_and_parameters()
Removes all the invalid lines and parameters.
The entire library is confined to this namespace.
Definition: version.hh:61
dimension_type num_rows() const
Returns the number of rows (generators) in the system.
static const Grid_Generator_System & zero_dim_univ()
Returns the singleton system containing only Grid_Generator::zero_dim_point().
void shift_space_dimensions(Variable v, dimension_type n)
dimension_type space_dimension() const
Returns the dimension of the vector space enclosing *this.
Sparse representation: only the nonzero coefficient are stored. If there are many nonzero coefficient...
void set_index_first_pending_row(dimension_type i)
Sets the index of the first pending row to i.
bool operator==(const Box< ITV > &x, const Box< ITV > &y)
Grid_Generator_System(Representation r=default_representation)
Default constructor: builds an empty system of generators.
size_t memory_size_type
An unsigned integral type for representing memory size in bytes.
memory_size_type total_memory_in_bytes() const
Returns the total size in bytes of the memory occupied by *this.
static void initialize()
Initializes the class.
dimension_type num_parameters() const
Returns the number of parameters in the system.
void remove_trailing_rows(dimension_type n)
Makes the system shrink by removing its n trailing rows.
void insert(const Grid_Generator &g)
Inserts into *this a copy of the generator g, increasing the number of space dimensions if needed...
A grid line, parameter or grid point.
Topology
Kinds of polyhedra domains.
Grid_Generator_System & operator=(const Grid_Generator_System &y)
Assignment operator.