COPASI API
4.16.103
|
#include <CMathModel.h>
Public Member Functions | |
void | applyInitialValues () |
std::vector< Refresh * > | buildDependendRefreshList (const std::set< const CCopasiObject * > &changedObjects) const |
std::vector< Refresh * > | buildRequiredRefreshList (const std::set< const CCopasiObject * > &requiredObjects) const |
void | calculateRootDerivatives (CVector< C_FLOAT64 > &rootDerivatives) |
CMathModel (const CCopasiContainer *pParent=NULL) | |
CMathModel (const CMathModel &src, const CCopasiContainer *pParent=NULL) | |
bool | compile (CModel *pModel) |
void | evaluateRoots (CVectorCore< C_FLOAT64 > &rootValues, const bool &ignoreDiscrete) |
const C_FLOAT64 & | getInitialTime () const |
size_t | getNumRoots () const |
const CProcessQueue & | getProcessQueue () const |
CProcessQueue & | getProcessQueue () |
const C_FLOAT64 & | getProcessQueueExecutionTime () const |
const CVector < CMathTrigger::CRootFinder * > & | getRootFinders () const |
bool | processQueue (const C_FLOAT64 &time, const bool &equality, CProcessQueue::resolveSimultaneousAssignments pResolveSimultaneousAssignments) |
void | processRoots (const C_FLOAT64 &time, const bool &equality, const bool &correct, const CVector< C_INT > &roots) |
void | processRoots (const C_FLOAT64 &time, const CVector< C_INT > &roots) |
virtual | ~CMathModel () |
![]() | |
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 CObjectInterface * | getObject (const CCopasiObjectName &cn) const |
virtual const objectMap & | getObjects () const |
virtual std::string | getUnits () const |
virtual const CCopasiObject * | getValueObject () const |
virtual bool | remove (CCopasiObject *pObject) |
virtual | ~CCopasiContainer () |
![]() | |
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 DataObjectSet & | getDirectDependencies (const DataObjectSet &context=DataObjectSet()) const |
virtual const std::string & | getKey () const |
CCopasiContainer * | getObjectAncestor (const std::string &type) const |
CCopasiDataModel * | getObjectDataModel () |
const CCopasiDataModel * | getObjectDataModel () const |
virtual std::string | getObjectDisplayName (bool regular=true, bool richtext=false) const |
const std::string & | getObjectName () const |
CCopasiContainer * | getObjectParent () const |
const std::string & | getObjectType () const |
virtual const CObjectInterface::ObjectSet & | getPrerequisites () const |
virtual Refresh * | getRefresh () const |
UpdateMethod * | getUpdateMethod () const |
virtual void * | getValuePointer () 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 () |
![]() | |
CObjectInterface () | |
virtual | ~CObjectInterface () |
Private Member Functions | |
void | calculateRootJacobian (CMatrix< C_FLOAT64 > &jacobian, const CVector< C_FLOAT64 > &rates) |
bool | determineInitialRoots (CVector< C_INT > &foundRoots) |
Private Attributes | |
CCopasiVector< CMathEvent > | mEvents |
CModel * | mpModel |
CProcessQueue | mProcessQueue |
CVector< bool > | mRootDiscrete |
CVector< CMathEvent * > | mRootIndex2Event |
CVector < CMathTrigger::CRootFinder * > | mRootIndex2RootFinder |
std::vector< Refresh * > | mRootRefreshes |
CVector< C_FLOAT64 * > | mRootValues |
Additional Inherited Members | |
![]() | |
typedef std::multimap < std::string, CCopasiObject * > | objectMap |
![]() | |
typedef std::set< const CCopasiObject * > | DataObjectSet |
typedef std::vector< Refresh * > | DataUpdateSequence |
![]() | |
typedef std::set< const CObjectInterface * > | ObjectSet |
typedef std::vector < CObjectInterface * > | UpdateSequence |
![]() | |
static std::vector< Refresh * > | buildUpdateSequence (const DataObjectSet &objects, const DataObjectSet &uptoDateObjects, const DataObjectSet &context=DataObjectSet()) |
static void | setRenameHandler (CRenameHandler *rh) |
![]() | |
static const std::vector < CCopasiContainer * > | EmptyList |
![]() | |
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 } |
![]() | |
template<class CType > | |
CCopasiObject * | addMatrixReference (const std::string &name, CType &reference, const unsigned C_INT32 &flag=0) |
template<class CType > | |
CCopasiObject * | addObjectReference (const std::string &name, CType &reference, const unsigned C_INT32 &flag=0) |
template<class CType > | |
CCopasiObject * | addVectorReference (const std::string &name, CType &reference, const unsigned C_INT32 &flag=0) |
void | initObjects () |
![]() | |
CCopasiObject () | |
CCopasiObject (const std::string &name, const CCopasiContainer *pParent=NULL, const std::string &type="CN", const unsigned C_INT32 &flag=0) | |
![]() | |
objectMap | mObjects |
![]() | |
static CRenameHandler * | smpRenameHandler = NULL |
Definition at line 23 of file CMathModel.h.
CMathModel::CMathModel | ( | const CCopasiContainer * | pParent = NULL | ) |
Default constructor
const | CCopasiContainer * pParent (default: NULL) |
Definition at line 21 of file CMathModel.cpp.
CMathModel::CMathModel | ( | const CMathModel & | src, |
const CCopasiContainer * | pParent = NULL |
||
) |
Copy constructor
const CMathModel & | src |
"const | CCopasiContainer * pParent (default: NULL) |
Definition at line 33 of file CMathModel.cpp.
References compile(), and mpModel.
|
virtual |
void CMathModel::applyInitialValues | ( | ) |
Initialize all values of the math model with their initial values.
Definition at line 372 of file CMathModel.cpp.
References CCopasiVector< T >::begin(), determineInitialRoots(), CCopasiVector< T >::end(), CModel::getInitialTime(), CProcessQueue::initialize(), mEvents, mpModel, mProcessQueue, mRootRefreshes, and processRoots().
Referenced by CModel::applyInitialValues().
std::vector< Refresh * > CMathModel::buildDependendRefreshList | ( | const std::set< const CCopasiObject * > & | changedObjects | ) | const |
Build a list of refresh calls needed to assure that all objects depending on the changed objects are up to date.
const | std::set< const CCopasiObject * > & changedObjects |
Definition at line 461 of file CMathModel.cpp.
References CModelEntity::ASSIGNMENT, CCopasiVector< T >::begin(), CCopasiObject::buildUpdateSequence(), CCopasiObject::dependsOn(), CCopasiVector< T >::end(), CModelEntity::FIXED, CStateTemplate::getEntities(), CModel::getMoieties(), CModel::getStateTemplate(), CModelEntity::getValueReference(), mpModel, CModelEntity::ODE, CModelEntity::REACTIONS, CStateTemplate::size(), and CModelEntity::TIME.
Referenced by CMathEvent::compile().
std::vector< Refresh * > CMathModel::buildRequiredRefreshList | ( | const std::set< const CCopasiObject * > & | requiredObjects | ) | const |
Build a list of refresh calls needed to assure that required objects are up to date.
const | std::set< const CCopasiObject * > & requiredObjects |
Definition at line 452 of file CMathModel.cpp.
References CCopasiObject::buildUpdateSequence().
Referenced by compile(), and CMathEvent::compile().
Calculate the time derivative of all roots
CVector< | C_FLOAT64 > & rootDerivatives |
Definition at line 417 of file CMathModel.cpp.
References CVectorCore< CType >::array(), CMatrix< CType >::array(), C_FLOAT64, C_INT, CModel::calculateDerivatives(), calculateRootJacobian(), dgemm_(), CModel::getNumDependentReactionMetabs(), CStateTemplate::getNumIndependent(), CModel::getStateTemplate(), K, mpModel, mRootValues, CVector< CType >::resize(), CVectorCore< CType >::size(), and CModel::updateSimulatedValues().
Referenced by CModel::calculateRootDerivatives(), and determineInitialRoots().
|
private |
Calculate the Jacobian for the roots.
CMatrix< | C_FLOAT64 > & jacobian |
const | CVector< C_FLOAT64 > & rates |
Definition at line 591 of file CMathModel.cpp.
References CVectorCore< CType >::array(), CMatrix< CType >::array(), CState::beginIndependent(), C_FLOAT64, evaluateRoots(), CModel::getNumDependentReactionMetabs(), CState::getNumIndependent(), CModel::getState(), min, mpModel, mRootValues, CMatrix< CType >::resize(), CModel::setState(), CVectorCore< CType >::size(), and CMatrix< CType >::size().
Referenced by calculateRootDerivatives().
bool CMathModel::compile | ( | CModel * | pModel | ) |
Compile the mathematical model based on given the model.
CModel | * pModel |
Definition at line 58 of file CMathModel.cpp.
References CCopasiVector< T >::add(), CVectorCore< CType >::array(), CCopasiVector< T >::begin(), buildRequiredRefreshList(), C_FLOAT64, CCopasiVector< T >::clear(), CMathEvent::compile(), CCopasiVector< T >::end(), CStateTemplate::endDependent(), CStateTemplate::getEntities(), CModel::getEvents(), CMathEvent::getMathTrigger(), CMathTrigger::getRootFinders(), CModel::getStateTemplate(), mEvents, mpModel, mRootDiscrete, mRootIndex2Event, mRootIndex2RootFinder, mRootRefreshes, mRootValues, and CVector< CType >::resize().
Referenced by CMathModel(), and CModel::compile().
Determine whether there are any initial roots and mark them.
CVector< | C_INT > & foundRoots |
Definition at line 550 of file CMathModel.cpp.
References CVectorCore< CType >::array(), C_FLOAT64, C_INT, calculateRootDerivatives(), mRootIndex2RootFinder, mRootValues, CVector< CType >::resize(), and CVectorCore< CType >::size().
Referenced by applyInitialValues().
void CMathModel::evaluateRoots | ( | CVectorCore< C_FLOAT64 > & | rootValues, |
const bool & | ignoreDiscrete | ||
) |
Evaluate all root values for the current state of the model. If ignoreDiscrete is true discrete roots evaluate to 1.0.
CVectorCore< | double > & rootValues |
const | bool & ignoreDiscrete |
Definition at line 169 of file CMathModel.cpp.
References CVectorCore< CType >::array(), C_FLOAT64, mRootDiscrete, mRootRefreshes, mRootValues, and CVectorCore< CType >::size().
Referenced by calculateRootJacobian(), CModel::evaluateRoots(), CProcessQueue::process(), and CProcessQueue::rootsFound().
const C_FLOAT64 & CMathModel::getInitialTime | ( | ) | const |
Retreive the initial time
Definition at line 206 of file CMathModel.cpp.
References CModel::getInitialTime(), and mpModel.
Referenced by CProcessQueue::initialize().
size_t CMathModel::getNumRoots | ( | ) | const |
Retrieve the number of roots used in checking for discontinuities.
Definition at line 412 of file CMathModel.cpp.
References mRootValues, and CVectorCore< CType >::size().
Referenced by CModel::getNumRoots(), and CProcessQueue::initialize().
const CProcessQueue & CMathModel::getProcessQueue | ( | ) | const |
Definition at line 362 of file CMathModel.cpp.
References mProcessQueue.
Referenced by CCrossSectionTask::finish(), CTrajectoryTask::initialize(), CCrossSectionTask::process(), and CCrossSectionTask::restore().
CProcessQueue & CMathModel::getProcessQueue | ( | ) |
const C_FLOAT64 & CMathModel::getProcessQueueExecutionTime | ( | ) | const |
Retrieve the next execution time scheduled in the process queue
Definition at line 357 of file CMathModel.cpp.
References CProcessQueue::getProcessQueueExecutionTime(), and mProcessQueue.
Referenced by CModel::getProcessQueueExecutionTime().
const CVector< CMathTrigger::CRootFinder * > & CMathModel::getRootFinders | ( | ) | const |
Retrieve a vector of root finders
Definition at line 447 of file CMathModel.cpp.
References mRootIndex2RootFinder.
Referenced by CModel::getRootFinders(), and CProcessQueue::rootsFound().
bool CMathModel::processQueue | ( | const C_FLOAT64 & | time, |
const bool & | equality, | ||
CProcessQueue::resolveSimultaneousAssignments | pResolveSimultaneousAssignments | ||
) |
Process events scheduled at the given which a are checked for equality or not
const | C_FLOAT64 & time |
const | bool & equality |
CProcessQueue::resolveSimultaneousAssignments | pResolveSimultaneousAssignments |
Definition at line 211 of file CMathModel.cpp.
References mProcessQueue, and CProcessQueue::process().
Referenced by CModel::processQueue().
void CMathModel::processRoots | ( | const C_FLOAT64 & | time, |
const bool & | equality, | ||
const bool & | correct, | ||
const CVector< C_INT > & | roots | ||
) |
Check whether the roots which have value 1 lead to firing of events and schedule them if needed. This method is intended to be called from integration methods, which can distinguish between equality and inequality.
const | C_FLOAT64 & time |
const | bool & equality |
const | bool & correct |
const | CVector< C_INT > & roots |
Definition at line 218 of file CMathModel.cpp.
References CVectorCore< CType >::array(), C_INT, CMathTrigger::calculate(), CMathTrigger::CRootFinder::calculateTrueValue(), CMathEvent::fire(), CMathEvent::getMathTrigger(), mProcessQueue, mRootIndex2Event, mRootIndex2RootFinder, mRootRefreshes, and CVectorCore< CType >::size().
Referenced by applyInitialValues(), CProcessQueue::process(), and CModel::processRoots().
Check whether the roots which have value 1 lead to firing of events and schedule them if needed. This method is intended to be called during discrete event processing e.g. while processing the event queue.
const | C_FLOAT64 & time |
const | bool & equality |
const | bool & correct |
const | CVector< C_INT > & roots |
Definition at line 296 of file CMathModel.cpp.
References CVectorCore< CType >::array(), C_INT, CMathTrigger::calculate(), CMathEvent::fire(), CMathEvent::getMathTrigger(), mProcessQueue, mRootIndex2Event, mRootIndex2RootFinder, mRootRefreshes, and CVectorCore< CType >::size().
|
private |
List of events
Definition at line 187 of file CMathModel.h.
Referenced by applyInitialValues(), and compile().
|
private |
The model
Definition at line 177 of file CMathModel.h.
Referenced by applyInitialValues(), buildDependendRefreshList(), calculateRootDerivatives(), calculateRootJacobian(), CMathModel(), compile(), and getInitialTime().
|
private |
The event process queue
Definition at line 182 of file CMathModel.h.
Referenced by applyInitialValues(), getProcessQueue(), getProcessQueueExecutionTime(), processQueue(), and processRoots().
|
private |
A vector indicating whether a root may only change during discrete events.
Definition at line 198 of file CMathModel.h.
Referenced by compile(), and evaluateRoots().
|
private |
A map from the index of a root value to the associated event
Definition at line 209 of file CMathModel.h.
Referenced by compile(), and processRoots().
|
private |
A map from the index of a root value to the associated root finder
Definition at line 214 of file CMathModel.h.
Referenced by compile(), determineInitialRoots(), getRootFinders(), and processRoots().
|
private |
The sequence of refresh calls needed to calculate the current root values.
Definition at line 204 of file CMathModel.h.
Referenced by applyInitialValues(), compile(), evaluateRoots(), and processRoots().
A vector of pointers to the current root finder values
Definition at line 192 of file CMathModel.h.
Referenced by calculateRootDerivatives(), calculateRootJacobian(), compile(), determineInitialRoots(), evaluateRoots(), and getNumRoots().