33#ifndef _CMGRAPHS_MAPGRAPH_H_
34#define _CMGRAPHS_MAPGRAPH_H_
38#include "chomp/system/textfile.h"
39#include "chomp/cubes/pointset.h"
40#include "chomp/cubes/cube.h"
55template <
class typeCubes,
class typeGraph,
class typeCubMap>
57 const typeCubMap &theCubMap,
bool cropping =
true)
64 cropping ?
true : theCubMap. cropping);
69 int_t nX = X. size ();
70 for (int_t cur = 0; cur < nX; ++ cur)
76 theCubMap (X [cur], 0, &g, &X, 0,
false);
79 if (cur && !(cur % ((
spaceDim >= 3) ? 1000 : 10000)))
81 chomp::homology::scon << std::setw (8) <<
82 (cur / 1000) <<
"k\b\b\b\b\b\b\b\b\b";
96template <
class typeCubes,
class typeGraph,
class typeCubMap>
97inline void computeMapGraphIsol (
const typeCubes &X, typeGraph &g,
98 const typeCubMap &theCubMap, typeCubes &Xadd, int_t maxAdd)
100 using chomp::homology::sbug;
103 if (maxAdd < Xadd. size ())
104 maxAdd = Xadd. size ();
115 int_t nX = X. size ();
116 for (int_t cur = 0; cur < nX; ++ cur)
124 theCubMap (X [cur], &img, 0, 0, 0,
false);
128 int_t nImg (img. size ());
129 for (int_t i = 0; i < nImg; ++ i)
132 int_t n (X. getnumber (q));
140 g. addEdge (nX + maxAdd + n);
145 if (cur && !(cur % ((
spaceDim >= 3) ? 1000 : 10000)))
147 chomp::homology::scon << std::setw (8) <<
148 (cur / 1000) <<
"k\b\b\b\b\b\b\b\b\b";
151 if (theCubMap. cropped)
153 sbug <<
"(cropped) ";
154 theCubMap. cropped =
false;
156 sbug <<
"(XexitBegin " << Xexit. size () <<
") ";
160 chomp::homology::hashedset<int_t> addNumbers;
161 bool modified =
false;
162 int_t processed = nX;
166 for (int_t cur = 0; cur < Xexit. size (); ++ cur)
169 if (addNumbers. check (nX + maxAdd + cur))
174 if ((
spaceDim >= 3) && !(processed % 1000))
176 chomp::homology::scon << std::setw (8) <<
177 (processed / 1000) <<
178 "k\b\b\b\b\b\b\b\b\b";
184 theCubMap (Xexit [cur], &img, 0, 0, 0,
false);
187 bool intersects =
false;
188 int_t nImg (img. size ());
189 for (int_t i = 0; i < nImg; ++ i)
192 if (X. check (q) || Xadd. check (q))
207 if (Xadd. size () >= maxAdd)
208 throw "Too many cubes must be added to X.";
210 Xadd. add (Xexit [cur]);
211 addNumbers. add (nX + maxAdd + cur);
213 for (int_t i = 0; i < nImg; ++ i)
216 int_t n (X. getnumber (q));
222 n = Xadd. getnumber (q);
229 g. addEdge (nX + maxAdd + n);
234 sbug <<
"(XexitEnd " << Xexit. size () <<
") ";
235 sbug <<
"(" << g. countVertices () <<
"v," <<
236 g. countEdges () <<
"e) ";
238 sbug <<
"(Xadd " << Xadd. size () <<
") ";
244 int_t XsizeNew (X. size () + Xadd. size ());
245 for (int_t v = 0; v < XsizeNew; ++ v)
248 for (int_t e = 0; e < g. countEdges (v); ++ e)
250 int_t w (g. getEdge (v, e));
257 int_t pos (addNumbers. getnumber (w));
259 h. addEdge (nX + pos);
265 sbug <<
"(" << g. countVertices () <<
"v," <<
266 g. countEdges () <<
"e) ";
Initializes the given variable with the value provided and restores the previous value at the end of ...
Sets space wrapping locally.
Choice of configuration settings.
void computeMapGraph(const typeCubes &X, typeGraph &g, const typeCubMap &theCubMap, bool cropping=true)
Computes the cubical map on 'X' and fills out the graph 'g'.
const int spaceDim
The dimension of the phase space.
Helper functions and an auxiliary class for space wrapping.
Customizable data types for the Conley-Morse graphs computation program.
Data types for the dynamical systems data structures.
chomp::homology::hashedset< spcCube > spcCubes
The type of a set of cubes in the phase space.
chomp::homology::tCubeBase< spcCoord > spcCube
The type of a cube in the phase space.
Utilites and helper functions.