COPASI API  4.16.103
Public Member Functions | Private Member Functions | Friends | List of all members
CSensTask Class Reference

#include <CSensTask.h>

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

Public Member Functions

virtual CCopasiMethodcreateMethod (const int &type) const
 
 CSensTask (const CCopasiContainer *pParent=NULL)
 
 CSensTask (const CSensTask &src, const CCopasiContainer *pParent=NULL)
 
virtual bool initialize (const OutputFlag &of, COutputHandler *pOutputHandler, std::ostream *pOstream)
 
virtual void print (std::ostream *ostream) const
 
virtual bool process (const bool &useInitialValues)
 
virtual bool restore ()
 
virtual bool updateMatrices ()
 
virtual ~CSensTask ()
 
- 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 ~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
 
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 ()
 

Private Member Functions

void cleanup ()
 

Friends

std::ostream & operator<< (std::ostream &os, const CSensTask &A)
 

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 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 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

CSensTask class.

Definition at line 35 of file CSensTask.h.

Constructor & Destructor Documentation

CSensTask::CSensTask ( const CCopasiContainer pParent = NULL)

Default constructor

Parameters
constCCopasiContainer * pParent (default: NULL)

Definition at line 41 of file CSensTask.cpp.

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

41  :
43 {
44  mpProblem = new CSensProblem(this);
45 
47  this->add(mpMethod, true);
48 
49 }
virtual CCopasiMethod * createMethod(const int &type) const
Definition: CSensTask.cpp:66
CCopasiMethod * mpMethod
Definition: CCopasiTask.h:239
CCopasiTask(const std::string &name="NoName", const CCopasiContainer *pParent=NULL, const std::string &type="Task")
CCopasiProblem * mpProblem
Definition: CCopasiTask.h:234
virtual bool add(CCopasiObject *pObject, const bool &adopt=true)
CSensTask::CSensTask ( const CSensTask src,
const CCopasiContainer pParent = NULL 
)

Copy constructor

Parameters
constCSensTask & src
constCCopasiContainer * pParent (default: NULL)

Definition at line 51 of file CSensTask.cpp.

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

52  :
53  CCopasiTask(src, pParent)
54 {
55  mpProblem =
56  new CSensProblem(*(CSensProblem *) src.mpProblem, this);
57 
59  this->add(mpMethod, true);
60 }
virtual CCopasiMethod * createMethod(const int &type) const
Definition: CSensTask.cpp:66
CCopasiMethod * mpMethod
Definition: CCopasiTask.h:239
CCopasiTask(const std::string &name="NoName", const CCopasiContainer *pParent=NULL, const std::string &type="Task")
const CCopasiMethod::SubType & getSubType() const
CCopasiProblem * mpProblem
Definition: CCopasiTask.h:234
virtual bool add(CCopasiObject *pObject, const bool &adopt=true)
CSensTask::~CSensTask ( )
virtual

Destructor

Definition at line 62 of file CSensTask.cpp.

63 {}

Member Function Documentation

void CSensTask::cleanup ( )
private

cleanup()

Definition at line 73 of file CSensTask.cpp.

74 {}
CCopasiMethod * CSensTask::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 66 of file CSensTask.cpp.

References CSensMethod::createMethod().

Referenced by CSensTask().

67 {
69 
70  return CSensMethod::createMethod(Type);
71 }
static CSensMethod * createMethod(CCopasiMethod::SubType subType=CCopasiMethod::sensMethod)
Definition: CSensMethod.cpp:34
bool CSensTask::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 101 of file CSensTask.cpp.

References CCopasiTask::initialize(), and updateMatrices().

104 {
105 
106  bool success = true;
107 
108  //this needs to be done before the initialization of the output
109  if (!updateMatrices()) success = false;
110 
111  if (!CCopasiTask::initialize(of, pOutputHandler, pOstream)) success = false;
112 
113  return success;
114 }
virtual bool initialize(const OutputFlag &of, COutputHandler *pOutputHandler, std::ostream *pOstream)
virtual bool updateMatrices()
Definition: CSensTask.cpp:79
void CSensTask::print ( std::ostream *  ostream) const
virtual

This is the output method for any object. The default implementation provided with CCopasiObject uses the ostream operator<< of the object to print the object.To overide this default behaviour one needs to reimplement the virtual print function.

Parameters
std::ostream* ostream

Reimplemented from CCopasiObject.

Definition at line 77 of file CSensTask.cpp.

77 {(*ostream) << (*this);}
bool CSensTask::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 116 of file CSensTask.cpp.

References COutputInterface::AFTER, CModel::applyInitialValues(), COutputInterface::BEFORE, COutputInterface::DURING, CCopasiProblem::getModel(), CCopasiMethod::isValidProblem(), CCopasiTask::mpCallBack, CCopasiTask::mpMethod, CCopasiTask::mpProblem, CCopasiTask::mReport, CReport::output(), and CSensMethod::process().

117 {
118  assert(/*mpProblem && */mpMethod);
120 
121  CSensProblem* pProblem =
122  dynamic_cast<CSensProblem *>(mpProblem);
123  assert(pProblem);
124 
125  CSensMethod* pMethod =
126  dynamic_cast<CSensMethod *>(mpMethod);
127  assert(pMethod);
128 
129  if (useInitialValues)
130  pProblem->getModel()->applyInitialValues();
131 
133 
134  bool success = pMethod->process(mpCallBack);
135 
138 
139  return (success);
140 }
CCopasiMethod * mpMethod
Definition: CCopasiTask.h:239
CProcessReport * mpCallBack
Definition: CCopasiTask.h:249
CReport mReport
Definition: CCopasiTask.h:244
void applyInitialValues()
Definition: CModel.cpp:1236
virtual bool isValidProblem(const CCopasiProblem *pProblem)
CCopasiProblem * mpProblem
Definition: CCopasiTask.h:234
bool process(CProcessReport *handler)
CModel * getModel() const
virtual void output(const Activity &activity)
Definition: CReport.cpp:107
bool CSensTask::restore ( )
virtual

Perform necessary cleanup procedures

Reimplemented from CCopasiTask.

Definition at line 143 of file CSensTask.cpp.

References CCopasiTask::mpMethod, CCopasiTask::mUpdateModel, and CSensMethod::restore().

144 {
145  bool success = true;
146 
147  CSensMethod* pMethod =
148  dynamic_cast<CSensMethod *>(mpMethod);
149 
150  if (pMethod != NULL)
151  pMethod->restore(mUpdateModel);
152 
153  return success;
154 }
CCopasiMethod * mpMethod
Definition: CCopasiTask.h:239
bool restore(const bool &updateModel)
bool mUpdateModel
Definition: CCopasiTask.h:223
bool CSensTask::updateMatrices ( )
virtual

Resizes result matrices and updates array annotations. This is used when we need to know about the data structures of a task result without actually performing the task, e.g. when selecting objects for output. For now we assume that this functionality is also performed when initialize() is called.

Reimplemented from CCopasiTask.

Definition at line 79 of file CSensTask.cpp.

References CModel::compileIfNecessary(), CCopasiProblem::getModel(), CSensMethod::initialize(), CCopasiTask::mpCallBack, CCopasiTask::mpMethod, and CCopasiTask::mpProblem.

Referenced by initialize().

80 {
81  assert(mpProblem && mpMethod);
82 
83  CSensProblem* pProblem =
84  dynamic_cast<CSensProblem *>(mpProblem);
85  assert(pProblem);
86 
87  CSensMethod* pMethod =
88  dynamic_cast<CSensMethod *>(mpMethod);
89  assert(pMethod);
90 
91  bool success = true;
92 
93  if (!pProblem->getModel()->compileIfNecessary(mpCallBack)) success = false;
94 
95  //this does actually more than just update the matrices, but it should do no harm
96  if (!pMethod->initialize(pProblem)) success = false;
97 
98  return success;
99 }
CCopasiMethod * mpMethod
Definition: CCopasiTask.h:239
CProcessReport * mpCallBack
Definition: CCopasiTask.h:249
CCopasiProblem * mpProblem
Definition: CCopasiTask.h:234
bool initialize(CSensProblem *problem)
bool compileIfNecessary(CProcessReport *pProcessReport)
Definition: CModel.cpp:612
CModel * getModel() const

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const CSensTask A 
)
friend

Definition at line 156 of file CSensTask.cpp.

157 {
158  return os;
159 }

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