The Original CHomP Software
Public Types | Public Member Functions | Public Attributes | Private Attributes | List of all members
chomp::homology::BufferedMapClass< TCube > Class Template Reference

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>

Inheritance diagram for chomp::homology::BufferedMapClass< TCube >:
chomp::homology::MapClass< Cube, hashedset< Cube > >

Public Types

typedef hashedset< TCube > TSetOfCubes
 The type of the set of cubes. More...
 
typedef TCube::CoordType TCoordType
 The type of coordinates of a cube. More...
 
typedef int(* map) (const TCoordType *coord, double *left, double *right)
 The class of a map that computes the image of a unitary cube. More...
 

Public Member Functions

 BufferedMapClass (map _f)
 The constructor. More...
 
const TSetOfCubesoperator() (const TCube &q) const
 Computes the image of a cube under the map and adds the image cubes to the given set. More...
 
- Public Member Functions inherited from chomp::homology::MapClass< Cube, hashedset< Cube > >
const hashedset< Cube > & operator() (const Cube &q) const
 Computes the image of a cube under the map and adds the image cubes to the given set. More...
 

Public Attributes

mvmap< TCube, TCube > F
 The multivalued cubical map computed so far. More...
 

Private Attributes

map f
 A pointer to the map which computes images of cubes. More...
 

Detailed Description

template<class TCube = Cube>
class chomp::homology::BufferedMapClass< TCube >

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 75 of file indxpalg.h.

Member Typedef Documentation

◆ map

template<class TCube = Cube>
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 85 of file indxpalg.h.

◆ TCoordType

template<class TCube = Cube>
typedef TCube::CoordType chomp::homology::BufferedMapClass< TCube >::TCoordType

The type of coordinates of a cube.

Definition at line 82 of file indxpalg.h.

◆ TSetOfCubes

template<class TCube = Cube>
typedef hashedset<TCube> chomp::homology::BufferedMapClass< TCube >::TSetOfCubes

The type of the set of cubes.

Definition at line 79 of file indxpalg.h.

Constructor & Destructor Documentation

◆ BufferedMapClass()

template<class TCube = Cube>
chomp::homology::BufferedMapClass< TCube >::BufferedMapClass ( map  _f)
inline

The constructor.

Definition at line 89 of file indxpalg.h.

89: f (_f) {}
map f
A pointer to the map which computes images of cubes.
Definition: indxpalg.h:100

Member Function Documentation

◆ operator()()

template<class TCube >
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.

Definition at line 106 of file indxpalg.h.

107{
108 // if the image of the cube is already known, then return it
109 const TSetOfCubes &dom = F. getdomain ();
110 if (dom. check (q))
111 return F (q);
112
113 // determine the dimension
114 const int dim = q. dim ();
115
116 // compute the image of the cube
117 TCoordType *coord = new TCoordType [dim];
118 q. coord (coord);
119 double *left = new double [dim];
120 double *right = new double [dim];
121 f (coord, left, right);
122 delete [] coord;
123
124 // compute the minimal and maximal corner of the rectangular
125 // cubical set that covers the computed image of the cube
126 TCoordType *ileft = new TCoordType [dim];
127 TCoordType *iright = new TCoordType [dim];
128 for (int i = 0; i < dim; ++ i)
129 {
130 ileft [i] = static_cast<TCoordType> (left [i]);
131 if ((ileft [i] + 1 < left [i]) ||
132 (ileft [i] - 1 > left [i]))
133 throw "Conversion error: double to coord - "
134 "out of range.";
135 for (int j = 0; j < 10; ++ j)
136 {
137 if (ileft [i] >= left [i])
138 -- ileft [i];
139 else
140 break;
141 }
142 if (ileft [i] >= left [i])
143 throw "Outer approximation failure (left).";
144 iright [i] = static_cast<TCoordType> (right [i]);
145 if ((iright [i] + 1 < right [i]) ||
146 (iright [i] - 1 > right [i]))
147 throw "Conversion error: double to coord - "
148 "out of range.";
149 for (int j = 0; j < 10; ++ j)
150 {
151 if (iright [i] <= right [i])
152 ++ iright [i];
153 else
154 break;
155 }
156 if (iright [i] <= right [i])
157 throw "Outer approximation failure (right).";
158 }
159 delete [] right;
160 delete [] left;
161
162 // create the image of the cube and add all the cubes to it
163 hashedset<TCube> &img = F [q];
164 tRectangle<TCoordType> r (ileft, iright, dim);
165 const TCoordType *c;
166 while ((c = r. get ()) != 0)
167 img. add (TCube (c, dim));
168 delete [] iright;
169 delete [] ileft;
170
171 // return the image of the cube
172 return F (q);
173} /* operator () */
TCube::CoordType TCoordType
The type of coordinates of a cube.
Definition: indxpalg.h:82
hashedset< TCube > TSetOfCubes
The type of the set of cubes.
Definition: indxpalg.h:79
mvmap< TCube, TCube > F
The multivalued cubical map computed so far.
Definition: indxpalg.h:96

Member Data Documentation

◆ F

template<class TCube = Cube>
mvmap<TCube,TCube> chomp::homology::BufferedMapClass< TCube >::F
mutable

The multivalued cubical map computed so far.

Definition at line 96 of file indxpalg.h.

◆ f

template<class TCube = Cube>
map chomp::homology::BufferedMapClass< TCube >::f
private

A pointer to the map which computes images of cubes.

Definition at line 100 of file indxpalg.h.


The documentation for this class was generated from the following file: