COPASI API  4.16.103
CEFMTask.h
Go to the documentation of this file.
1 // Begin CVS Header
2 // $Source: /Volumes/Home/Users/shoops/cvs/copasi_dev/copasi/elementaryFluxModes/CEFMTask.h,v $
3 // $Revision: 1.7 $
4 // $Name: $
5 // $Author: shoops $
6 // $Date: 2011/03/07 19:27:36 $
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  * CEFMTask class.
25  * This class is used to describe a task in COPASI. This class is
26  * intended to be used as the parent class for all tasks whithin COPASI.
27  *
28  * Created for Copasi by Stefan Hoops 2003
29  */
30 
31 #ifndef COPASI_CEFMTask
32 #define COPASI_CEFMTask
33 
34 #include <string>
35 
36 #include "utilities/CCopasiTask.h"
37 
38 class CFluxMode;
39 class CMetab;
40 
41 class CEFMTask : public CCopasiTask
42 {
43 public:
44  /**
45  * The methods which can be selected for performing this task.
46  */
47  static const unsigned int ValidMethods[];
48 
49  /**
50  * Check whether the given method is in the list of valid methods
51  * This list must end with CCopasiMethod::unset
52  * @param const unsigned C_INT32 & method
53  * @param const unsigned C_INT32 * validMethods
54  * @return bool isValid
55  */
56  static bool isValidMethod(const unsigned C_INT32 & method,
57  const unsigned C_INT32 * validMethods);
58 
59  /**
60  * default constructor
61  * @param const CCopasiContainer * pParent (default: NULL)
62  */
63  CEFMTask(const CCopasiContainer * pParent = NULL);
64 
65  /**
66  * Copy constructor
67  * @param const COptTask & src
68  */
69  //-COptTask(const CEFMTask & src);
70  CEFMTask(const CEFMTask & src, const CCopasiContainer * pParent = NULL);
71 
72  /**
73  * Destructor
74  */
75  virtual ~CEFMTask();
76 
77  /**
78  * Set the call back of the task
79  * @param CProcessReport * pCallBack
80  * @result bool success
81  */
82  virtual bool setCallBack(CProcessReport * pCallBack);
83 
84  /**
85  * Initialize the task. If an ostream is given this ostream is used
86  * instead of the target specified in the report. This allows nested
87  * tasks to share the same output device.
88  * @param const OutputFlag & of
89  * @param COutputHandler * pOutputHandler
90  * @param std::ostream * pOstream (default: NULL)
91  * @return bool success
92  */
93  virtual bool initialize(const OutputFlag & of,
94  COutputHandler * pOutputHandler,
95  std::ostream * pOstream);
96 
97  /**
98  * Process the task with or without initializing to the initial state.
99  * @param const bool & useInitialValues
100  * @return bool success
101  */
102  virtual bool process(const bool & useInitialValues);
103 
104  /**
105  * Set the method type applied to solve the task
106  * @param const CCopasiMethod::SubType & type
107  * @return bool success
108  */
109  virtual bool setMethodType(const int & type);
110 
111  /**
112  * Create a method of the specified type to solve the task.
113  * It is the duty of the caller to release the CCopasiMethod.
114  * @param const CCopasiMethod::SubType & type
115  * @return CCopasiMethod *
116  */
117  virtual CCopasiMethod * createMethod(const int & type) const;
118 
119  /**
120  * Retrieve the Flux Modes
121  * @return const std::vector< CFluxMode > &
122  */
123  const std::vector< CFluxMode > & getFluxModes() const;
124 
125  /**
126  * Retrieve the description of the flux mode
127  * @param const CFluxMode & fluxMode
128  * @return std::string fluxModeDescription
129  */
130  std::string getFluxModeDescription(const CFluxMode & fluxMode) const;
131 
132  /**
133  * Retrieve the reaction equation of the part of the flux mode pointed at by itReaction
134  * @param const std::map< size_t, C_FLOAT64 >::const_iterator & itReaction
135  * @return std::string reactionEquation
136  */
137  std::string getReactionEquation(const std::map< size_t, C_FLOAT64 >::const_iterator & itReaction) const;
138 
139  /**
140  * Retrieve the species changes for the given flux mode and species
141  * @param const CFluxMode & fluxMode
142  * @param const CMetab & pMetab
143  * @return std::pair< C_FLOAT64, C_FLOAT64 > changes
144  */
145  std::pair< C_FLOAT64, C_FLOAT64 > getSpeciesChanges(const CFluxMode & fluxMode,
146  const CMetab & metab) const;
147 
148  /**
149  * Retrieve the net reaction for the given flux mode.
150  * @param const CFluxMode & fluxMode
151  * @return std::string netReaction
152  */
153  std::string getNetReaction(const CFluxMode & fluxMode) const;
154 
155  /**
156  * Retrieve the internal species for the given flux mode.
157  * @param const CFluxMode & fluxMode
158  * @return std::string species
159  */
160  std::string getInternalSpecies(const CFluxMode & fluxMode) const;
161 
162 private:
163  /**
164  * Retrieve the net reaction data for the given flux mode.
165  * @param const CFluxMode & fluxMode
166  * @return std::map< const CMetab *, C_FLOAT64 >g netReactionData
167  */
168  std::map< const CMetab *, C_FLOAT64 > getNetReactionData(const CFluxMode & fluxMode) const;
169 
170 #ifdef COPASI_SSA
171  std::string getReactionEquationForward(unsigned C_INT32 index1,
172  unsigned C_INT32 index2) const;
173  std::string getReactionEquationBackward(unsigned C_INT32 index1,
174  unsigned C_INT32 index2) const;
175 #endif // COPASI_SSA
176 };
177 
178 #endif // COPASI_CEFMTask
virtual bool process(const bool &useInitialValues)
Definition: CEFMTask.cpp:104
std::string getNetReaction(const CFluxMode &fluxMode) const
Definition: CEFMTask.cpp:274
static bool isValidMethod(const unsigned C_INT32 &method, const unsigned C_INT32 *validMethods)
std::string getReactionEquation(const std::map< size_t, C_FLOAT64 >::const_iterator &itReaction) const
Definition: CEFMTask.cpp:188
std::pair< C_FLOAT64, C_FLOAT64 > getSpeciesChanges(const CFluxMode &fluxMode, const CMetab &metab) const
Definition: CEFMTask.cpp:216
std::string getFluxModeDescription(const CFluxMode &fluxMode) const
Definition: CEFMTask.cpp:132
std::map< const CMetab *, C_FLOAT64 > getNetReactionData(const CFluxMode &fluxMode) const
Definition: CEFMTask.cpp:364
virtual bool initialize(const OutputFlag &of, COutputHandler *pOutputHandler, std::ostream *pOstream)
Definition: CEFMTask.cpp:88
const std::vector< CFluxMode > & getFluxModes() const
Definition: CEFMTask.cpp:183
#define C_INT32
Definition: copasi.h:90
Definition: CMetab.h:178
std::string getInternalSpecies(const CFluxMode &fluxMode) const
Definition: CEFMTask.cpp:334
virtual ~CEFMTask()
Definition: CEFMTask.cpp:74
static const unsigned int ValidMethods[]
Definition: CEFMTask.h:47
CEFMTask(const CCopasiContainer *pParent=NULL)
Definition: CEFMTask.cpp:55
virtual bool setCallBack(CProcessReport *pCallBack)
Definition: CEFMTask.cpp:77
virtual bool setMethodType(const int &type)
Definition: CEFMTask.cpp:109
virtual CCopasiMethod * createMethod(const int &type) const
Definition: CEFMTask.cpp:125