34#ifndef _CMGRAPHS_DATACONV_H_
35#define _CMGRAPHS_DATACONV_H_
43#include "chomp/system/config.h"
44#include "chomp/system/textfile.h"
45#include "chomp/multiwork/mw.h"
60inline chomp::multiwork::mwData &
operator << (chomp::multiwork::mwData &data,
70inline chomp::multiwork::mwData &
operator >> (chomp::multiwork::mwData &data,
75 std::istringstream s (str);
86inline chomp::multiwork::mwData &
operator << (chomp::multiwork::mwData &data,
89 int maxLevel = eigenValues. maxLevel ();
91 for (
int level = 0; level < maxLevel; ++ level)
93 const std::vector<double> &re = eigenValues. re (level);
94 const std::vector<double> &im = eigenValues. im (level);
95 unsigned int nValues = re. size ();
96 if (nValues != im. size ())
97 throw "Different sizes of Re and Im vectors.";
99 for (
unsigned int i = 0; i < nValues; ++ i)
100 data << re [i] << im [i];
106inline chomp::multiwork::mwData &
operator >> (chomp::multiwork::mwData &data,
111 for (
int level = 0; level < maxLevel; ++ level)
113 std::vector<double> &reVector = eigenValues. re (level);
114 std::vector<double> &imVector = eigenValues. im (level);
115 unsigned int nValues = 0;
117 for (
unsigned int i = 0; i < nValues; ++ i)
119 double re = 0, im = 0;
121 reVector. push_back (re);
122 imVector. push_back (im);
134inline chomp::multiwork::mwData &
operator << (chomp::multiwork::mwData &data,
139 parCube::CoordType c [parCube::MaxDim];
140 for (
int i = 0; i < parCube::MaxDim; ++ i)
143 for (
int i = 0; i < dim; ++ i)
144 data <<
static_cast<int> (c [i]);
149inline chomp::multiwork::mwData &
operator >> (chomp::multiwork::mwData &data,
155 throw "Wrong cube dimension in mwData.";
157 for (
int i = 0; i < dim; ++ i)
161 c [i] =
static_cast<parCube::CoordType
> (number);
174inline chomp::multiwork::mwData &
operator << (chomp::multiwork::mwData &data,
177 int size = X. size ();
179 for (
int i = 0; i < size; ++ i)
185inline chomp::multiwork::mwData &
operator >> (chomp::multiwork::mwData &data,
191 throw "Negative size of a set of cubes in mwData.";
192 for (
int i = 0; i < size; ++ i)
207inline chomp::multiwork::mwData &
operator << (chomp::multiwork::mwData &data,
212 spcCube::CoordType c [spcCube::MaxDim];
214 for (
int i = 0; i < dim; ++ i)
215 data <<
static_cast<int> (c [i]);
220inline chomp::multiwork::mwData &
operator >> (chomp::multiwork::mwData &data,
226 throw "Wrong cube dimension in mwData.";
228 for (
int i = 0; i < dim; ++ i)
232 c [i] =
static_cast<spcCube::CoordType
> (number);
245inline chomp::multiwork::mwData &
operator << (chomp::multiwork::mwData &data,
246 const chomp::homology::diGraph<> &g)
249 int nVert = g. countVertices ();
253 for (
int v = 0; v < nVert; ++ v)
256 int nEdg = g. countEdges (v);
260 for (
int e = 0; e < nEdg; ++ e)
262 int target = g. getEdge (v, e);
271inline chomp::multiwork::mwData &
operator >> (chomp::multiwork::mwData &data,
272 chomp::homology::diGraph<> &g)
278 throw "Negative number of vertices decoded from mwData.";
282 for (
int v = 0; v < nVert; ++ v)
292 for (
int e = 0; e < nEdg; ++ e)
296 if ((target < 0) || (target >= nVert))
297 throw "Wrong vertex number found in mwData.";
The class that computes and returns properties of the Conley index.
Eigenvalues of the Conley index map gathered by levels.
Choice of configuration settings.
chomp::multiwork::mwData & operator<<(chomp::multiwork::mwData &data, const theConleyIndexType &ind)
Writes a Conley index to a MultiWork data structure.
chomp::multiwork::mwData & operator>>(chomp::multiwork::mwData &data, theConleyIndexType &ind)
Reads a Conley index from a MultiWork data structure.
Eigenvalues of the Conley index map.
const int paramDim
The dimension of the parameter space to iterate.
const int spaceDim
The dimension of the phase space.
Customizable data types for the Conley-Morse graphs computation program.
Data types for the dynamical systems data structures.
chomp::homology::tCubeFix< paramDim, parCoord > parCube
The type of a cube in the set of parameters.
chomp::homology::hashedset< parCube > parCubes
The type of a set of cubes in the set of parameters.
chomp::homology::tCubeBase< spcCoord > spcCube
The type of a cube in the phase space.
Utilites and helper functions.