COPASI API  4.16.103
CLyapWolfMethod.h
Go to the documentation of this file.
1 // Begin CVS Header
2 // $Source: /Volumes/Home/Users/shoops/cvs/copasi_dev/copasi/lyap/CLyapWolfMethod.h,v $
3 // $Revision: 1.9 $
4 // $Name: $
5 // $Author: shoops $
6 // $Date: 2011/03/07 19:30:20 $
7 // End CVS Header
8 
9 // Copyright (C) 2011 - 2010 by Pedro Mendes, Virginia Tech Intellectual
10 // Properties, Inc., University of Heidelberg, and The University
11 // of Manchester.
12 // All rights reserved.
13 
14 // Copyright (C) 2008 by Pedro Mendes, Virginia Tech Intellectual
15 // Properties, Inc., EML Research, gGmbH, University of Heidelberg,
16 // and The University of Manchester.
17 // All rights reserved.
18 
19 // Copyright (C) 2001 - 2007 by Pedro Mendes, Virginia Tech Intellectual
20 // Properties, Inc. and EML Research, gGmbH.
21 // All rights reserved.
22 
23 #ifndef COPASI_CLyapWolfMethod
24 #define COPASI_CLyapWolfMethod
25 
26 #include <sstream>
27 #include "utilities/CVector.h"
28 #include "utilities/CMatrix.h"
29 
30 #include "odepack++/CLSODA.h"
31 
32 class CModel;
33 class CState;
34 class CLyapTask;
35 
37 {
38  friend CLyapMethod *
40 
41 public:
42  struct Data
43  {
46  };
47 
48 public:
49  /**
50  * handles the complete calculation
51  */
52  bool calculate();
53 
54  // Attributes
55 private:
56  /**
57  * A pointer to the current state in complete model view.
58  */
60 
61  /**
62  * mData.dim is the dimension of the ODE system.
63  * mData.pMethod contains CLsodaMethod * this to be used in the static method EvalF
64  */
66 
67  /**
68  * Number of variables in the model
69  */
70  size_t mSystemSize;
71 
72  /**
73  * Number of exponents to calculate
74  */
75  unsigned C_INT32 mNumExp;
76 
78 
80 
81  //CVector<C_FLOAT64> mLocalExponents;
83  //CVector<C_FLOAT64> mExponents;
85 
86  /**
87  * integrated divergence
88  */
90 
91  /**
92  * Current time.
93  */
95 
96  /**
97  * Requested end time.
98  */
100 
101  /**
102  * LSODA state.
103  */
105 
106  /**
107  *
108  */
110 
111  /**
112  * Relative tolerance.
113  */
115 
116  /**
117  *
118  */
119  //bool mDefaultAtol;
120 
121  /**
122  * Absolute tolerance.
123  */
125 
126  /**
127  *
128  */
129  std::ostringstream mErrorMsg;
130 
135 
136  /**
137  * the vector that contains the extended system
138  */
140 
142 
144 
145  // Operations
146 private:
147  /**
148  * Default constructor.
149  * @param const CCopasiContainer * pParent (default: NULL)
150  */
151  CLyapWolfMethod(const CCopasiContainer * pParent = NULL);
152 
153 public:
154  /**
155  * Copy constructor.
156  * @param "const CLsodaMethod &" src
157  * @param const CCopasiContainer * pParent (default: NULL)
158  */
159  CLyapWolfMethod(const CLyapWolfMethod & src,
160  const CCopasiContainer * pParent = NULL);
161 
162  /**
163  * Destructor.
164  */
166 
167  /**
168  * This methods must be called to elevate subgroups to
169  * derived objects. The default implementation does nothing.
170  * @return bool success
171  */
172  virtual bool elevateChildren();
173 
174  /**
175  * This instructs the method to calculate a time step of deltaT
176  * starting with the current state, i.e., the result of the previous
177  * step.
178  * The new state (after deltaT) is expected in the current state.
179  * The return value is the actual timestep taken.
180  * @param "const double &" deltaT
181  */
182  virtual double step(const double & deltaT);
183 
184  /**
185  * This instructs the method to prepare for integration
186  * starting with the initialState given.
187  * @param "const CState *" initialState
188  */
189  virtual void start(/*const CState * initialState*/);
190 
191  /**
192  * Calculate the default absolute tolerance
193  * @param const CModel * pModel
194  * @return C_FLOAT64 defaultAtol
195  */
196  //C_FLOAT64 getDefaultAtol(const CModel * pModel) const;
197 
198  static void EvalF(const C_INT * n, const C_FLOAT64 * t, const C_FLOAT64 * y, C_FLOAT64 * ydot);
199 
200  /**
201  * This evaluates the derivatives for the complete model
202  */
203  void evalF(const C_FLOAT64 * t, const C_FLOAT64 * y, C_FLOAT64 * ydot);
204 
205  /**
206  * Check if the method is suitable for this problem
207  * @return bool suitability of the method
208  */
209  virtual bool isValidProblem(const CCopasiProblem * pProblem);
210 
211 private:
212  /**
213  * Intialize the method parameter
214  */
215  void initializeParameter();
216 
217  void orthonormalize();
218 
219  static C_FLOAT64 norm(const C_FLOAT64* dbl1, const C_FLOAT64 * dbl2);
220  static void scalarmult(C_FLOAT64* dbl1, const C_FLOAT64* dbl2, const C_FLOAT64 & f);
221  static C_FLOAT64 product(const C_FLOAT64* dbl1, const C_FLOAT64* dbl1End,
222  const C_FLOAT64* dbl2);
223  static void add(C_FLOAT64* dbl1, const C_FLOAT64* dbl1End,
224  const C_FLOAT64 & f, const C_FLOAT64* dbl2);
225 };
226 #endif // COPASI_CLsodaMethod
static C_FLOAT64 norm(const C_FLOAT64 *dbl1, const C_FLOAT64 *dbl2)
virtual bool elevateChildren()
#define C_INT
Definition: copasi.h:115
static void EvalF(const C_INT *n, const C_FLOAT64 *t, const C_FLOAT64 *y, C_FLOAT64 *ydot)
static C_FLOAT64 product(const C_FLOAT64 *dbl1, const C_FLOAT64 *dbl1End, const C_FLOAT64 *dbl2)
CLyapWolfMethod * pMethod
CVector< C_FLOAT64 > mAtol
static void add(C_FLOAT64 *dbl1, const C_FLOAT64 *dbl1End, const C_FLOAT64 &f, const C_FLOAT64 *dbl2)
Definition: CState.h:305
CVector< C_FLOAT64 > mNorms
#define C_INT32
Definition: copasi.h:90
C_FLOAT64 mSumDivergence
virtual void start()
CVector< C_INT > mIWork
virtual double step(const double &deltaT)
CLyapWolfMethod(const CCopasiContainer *pParent=NULL)
Definition: CLSODA.h:24
unsigned C_INT32 mNumExp
static void scalarmult(C_FLOAT64 *dbl1, const C_FLOAT64 *dbl2, const C_FLOAT64 &f)
std::ostringstream mErrorMsg
CVector< C_FLOAT64 > mVariables
static CLyapMethod * createMethod(CCopasiMethod::SubType subType=CCopasiMethod::lyapWolf)
Definition: CLyapMethod.cpp:58
CVector< C_FLOAT64 > mDWork
CMatrix< C_FLOAT64 > mJacobian
#define C_FLOAT64
Definition: copasi.h:92
void evalF(const C_FLOAT64 *t, const C_FLOAT64 *y, C_FLOAT64 *ydot)
CLyapTask * mpTask
Definition: CModel.h:50
virtual bool isValidProblem(const CCopasiProblem *pProblem)
CVector< C_FLOAT64 > mSumExponents