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

#include <CScanMethod.h>

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

Public Member Functions

size_t getTotalNumberOfSteps () const
 
bool init ()
 
virtual bool isValidProblem (const CCopasiProblem *pProblem)
 
bool scan ()
 
void setProblem (CScanProblem *problem)
 
 ~CScanMethod ()
 
- Public Member Functions inherited from CCopasiMethod
 CCopasiMethod (const CCopasiMethod &src, const CCopasiContainer *pParent=NULL)
 
const CCopasiMethod::SubTypegetSubType () const
 
const CCopasiTask::TypegetType () const
 
virtual void load (CReadConfig &configBuffer, CReadConfig::Mode mode=CReadConfig::SEARCH)
 
virtual void print (std::ostream *ostream) const
 
virtual void printResult (std::ostream *ostream) const
 
virtual bool setCallBack (CProcessReport *pCallBack)
 
virtual ~CCopasiMethod ()
 
- Public Member Functions inherited from CCopasiParameterGroup
bool addGroup (const std::string &name)
 
bool addParameter (const CCopasiParameter &parameter)
 
bool addParameter (const std::string &name, const CCopasiParameter::Type type)
 
template<class CType >
bool addParameter (const std::string &name, const CCopasiParameter::Type type, const CType &value)
 
void addParameter (CCopasiParameter *pParameter)
 
CCopasiParameterGroupassertGroup (const std::string &name)
 
template<class CType >
CCopasiParameterassertParameter (const std::string &name, const CCopasiParameter::Type type, const CType &defaultValue)
 
index_iterator beginIndex () const
 
name_iterator beginName () const
 
 CCopasiParameterGroup (const CCopasiParameterGroup &src, const CCopasiContainer *pParent=NULL)
 
 CCopasiParameterGroup (const std::string &name, const CCopasiContainer *pParent=NULL, const std::string &objectType="ParameterGroup")
 
void clear ()
 
virtual bool elevateChildren ()
 
index_iterator endIndex () const
 
name_iterator endName () const
 
CCopasiParameterGroupgetGroup (const std::string &name)
 
const CCopasiParameterGroupgetGroup (const std::string &name) const
 
CCopasiParameterGroupgetGroup (const size_t &index)
 
const CCopasiParameterGroupgetGroup (const size_t &index) const
 
size_t getIndex (const std::string &name) const
 
std::string getKey (const std::string &name) const
 
std::string getKey (const size_t &index) const
 
virtual const std::string & getName (const size_t &index) const
 
virtual const CObjectInterfacegetObject (const CCopasiObjectName &cn) const
 
CCopasiParametergetParameter (const std::string &name)
 
const CCopasiParametergetParameter (const std::string &name) const
 
CCopasiParametergetParameter (const size_t &index)
 
const CCopasiParametergetParameter (const size_t &index) const
 
CCopasiParameter::Type getType (const std::string &name) const
 
CCopasiParameter::Type getType (const size_t &index) const
 
std::string getUniqueParameterName (const CCopasiParameter *pParameter) const
 
const CCopasiParameter::ValuegetValue (const std::string &name) const
 
const CCopasiParameter::ValuegetValue (const size_t &index) const
 
CCopasiParameter::ValuegetValue (const std::string &name)
 
CCopasiParameter::ValuegetValue (const size_t &index)
 
CCopasiParameterGroupoperator= (const CCopasiParameterGroup &rhs)
 
bool removeParameter (const std::string &name)
 
bool removeParameter (const size_t &index)
 
template<class CType >
bool setValue (const std::string &name, const CType &value)
 
template<class CType >
bool setValue (const size_t &index, const CType &value)
 
size_t size () const
 
bool swap (const size_t &iFrom, const size_t &iTo)
 
bool swap (index_iterator &from, index_iterator &to)
 
virtual ~CCopasiParameterGroup ()
 
- Public Member Functions inherited from CCopasiParameter
 CCopasiParameter (const CCopasiParameter &src, const CCopasiContainer *pParent=NULL)
 
 CCopasiParameter (const std::string &name, const Type &type, const void *pValue=NULL, const CCopasiContainer *pParent=NULL, const std::string &objectType="Parameter")
 
virtual CCopasiObjectName getCN () const
 
virtual const std::string & getKey () const
 
virtual std::string getObjectDisplayName (bool regular=true, bool richtext=false) const
 
const CCopasiParameter::TypegetType () const
 
const ValuegetValue () const
 
ValuegetValue ()
 
virtual voidgetValuePointer () const
 
CCopasiObjectgetValueReference () const
 
bool isValidValue (const C_FLOAT64 &value) const
 
bool isValidValue (const C_INT32 &value) const
 
bool isValidValue (const unsigned C_INT32 &value) const
 
bool isValidValue (const bool &value) const
 
bool isValidValue (const std::string &value) const
 
bool isValidValue (const CCopasiObjectName &value) const
 
bool isValidValue (const std::vector< CCopasiParameter * > &value) const
 
CCopasiParameteroperator= (const CCopasiParameter &rhs)
 
template<class CType >
bool setValue (const CType &value)
 
bool setValue (const std::vector< CCopasiParameter * > &value)
 
virtual ~CCopasiParameter ()
 
- 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 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 const DataObjectSetgetDirectDependencies (const DataObjectSet &context=DataObjectSet()) const
 
CCopasiContainergetObjectAncestor (const std::string &type) const
 
CCopasiDataModelgetObjectDataModel ()
 
const CCopasiDataModelgetObjectDataModel () const
 
const std::string & getObjectName () const
 
CCopasiContainergetObjectParent () const
 
const std::string & getObjectType () const
 
virtual const
CObjectInterface::ObjectSet
getPrerequisites () const
 
virtual RefreshgetRefresh () const
 
UpdateMethodgetUpdateMethod () 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
 
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 ()
 

Static Public Member Functions

static CScanMethodcreateMethod (CCopasiMethod::SubType subType=CCopasiMethod::scanMethod)
 
- 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)
 

Protected Member Functions

 CScanMethod (CCopasiMethod::SubType subType, const CCopasiContainer *pParent=NULL)
 
- Protected Member Functions inherited from CCopasiMethod
 CCopasiMethod (const CCopasiTask::Type &taskType, const SubType &subType, const CCopasiContainer *pParent=NULL)
 
- Protected Member Functions inherited from CCopasiParameterGroup
 CCopasiParameterGroup ()
 
- 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)
 

Protected Attributes

bool mContinueFromCurrentState
 
std::vector< Refresh * > mInitialRefreshes
 
size_t mLastNestingItem
 
CScanProblemmpProblem
 
CRandommpRandomGenerator
 
CScanTaskmpTask
 
std::vector< CScanItem * > mScanItems
 
size_t mTotalSteps
 
- Protected Attributes inherited from CCopasiMethod
CProcessReportmpCallBack
 
- Protected Attributes inherited from CCopasiParameter
std::string mKey
 
CCopasiObjectmpValueReference
 
size_t mSize
 
Value mValue
 
- Protected Attributes inherited from CCopasiContainer
objectMap mObjects
 

Private Member Functions

bool calculate ()
 
bool cleanupScanItems ()
 
 CScanMethod ()
 
bool loop (size_t level)
 

Additional Inherited Members

- Public Types inherited from CCopasiMethod
enum  SubType {
  unset = 0, RandomSearch, RandomSearchMaster, SimulatedAnnealing,
  CoranaWalk, DifferentialEvolution, ScatterSearch, GeneticAlgorithm,
  EvolutionaryProgram, SteepestDescent, HybridGASA, GeneticAlgorithmSR,
  HookeJeeves, LevenbergMarquardt, NelderMead, SRES,
  Statistics, ParticleSwarm, Praxis, TruncatedNewton,
  Newton, deterministic, LSODAR, directMethod,
  stochastic, tauLeap, adaptiveSA, hybrid,
  hybridLSODA, hybridODE45, DsaLsodar, tssILDM,
  tssILDMModified, tssCSP, mcaMethodReder, scanMethod,
  lyapWolf, sensMethod, EFMAlgorithm, EFMBitPatternTreeAlgorithm,
  EFMBitPatternAlgorithm, Householder, crossSectionMethod, linearNoiseApproximation
}
 
- Public Types inherited from CCopasiParameterGroup
typedef parameterGroup::iterator index_iterator
 
typedef
CCopasiContainer::objectMap::iterator 
name_iterator
 
typedef std::vector
< CCopasiParameter * > 
parameterGroup
 
- Public Types inherited from CCopasiParameter
enum  Type {
  DOUBLE = 0, UDOUBLE, INT, UINT,
  BOOL, GROUP, STRING, CN,
  KEY, FILE, EXPRESSION, INVALID
}
 
- 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 Attributes inherited from CCopasiMethod
static const std::string SubTypeName []
 
static const char * XMLSubType []
 
- Static Public Attributes inherited from CCopasiParameter
static const std::string TypeName []
 
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
}
 
- Static Protected Attributes inherited from CCopasiObject
static CRenameHandlersmpRenameHandler = NULL
 

Detailed Description

Definition at line 159 of file CScanMethod.h.

Constructor & Destructor Documentation

CScanMethod::CScanMethod ( )
private

Default constructor.

Definition at line 353 of file CScanMethod.cpp.

References CRandom::createGenerator(), mpRandomGenerator, and CRandom::r250.

Referenced by createMethod().

353  :
355  mpProblem(NULL),
356  mpTask(NULL),
357  mpRandomGenerator(NULL),
358  mTotalSteps(1),
361 {
363 }
size_t mLastNestingItem
Definition: CScanMethod.h:189
#define C_INVALID_INDEX
Definition: copasi.h:222
CScanProblem * mpProblem
Definition: CScanMethod.h:165
static CRandom * createGenerator(CRandom::Type type=CRandom::mt19937, unsigned C_INT32 seed=0)
Definition: CRandom.cpp:49
CScanTask * mpTask
Definition: CScanMethod.h:170
CRandom * mpRandomGenerator
Definition: CScanMethod.h:175
bool mContinueFromCurrentState
Definition: CScanMethod.h:195
size_t mTotalSteps
Definition: CScanMethod.h:183
CScanMethod::CScanMethod ( CCopasiMethod::SubType  subType,
const CCopasiContainer pParent = NULL 
)
protected

Specific constructor.

Parameters
CCopasiMethod::SubTypesubType
constCCopasiContainer * pParent (default: NULL)
CScanMethod::~CScanMethod ( )

Copy constructor.

Parameters
const CTrajectoryMethod &src Destructor.

Definition at line 365 of file CScanMethod.cpp.

References cleanupScanItems(), and mpRandomGenerator.

366 {
368  delete mpRandomGenerator;
369  mpRandomGenerator = NULL;
370 }
bool cleanupScanItems()
CRandom * mpRandomGenerator
Definition: CScanMethod.h:175

Member Function Documentation

bool CScanMethod::calculate ( void  )
private

Definition at line 508 of file CScanMethod.cpp.

References mInitialRefreshes, mpTask, and CScanTask::processCallback().

Referenced by loop(), and scan().

509 {
510  std::vector< Refresh * >::iterator it = mInitialRefreshes.begin();
511  std::vector< Refresh * >::iterator end = mInitialRefreshes.end();
512 
513  while (it != end)
514  (**it++)();
515 
516  return mpTask->processCallback();
517 }
std::vector< Refresh * > mInitialRefreshes
Definition: CScanMethod.h:179
bool processCallback()
Definition: CScanTask.cpp:201
CScanTask * mpTask
Definition: CScanMethod.h:170
bool CScanMethod::cleanupScanItems ( )
private

Definition at line 372 of file CScanMethod.cpp.

References mpProblem, and mScanItems.

Referenced by init(), and ~CScanMethod().

373 {
374  if (!mpProblem) return false;
375 
376  size_t i, imax = mScanItems.size();
377 
378  for (i = 0; i < imax; ++i) if (mScanItems[i]) delete mScanItems[i];
379 
380  mScanItems.clear();
381  return true;
382 }
std::vector< CScanItem * > mScanItems
Definition: CScanMethod.h:177
CScanProblem * mpProblem
Definition: CScanMethod.h:165
CScanMethod * CScanMethod::createMethod ( CCopasiMethod::SubType  subType = CCopasiMethod::scanMethod)
static

Create a trajectory method. Note: the returned object has to be released after use with delete

Definition at line 348 of file CScanMethod.cpp.

References CScanMethod().

Referenced by CScanTask::createMethod().

349 {
350  return new CScanMethod();
351 }
size_t CScanMethod::getTotalNumberOfSteps ( ) const
inline

Definition at line 243 of file CScanMethod.h.

References mTotalSteps.

Referenced by CScanTask::process().

243 {return mTotalSteps;};
size_t mTotalSteps
Definition: CScanMethod.h:183
bool CScanMethod::init ( )

Definition at line 384 of file CScanMethod.cpp.

References CModel::buildInitialRefreshSequence(), CCopasiObject::buildUpdateSequence(), C_INVALID_INDEX, cleanupScanItems(), CScanItem::createScanItemFromParameterGroup(), CScanProblem::getContinueFromCurrentState(), CCopasiProblem::getModel(), CScanProblem::getNumberOfScanItems(), CScanItem::getNumSteps(), CScanItem::getObject(), CCopasiObject::getObjectParent(), CScanProblem::getScanItem(), CModel::getUptoDateObjects(), mContinueFromCurrentState, mInitialRefreshes, mLastNestingItem, mpProblem, mpRandomGenerator, mpTask, mScanItems, and mTotalSteps.

Referenced by CScanTask::process().

385 {
386  if (!mpProblem) return false;
387 
388  mpTask = dynamic_cast< CScanTask * >(getObjectParent());
389 
390  if (mpTask == NULL) return false;
391 
393  mInitialRefreshes.clear();
394  //mTransientRefreshes.clear();
395 
396  mTotalSteps = 1;
397  std::set< const CCopasiObject * > InitialObjectSet;
398  std::set< const CCopasiObject * > TransientObjectSet;
399 
400  size_t i, imax = mpProblem->getNumberOfScanItems();
402 
403  for (i = 0; i < imax; ++i)
404  {
408 
409  if (pItem == NULL)
410  {
411  continue;
412  }
413 
414  mScanItems.push_back(pItem);
415  mTotalSteps *= pItem->getNumSteps() + 1;
416 
417  if (pItem->getObject() != NULL)
418  {
419  InitialObjectSet.insert(pItem->getObject());
420  }
421  }
422 
424  {
426  }
427  else
428  {
430  }
431 
432  //set mLastNestingItem
434 
435  if (imax != 0)
436  {
437  //search from the end
438  size_t j;
439 
440  for (j = mScanItems.size() - 1; j != C_INVALID_INDEX; --j)
441  {
442  if (mScanItems[j]->isNesting())
443  {
444  mLastNestingItem = j;
445  break;
446  }
447  }
448  }
449 
450  return true;
451 }
size_t mLastNestingItem
Definition: CScanMethod.h:189
const std::set< const CCopasiObject * > & getUptoDateObjects() const
Definition: CModel.cpp:1178
std::vector< CScanItem * > mScanItems
Definition: CScanMethod.h:177
#define C_INVALID_INDEX
Definition: copasi.h:222
size_t getNumberOfScanItems() const
bool cleanupScanItems()
CScanProblem * mpProblem
Definition: CScanMethod.h:165
std::vector< Refresh * > mInitialRefreshes
Definition: CScanMethod.h:179
bool getContinueFromCurrentState() const
CScanTask * mpTask
Definition: CScanMethod.h:170
CRandom * mpRandomGenerator
Definition: CScanMethod.h:175
const CCopasiObject * getObject() const
static std::vector< Refresh * > buildUpdateSequence(const DataObjectSet &objects, const DataObjectSet &uptoDateObjects, const DataObjectSet &context=DataObjectSet())
size_t getNumSteps() const
const CCopasiParameterGroup * getScanItem(size_t index) const
std::vector< Refresh * > buildInitialRefreshSequence(std::set< const CCopasiObject * > &changedObjects)
Definition: CModel.cpp:4164
static CScanItem * createScanItemFromParameterGroup(CCopasiParameterGroup *si, CRandom *rg, const bool &continueFromCurrentState)
Definition: CScanMethod.cpp:48
CModel * getModel() const
CCopasiContainer * getObjectParent() const
bool mContinueFromCurrentState
Definition: CScanMethod.h:195
size_t mTotalSteps
Definition: CScanMethod.h:183
bool CScanMethod::isValidProblem ( const CCopasiProblem pProblem)
virtual

The main scan method. Check if the method is suitable for this problem

Returns
bool suitability of the method

Reimplemented from CCopasiMethod.

Definition at line 523 of file CScanMethod.cpp.

References CScanItem::createScanItemFromParameterGroup(), CCopasiMessage::ERROR, CCopasiMessage::EXCEPTION, CScanProblem::getContinueFromCurrentState(), CScanProblem::getNumberOfScanItems(), CScanProblem::getScanItem(), CCopasiMethod::isValidProblem(), CScanItem::isValidScanItem(), mContinueFromCurrentState, mpProblem, mpRandomGenerator, and CCopasiMessage::WARNING.

524 {
525  if (!CCopasiMethod::isValidProblem(pProblem)) return false;
526 
527  const CScanProblem * pP = dynamic_cast<const CScanProblem *>(pProblem);
528 
529  if (!pP)
530  {
531  //not a TrajectoryProblem
532  CCopasiMessage(CCopasiMessage::EXCEPTION, "Problem is not a Scan problem.");
533  return false;
534  }
535 
537 
538  size_t i, imax = pP->getNumberOfScanItems();
539 
540  if (imax <= 0)
541  {
542  //no scan items
543  CCopasiMessage(CCopasiMessage::WARNING, "There is nothing to scan.");
544  return false;
545  }
546 
547  for (i = 0; i < imax; ++i)
548  {
552 
553  if (!si)
554  {
555  //parameter group could not be interpreted
556  CCopasiMessage(CCopasiMessage::ERROR, "Internal problem with scan definition.");
557  return false;
558  }
559 
561  {
562  //the self check of the scan item failed.
563  //the message should be generated by the isValidScanItem() method.
564  delete si;
565  return false;
566  }
567 
568  delete si;
569  //mTotalSteps *= mScanItems[i]->getNumSteps();
570  }
571 
572  return true;
573 }
size_t getNumberOfScanItems() const
CScanProblem * mpProblem
Definition: CScanMethod.h:165
virtual bool isValidProblem(const CCopasiProblem *pProblem)
virtual bool isValidScanItem(const bool &continueFromCurrentState)
bool getContinueFromCurrentState() const
CRandom * mpRandomGenerator
Definition: CScanMethod.h:175
const CCopasiParameterGroup * getScanItem(size_t index) const
static CScanItem * createScanItemFromParameterGroup(CCopasiParameterGroup *si, CRandom *rg, const bool &continueFromCurrentState)
Definition: CScanMethod.cpp:48
bool mContinueFromCurrentState
Definition: CScanMethod.h:195
bool CScanMethod::loop ( size_t  level)
private

Definition at line 481 of file CScanMethod.cpp.

References calculate(), CCopasiObject::getObjectParent(), CScanItem::isFinished(), CScanItem::isNesting(), mLastNestingItem, mScanItems, CScanItem::reset(), and CScanItem::step().

Referenced by scan().

482 {
483  bool isLastMasterItem = (level == (mScanItems.size() - 1)); //TODO
484 
485  CScanItem* currentSI = mScanItems[level];
486 
487  for (currentSI->reset(); !currentSI->isFinished(); currentSI->step())
488  {
489  //TODO: handle slave SIs
490 
491  if (isLastMasterItem)
492  {
493  if (!calculate()) return false;
494  }
495  else
496  {
497  if (!loop(level + 1)) return false;
498  } //TODO
499 
500  //separator needs to be handled slightly differently if we are at the last item
501  if (currentSI->isNesting())
502  ((CScanTask*)(getObjectParent()))->outputSeparatorCallback(level == mLastNestingItem);
503  }
504 
505  return true;
506 }
bool isFinished() const
size_t mLastNestingItem
Definition: CScanMethod.h:189
bool calculate()
std::vector< CScanItem * > mScanItems
Definition: CScanMethod.h:177
virtual bool isNesting() const
Definition: CScanMethod.h:70
virtual void step()=0
void reset()
bool loop(size_t level)
CCopasiContainer * getObjectParent() const
bool CScanMethod::scan ( )

Definition at line 453 of file CScanMethod.cpp.

References calculate(), loop(), mpProblem, and mScanItems.

Referenced by CScanTask::process().

454 {
455  if (!mpProblem) return false;
456 
457  //a hack to ensure that the first subtask is run with initial conditions
458  //pDataModel->getModel()->setState(&mpProblem->getInitialState());
459 
460  bool success = true;
461 
462  size_t i, imax = mScanItems.size();
463 
464  //store old parameter values
465  for (i = 0; i < imax; ++i)
466  mScanItems[i]->storeValue();
467 
468  //Do the scan...
469  if (imax) //there are scan items
470  success = loop(0);
471  else
472  success = calculate(); //nothing to scan, only one call to the subtask
473 
474  //restore old parameter values
475  for (i = 0; i < imax; ++i)
476  mScanItems[i]->restoreValue();
477 
478  return success;
479 }
bool calculate()
std::vector< CScanItem * > mScanItems
Definition: CScanMethod.h:177
CScanProblem * mpProblem
Definition: CScanMethod.h:165
bool loop(size_t level)
void CScanMethod::setProblem ( CScanProblem problem)

Set a pointer to the problem. This method is used by CTrajectory

Parameters
CTrajectoryProblem *problem

Definition at line 519 of file CScanMethod.cpp.

References mpProblem.

Referenced by CScanTask::process().

520 {mpProblem = problem;}
CScanProblem * mpProblem
Definition: CScanMethod.h:165

Member Data Documentation

bool CScanMethod::mContinueFromCurrentState
protected

Variable indicating whether the subtask shall continue from the current state or the initial state

Definition at line 195 of file CScanMethod.h.

Referenced by init(), and isValidProblem().

std::vector< Refresh * > CScanMethod::mInitialRefreshes
protected

Definition at line 179 of file CScanMethod.h.

Referenced by calculate(), and init().

size_t CScanMethod::mLastNestingItem
protected

the index of the last item that has several subitems, also the last item that need to generate output separators

Definition at line 189 of file CScanMethod.h.

Referenced by init(), and loop().

CScanProblem* CScanMethod::mpProblem
protected

A pointer to the trajectory problem.

Definition at line 165 of file CScanMethod.h.

Referenced by cleanupScanItems(), init(), isValidProblem(), scan(), and setProblem().

CRandom* CScanMethod::mpRandomGenerator
protected

A pointer to the random number generator

Definition at line 175 of file CScanMethod.h.

Referenced by CScanMethod(), init(), isValidProblem(), and ~CScanMethod().

CScanTask* CScanMethod::mpTask
protected

A pointer to the scan Task.

Definition at line 170 of file CScanMethod.h.

Referenced by calculate(), and init().

std::vector<CScanItem*> CScanMethod::mScanItems
protected

Definition at line 177 of file CScanMethod.h.

Referenced by cleanupScanItems(), init(), loop(), and scan().

size_t CScanMethod::mTotalSteps
protected

Definition at line 183 of file CScanMethod.h.

Referenced by getTotalNumberOfSteps(), and init().


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