COPASI API  4.16.103
CSteadyStateMethod.h
Go to the documentation of this file.
1 // Begin CVS Header
2 // $Source: /Volumes/Home/Users/shoops/cvs/copasi_dev/copasi/steadystate/CSteadyStateMethod.h,v $
3 // $Revision: 1.22 $
4 // $Name: $
5 // $Author: shoops $
6 // $Date: 2011/03/07 19:33:41 $
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) 2001 - 2007 by Pedro Mendes, Virginia Tech Intellectual
15 // Properties, Inc. and EML Research, gGmbH.
16 // All rights reserved.
17 
18 /**
19  * CSteadyStateMethod class.
20  * This class describes the interface to all steady state methods.
21  * The variaous method like Netwon have to be derived from
22  * this class.
23  *
24  * Created for Copasi by Stefan Hoops 2002
25  */
26 
27 #ifndef COPASI_CSteadyStateMethod
28 #define COPASI_CSteadyStateMethod
29 
30 #include <string>
31 #include <sstream>
32 
34 #include "utilities/CMatrix.h"
35 
37 class CSteadyStateTask;
38 class CState;
39 class CEigen;
40 class CProcessReport;
41 class CModel;
42 
44 {
45 public:
47  {
48  notFound = 0,
52  };
53 
54 protected:
55  /**
56  * A pointer to the problem.
57  */
59 
60  /**
61  * A pointer to the model.
62  */
64 
65  /**
66  * A pointer to the task.
67  */
69 
70  /**
71  * A pointer to the steady state
72  */
74 
75  /**
76  * The jacobian of the steadystate
77  */
79 
80  /**
81  * The concentration rate that is considered zero
82  */
84 
85  /**
86  * The factor for numerical derivation
87  */
89 
90  /**
91  * The resolution of the variable of numerical derivation
92  */
94 
95  std::ostringstream mMethodLog;
96 
97  // Operations
98 private:
99  /**
100  * Default constructor.
101  */
103 
104 protected:
105  /**
106  * Specific constructor.
107  * @param CCopasiMethod::SubType subType
108  * @param const CCopasiContainer * pParent (default: NULL)
109  */
111  const CCopasiContainer * pParent = NULL);
112 
113  /**
114  * initialize parameters and handle parameters of old copasi files
115  */
116  void initializeParameter();
117 
118 public:
119  /**
120  * Create a trajectory method.
121  * Note: the returned object has to be released after use with delete
122  */
123  static CSteadyStateMethod *
126 
127  /**
128  * Copy constructor.
129  * @param "const CSteadyStateMethod &" src
130  * @param const CCopasiContainer * pParent (default: NULL)
131  */
133  const CCopasiContainer * pParent = NULL);
134 
135  /**
136  * Destructor.
137  */
139 
140  bool elevateChildren();
141 
142  /**
143  * This instructs the method to calculate a the steady state
144  * starting with the initialState given.
145  * The steady state is returned in the object pointed to by steadyState.
146  * @param CState * steadyState
147  * @param CMatrix< C_FLOAT64 > & jacobianX
148  * @param CProcessReport * handler
149  * @return CSteadyStateMethod::ReturnCode returnCode
150  */
152  CMatrix< C_FLOAT64 > & jacobianX,
153  CProcessReport * handler);
154 
155  /**
156  * Check if the method is suitable for this problem
157  * @return bool suitability of the method
158  */
159  virtual bool isValidProblem(const CCopasiProblem * pProblem);
160 
161  /**
162  * Initialize the method must be called before process
163  * @param const CSteadyStateProblem * pProblem
164  * @return bool success
165  */
166  virtual bool initialize(const CSteadyStateProblem * pProblem);
167 
168  /**
169  * calls the CModel methods to calculate the jacobians (at the steady state).
170  * This trivial method is implemented in the method
171  * because it may need to know about some method parameters
172  */
173  void doJacobian(CMatrix< C_FLOAT64 > & jacobian,
174  CMatrix< C_FLOAT64 > & jacobianX);
175 
176  /**
177  * returns the resolution for stability analysis
178  */
180 
181  std::string getMethodLog() const;
182 
183 protected:
184 
185  /**
186  * This instructs the method to calculate a the steady state
187  * starting with the initialState given.
188  * The steady state is returned in the object pointed to by steadyState.
189  * @return CSteadyStateMethod::ReturnCode returnCode
190  */
192  processInternal();
193 
194  /**
195  * This function has to be called at the return of any implementation
196  * of the protected function process()
197  * @return CSteadyStateMethod::ReturnCode returnCode
198  */
200  returnProcess(bool steadyStateFound);
201 
202  /**
203  * Check whether the steady state is chemical equilibrium
204  * @param const C_FLOAT64 & resolution
205  * @retrun bool isEquilibrium
206  */
207  bool isEquilibrium(const C_FLOAT64 & resolution) const;
208 
209 protected:
210  /**
211  * Check whether all values make physically sence, i.e.,
212  * volumes and particle number are positive
213  * @return bool allPositive
214  */
215  bool allPositive();
216 
217  void calculateJacobianX(const C_FLOAT64 & oldMaxRate);
218 };
219 
220 #include "CNewtonMethod.h"
221 
222 #endif // COPASI_CSteadyStateMethod
C_FLOAT64 * mpDerivationFactor
CMatrix< C_FLOAT64 > * mpJacobianX
Definition: CEigen.h:36
virtual bool isValidProblem(const CCopasiProblem *pProblem)
Definition: CState.h:305
std::ostringstream mMethodLog
std::string getMethodLog() const
void calculateJacobianX(const C_FLOAT64 &oldMaxRate)
virtual CSteadyStateMethod::ReturnCode returnProcess(bool steadyStateFound)
CSteadyStateTask * mpParentTask
virtual bool initialize(const CSteadyStateProblem *pProblem)
const CSteadyStateProblem * mpProblem
C_FLOAT64 * mpDerivationResolution
static CSteadyStateMethod * createMethod(CCopasiMethod::SubType subType=CCopasiMethod::Newton)
virtual CSteadyStateMethod::ReturnCode processInternal()
#define C_FLOAT64
Definition: copasi.h:92
CSteadyStateMethod::ReturnCode process(CState *pState, CMatrix< C_FLOAT64 > &jacobianX, CProcessReport *handler)
C_FLOAT64 * mpSSResolution
C_FLOAT64 getStabilityResolution()
Definition: CModel.h:50
void doJacobian(CMatrix< C_FLOAT64 > &jacobian, CMatrix< C_FLOAT64 > &jacobianX)
bool isEquilibrium(const C_FLOAT64 &resolution) const