This class is a wrapper for a map that computes the image of a cube as a rectangular box (i.e., using the interval arithmetic). More...
#include <indxpalg.h>
Public Types | |
typedef hashedset< TCube > | TSetOfCubes |
The type of the set of cubes. | |
typedef TCube::CoordType | TCoordType |
The type of coordinates of a cube. | |
typedef int(* | map )(const TCoordType *coord, double *left, double *right) |
The class of a map that computes the image of a unitary cube. | |
Public Member Functions | |
BufferedMapClass (map _f) | |
The constructor. | |
const TSetOfCubes & | operator() (const TCube &q) const |
Computes the image of a cube under the map and adds the image cubes to the given set. | |
Public Attributes | |
mvmap< TCube, TCube > | F |
The multivalued cubical map computed so far. | |
Private Attributes | |
map | f |
A pointer to the map which computes images of cubes. |
This class is a wrapper for a map that computes the image of a cube as a rectangular box (i.e., using the interval arithmetic).
Additionally, each object of this class stores all the previously computed values for quick reference.
Definition at line 76 of file indxpalg.h.
typedef int(* chomp::homology::BufferedMapClass< TCube >::map)(const TCoordType *coord, double *left, double *right) |
The class of a map that computes the image of a unitary cube.
Definition at line 86 of file indxpalg.h.
typedef TCube::CoordType chomp::homology::BufferedMapClass< TCube >::TCoordType |
The type of coordinates of a cube.
Definition at line 83 of file indxpalg.h.
typedef hashedset<TCube> chomp::homology::BufferedMapClass< TCube >::TSetOfCubes |
The type of the set of cubes.
Definition at line 80 of file indxpalg.h.
chomp::homology::BufferedMapClass< TCube >::BufferedMapClass | ( | map | _f | ) | [inline] |
const BufferedMapClass< TCube >::TSetOfCubes & chomp::homology::BufferedMapClass< TCube >::operator() | ( | const TCube & | q | ) | const |
Computes the image of a cube under the map and adds the image cubes to the given set.
Reimplemented from chomp::homology::MapClass< TCube, hashedset< TCube > >.
Definition at line 107 of file indxpalg.h.
References chomp::homology::BufferedMapClass< TCube >::f, and chomp::homology::BufferedMapClass< TCube >::F.
{ // if the image of the cube is already known, then return it const TSetOfCubes &dom = F. getdomain (); if (dom. check (q)) return F (q); // determine the dimension const int dim = q. dim (); // compute the image of the cube TCoordType *coord = new TCoordType [dim]; q. coord (coord); double *left = new double [dim]; double *right = new double [dim]; f (coord, left, right); delete [] coord; // compute the minimal and maximal corner of the rectangular // cubical set that covers the computed image of the cube TCoordType *ileft = new TCoordType [dim]; TCoordType *iright = new TCoordType [dim]; for (int i = 0; i < dim; ++ i) { ileft [i] = static_cast<TCoordType> (left [i]); if ((ileft [i] + 1 < left [i]) || (ileft [i] - 1 > left [i])) throw "Conversion error: double to coord - " "out of range."; for (int j = 0; j < 10; ++ j) { if (ileft [i] >= left [i]) -- ileft [i]; else break; } if (ileft [i] >= left [i]) throw "Outer approximation failure (left)."; iright [i] = static_cast<TCoordType> (right [i]); if ((iright [i] + 1 < right [i]) || (iright [i] - 1 > right [i])) throw "Conversion error: double to coord - " "out of range."; for (int j = 0; j < 10; ++ j) { if (iright [i] <= right [i]) ++ iright [i]; else break; } if (iright [i] <= right [i]) throw "Outer approximation failure (right)."; } delete [] right; delete [] left; // create the image of the cube and add all the cubes to it hashedset<TCube> &img = F [q]; tRectangle<TCoordType> r (ileft, iright, dim); const TCoordType *c; while ((c = r. get ()) != 0) img. add (TCube (c, dim)); delete [] iright; delete [] ileft; // return the image of the cube return F (q); } /* operator () */
mvmap<TCube,TCube> chomp::homology::BufferedMapClass< TCube >::F [mutable] |
The multivalued cubical map computed so far.
Definition at line 97 of file indxpalg.h.
Referenced by chomp::homology::BufferedMapClass< TCube >::operator()().
map chomp::homology::BufferedMapClass< TCube >::f [private] |
A pointer to the map which computes images of cubes.
Definition at line 101 of file indxpalg.h.
Referenced by chomp::homology::BufferedMapClass< TCube >::operator()().