|
(Note that these are not member functions.)
|
std::ostream & | operator<< (std::ostream &s, const Grid_Generator &g) |
| Output operator. More...
|
|
void | swap (Grid_Generator &x, Grid_Generator &y) |
| Swaps x with y . More...
|
|
Grid_Generator | grid_line (const Linear_Expression &e, Representation r=Grid_Generator::default_representation) |
| Shorthand for Grid_Generator::grid_line(const Linear_Expression& e, Representation r).
|
|
Grid_Generator | parameter (const Linear_Expression &e=Linear_Expression::zero(), Coefficient_traits::const_reference d=Coefficient_one(), Representation r=Grid_Generator::default_representation) |
| Shorthand for Grid_Generator::parameter(const Linear_Expression& e, Coefficient_traits::const_reference d, Representation r).
|
|
Grid_Generator | parameter (Representation r) |
| Shorthand for Grid_Generator::parameter(Representation r). More...
|
|
Grid_Generator | parameter (const Linear_Expression &e, Representation r) |
| Shorthand for Grid_Generator::parameter(const Linear_Expression& e, Representation r).
|
|
Grid_Generator | grid_point (const Linear_Expression &e=Linear_Expression::zero(), Coefficient_traits::const_reference d=Coefficient_one(), Representation r=Grid_Generator::default_representation) |
| Shorthand for Grid_Generator::grid_point(const Linear_Expression& e, Coefficient_traits::const_reference d, Representation r).
|
|
Grid_Generator | grid_point (Representation r) |
| Shorthand for Grid_Generator::grid_point(Representation r). More...
|
|
Grid_Generator | grid_point (const Linear_Expression &e, Representation r) |
| Shorthand for Grid_Generator::grid_point(const Linear_Expression& e, Representation r).
|
|
bool | operator== (const Grid_Generator &x, const Grid_Generator &y) |
| Returns true if and only if x is equivalent to y . More...
|
|
bool | operator!= (const Grid_Generator &x, const Grid_Generator &y) |
| Returns true if and only if x is not equivalent to y . More...
|
|
std::ostream & | operator<< (std::ostream &s, const Grid_Generator::Type &t) |
| Output operator. More...
|
|
bool | operator== (const Grid_Generator &x, const Grid_Generator &y) |
|
bool | operator!= (const Grid_Generator &x, const Grid_Generator &y) |
|
Grid_Generator | grid_line (const Linear_Expression &e, Representation r) |
|
Grid_Generator | parameter (const Linear_Expression &e, Coefficient_traits::const_reference d, Representation r) |
|
Grid_Generator | parameter (Representation r) |
|
Grid_Generator | parameter (const Linear_Expression &e, Representation r) |
|
Grid_Generator | grid_point (const Linear_Expression &e, Coefficient_traits::const_reference d, Representation r) |
|
Grid_Generator | grid_point (Representation r) |
|
Grid_Generator | grid_point (const Linear_Expression &e, Representation r) |
|
void | swap (Grid_Generator &x, Grid_Generator &y) |
|
A grid line, parameter or grid point.
An object of the class Grid_Generator is one of the following:
- a grid_line
;
- a parameter
;
- a grid_point
;
where
is the dimension of the space and, for grid_points and parameters,
is the divisor.
- How to build a grid generator.
- Each type of generator is built by applying the corresponding function (
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.
- In all the following examples it is assumed that variables
x
, y
and z
are defined as follows: Variable x(0);
Variable y(1);
Variable z(2);
- Example 1
- The following code builds a grid line with direction
and having space dimension
: By definition, the origin of the space is not a line, so that the following code throws an exception:
- Example 2
- The following code builds the parameter as the vector
which has the same direction as the line in Example 1: Note that, unlike lines, for parameters, the length as well as the direction of the vector represented by the code is significant. Thus q
is not the same as the parameter q1
defined by By definition, the origin of the space is not a parameter, so that the following code throws an exception:
- Example 3
- The following code builds the grid point
: The same effect can be obtained by using the following code: Similarly, the origin
can be defined using either one of the following lines of code: Note however that the following code would have defined a different point, namely
: The following two lines of code both define the only grid point having space dimension zero, namely
. In the second case we exploit the fact that the first argument of the function point
is optional.
- Example 4
- The 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): Obviously, the divisor can be used to specify points having some non-integer (but rational) coordinates. For instance, the grid point
can be specified by the following code: If a zero divisor is provided, an exception is thrown.
- Example 5
- Parameters, like grid points can have a divisor. For instance, the parameter
can be defined: Also, the divisor can be used to specify parameters having some non-integer (but rational) coordinates. For instance, the parameter
can be defined: If a zero divisor is provided, an exception is thrown.
- How to inspect a grid generator
- Several methods are provided to examine a grid generator and extract all the encoded information: its space dimension, its type and the value of its integer coefficients and the value of the denominator.
- Example 6
- The following code shows how it is possible to access each single coefficient of a grid generator. If
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;
e += (i + 1) * g1.coefficient(Variable(i)) * Variable(i);
cout << "Parameter g2: " << g2 << endl;
}
else
cout << "Grid generator g1 is not a grid point." << endl;
Therefore, for the grid point we would obtain the following output: Grid point g1: p((2*A - B + 3*C)/2)
When working with grid points and parameters, be careful not to confuse the notion of coefficient with the notion of coordinate: these are equivalent only when the divisor is 1.