COPASI API  4.16.103
CLyapTask.h
Go to the documentation of this file.
1 // Begin CVS Header
2 // $Source: /Volumes/Home/Users/shoops/cvs/copasi_dev/copasi/lyap/CLyapTask.h,v $
3 // $Revision: 1.15 $
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 /**
24  * CLyapTask class.
25  */
26 
27 #ifndef COPASI_CLyapTask
28 #define COPASI_CLyapTask
29 
30 #include "lyap/CLyapMethod.h"
31 #include "utilities/CCopasiTask.h"
32 #include "utilities/CReadConfig.h"
33 
34 class CLyapProblem;
35 class CLyapMethod;
36 class CState;
37 
38 class CLyapTask : public CCopasiTask
39 {
40  friend class CLyapWolfMethod;
41 
42  //Attributes
43 private:
44 
45  /**
46  * A pointer to the trajectory Problem
47  */
49 
50  /**
51  * A pointer to the trajectory method
52  */
54 
55  /**
56  * Vectors with the result
57  */
60 
63 
64  /**
65  * Divergence averaged over the last orthonormalization interval
66  */
68 
69  /**
70  * Divergence averaged over the whole integration time
71  */
73 
74  //for the progress bar
76  size_t mhProcess;
77 
78  //for updating the references
79  std::vector<CCopasiObjectReference<C_FLOAT64> *> mvExpRef;
80  std::vector<CCopasiObjectReference<C_FLOAT64> *> mvLocExpRef;
81 
86 
87 public:
88  /**
89  * Default constructor
90  * @param const CCopasiContainer * pParent (default: NULL)
91  */
92  CLyapTask(const CCopasiContainer * pParent = NULL);
93 
94  /**
95  * Destructor
96  */
97  ~CLyapTask();
98 
99  /**
100  * Initialize the task. If an ostream is given this ostream is used
101  * instead of the target specified in the report. This allows nested
102  * tasks to share the same output device.
103  * @param const OutputFlag & of
104  * @param COutputHandler * pOutputHandler
105  * @param std::ostream * pOstream (default: NULL)
106  * @return bool success
107  */
108  virtual bool initialize(const OutputFlag & of,
109  COutputHandler * pOutputHandler,
110  std::ostream * pOstream);
111 
112  /**
113  * Process the task with or without initializing to the initial state.
114  * @param const bool & useInitialValues
115  * @return bool success
116  */
117  virtual bool process(const bool & useInitialValues);
118 
119  /**
120  * Perform neccessary cleaup procedures
121  */
122  virtual bool restore();
123 
124  //methods needed by the result widget
125 
127  {return mExponents;}
128 
129  //const CVector<C_FLOAT64> & localExponents() const
130  //{return mLocalExponents;}
131 
132  const C_FLOAT64 & sumOfExponents() const
133  {return mSumOfExponents;}
134 
135  const C_FLOAT64 & averageDivergence() const
136  {return mAverageDivergence;}
137 
138  /**
139  *
140  */
141  bool resultAvailable() const;
142 
143  /**
144  * was divergence requested for the last calculation?
145  */
146  bool resultHasDivergence() const;
147 
148  /**
149  * how many independent variables had the model at the time of the
150  * last calculation?
151  */
152  size_t modelVariablesInResult() const;
153 
154  size_t numberOfExponentsCalculated() const;
155 
156  /**
157  * Set the method type applied to solve the task
158  * @param const CCopasiMethod::SubType & type
159  * @return bool success
160  */
161  virtual bool setMethodType(const int & type);
162 
163  /**
164  * Create a method of the specified type to solve the task.
165  * It is the duty of the caller to release the CCopasiMethod.
166  * @param const CCopasiMethod::SubType & type
167  * @return CCopasiMethod *
168  */
169  virtual CCopasiMethod * createMethod(const int & type) const;
170 
171  /**
172  * This is called by the method to generate the output and update the progress
173  * bar. The parameter is the percentage for the progress bar.
174  * The return value is the return value of the progress bar handler (and
175  * determines if the calculation will be stopped).
176  * If onlyProgess is true, no output is done.
177  */
178  bool methodCallback(const C_FLOAT64 & percentage, bool onlyProgress);
179 
180  /**
181  * This functionality is expected from CLyapProblem but has to be implmented
182  * here for the moment. This is called from the corresponding method of the problem
183  */
184  void printResult(std::ostream * ostream) const;
185 
186 private:
187  /**
188  * cleanup()
189  */
190  void cleanup();
191 
192  void initObjects();
193 
194  /**
195  * this does calculations that need to be done before output:
196  * sum of exponents, divergence, ...
197  */
199 };
200 #endif // COPASI_CLyapTask
const C_FLOAT64 & averageDivergence() const
Definition: CLyapTask.h:135
virtual bool initialize(const OutputFlag &of, COutputHandler *pOutputHandler, std::ostream *pOstream)
Definition: CLyapTask.cpp:125
const CVector< C_FLOAT64 > & exponents() const
Definition: CLyapTask.h:126
size_t modelVariablesInResult() const
Definition: CLyapTask.cpp:330
CVector< C_FLOAT64 > mLocalExponents
Definition: CLyapTask.h:58
virtual bool setMethodType(const int &type)
Definition: CLyapTask.cpp:237
virtual CCopasiMethod * createMethod(const int &type) const
Definition: CLyapTask.cpp:253
size_t numberOfExponentsCalculated() const
Definition: CLyapTask.cpp:335
CLyapTask(const CCopasiContainer *pParent=NULL)
Definition: CLyapTask.cpp:52
Definition: CState.h:305
void initObjects()
Definition: CLyapTask.cpp:84
bool methodCallback(const C_FLOAT64 &percentage, bool onlyProgress)
Definition: CLyapTask.cpp:260
bool resultAvailable() const
Definition: CLyapTask.cpp:320
std::vector< CCopasiObjectReference< C_FLOAT64 > * > mvLocExpRef
Definition: CLyapTask.h:80
size_t mhProcess
Definition: CLyapTask.h:76
C_FLOAT64 mPercentage
Definition: CLyapTask.h:75
C_FLOAT64 mIntervalDivergence
Definition: CLyapTask.h:67
std::vector< CCopasiObjectReference< C_FLOAT64 > * > mvExpRef
Definition: CLyapTask.h:79
CVector< C_FLOAT64 > mExponents
Definition: CLyapTask.h:59
virtual bool process(const bool &useInitialValues)
Definition: CLyapTask.cpp:168
size_t mNumExponentsCalculated
Definition: CLyapTask.h:85
const C_FLOAT64 & sumOfExponents() const
Definition: CLyapTask.h:132
void cleanup()
Definition: CLyapTask.cpp:81
void printResult(std::ostream *ostream) const
Definition: CLyapTask.cpp:292
virtual bool restore()
Definition: CLyapTask.cpp:219
#define C_FLOAT64
Definition: copasi.h:92
C_FLOAT64 mSumOfLocalExponents
Definition: CLyapTask.h:62
size_t mModelVariablesInResult
Definition: CLyapTask.h:84
C_FLOAT64 mSumOfExponents
Definition: CLyapTask.h:61
bool resultHasDivergence() const
Definition: CLyapTask.cpp:325
bool mResultAvailable
Definition: CLyapTask.h:82
C_FLOAT64 mAverageDivergence
Definition: CLyapTask.h:72
CLyapProblem * mpLyapProblem
Definition: CLyapTask.h:48
void calculationsBeforeOutput()
Definition: CLyapTask.cpp:278
bool mResultHasDivergence
Definition: CLyapTask.h:83
CLyapMethod * mpLyapMethod
Definition: CLyapTask.h:53