#include <ppl.hh>
Inherits Parma_Polyhedra_Library::Generator.
Public Types | |
| enum | Type { LINE, PARAMETER, POINT } |
| The generator type. More... | |
Public Member Functions | |
| Grid_Generator (const Grid_Generator &g) | |
| Ordinary copy-constructor. | |
| ~Grid_Generator () | |
| Destructor. | |
| Grid_Generator & | operator= (const Grid_Generator &g) |
| Assignment operator. | |
| Grid_Generator & | operator= (const Generator &g) |
| Assignment operator. | |
| dimension_type | space_dimension () const |
Returns the dimension of the vector space enclosing *this. | |
| Type | type () const |
Returns the generator type of *this. | |
| bool | is_line () const |
Returns true if and only if *this is a line. | |
| bool | is_parameter () const |
Returns true if and only if *this is a parameter. | |
| bool | is_line_or_parameter () const |
Returns true if and only if *this is a line or a parameter. | |
| bool | is_point () const |
Returns true if and only if *this is a point. | |
| bool | is_parameter_or_point () const |
Returns true if and only if *this row represents a parameter or a point. | |
| Coefficient_traits::const_reference | coefficient (Variable v) const |
Returns the coefficient of v in *this. | |
| Coefficient_traits::const_reference | divisor () const |
Returns the divisor of *this. | |
| memory_size_type | total_memory_in_bytes () const |
Returns a lower bound to the total size in bytes of the memory occupied by *this. | |
| memory_size_type | external_memory_in_bytes () const |
Returns the size in bytes of the memory managed by *this. | |
| bool | is_equivalent_to (const Grid_Generator &y) const |
Returns true if and only if *this and y are equivalent generators. | |
| bool | is_equal_to (const Grid_Generator &y) const |
Returns true if *this is exactly equal to y. | |
| bool | is_equal_at_dimension (dimension_type dim, const Grid_Generator &gg) const |
Returns true if *this is equal to gg in dimension dim. | |
| bool | all_homogeneous_terms_are_zero () const |
Returns true if and only if all the homogeneous terms of *this are . | |
| void | ascii_dump () const |
Writes to std::cerr an ASCII representation of *this. | |
| void | ascii_dump (std::ostream &s) const |
Writes to s an ASCII representation of *this. | |
| void | print () const |
Prints *this to std::cerr using operator<<. | |
| bool | ascii_load (std::istream &s) |
Loads from s an ASCII representation (as produced by ascii_dump(std::ostream&) const) and sets *this accordingly. Returns true if successful, false otherwise. | |
| bool | OK () const |
| Checks if all the invariants are satisfied. | |
| void | swap (Grid_Generator &y) |
Swaps *this with y. | |
| void | coefficient_swap (Grid_Generator &y) |
Swaps *this with y, leaving *this with the original capacity. | |
Static Public Member Functions | |
| static Grid_Generator | grid_line (const Linear_Expression &e) |
Returns the line of direction e. | |
| static Grid_Generator | parameter (const Linear_Expression &e=Linear_Expression::zero(), Coefficient_traits::const_reference d=Coefficient_one()) |
Returns the parameter of direction e and size e/d. | |
| static Grid_Generator | grid_point (const Linear_Expression &e=Linear_Expression::zero(), Coefficient_traits::const_reference d=Coefficient_one()) |
Returns the point at e / d. | |
| static dimension_type | max_space_dimension () |
| Returns the maximum space dimension a Grid_Generator can handle. | |
| static void | initialize () |
| Initializes the class. | |
| static void | finalize () |
| Finalizes the class. | |
| static const Grid_Generator & | zero_dim_point () |
Returns the origin of the zero-dimensional space . | |
Related Functions | |
| (Note that these are not member functions.) | |
| std::ostream & | operator<< (std::ostream &s, const Grid_Generator &g) |
| Output operator. | |
| void | swap (Parma_Polyhedra_Library::Grid_Generator &x, Parma_Polyhedra_Library::Grid_Generator &y) |
Specializes std::swap. | |
| bool | operator== (const Grid_Generator &x, const Grid_Generator &y) |
Returns true if and only if x is equivalent to y. | |
| bool | operator!= (const Grid_Generator &x, const Grid_Generator &y) |
Returns true if and only if x is not equivalent to y. | |
| std::ostream & | operator<< (std::ostream &s, const Grid_Generator::Type &t) |
| Output operator. | |
An object of the class Grid_Generator is one of the following:
;
;
;
where
is the dimension of the space and, for grid_points and parameters,
is the divisor.
grid_line, parameter or grid_point) to a linear expression; the space dimension of the generator is defined as the space dimension of the corresponding linear expression. Linear expressions used to define a generator should be homogeneous (any constant term will be simply ignored). When defining grid points and parameters, an optional Coefficient argument can be used as a common divisor for all the coefficients occurring in the provided linear expression; the default value for this argument is 1.x, y and z are defined as follows: Variable x(0); Variable y(1); Variable z(2);
and having space dimension
: Grid_Generator l = grid_line(x - y - z);
Grid_Generator l = grid_line(0*x);
which has the same direction as the line in Example 1: Grid_Generator q = parameter(x - y - z);
q is not the same as the parameter q1 defined by Grid_Generator q1 = parameter(2x - 2y - 2z);
Grid_Generator q = parameter(0*x);
: Grid_Generator p = grid_point(1*x + 0*y + 2*z);
Grid_Generator p = grid_point(x + 2*z);
can be defined using either one of the following lines of code: Grid_Generator origin3 = grid_point(0*x + 0*y + 0*z); Grid_Generator origin3_alt = grid_point(0*z);
: Grid_Generator origin2 = grid_point(0*y);
. In the second case we exploit the fact that the first argument of the function point is optional. Grid_Generator origin0 = Generator::zero_dim_point(); Grid_Generator origin0_alt = grid_point();
specified in Example 3 above can also be obtained with the following code, where we provide a non-default value for the second argument of the function grid_point (the divisor): Grid_Generator p = grid_point(2*x + 0*y + 4*z, 2);
can be specified by the following code: Grid_Generator p1 = grid_point(-15*x + 32*y + 21*z, 10);
can be defined: Grid_Generator q = parameter(2*x + 0*y + 4*z, 2);
can be defined: Grid_Generator q = parameter(-15*x + 32*y + 21*z, 10);
g1 is a grid point having coordinates
, we construct the parameter g2 having coordinates
. if (g1.is_point()) { cout << "Grid point g1: " << g1 << endl; Linear_Expression e; for (dimension_type i = g1.space_dimension(); i-- > 0; ) e += (i + 1) * g1.coefficient(Variable(i)) * Variable(i); Grid_Generator g2 = parameter(e, g1.divisor()); cout << "Parameter g2: " << g2 << endl; } else cout << "Grid Generator g1 is not a grid point." << endl;
Grid_Generator g1 = grid_point(2*x - y + 3*z, 2);
The generator type.
| LINE | The generator is a grid line. |
| PARAMETER | The generator is a parameter. |
| POINT | The generator is a grid point. |
Reimplemented from Parma_Polyhedra_Library::Generator.
| Grid_Generator grid_line | ( | const Linear_Expression & | e | ) | [inline, static] |
Returns the line of direction e.
Shorthand for Grid_Generator Grid_Generator::grid_line(const Linear_Expression& e).
| std::invalid_argument | Thrown if the homogeneous part of e represents the origin of the vector space. |
| Grid_Generator parameter | ( | const Linear_Expression & | e = Linear_Expression::zero(), |
|
| Coefficient_traits::const_reference | d = Coefficient_one() | |||
| ) | [inline, static] |
Returns the parameter of direction e and size e/d.
Shorthand for Grid_Generator Grid_Generator::parameter(const Linear_Expression& e, Coefficient_traits::const_reference d).
Both e and d are optional arguments, with default values Linear_Expression::zero() and Coefficient_one(), respectively.
| std::invalid_argument | Thrown if d is zero. |
| Grid_Generator grid_point | ( | const Linear_Expression & | e = Linear_Expression::zero(), |
|
| Coefficient_traits::const_reference | d = Coefficient_one() | |||
| ) | [inline, static] |
Returns the point at e / d.
Shorthand for Grid_Generator Grid_Generator::grid_point(const Linear_Expression& e, Coefficient_traits::const_reference d).
Both e and d are optional arguments, with default values Linear_Expression::zero() and Coefficient_one(), respectively.
| std::invalid_argument | Thrown if d is zero. |
| Coefficient_traits::const_reference Parma_Polyhedra_Library::Grid_Generator::coefficient | ( | Variable | v | ) | const [inline] |
Returns the coefficient of v in *this.
| std::invalid_argument | Thrown if the index of v is greater than or equal to the space dimension of *this. |
Reimplemented from Parma_Polyhedra_Library::Generator.
| Coefficient_traits::const_reference Parma_Polyhedra_Library::Grid_Generator::divisor | ( | ) | const [inline] |
Returns the divisor of *this.
| std::invalid_argument | Thrown if *this is a line. |
Reimplemented from Parma_Polyhedra_Library::Generator.
| bool Parma_Polyhedra_Library::Grid_Generator::is_equivalent_to | ( | const Grid_Generator & | y | ) | const |
Returns true if and only if *this and y are equivalent generators.
Generators having different space dimensions are not equivalent.
| void Parma_Polyhedra_Library::Grid_Generator::coefficient_swap | ( | Grid_Generator & | y | ) |
Swaps *this with y, leaving *this with the original capacity.
All elements up to and including the last element of the smaller of *this and y are swapped. The parameter divisor element of y is swapped with the divisor element of *this.
| std::ostream & operator<< | ( | std::ostream & | s, | |
| const Grid_Generator & | g | |||
| ) | [related] |
Output operator.
| void swap | ( | Parma_Polyhedra_Library::Grid_Generator & | x, | |
| Parma_Polyhedra_Library::Grid_Generator & | y | |||
| ) | [related] |
Specializes std::swap.
| bool operator== | ( | const Grid_Generator & | x, | |
| const Grid_Generator & | y | |||
| ) | [related] |
Returns true if and only if x is equivalent to y.
| bool operator!= | ( | const Grid_Generator & | x, | |
| const Grid_Generator & | y | |||
| ) | [related] |
Returns true if and only if x is not equivalent to y.
| std::ostream & operator<< | ( | std::ostream & | s, | |
| const Grid_Generator::Type & | t | |||
| ) | [related] |
Output operator.
1.5.7.1