COPASI API  4.16.103
Public Member Functions | Static Public Attributes | List of all members
CMoietiesTask Class Reference

#include <CMoietiesTask.h>

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

Public Member Functions

 CMoietiesTask (const CCopasiTask::Type &type=CCopasiTask::moieties, const CCopasiContainer *pParent=NULL)
 
 CMoietiesTask (const CMoietiesTask &src, const CCopasiContainer *pParent=NULL)
 
virtual CCopasiMethodcreateMethod (const int &type) const
 
virtual bool initialize (const OutputFlag &of, COutputHandler *pOutputHandler, std::ostream *pOstream)
 
virtual bool process (const bool &useInitialValues)
 
virtual bool restore ()
 
virtual bool setCallBack (CProcessReport *pCallBack)
 
virtual bool setMethodType (const int &type)
 
 ~CMoietiesTask ()
 
- 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)
 
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 ()
 

Static Public Attributes

static const unsigned int ValidMethods []
 
- 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
 

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

Definition at line 26 of file CMoietiesTask.h.

Constructor & Destructor Documentation

CMoietiesTask::CMoietiesTask ( const CCopasiTask::Type type = CCopasiTask::moieties,
const CCopasiContainer pParent = NULL 
)

default constructor

Parameters
constCCopasiTask::Type & type (default: moieties)
constCCopasiContainer * pParent (default: NULL)

Definition at line 36 of file CMoietiesTask.cpp.

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

37  :
38  CCopasiTask(type, pParent)
39 {
40  mpProblem = new CMoietiesProblem(type, this);
42  this->add(mpMethod, true);
43 }
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
static CMoietiesMethod * createMethod(const CCopasiMethod::SubType &subType=CCopasiMethod::Householder)
virtual bool add(CCopasiObject *pObject, const bool &adopt=true)
CMoietiesTask::CMoietiesTask ( const CMoietiesTask src,
const CCopasiContainer pParent = NULL 
)

Copy constructor

Parameters
constCMoietiesTask & src

Definition at line 45 of file CMoietiesTask.cpp.

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

46  :
47  CCopasiTask(src, pParent)
48 {
49  mpProblem = new CMoietiesProblem(* static_cast< CMoietiesProblem * >(src.mpProblem), this);
51  this->add(mpMethod, true);
52 }
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
static CMoietiesMethod * createMethod(const CCopasiMethod::SubType &subType=CCopasiMethod::Householder)
virtual bool add(CCopasiObject *pObject, const bool &adopt=true)
CMoietiesTask::~CMoietiesTask ( )

Destructor

Definition at line 55 of file CMoietiesTask.cpp.

56 {}

Member Function Documentation

CCopasiMethod * CMoietiesTask::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 147 of file CMoietiesTask.cpp.

References CMoietiesMethod::createMethod().

Referenced by setMethodType().

148 {
150 
151  return CMoietiesMethod::createMethod(Type);
152 }
static CMoietiesMethod * createMethod(const CCopasiMethod::SubType &subType=CCopasiMethod::Householder)
bool CMoietiesTask::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 71 of file CMoietiesTask.cpp.

References CCopasiTask::initialize(), CCopasiMethod::isValidProblem(), CCopasiTask::mpMethod, CCopasiTask::mpProblem, and CMoietiesMethod::setProblem().

74 {
75  CMoietiesProblem * pProblem = dynamic_cast<CMoietiesProblem *>(mpProblem);
76  CMoietiesMethod * pMethod = dynamic_cast<CMoietiesMethod *>(mpMethod);
77 
78  if (!pProblem || !pMethod) return false;
79 
80  pMethod->setProblem(pProblem);
81 
82  // Default initialization
83  bool success = CCopasiTask::initialize(of, pOutputHandler, pOstream);
84 
85  success &= mpMethod->isValidProblem(mpProblem);
86 
87  return success;
88 }
CCopasiMethod * mpMethod
Definition: CCopasiTask.h:239
virtual bool initialize(const OutputFlag &of, COutputHandler *pOutputHandler, std::ostream *pOstream)
void setProblem(CMoietiesProblem *pProblem)
virtual bool isValidProblem(const CCopasiProblem *pProblem)
CCopasiProblem * mpProblem
Definition: CCopasiTask.h:234
bool CMoietiesTask::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 91 of file CMoietiesTask.cpp.

References COutputInterface::AFTER, COutputInterface::BEFORE, COutputHandler::compile(), CCopasiMessage::getLastMessage(), CCopasiObject::getObjectDataModel(), CCopasiTask::mpMethod, CCopasiTask::mpOutputHandler, CCopasiTask::output(), and CCopasiMessage::size().

92 {
93  bool success = true;
94 
96 
97  success = static_cast< CMoietiesMethod * >(mpMethod)->process();
98 
99  // The call to process may modify some object pointers. We therefore
100  // have to recompile the output.
101 
102  if (mpOutputHandler != NULL)
103  {
104  std::vector< CCopasiContainer * > ListOfContainer;
105  ListOfContainer.push_back(this);
106 
107  CCopasiDataModel* pDataModel = getObjectDataModel();
108  assert(pDataModel != NULL);
109 
110  size_t Size = CCopasiMessage::size();
111 
112  mpOutputHandler->compile(ListOfContainer, pDataModel);
113 
114  // Remove error messages created by setExpression as this may fail
115  // due to incomplete model specification at this time.
116  while (CCopasiMessage::size() > Size)
118  }
119 
121 
122  return success;
123 }
CCopasiDataModel * getObjectDataModel()
CCopasiMethod * mpMethod
Definition: CCopasiTask.h:239
virtual bool process(const bool &useInitialValues)
virtual void output(const COutputInterface::Activity &activity)
static size_t size()
virtual bool compile(std::vector< CCopasiContainer * > listOfContainer, const CCopasiDataModel *pDataModel)
static CCopasiMessage getLastMessage()
COutputHandler * mpOutputHandler
Definition: CCopasiTask.h:464
bool CMoietiesTask::restore ( )
virtual

Perform necessary cleanup procedures

Reimplemented from CCopasiTask.

Definition at line 126 of file CMoietiesTask.cpp.

References CCopasiProblem::getModel(), CCopasiTask::mpProblem, and CModel::updateInitialValues().

127 {
129  return true;
130 }
CCopasiProblem * mpProblem
Definition: CCopasiTask.h:234
bool updateInitialValues()
Definition: CModel.cpp:1461
CModel * getModel() const
bool CMoietiesTask::setCallBack ( CProcessReport pCallBack)
virtual

Set the call back of the task

Parameters
CProcessReport* pCallBack
Returns
bool succes

Reimplemented from CCopasiTask.

Definition at line 59 of file CMoietiesTask.cpp.

References CCopasiTask::mpMethod, CCopasiTask::mpProblem, CCopasiProblem::setCallBack(), CCopasiMethod::setCallBack(), and CCopasiTask::setCallBack().

60 {
61  bool success = CCopasiTask::setCallBack(pCallBack);
62 
63  if (!mpProblem->setCallBack(pCallBack)) success = false;
64 
65  if (!mpMethod->setCallBack(pCallBack)) success = false;
66 
67  return success;
68 }
virtual bool setCallBack(CProcessReport *pCallBack)
CCopasiMethod * mpMethod
Definition: CCopasiTask.h:239
virtual bool setCallBack(CProcessReport *pCallBack)
CCopasiProblem * mpProblem
Definition: CCopasiTask.h:234
virtual bool setCallBack(CProcessReport *pCallBack)
bool CMoietiesTask::setMethodType ( const int &  type)
virtual

Set the method type applied to solve the task

Parameters
constCCopasiMethod::SubType & type
Returns
bool success

Reimplemented from CCopasiTask.

Definition at line 132 of file CMoietiesTask.cpp.

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

133 {
135 
136  if (mpMethod->getSubType() == Type) return true;
137 
138  pdelete(mpMethod);
139 
140  mpMethod = createMethod(Type);
141  this->add(mpMethod, true);
142 
143  return true;
144 }
CCopasiMethod * mpMethod
Definition: CCopasiTask.h:239
#define pdelete(p)
Definition: copasi.h:215
virtual CCopasiMethod * createMethod(const int &type) const
const CCopasiMethod::SubType & getSubType() const
virtual bool add(CCopasiObject *pObject, const bool &adopt=true)

Member Data Documentation

const unsigned int CMoietiesTask::ValidMethods
static
Initial value:

The methods which can be selected for preforming this task.

Definition at line 34 of file CMoietiesTask.h.


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