30#ifndef _CMGRAPHS_ODEINTEGR_H_ 
   31#define _CMGRAPHS_ODEINTEGR_H_ 
   45#include "chomp/system/config.h" 
   46#include "chomp/system/textfile.h" 
   47#include "chomp/multiwork/mwdata.h" 
   73        void setParam (
const double *left, 
const double *right, 
int n);
 
   78        void get (
int &order, 
double &step, 
int &n, 
int subdiv);
 
   84        bool adjust (
bool successful, 
int subdiv);
 
   93        void useInfo (
const std::string &info);
 
   96        void saveData (chomp::multiwork::mwData &data) 
const;
 
   99        void loadData (chomp::multiwork::mwData &data);
 
  147        defaultOrder (order), defaultStepSize (step),
 
  148        defaultNumberOfSteps (n),
 
  149        usingPrevious (false), changed (false)
 
  161        throw "Trying to use the copy constructor of OdeIntegrParam.";
 
  167        throw "Trying to use the assignment operator of OdeIntegrParam.";
 
  174        param. define (left, right, n);
 
  194        static int prevSubdiv = 0;
 
  195        if (subdiv > prevSubdiv)
 
  197                using chomp::homology::sbug;
 
  198                sbug << 
"Using step size " << step << 
" at depth " <<
 
  208        using chomp::homology::sbug;
 
  215        const double incCoef = 2.0;
 
  216        const double decCoef = 0.9;
 
  223                sbug << 
"Good!\nSuccessful integration at depth " <<
 
  224                        subdiv << 
" with step size = " <<
 
  237        sbug << 
"Integration at depth " << subdiv <<
 
  238                " failed with step size " << 
stepSizes [subdiv] << 
". ";
 
  245        sbug << 
"Trying " << 
stepSizes [subdiv] << 
".\n";
 
  253        while (
static_cast<int> (
stepSizes. size ()) <= subdiv)
 
  273        while (
static_cast<int> (
strategy. size ()) <= subdiv)
 
  285                return std::string ();
 
  288        std::ostringstream s;
 
  293#ifdef ODEPARAM_APPROXIMATE 
  299        int precision = s. precision ();
 
  301        s << std::setprecision (hiprec);
 
  302        for (
size_t n = 0; n < 
stepSizes. size (); ++ n)
 
  304        s << std::setprecision (precision);
 
  310        chomp::multiwork::mwData data;
 
  327        using chomp::homology::ignorecomments;
 
  328        std::istringstream s (info);
 
  337#ifdef ODEPARAM_APPROXIMATE 
  339        if (s. 
get () != 
'S')
 
  343        size_t stepSizesSize = 0;
 
  346        for (
size_t n = 0; n < stepSizesSize; ++ n)
 
  350        if (s. 
get () != 
'B')
 
  357        chomp::multiwork::mwData data;
 
  363        if (!(
param == _paramExact))
 
  372        if (s. 
get () != 
'Q')
 
  373                throw "Missing 'Q' at the end of ODE integr info.";
 
  402inline chomp::multiwork::mwData &
operator << (chomp::multiwork::mwData &data,
 
  405        odeIntegrParam. saveData (data);
 
  410inline chomp::multiwork::mwData &
operator >> (chomp::multiwork::mwData &data,
 
  413        odeIntegrParam. loadData (data);
 
A data structure for storing map parameters.
 
A class whose objects are responsible for adjusting the integration parameters such as step size and ...
 
void saveData(chomp::multiwork::mwData &data) const
Saves the data for serialization.
 
void useInfo(const std::string &info)
Analyzes a previously saved line with a summary of information and adjusts the data accordingly.
 
bool adjust(bool successful, int subdiv)
Adjusts parameters if necessary after a successful computation or after an unsuccessful computation o...
 
std::vector< double > stepSizes
Step sizes at subsequent subdivision depths.
 
std::string getInfo() const
Returns a line (or lines) with a summary of information about the knowledge gathered through the "adj...
 
int defaultOrder
The order of the Taylor method suggested to use.
 
MapParam param
The parameters of the map.
 
~OdeIntegrParam()
The destructor.
 
std::vector< int > strategy
Strategy for trying another step size at each subdivision depth.
 
void get(int &order, double &step, int &n, int subdiv)
Provides recommended values for integration: the order of the Taylor method, the size of the integrat...
 
bool changed
Were the parameters changed, so that it is worth to share them?
 
double defaultStepSize
The size of the step suggested for itegrating the flow.
 
OdeIntegrParam(int order, double step, int n)
The constructor which takes the suggested values for the order of the method, the step size,...
 
OdeIntegrParam & operator=(const OdeIntegrParam &)
The assignment operator should not be used.
 
void setParam(const double *left, const double *right, int n)
Sets the parameters to the given intervals defined by their left and right coordinates.
 
bool usingPrevious
Was this information set up based on previous results?
 
void loadData(chomp::multiwork::mwData &data)
Retrieves a serialized object.
 
int defaultNumberOfSteps
The number of steps suggested to use.
 
void extendVectors(int subdiv)
Extends the internal arrays to make sure that the entries for the given subdivision depth are valid.
 
Converting a binary data buffer into a printable text and vice versa.
 
void text2data(const std::string &str, chomp::multiwork::mwData &data)
Decodes a prevously prepared text back into binary data.
 
std::string data2text(const chomp::multiwork::mwData &data)
Encodes the entire binary data into a text string (single line, printable characters only).
 
Data conversion for sending/receiving: std::vectors and hashed sets of any objects.
 
A simple aggregate data structure for map parameters.
 
bool intersect(const MapParam &par1, const MapParam &par2)
Checks if two aggregate parameter objects are so close to each other that after a small blow-up they ...
 
bool shareInteriors(const MapParam &par1, const MapParam &par2)
Checks if two aggregate parameter objects that intersect actually share interiors in the parameters o...
 
const int initialDepth
The initial depth of subdivisions in the phase space.
 
const int finalDepth
The final depth of subdivisions in the phase space.
 
chomp::multiwork::mwData & operator<<(chomp::multiwork::mwData &data, const OdeIntegrParam &odeIntegrParam)
Serializes an object with ODE parameters.
 
chomp::multiwork::mwData & operator>>(chomp::multiwork::mwData &data, OdeIntegrParam &odeIntegrParam)
Deserializes an object with ODE parameters.