COPASI API  4.16.103
CTrajectoryTask.h
Go to the documentation of this file.
1 // Copyright (C) 2010 - 2013 by Pedro Mendes, Virginia Tech Intellectual
2 // Properties, Inc., University of Heidelberg, and The University
3 // of Manchester.
4 // All rights reserved.
5 
6 // Copyright (C) 2008 - 2009 by Pedro Mendes, Virginia Tech Intellectual
7 // Properties, Inc., EML Research, gGmbH, University of Heidelberg,
8 // and The University of Manchester.
9 // All rights reserved.
10 
11 // Copyright (C) 2002 - 2007 by Pedro Mendes, Virginia Tech Intellectual
12 // Properties, Inc. and EML Research, gGmbH.
13 // All rights reserved.
14 
15 /**
16  * CTrajectoryTask class.
17  *
18  * This class implements a trajectory task which is comprised of a
19  * of a problem and a method. Additionally calls to the reporting
20  * methods are done when initialized.
21  *
22  * Created for COPASI by Stefan Hoops 2002
23  */
24 
25 #ifndef COPASI_CTrajectoryTask
26 #define COPASI_CTrajectoryTask
27 
29 #include "utilities/CCopasiTask.h"
30 #include "utilities/CReadConfig.h"
31 #include "trajectory/CTimeSeries.h"
32 
33 class CTrajectoryProblem;
34 class CTrajectoryMethod;
35 class CState;
36 
38 {
39  //Attributes
40 public:
41  /**
42  * The methods which can be selected for performing this task.
43  */
44  static const unsigned int ValidMethods[];
45 
46 private:
47 
48  /**
49  * whether the time series should be stored in mTimeSeries
50  */
52 
53  /**
54  * the time series (if requested)
55  */
57 
58  /**
59  * A pointer to the trajectory Problem
60  */
62 
63  /**
64  * A pointer to the trajectory method
65  */
67 
68  /**
69  * Indicates whether we need to update moieties.
70  */
72 
73  /**
74  * A pointer to the current state of the integration.
75  */
77 
78  /**
79  * A pointer to the current time of the integration.
80  */
82 
83  /**
84  * A pointer to the time at which the output starts.
85  */
87 
88  /**
89  * A pointer to lessOrEqual comparison
90  */
91  bool (*mpLessOrEqual)(const C_FLOAT64 &, const C_FLOAT64 &);
92 
93  /**
94  * A pointer to less comparison
95  */
96  bool (*mpLess)(const C_FLOAT64 &, const C_FLOAT64 &);
97 
98 public:
99  /**
100  * Default constructor
101  * @param const CCopasiContainer * pParent (default: NULL)
102  */
103  CTrajectoryTask(const CCopasiContainer * pParent = NULL);
104 
105  /**
106  * Copy constructor
107  * @param const CTrajectoryTask & src
108  * @param const CCopasiContainer * pParent (default: NULL)
109  */
110  CTrajectoryTask(const CTrajectoryTask & src,
111  const CCopasiContainer * pParent = NULL);
112 
113  /**
114  * Destructor
115  */
117 
118  /**
119  * Initialize the task. If an ostream is given this ostream is used
120  * instead of the target specified in the report. This allows nested
121  * tasks to share the same output device.
122  * @param const OutputFlag & of
123  * @param COutputHandler * pOutputHandler
124  * @param std::ostream * pOstream (default: NULL)
125  * @return bool success
126  */
127  virtual bool initialize(const OutputFlag & of,
128  COutputHandler * pOutputHandler,
129  std::ostream * pOstream);
130 
131  /**
132  * Process the task with or without initializing to the initial state.
133  * @param const bool & useInitialValues
134  * @return bool success
135  */
136  virtual bool process(const bool & useInitialValues);
137 
138  /**
139  * Starts the process of integration by calling CTrajectoryMethod::start
140  * @param const bool & useInitialValues
141  */
142  void processStart(const bool & useInitialValues);
143 
144  /**
145  * Integrates one step
146  * @param const C_FLOAT64 & nextTime
147  * @return bool success;
148  */
149  bool processStep(const C_FLOAT64 & nextTime);
150 
151  /**
152  * Perform necessary cleanup procedures
153  */
154  virtual bool restore();
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  * Loads parameters for this solver with data coming from a
173  * CReadConfig object. (CReadConfig object reads an input stream)
174  * @param configbuffer reference to a CReadConfig object.
175  */
176  void load(CReadConfig & configBuffer);
177 
178  /**
179  * Retrieves a pointer to current state of the integration.
180  * @return CState * pState
181  */
182  CState * getState();
183 
184  /**
185  * gets a reference to the time series
186  * @return time series
187  */
188  const CTimeSeries & getTimeSeries() const;
189 
190 private:
191  /**
192  * cleanup()
193  */
194  void cleanup();
195 };
196 #endif // COPASI_CTrajectoryTask
virtual bool initialize(const OutputFlag &of, COutputHandler *pOutputHandler, std::ostream *pOstream)
CTimeSeries mTimeSeries
static const unsigned int ValidMethods[]
bool processStep(const C_FLOAT64 &nextTime)
CTrajectoryProblem * mpTrajectoryProblem
Definition: CState.h:305
virtual bool process(const bool &useInitialValues)
CState * mpCurrentState
void processStart(const bool &useInitialValues)
const C_FLOAT64 * mpCurrentTime
C_FLOAT64 mOutputStartTime
bool(* mpLessOrEqual)(const C_FLOAT64 &, const C_FLOAT64 &)
const CTimeSeries & getTimeSeries() const
void load(CReadConfig &configBuffer)
bool(* mpLess)(const C_FLOAT64 &, const C_FLOAT64 &)
#define C_FLOAT64
Definition: copasi.h:92
virtual bool restore()
virtual CCopasiMethod * createMethod(const int &type) const
virtual bool setMethodType(const int &type)
CTrajectoryMethod * mpTrajectoryMethod
CTrajectoryTask(const CCopasiContainer *pParent=NULL)