COPASI API  4.16.103
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
CScanTask Class Reference

#include <CScanTask.h>

Inheritance diagram for CScanTask:
Inheritance graph
[legend]
Collaboration diagram for CScanTask:
Collaboration graph
[legend]

Public Member Functions

void cleanup ()
 
virtual CCopasiMethodcreateMethod (const int &type) const
 
 CScanTask (const CCopasiContainer *pParent=NULL)
 
 CScanTask (const CScanTask &src, const CCopasiContainer *pParent=NULL)
 
void fixBuild81 ()
 
virtual bool initialize (const OutputFlag &of, COutputHandler *pOutputHandler, std::ostream *pOstream)
 
void load (CReadConfig &configBuffer)
 
bool outputSeparatorCallback (bool isLast=false)
 
virtual bool process (const bool &useInitialValues)
 
bool processCallback ()
 
virtual bool restore ()
 
 ~CScanTask ()
 
- Public Member Functions inherited from CCopasiTask
 CCopasiTask (const std::string &name="NoName", const CCopasiContainer *pParent=NULL, const std::string &type="Task")
 
 CCopasiTask (const Type &taskType, const CCopasiContainer *pParent=NULL, const std::string &type="Task")
 
 CCopasiTask (const CCopasiTask &src, const CCopasiContainer *pParent=NULL)
 
void cleanup ()
 
CProcessReportgetCallBack () const
 
const CDescriptiongetDescription () const
 
virtual const std::string & getKey () const
 
CCopasiMethodgetMethod ()
 
const CCopasiMethodgetMethod () const
 
COutputHandlergetOutputHandler () const
 
const OutputFlaggetOutputMode () const
 
CCopasiProblemgetProblem ()
 
const CCopasiProblemgetProblem () const
 
CReportgetReport ()
 
const CResultgetResult () const
 
CCopasiParameterGroupgetSliders ()
 
Type getType () const
 
const bool & isScheduled () const
 
const bool & isUpdateModel () const
 
virtual void output (const COutputInterface::Activity &activity)
 
virtual void separate (const COutputInterface::Activity &activity)
 
virtual bool setCallBack (CProcessReport *pCallBack)
 
virtual bool setMethodType (const int &type)
 
void setScheduled (const bool &scheduled)
 
void setType (const Type &type)
 
void setUpdateModel (const bool &updateModel)
 
virtual bool updateMatrices ()
 
virtual ~CCopasiTask ()
 
- Public Member Functions inherited from CCopasiContainer
virtual bool add (CCopasiObject *pObject, const bool &adopt=true)
 
 CCopasiContainer (const std::string &name, const CCopasiContainer *pParent=NULL, const std::string &type="CN", const unsigned C_INT32 &flag=CCopasiObject::Container)
 
 CCopasiContainer (const CCopasiContainer &src, const CCopasiContainer *pParent=NULL)
 
virtual std::string getChildObjectUnits (const CCopasiObject *pObject) const
 
virtual const CObjectInterfacegetObject (const CCopasiObjectName &cn) const
 
virtual const objectMapgetObjects () const
 
virtual std::string getUnits () const
 
virtual const CCopasiObjectgetValueObject () const
 
virtual bool remove (CCopasiObject *pObject)
 
virtual ~CCopasiContainer ()
 
- Public Member Functions inherited from CCopasiObject
void addDirectDependency (const CCopasiObject *pObject)
 
 CCopasiObject (const CCopasiObject &src, const CCopasiContainer *pParent=NULL)
 
void clearDirectDependencies ()
 
void clearRefresh ()
 
bool dependsOn (DataObjectSet candidates, const DataObjectSet &context=DataObjectSet()) const
 
void getAllDependencies (DataObjectSet &dependencies, const DataObjectSet &context) const
 
virtual CCopasiObjectName getCN () const
 
virtual const DataObjectSetgetDirectDependencies (const DataObjectSet &context=DataObjectSet()) const
 
CCopasiContainergetObjectAncestor (const std::string &type) const
 
CCopasiDataModelgetObjectDataModel ()
 
const CCopasiDataModelgetObjectDataModel () const
 
virtual std::string getObjectDisplayName (bool regular=true, bool richtext=false) const
 
const std::string & getObjectName () const
 
CCopasiContainergetObjectParent () const
 
const std::string & getObjectType () const
 
virtual const
CObjectInterface::ObjectSet
getPrerequisites () const
 
virtual RefreshgetRefresh () const
 
UpdateMethodgetUpdateMethod () const
 
virtual voidgetValuePointer () const
 
bool hasCircularDependencies (DataObjectSet &candidates, DataObjectSet &verified, const DataObjectSet &context) const
 
bool hasUpdateMethod () const
 
bool isArray () const
 
bool isContainer () const
 
bool isDataModel () const
 
bool isMatrix () const
 
bool isNameVector () const
 
bool isNonUniqueName () const
 
virtual bool isPrerequisiteForContext (const CObjectInterface *pObject, const CMath::SimulationContextFlag &context, const CObjectInterface::ObjectSet &changedObjects) const
 
bool isReference () const
 
bool isRoot () const
 
bool isSeparator () const
 
bool isStaticString () const
 
bool isValueBool () const
 
bool isValueDbl () const
 
bool isValueInt () const
 
bool isValueInt64 () const
 
bool isValueString () const
 
bool isVector () const
 
virtual bool mustBeDeleted (const DataObjectSet &deletedObjects) const
 
virtual void print (std::ostream *ostream) const
 
void removeDirectDependency (const CCopasiObject *pObject)
 
void setDirectDependencies (const DataObjectSet &directDependencies)
 
bool setObjectName (const std::string &name)
 
virtual bool setObjectParent (const CCopasiContainer *pParent)
 
void setObjectValue (const C_FLOAT64 &value)
 
void setObjectValue (const C_INT32 &value)
 
void setObjectValue (const bool &value)
 
template<class CType >
void setRefresh (CType *pType, void(CType::*method)(void))
 
template<class CType >
void setUpdateMethod (CType *pType, void(CType::*method)(const C_FLOAT64 &))
 
template<class CType >
void setUpdateMethod (CType *pType, void(CType::*method)(const C_INT32 &))
 
template<class CType >
void setUpdateMethod (CType *pType, void(CType::*method)(const bool &))
 
virtual ~CCopasiObject ()
 
- Public Member Functions inherited from CObjectInterface
 CObjectInterface ()
 
virtual ~CObjectInterface ()
 

Protected Member Functions

bool initSubtask (const OutputFlag &of, COutputHandler *pOutputHandler, std::ostream *pOstream)
 
- Protected Member Functions inherited from CCopasiContainer
template<class CType >
CCopasiObjectaddMatrixReference (const std::string &name, CType &reference, const unsigned C_INT32 &flag=0)
 
template<class CType >
CCopasiObjectaddObjectReference (const std::string &name, CType &reference, const unsigned C_INT32 &flag=0)
 
template<class CType >
CCopasiObjectaddVectorReference (const std::string &name, CType &reference, const unsigned C_INT32 &flag=0)
 
void initObjects ()
 
- Protected Member Functions inherited from CCopasiObject
 CCopasiObject ()
 
 CCopasiObject (const std::string &name, const CCopasiContainer *pParent=NULL, const std::string &type="CN", const unsigned C_INT32 &flag=0)
 

Private Attributes

size_t mhProgress
 
bool mOutputInSubtask
 
unsigned C_INT32 mProgress
 
CCopasiTaskmpSubtask
 
bool mUseInitialValues
 

Additional Inherited Members

- Public Types inherited from CCopasiTask
enum  eOutputFlagBase {
  INITIALIZE = 0x01, STREAM = 0x02, FINISH = 0x04, REPORT = 0x10,
  PLOT = 0x20, TIME_SERIES = 0x40
}
 
enum  OutputFlag {
  NO_OUTPUT = 0, OUTPUT_BEFORE = INITIALIZE, OUTPUT_AFTER = FINISH, OUTPUT = REPORT | PLOT | STREAM,
  OUTPUT_SE = REPORT | PLOT | INITIALIZE | STREAM | FINISH, OUTPUT_UI = REPORT | PLOT | TIME_SERIES | INITIALIZE | STREAM | FINISH, ONLY_TIME_SERIES = TIME_SERIES | INITIALIZE | STREAM | FINISH
}
 
enum  Type {
  steadyState = 0, timeCourse, scan, fluxMode,
  optimization, parameterFitting, mca, lyap,
  tssAnalysis, sens, moieties, crosssection,
  lna, unset
}
 
- Public Types inherited from CCopasiContainer
typedef std::multimap
< std::string, CCopasiObject * > 
objectMap
 
- Public Types inherited from CCopasiObject
typedef std::set< const
CCopasiObject * > 
DataObjectSet
 
typedef std::vector< Refresh * > DataUpdateSequence
 
- Public Types inherited from CObjectInterface
typedef std::set< const
CObjectInterface * > 
ObjectSet
 
typedef std::vector
< CObjectInterface * > 
UpdateSequence
 
- Static Public Member Functions inherited from CCopasiTask
static bool isValidMethod (const unsigned int &method, const unsigned int *validMethods)
 
- Static Public Member Functions inherited from CCopasiObject
static std::vector< Refresh * > buildUpdateSequence (const DataObjectSet &objects, const DataObjectSet &uptoDateObjects, const DataObjectSet &context=DataObjectSet())
 
static void setRenameHandler (CRenameHandler *rh)
 
- Public Attributes inherited from CCopasiTask
std::string Error
 
std::string Warning
 
- Static Public Attributes inherited from CCopasiTask
static const std::string TypeName []
 
static const unsigned int ValidMethods []
 
static const char * XMLType []
 
- Static Public Attributes inherited from CCopasiContainer
static const std::vector
< CCopasiContainer * > 
EmptyList
 
- Protected Types inherited from CCopasiObject
enum  Flag {
  Container = 0x1, Vector = 0x2, Matrix = 0x4, NameVector = 0x8,
  Reference = 0x10, ValueBool = 0x20, ValueInt = 0x40, ValueInt64 = 0x80,
  ValueDbl = 0x100, NonUniqueName = 0x200, StaticString = 0x400, ValueString = 0x800,
  Separator = 0x1000, ModelEntity = 0x2000, Array = 0x4000, DataModel = 0x8000,
  Root = 0x10000, Gui = 0x20000
}
 
- Protected Attributes inherited from CCopasiTask
CDescription mDescription
 
OutputFlag mDoOutput
 
std::string mKey
 
unsigned C_INT32 mOutputCounter
 
CProcessReportmpCallBack
 
CStatempInitialState
 
CCopasiMethodmpMethod
 
COutputHandlermpOutputHandler
 
CCopasiProblemmpProblem
 
CCopasiParameterGroupmpSliders
 
CReport mReport
 
CResult mResult
 
bool mScheduled
 
Type mType
 
bool mUpdateModel
 
- Protected Attributes inherited from CCopasiContainer
objectMap mObjects
 
- Static Protected Attributes inherited from CCopasiObject
static CRenameHandlersmpRenameHandler = NULL
 

Detailed Description

Definition at line 34 of file CScanTask.h.

Constructor & Destructor Documentation

CScanTask::CScanTask ( const CCopasiContainer pParent = NULL)

default constructor

CScanTask class.

This class implements a scan task which is comprised of a of a problem and a method.

Definition at line 47 of file CScanTask.cpp.

References CCopasiContainer::add(), createMethod(), CCopasiTask::mpMethod, CCopasiTask::mpProblem, and CCopasiMethod::scanMethod.

47  :
49  mProgress(0),
51  mpSubtask(NULL),
52  mOutputInSubtask(false),
53  mUseInitialValues(true)
54 {
55  mpProblem = new CScanProblem(this);
57  this->add(mpMethod, true);
58  static_cast< CScanMethod * >(mpMethod)->setProblem(static_cast< CScanProblem * >(mpProblem));
59 }
CCopasiMethod * mpMethod
Definition: CCopasiTask.h:239
bool mOutputInSubtask
Definition: CScanTask.h:59
bool mUseInitialValues
Definition: CScanTask.h:61
CCopasiTask(const std::string &name="NoName", const CCopasiContainer *pParent=NULL, const std::string &type="Task")
#define C_INVALID_INDEX
Definition: copasi.h:222
CCopasiProblem * mpProblem
Definition: CCopasiTask.h:234
unsigned C_INT32 mProgress
Definition: CScanTask.h:47
CCopasiTask * mpSubtask
Definition: CScanTask.h:57
size_t mhProgress
Definition: CScanTask.h:52
virtual bool add(CCopasiObject *pObject, const bool &adopt=true)
virtual CCopasiMethod * createMethod(const int &type) const
Definition: CScanTask.cpp:80
CScanTask::CScanTask ( const CScanTask src,
const CCopasiContainer pParent = NULL 
)

Copy constructor

Parameters
constCScanTask & src

Definition at line 61 of file CScanTask.cpp.

References CCopasiContainer::add(), createMethod(), CCopasiTask::mpMethod, CCopasiTask::mpProblem, and CCopasiMethod::scanMethod.

62  :
63  CCopasiTask(src, pParent),
64  mProgress(0),
66  mpSubtask(NULL),
67  mOutputInSubtask(false),
68  mUseInitialValues(true)
69 {
70  mpProblem = new CScanProblem(*(CScanProblem *) src.mpProblem, this);
72  this->add(mpMethod, true);
73  static_cast< CScanMethod * >(mpMethod)->setProblem(static_cast< CScanProblem * >(mpProblem));
74 }
CCopasiMethod * mpMethod
Definition: CCopasiTask.h:239
bool mOutputInSubtask
Definition: CScanTask.h:59
bool mUseInitialValues
Definition: CScanTask.h:61
CCopasiTask(const std::string &name="NoName", const CCopasiContainer *pParent=NULL, const std::string &type="Task")
#define C_INVALID_INDEX
Definition: copasi.h:222
CCopasiProblem * mpProblem
Definition: CCopasiTask.h:234
unsigned C_INT32 mProgress
Definition: CScanTask.h:47
CCopasiTask * mpSubtask
Definition: CScanTask.h:57
size_t mhProgress
Definition: CScanTask.h:52
virtual bool add(CCopasiObject *pObject, const bool &adopt=true)
virtual CCopasiMethod * createMethod(const int &type) const
Definition: CScanTask.cpp:80
CScanTask::~CScanTask ( )

Destructor

Definition at line 76 of file CScanTask.cpp.

References cleanup().

77 {cleanup();}
void cleanup()
Definition: CScanTask.cpp:87

Member Function Documentation

void CScanTask::cleanup ( )

cleanup()

Definition at line 87 of file CScanTask.cpp.

Referenced by ~CScanTask().

88 {}
CCopasiMethod * CScanTask::createMethod ( const int &  type) const
virtual

Create a method of the specified type to solve the task. It is the duty of the caller to release the CCopasiMethod.

Parameters
constCCopasiMethod::SubType & type
Returns
CCopasiMethod *

Reimplemented from CCopasiTask.

Definition at line 80 of file CScanTask.cpp.

References CScanMethod::createMethod().

Referenced by CScanTask().

81 {
83 
84  return CScanMethod::createMethod(Type);
85 }
static CScanMethod * createMethod(CCopasiMethod::SubType subType=CCopasiMethod::scanMethod)
void CScanTask::fixBuild81 ( )

Fix files written with Version 4.12.81 and earlier, which wrote the exp(mean) and exp(std. deviation) for normal random distributions in the scan task.

Definition at line 322 of file CScanTask.cpp.

References CScanProblem::fixBuild81(), and CCopasiTask::mpProblem.

Referenced by CCopasiXML::fixBuild81().

323 {
324  CScanProblem * pProblem = dynamic_cast< CScanProblem * >(mpProblem);
325 
326  if (pProblem == NULL) return;
327 
328  pProblem->fixBuild81();
329 
330  return;
331 }
CCopasiProblem * mpProblem
Definition: CCopasiTask.h:234
bool CScanTask::initialize ( const OutputFlag of,
COutputHandler pOutputHandler,
std::ostream *  pOstream 
)
virtual

Initialize the task. If an ostream is given this ostream is used instead of the target specified in the report. This allows nested tasks to share the same output device.

Parameters
constOutputFlag & of
COutputHandler* pOutputHandler
std::ostream* pOstream (default: NULL)
Returns
bool success

Reimplemented from CCopasiTask.

Definition at line 90 of file CScanTask.cpp.

References COutputHandler::addInterface(), CCopasiMessage::COMMANDLINE, CCopasiObject::getObjectDataModel(), CCopasiObject::getObjectName(), CReport::getStream(), CCopasiTask::initialize(), initSubtask(), CCopasiMethod::isValidProblem(), MCCopasiTask, CCopasiTask::mpMethod, CCopasiTask::mpProblem, CCopasiTask::mReport, CReport::open(), and CCopasiTask::REPORT.

93 {
94  assert(mpProblem && mpMethod);
95 
97 
98  bool success = true;
99 
100  if ((of & REPORT) &&
101  pOutputHandler != NULL)
102  {
103  if (mReport.open(getObjectDataModel(), pOstream))
104  pOutputHandler->addInterface(&mReport);
105  else
107  }
108 
109  success &= initSubtask(of, pOutputHandler, mReport.getStream());
110  success &= CCopasiTask::initialize(of, pOutputHandler, mReport.getStream());
111 
112  return success;
113 }
CCopasiDataModel * getObjectDataModel()
CCopasiMethod * mpMethod
Definition: CCopasiTask.h:239
const std::string & getObjectName() const
virtual bool initialize(const OutputFlag &of, COutputHandler *pOutputHandler, std::ostream *pOstream)
bool initSubtask(const OutputFlag &of, COutputHandler *pOutputHandler, std::ostream *pOstream)
Definition: CScanTask.cpp:235
CReport mReport
Definition: CCopasiTask.h:244
virtual bool isValidProblem(const CCopasiProblem *pProblem)
CCopasiProblem * mpProblem
Definition: CCopasiTask.h:234
#define MCCopasiTask
virtual void addInterface(COutputInterface *pInterface)
std::ostream * getStream() const
Definition: CReport.cpp:392
std::ostream * open(const CCopasiDataModel *pDataModel, std::ostream *pOstream=NULL)
Definition: CReport.cpp:336
bool CScanTask::initSubtask ( const OutputFlag of,
COutputHandler pOutputHandler,
std::ostream *  pOstream 
)
protected

Init the subtask

Parameters
constOutputFlag & of
COutputHandler* pOutputHandler
Returns
success

Definition at line 235 of file CScanTask.cpp.

References CCopasiTask::crosssection, fatalError, CScanProblem::getContinueFromCurrentState(), CCopasiDataModel::getModel(), CCopasiObject::getObjectDataModel(), CCopasiTask::getProblem(), CCopasiDataModel::getTaskList(), CCopasiParameterGroup::getValue(), CCopasiTask::initialize(), CCopasiTask::lna, CCopasiTask::lyap, CCopasiTask::mca, mOutputInSubtask, CCopasiTask::mpProblem, mpSubtask, mUseInitialValues, CCopasiTask::NO_OUTPUT, CCopasiTask::optimization, CCopasiTask::OUTPUT, CCopasiTask::parameterFitting, CCopasiParameter::Value::pBOOL, CCopasiParameter::Value::pUINT, CCopasiTask::sens, CCopasiTask::setCallBack(), CCopasiProblem::setModel(), CCopasiTask::steadyState, CCopasiTask::timeCourse, CCopasiTask::tssAnalysis, and CCopasiTask::TypeName.

Referenced by initialize().

238 {
239  if (!mpProblem) fatalError();
240 
241  CScanProblem * pProblem = dynamic_cast<CScanProblem *>(mpProblem);
242 
243  if (!pProblem) fatalError();
244 
245  //get the parameters from the problem
246  CCopasiTask::Type type = *(CCopasiTask::Type*) pProblem->getValue("Subtask").pUINT;
247  CCopasiDataModel* pDataModel = getObjectDataModel();
248  assert(pDataModel != NULL);
249 
250  switch (type)
251  {
253  mpSubtask = dynamic_cast<CCopasiTask*>
254  ((*pDataModel->getTaskList())["Steady-State"]);
255  break;
256 
258  mpSubtask = dynamic_cast<CCopasiTask*>
259  ((*pDataModel->getTaskList())["Time-Course"]);
260  break;
261 
262  case CCopasiTask::mca:
263  mpSubtask = dynamic_cast<CCopasiTask*>
264  ((*pDataModel->getTaskList())["Metabolic Control Analysis"]);
265  break;
266 
267  case CCopasiTask::lyap:
268  mpSubtask = dynamic_cast<CCopasiTask*>
269  ((*pDataModel->getTaskList())["Lyapunov Exponents"]);
270  break;
271 
273  mpSubtask = dynamic_cast<CCopasiTask*>
274  ((*pDataModel->getTaskList())["Optimization"]);
275  break;
276 
278  mpSubtask = dynamic_cast<CCopasiTask*>
279  ((*pDataModel->getTaskList())["Parameter Estimation"]);
280  break;
281 
282  case CCopasiTask::sens:
283  mpSubtask = dynamic_cast<CCopasiTask*>
284  ((*pDataModel->getTaskList())["Sensitivities"]);
285  break;
286 
287  case CCopasiTask::lna:
288  mpSubtask = dynamic_cast<CCopasiTask*>
289  ((*pDataModel->getTaskList())["Linear Noise Approximation"]);
290  break;
291 
293  mpSubtask = dynamic_cast<CCopasiTask*>
294  ((*pDataModel->getTaskList())[CCopasiTask::TypeName[tssAnalysis]]);
295  break;
296 
298  mpSubtask = dynamic_cast<CCopasiTask*>
299  ((*pDataModel->getTaskList())["Cross Section"]);
300  break;
301 
302  default:
303  mpSubtask = NULL;
304  }
305 
306  mOutputInSubtask = * pProblem->getValue("Output in subtask").pBOOL;
308 
309  if (!mpSubtask) return false;
310 
311  mpSubtask->getProblem()->setModel(pDataModel->getModel()); //TODO
312  mpSubtask->setCallBack(NULL);
313 
314  if (mOutputInSubtask)
315  return mpSubtask->initialize(OUTPUT, pOutputHandler, pOstream);
316  else
317  return mpSubtask->initialize(NO_OUTPUT, pOutputHandler, pOstream);
318 
319  return true;
320 }
CCopasiDataModel * getObjectDataModel()
virtual bool setCallBack(CProcessReport *pCallBack)
static const std::string TypeName[]
Definition: CCopasiTask.h:67
CCopasiProblem * getProblem()
bool mOutputInSubtask
Definition: CScanTask.h:59
bool mUseInitialValues
Definition: CScanTask.h:61
virtual bool initialize(const OutputFlag &of, COutputHandler *pOutputHandler, std::ostream *pOstream)
#define fatalError()
virtual bool setModel(CModel *pModel)
CCopasiProblem * mpProblem
Definition: CCopasiTask.h:234
CCopasiTask * mpSubtask
Definition: CScanTask.h:57
CCopasiVectorN< CCopasiTask > * getTaskList()
unsigned C_INT32 * pUINT
bool getContinueFromCurrentState() const
const CCopasiParameter::Value & getValue(const std::string &name) const
void CScanTask::load ( CReadConfig configBuffer)

Loads parameters for this solver with data coming from a CReadConfig object. (CReadConfig object reads an input stream)

Parameters
configbufferreference to a CReadConfig object.

Definition at line 115 of file CScanTask.cpp.

116 {}
bool CScanTask::outputSeparatorCallback ( bool  isLast = false)

output separators if isLast==true this method has to decide if a separator should be generated dependent on mOutputInSubtask.

Definition at line 227 of file CScanTask.cpp.

References COutputInterface::DURING, mOutputInSubtask, and CCopasiTask::separate().

228 {
229  if ((!isLast) || mOutputInSubtask)
231 
232  return true;
233 }
virtual void separate(const COutputInterface::Activity &activity)
bool mOutputInSubtask
Definition: CScanTask.h:59
bool CScanTask::process ( const bool &  useInitialValues)
virtual

Process the task with or without initializing to the initial state.

Parameters
constbool & useInitialValues
Returns
bool success

Reimplemented from CCopasiTask.

Definition at line 118 of file CScanTask.cpp.

References CProcessReport::addItem(), COutputInterface::AFTER, CModel::applyInitialValues(), COutputInterface::BEFORE, C_INT32, CCrossSectionTask::createEvent(), fatalError, CCopasiProblem::getModel(), CScanMethod::getTotalNumberOfSteps(), CScanMethod::init(), mhProgress, CCopasiTask::mpCallBack, CCopasiTask::mpMethod, CCopasiTask::mpProblem, mProgress, mpSubtask, CCopasiTask::output(), CCrossSectionTask::removeEvent(), CScanMethod::scan(), CCopasiTask::setCallBack(), CProcessReport::setName(), and CScanMethod::setProblem().

119 {
120  if (!mpProblem) fatalError();
121 
122  if (!mpMethod) fatalError();
123 
124  CScanProblem * pProblem = dynamic_cast<CScanProblem *>(mpProblem);
125 
126  if (!pProblem) fatalError();
127 
128  CScanMethod * pMethod = dynamic_cast<CScanMethod *>(mpMethod);
129 
130  if (!pMethod) fatalError();
131 
132  bool success = true;
133 
134  CCrossSectionTask* task = dynamic_cast<CCrossSectionTask*>(mpSubtask);
135 
136  if (task != NULL)
137  task->createEvent();
138 
139  if (useInitialValues)
140  {
142  }
143 
144  //TODO: reports
145 
146  // initialize the method (parsing the ScanItems)
147  pMethod->setProblem(pProblem);
148 
149  if (!pMethod->init()) return false;
150 
151  // init progress bar
152  mProgress = 0;
153 
154  if (mpCallBack)
155  {
156  mpCallBack->setName("performing parameter scan...");
157 
158  unsigned C_INT32 totalSteps = (unsigned C_INT32) pMethod->getTotalNumberOfSteps();
159  mhProgress = mpCallBack->addItem("Number of Steps",
160  mProgress,
161  &totalSteps);
162 
163  if (mpSubtask)
165  }
166 
167  // init output handler (plotting)
169 
170  //calling the scanner, output is done in the callback
171  if (!pMethod->scan()) success = false;
172 
173  if (task != NULL)
174  task->removeEvent();
175 
176  //finishing progress bar and output
177  //if (mpCallBack) mpCallBack->finish();
178  //if (mpOutputHandler) mpOutputHandler->finish();
180 
181  if (mpSubtask)
182  mpSubtask->setCallBack(NULL);
183 
184  return success;
185 }
virtual bool setCallBack(CProcessReport *pCallBack)
CCopasiMethod * mpMethod
Definition: CCopasiTask.h:239
void setProblem(CScanProblem *problem)
virtual bool setName(const std::string &name)
CProcessReport * mpCallBack
Definition: CCopasiTask.h:249
#define fatalError()
virtual void output(const COutputInterface::Activity &activity)
#define C_INT32
Definition: copasi.h:90
void applyInitialValues()
Definition: CModel.cpp:1236
CCopasiProblem * mpProblem
Definition: CCopasiTask.h:234
unsigned C_INT32 mProgress
Definition: CScanTask.h:47
CCopasiTask * mpSubtask
Definition: CScanTask.h:57
size_t addItem(const std::string &name, const std::string &value, const std::string *pEndValue=NULL)
size_t mhProgress
Definition: CScanTask.h:52
size_t getTotalNumberOfSteps() const
Definition: CScanMethod.h:243
CModel * getModel() const
bool CScanTask::processCallback ( )

Do the subtask and the output

Definition at line 201 of file CScanTask.cpp.

References COutputInterface::DURING, CCopasiTask::getProblem(), CCopasiTask::isUpdateModel(), mhProgress, mOutputInSubtask, CCopasiTask::mpCallBack, mProgress, mpSubtask, mUseInitialValues, CCopasiTask::output(), CCopasiTask::process(), CProcessReport::progressItem(), and COptProblem::restoreModel().

Referenced by CScanMethod::calculate().

202 {
203  bool success = mpSubtask->process(mUseInitialValues);
204 
205  //do output
206  if (success && !mOutputInSubtask)
208 
209  if (mpSubtask->isUpdateModel())
210  {
211  COptProblem* problem = dynamic_cast<COptProblem*>(mpSubtask->getProblem());
212 
213  if (problem != NULL)
214  {
215  problem->restoreModel(true);
216  }
217  }
218 
219  //do progress bar
220  ++mProgress;
221 
223 
224  return true;
225 }
CCopasiProblem * getProblem()
void restoreModel(const bool &updateModel)
bool mOutputInSubtask
Definition: CScanTask.h:59
bool mUseInitialValues
Definition: CScanTask.h:61
const bool & isUpdateModel() const
CProcessReport * mpCallBack
Definition: CCopasiTask.h:249
virtual void output(const COutputInterface::Activity &activity)
virtual bool progressItem(const size_t &handle)
unsigned C_INT32 mProgress
Definition: CScanTask.h:47
CCopasiTask * mpSubtask
Definition: CScanTask.h:57
virtual bool process(const bool &useInitialValues)
size_t mhProgress
Definition: CScanTask.h:52
bool CScanTask::restore ( )
virtual

Perform necessary cleanup procedures

Reimplemented from CCopasiTask.

Definition at line 187 of file CScanTask.cpp.

References mpSubtask, and CCopasiTask::restore().

188 {
189  bool success = true;
190 
191  if (mpSubtask != NULL)
192  {
193  success &= mpSubtask->restore();
194  }
195 
196  success = CCopasiTask::restore();
197 
198  return success;
199 }
CCopasiTask * mpSubtask
Definition: CScanTask.h:57
virtual bool restore()

Member Data Documentation

size_t CScanTask::mhProgress
private

Handle to process item

Definition at line 52 of file CScanTask.h.

Referenced by process(), and processCallback().

bool CScanTask::mOutputInSubtask
private

Definition at line 59 of file CScanTask.h.

Referenced by initSubtask(), outputSeparatorCallback(), and processCallback().

unsigned C_INT32 CScanTask::mProgress
private

Pointer to the output stream for reporting for progress bar

Definition at line 47 of file CScanTask.h.

Referenced by process(), and processCallback().

CCopasiTask* CScanTask::mpSubtask
private

the subtask

Definition at line 57 of file CScanTask.h.

Referenced by initSubtask(), process(), processCallback(), and restore().

bool CScanTask::mUseInitialValues
private

Definition at line 61 of file CScanTask.h.

Referenced by initSubtask(), and processCallback().


The documentation for this class was generated from the following files: