32#ifndef _CMGRAPHS_INDPAIR_H_
33#define _CMGRAPHS_INDPAIR_H_
43#include "chomp/system/textfile.h"
44#include "chomp/system/timeused.h"
45#include "chomp/struct/hashsets.h"
46#include "chomp/cubes/cube.h"
76 int dim ()
const {
return 1;}
86 template <
class IntType>
87 int getcube (int_t n, IntType *coord)
const {
return 0;}
101template <
class mapcomp,
class cubetype = chomp::homology::cube,
102 class cubsettype = chomp::homology::hashedset<cubetype> >
113 IndexPair (
const mapcomp &_theCubMap = mapcomp ());
116 int add (
const cubetype &q);
125 const cubsettype &
getInv ()
const;
131 const cubsettype &
getExit ()
const;
134 template <
class IntType>
135 int getcube (int_t n, IntType *coord)
const;
165 chomp::homology::mvmap<cubetype,cubetype>
F;
173 int addimage (int_t n,
const cubsettype &img);
179template <
class mapcomp,
class cubetype,
class cubsettype>
181 (
const mapcomp &_theCubMap): theCubMap (_theCubMap)
186template <
class mapcomp,
class cubetype,
class cubsettype>
190 return S [0]. dim ();
191 else if (!exitSet. empty ())
192 return exitSet [0]. dim ();
197template <
class mapcomp,
class cubetype,
class cubsettype>
203template <
class mapcomp,
class cubetype,
class cubsettype>
210template <
class mapcomp,
class cubetype,
class cubsettype>
213 return exitSet. size ();
216template <
class mapcomp,
class cubetype,
class cubsettype>
223template <
class mapcomp,
class cubetype,
class cubsettype>
224template <
class IntType>
226 (int_t n, IntType *coord)
const
228 int_t countS = S. size ();
231 S [n]. coord (coord);
234 int_t countExit = exitSet. size ();
235 if (n < countS + countExit)
237 exitSet [n - countS]. coord (coord);
240 outside [n - countS - countExit]. coord (coord);
244template <
class mapcomp,
class cubetype,
class cubsettype>
247 int_t countS = S. size ();
249 return F (S [n]). size ();
251 return F (exitSet [n - countS]). size ();
254template <
class mapcomp,
class cubetype,
class cubsettype>
256 (int_t n, int_t i)
const
258 int_t countS = S. size ();
259 const cubetype &q = (n < countS) ? (F (S [n])) [i] :
260 (F (exitSet [n - countS])) [i];
261 int_t num = S. getnumber (q);
264 num = exitSet. getnumber (q);
266 return (countS + num);
267 int_t countExit = exitSet. size ();
268 num = outside. getnumber (q);
270 return (countS + countExit + num);
271 throw "Index pair not prepared.";
279template <
class mapcomp,
class cubetype,
class cubsettype>
281 const cubsettype &img)
284 int_t countS = S. size ();
285 int_t imgSize = img. size ();
286 for (int_t i = 0; i < imgSize; ++ i)
288 const cubetype &qImg (img [i]);
291 if (!S. check (qImg))
297 throw "Wrong index pair detected.";
298 else if (!exitSet. check (qImg))
305 throw "Excessive index pair size.";
310template <
class mapcomp,
class cubetype,
class cubsettype>
320 int_t countS = S. size ();
322 chomp::homology::sbug <<
"Computing the index pair... ";
325 int_t countSX = countS;
326 for (int_t n = 0; n < countSX; ++ n)
329 const cubetype &q ((n < countS) ? S [n] :
330 exitSet [n - countS]);
333 cubsettype &img = F [q];
342 chomp::homology::sbug <<
"* ";
343 countSX = countS + exitSet. size ();
347 chomp::homology::sbug << S. size () <<
" + " << exitSet. size () <<
348 " + " << outside. size () <<
" cubes.\n";
352template <
class mapcomp,
class cubetype,
class cubsettype>
355 typename cubetype::CoordType coord [cubetype::MaxDim];
357 cubetype r (coord, q. dim ());
362template <
class mapcomp,
class cubetype,
class cubsettype>
369 chomp::homology::mvmap<cubetype,cubetype> nomap;
The empty index pair class simulates an empty index pair.
int_t imgcount(int_t n) const
Returns the number of cubes in the image of the n-th cube.
chomp::homology::Cube CubeType
The type of a cube.
chomp::homology::SetOfCubes CubSetType
The type of a set of cubes.
int_t countExit() const
Returns the number of cubes in the exit set.
int getcube(int_t n, IntType *coord) const
Returns the coordinates of the n-th cube (first Inv, then Exit, followed by outside).
int_t getimgcube(int_t n, int_t i) const
Returns the number of the n-th cube in the image.
int_t countInv() const
Returns the number of cubes in the isolating neighborhood.
int dim() const
Returns the dimension of the underlying space.
A generic class that computes an index pair given the isolating neighborhood and a means to compute t...
int addimage(int_t n, const cubsettype &img)
Adds the image of the map computed on one cube.
cubetype CubeType
The type of a cube.
int dim() const
Returns the dimension of the phase space.
const cubsettype & getInv() const
Returns the invariant part as a set of cubes.
int clear()
Clears the sets and the stored map.
IndexPair(const mapcomp &_theCubMap=mapcomp())
The only allowed constructor.
int_t getimgcube(int_t n, int_t i) const
Returns the number of the i-th cube in the image of the n-th cube.
cubsettype outside
Additional images of cubes from the exit set.
int compute()
Computes the map on the entire set S, adds the necessary cubes to the exit set, and also computes the...
int_t countInv() const
Returns the number of cubes in the isolating neighborhood.
const cubsettype & getExit() const
Returns the exit set as a set of cubes.
int_t imgcount(int_t n) const
Returns the number of cubes in the image of the n-th cube (which is either in S, or in the exit set).
cubsettype exitSet
The image of S without S.
int add(const cubetype &q)
Adds a cube to S.
const mapcomp & theCubMap
The map object.
chomp::homology::mvmap< cubetype, cubetype > F
The multivalued cubical map that has been computed so far.
cubsettype S
The isolating neighborhood whose Conley index is computed.
int getcube(int_t n, IntType *coord) const
Retrieves the coordinates of the n-th cube.
cubsettype CubSetType
The type of a set of cubes.
int_t countExit() const
Returns the number of cubes in the exit set.
Sets space wrapping locally.
Choice of configuration settings.
const bool ignoreIsolationForConleyIndex
Ignoring the isolation problem while computing the Conley index.
const int maxIndexPairSize
The maximal allowed size of the index pair.
Helper functions and an auxiliary class for space wrapping.
Customizable data types for the Conley-Morse graphs computation program.