COPASI API  4.16.103
CScanTask.h
Go to the documentation of this file.
1 // Copyright (C) 2010 - 2014 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) 2003 - 2007 by Pedro Mendes, Virginia Tech Intellectual
12 // Properties, Inc. and EML Research, gGmbH.
13 // All rights reserved.
14 
15 /**
16  * CScanTask class.
17  *
18  * This class implements a scan task which is comprised of a
19  * of a problem and a method.
20  *
21  */
22 
23 #ifndef COPASI_CScanTask
24 #define COPASI_CScanTask
25 
26 #include "utilities/CReadConfig.h"
27 #include "scan/CScanMethod.h"
28 #include "utilities/CVector.h"
29 #include "scan/CScanProblem.h"
30 
31 class CScanMethod;
32 class CReport;
33 
34 class CScanTask : public CCopasiTask
35 {
36  //Attributes
37 private:
38 
39  /**
40  * Pointer to the output stream for reporting
41  */
42  //std::ostream * mpOut;
43 
44  /**
45  * for progress bar
46  */
47  unsigned C_INT32 mProgress;
48 
49  /**
50  * Handle to process item
51  */
52  size_t mhProgress;
53 
54  /**
55  * the subtask
56  */
58 
60 
62 
63 public:
64 
65  /**
66  * default constructor
67  */
68  CScanTask(const CCopasiContainer * pParent = NULL);
69 
70  /**
71  * Copy constructor
72  * @param const CScanTask & src
73  */
74  //-CScanTask(const CScanTask & src);
75  CScanTask(const CScanTask & src, const CCopasiContainer * pParent = NULL);
76 
77  /**
78  * Destructor
79  */
80  ~CScanTask();
81 
82  /**
83  * cleanup()
84  */
85  void cleanup();
86 
87  /**
88  * Create a method of the specified type to solve the task.
89  * It is the duty of the caller to release the CCopasiMethod.
90  * @param const CCopasiMethod::SubType & type
91  * @return CCopasiMethod *
92  */
93  virtual CCopasiMethod * createMethod(const int & type) const;
94 
95  /**
96  * Initialize the task. If an ostream is given this ostream is used
97  * instead of the target specified in the report. This allows nested
98  * tasks to share the same output device.
99  * @param const OutputFlag & of
100  * @param COutputHandler * pOutputHandler
101  * @param std::ostream * pOstream (default: NULL)
102  * @return bool success
103  */
104  virtual bool initialize(const OutputFlag & of,
105  COutputHandler * pOutputHandler,
106  std::ostream * pOstream);
107 
108  /**
109  * Process the task with or without initializing to the initial state.
110  * @param const bool & useInitialValues
111  * @return bool success
112  */
113  virtual bool process(const bool & useInitialValues);
114 
115  /**
116  * Perform necessary cleanup procedures
117  */
118  virtual bool restore();
119 
120  /**
121  * Loads parameters for this solver with data coming from a
122  * CReadConfig object. (CReadConfig object reads an input stream)
123  * @param configbuffer reference to a CReadConfig object.
124  */
125  void load(CReadConfig & configBuffer);
126 
127  /**
128  * Do the subtask and the output
129  */
130  bool processCallback();
131 
132  /**
133  * output separators
134  * if isLast==true this method has to decide if a separator should
135  * be generated dependent on mOutputInSubtask.
136  */
137  bool outputSeparatorCallback(bool isLast = false);
138 
139  /**
140  * Fix files written with Version 4.12.81 and earlier, which wrote the exp(mean) and exp(std. deviation) for
141  * normal random distributions in the scan task.
142  */
143  void fixBuild81();
144 
145 protected:
146 
147  /**
148  * Init the subtask
149  * @param const OutputFlag & of
150  * @param COutputHandler * pOutputHandler
151  * @return success
152  */
153  bool initSubtask(const OutputFlag & of,
154  COutputHandler * pOutputHandler,
155  std::ostream * pOstream);
156 };
157 #endif // COPASI_CScanTask
bool mOutputInSubtask
Definition: CScanTask.h:59
bool mUseInitialValues
Definition: CScanTask.h:61
virtual bool process(const bool &useInitialValues)
Definition: CScanTask.cpp:118
CScanTask(const CCopasiContainer *pParent=NULL)
Definition: CScanTask.cpp:47
bool outputSeparatorCallback(bool isLast=false)
Definition: CScanTask.cpp:227
bool initSubtask(const OutputFlag &of, COutputHandler *pOutputHandler, std::ostream *pOstream)
Definition: CScanTask.cpp:235
#define C_INT32
Definition: copasi.h:90
void cleanup()
Definition: CScanTask.cpp:87
void load(CReadConfig &configBuffer)
Definition: CScanTask.cpp:115
unsigned C_INT32 mProgress
Definition: CScanTask.h:47
CCopasiTask * mpSubtask
Definition: CScanTask.h:57
bool processCallback()
Definition: CScanTask.cpp:201
virtual bool initialize(const OutputFlag &of, COutputHandler *pOutputHandler, std::ostream *pOstream)
Definition: CScanTask.cpp:90
virtual bool restore()
Definition: CScanTask.cpp:187
size_t mhProgress
Definition: CScanTask.h:52
virtual CCopasiMethod * createMethod(const int &type) const
Definition: CScanTask.cpp:80
void fixBuild81()
Definition: CScanTask.cpp:322