COPASI API
4.16.103
|
#include <CHybridMethodODE45.h>
Classes | |
struct | Data |
Public Member Functions | |
CHybridMethodODE45 (const CHybridMethodODE45 &src, const CCopasiContainer *pParent=NULL) | |
virtual bool | elevateChildren () |
virtual bool | isValidProblem (const CCopasiProblem *pProblem) |
virtual void | start (const CState *initialState) |
virtual Status | step (const double &deltaT) |
~CHybridMethodODE45 () | |
![]() | |
CTrajectoryMethod (const CTrajectoryMethod &src, const CCopasiContainer *pParent=NULL) | |
const CVector< C_INT > & | getRoots () const |
void | setCurrentState (CState *currentState) |
void | setProblem (CTrajectoryProblem *problem) |
virtual void | stateChanged () |
~CTrajectoryMethod () | |
![]() | |
CCopasiMethod (const CCopasiMethod &src, const CCopasiContainer *pParent=NULL) | |
const CCopasiMethod::SubType & | getSubType () const |
const CCopasiTask::Type & | getType () 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 () |
![]() | |
bool | addGroup (const std::string &name) |
bool | addParameter (const CCopasiParameter ¶meter) |
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) |
CCopasiParameterGroup * | assertGroup (const std::string &name) |
template<class CType > | |
CCopasiParameter * | assertParameter (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 () |
index_iterator | endIndex () const |
name_iterator | endName () const |
CCopasiParameterGroup * | getGroup (const std::string &name) |
const CCopasiParameterGroup * | getGroup (const std::string &name) const |
CCopasiParameterGroup * | getGroup (const size_t &index) |
const CCopasiParameterGroup * | getGroup (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 CObjectInterface * | getObject (const CCopasiObjectName &cn) const |
CCopasiParameter * | getParameter (const std::string &name) |
const CCopasiParameter * | getParameter (const std::string &name) const |
CCopasiParameter * | getParameter (const size_t &index) |
const CCopasiParameter * | getParameter (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::Value & | getValue (const std::string &name) const |
const CCopasiParameter::Value & | getValue (const size_t &index) const |
CCopasiParameter::Value & | getValue (const std::string &name) |
CCopasiParameter::Value & | getValue (const size_t &index) |
CCopasiParameterGroup & | operator= (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 () |
![]() | |
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::Type & | getType () const |
const Value & | getValue () const |
Value & | getValue () |
virtual void * | getValuePointer () const |
CCopasiObject * | getValueReference () 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 |
CCopasiParameter & | operator= (const CCopasiParameter &rhs) |
template<class CType > | |
bool | setValue (const CType &value) |
bool | setValue (const std::vector< CCopasiParameter * > &value) |
virtual | ~CCopasiParameter () |
![]() | |
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 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 const DataObjectSet & | getDirectDependencies (const DataObjectSet &context=DataObjectSet()) const |
CCopasiContainer * | getObjectAncestor (const std::string &type) const |
CCopasiDataModel * | getObjectDataModel () |
const CCopasiDataModel * | getObjectDataModel () 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 |
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 () |
![]() | |
CObjectInterface () | |
virtual | ~CObjectInterface () |
Protected Member Functions | |
void | calculateAmu (size_t rIndex) |
C_INT32 | checkModel (CModel *model) |
CHybridMethodODE45 (const CCopasiContainer *pParent=NULL) | |
void | cleanup () |
void | doInverseInterpolation () |
C_FLOAT64 | doSingleStep (C_FLOAT64 currentTime, C_FLOAT64 endTime) |
void | evalF (const C_FLOAT64 *t, const C_FLOAT64 *y, C_FLOAT64 *ydot) |
void | fireReaction (size_t rIndex) |
void | fireSlowReaction4Hybrid () |
C_FLOAT64 | generateReactionTime (size_t rIndex) |
C_FLOAT64 | getDefaultAtol (const CModel *pModel) const |
size_t | getReactionIndex4Hybrid () |
void | getStochTimeAndIndex (C_FLOAT64 &ds, size_t &rIndex) |
void | initMethod (C_FLOAT64 time) |
void | integrateDeterministicPart (C_FLOAT64 ds) |
void | outputData () |
void | outputDebug (std::ostream &os, size_t level) |
void | outputState (const CState *pS) |
void | setupBalances () |
void | setupCalculateSet () |
void | setupDependencyGraph () |
void | setupMetab2React () |
void | setupMetabFlags () |
void | setupMethod () |
void | setupPriorityQueue (C_FLOAT64 startTime=0.0) |
void | setupReactAffect () |
void | setupReactionFlags () |
void | updatePriorityQueue (size_t rIndex, C_FLOAT64 time) |
void | updateTauMu (size_t rIndex, C_FLOAT64 time) |
![]() | |
CTrajectoryMethod (const CCopasiMethod::SubType &subType, const CCopasiContainer *pParent=NULL) | |
![]() | |
CCopasiMethod (const CCopasiTask::Type &taskType, const SubType &subType, const CCopasiContainer *pParent=NULL) | |
![]() | |
CCopasiParameterGroup () | |
![]() | |
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) | |
Static Protected Member Functions | |
static void | EvalF (const C_INT *n, const C_FLOAT64 *t, const C_FLOAT64 *y, C_FLOAT64 *ydot) |
static bool | modelHasAssignments (const CModel *pModel) |
Private Member Functions | |
C_INT | fehl_ (pEvalF f, const C_INT *neqn, double *y, double *t, double *h__, double *yp, double *f1, double *f2, double *f3, double *f4, double *f5, double *s, double *yrcd) |
std::set< std::string > * | getAffects (size_t rIndex) |
std::set< std::string > * | getDependsOn (size_t rIndex) |
void | initializeParameter () |
C_INT | rkf45_ (pEvalF f, const C_INT *neqn, double *y, double *t, double *tout, double *relerr, double *abserr, C_INT *iflag, double *work, C_INT *iwork, double *yrcd) |
C_INT | rkfs_ (pEvalF f, const C_INT *neqn, double *y, double *t, double *tout, double *relerr, double *abserr, C_INT *iflag, double *yp, double *h__, double *f1, double *f2, double *f3, double *f4, double *f5, double *savre, double *savae, C_INT *nfe, C_INT *kop, C_INT *init, C_INT *jflag, C_INT *kflag, double *yrcd) |
Friends | |
CTrajectoryMethod * | CTrajectoryMethod::createMethod (CCopasiMethod::SubType subType) |
Definition at line 133 of file CHybridMethodODE45.h.
|
protected |
Default Constructor
This class implements an hybrid algorithm for the simulation of a biochemical system over time.
File name: CHybridMethodODE45.cpp Author: Shuo Wang Email: shuow ang. learn er@g mail. com
Last change: 26, Aug 2013 Default constructor.
Definition at line 61 of file CHybridMethodODE45.cpp.
References CRandom::createGenerator(), CHybridMethodODE45::Data::dim, initializeParameter(), mData, mpRandomGenerator, CRandom::mt19937, and CHybridMethodODE45::Data::pMethod.
CHybridMethodODE45::CHybridMethodODE45 | ( | const CHybridMethodODE45 & | src, |
const CCopasiContainer * | pParent = NULL |
||
) |
Copy constructor
const | CHybridMethodODE45 & src |
const | CCopasiContainer * pParent (default: NULL) |
Copy Constructor
Definition at line 74 of file CHybridMethodODE45.cpp.
References CRandom::createGenerator(), CHybridMethodODE45::Data::dim, initializeParameter(), mData, mpRandomGenerator, CRandom::mt19937, and CHybridMethodODE45::Data::pMethod.
CHybridMethodODE45::~CHybridMethodODE45 | ( | ) |
Destructor.
Definition at line 88 of file CHybridMethodODE45.cpp.
References cleanup(), and DESTRUCTOR_TRACE.
|
protected |
Calculates an amu value for a given reaction.
rIndex | A size_t specifying the reaction to be updated |
Definition at line 1154 of file CHybridMethodODE45.cpp.
References C_FLOAT64, C_INT32, mAmu, mDoCorrection, and mLocalSubstrates.
Referenced by evalF(), fireSlowReaction4Hybrid(), initMethod(), setupPriorityQueue(), and updatePriorityQueue().
Test the model if it is proper to perform stochastic simulations on. Several properties are tested (e.g. integer stoichometry, all reactions take place in one compartment only, irreversibility...).
Definition at line 2440 of file CHybridMethodODE45.cpp.
References C_FLOAT64, C_INT32, CModel::getReactions(), CModel::getStoi(), INT_EPSILON, mpReactions, mStoi, CMatrix< CType >::numRows(), and CCopasiVector< T >::size().
|
protected |
Cleans up memory, etc.
Definition at line 380 of file CHybridMethodODE45.cpp.
References mOldY, mpInterpolation, mpModel, mpRandomGenerator, mpState, and mY.
Referenced by ~CHybridMethodODE45().
|
protected |
Do inverse interpolation to find the state when a slow reaction is fired.
Definition at line 977 of file CHybridMethodODE45.cpp.
References CVectorCore< CType >::array(), CState::beginIndependent(), C_FLOAT64, CHybridMethodODE45::Data::dim, CStateRecord::getArray(), CInterpolation::getInterpolationState(), CStateRecord::getTime(), INTERP_RECORD_NUM, mData, mOldTime, mOldY, mpEventState, mpInterpolation, mpModel, mpState, mStateRecord, mTime, mUseStateRecord, mY, CInterpolation::recordReset(), CInterpolation::recordState(), CModel::setState(), CState::setTime(), and CModel::updateSimulatedValues().
Referenced by doSingleStep().
Simulates the system over the next interval of time. The current time and the end time of the current step() are given as arguments.
currentTime | A C_FLOAT64 specifying the current time |
endTime | A C_FLOAT64 specifying the end time of the step() |
Simulates the system over the next interval of time. The new time after this step is returned.
currentTime | A C_FLOAT64 specifying the current time |
endTime | A C_FLOAT64 specifying the endTime of the current step() |
Definition at line 753 of file CHybridMethodODE45.cpp.
References C_FLOAT64, CONTINUE, DETERMINISTIC, doInverseInterpolation(), fireReaction(), fireSlowReaction4Hybrid(), CModel::getState(), getStochTimeAndIndex(), CState::getTime(), HAS_EVENT, HYBRID, integrateDeterministicPart(), mMethod, mODE45Status, mpModel, mpState, NEW_STEP, CModel::setState(), CState::setTime(), STOCHASTIC, and updatePriorityQueue().
Referenced by step().
|
virtual |
This methods must be called to elevate subgroups to derived objects. The default implementation does nothing.
Reimplemented from CCopasiParameterGroup.
Definition at line 96 of file CHybridMethodODE45.cpp.
References initializeParameter().
|
staticprotected |
Dummy Function for calculating derivative of ODE systems
Dummy f function for calculating derivative of y
Definition at line 1020 of file CHybridMethodODE45.cpp.
References evalF(), and CHybridMethodODE45::Data::pMethod.
Referenced by integrateDeterministicPart().
|
protected |
This evaluates the derivatives for the complete model
Derivative Calculation Function
Definition at line 1026 of file CHybridMethodODE45.cpp.
References CState::beginIndependent(), C_FLOAT64, calculateAmu(), CHybridMethodODE45::Data::dim, mAmu, mCalculateSet, mData, mLocalBalances, mNumReactions, mpModel, mpState, mReactionFlags, CModel::setState(), CState::setTime(), SLOW, and CModel::updateSimulatedValues().
Referenced by EvalF().
|
private |
|
protected |
Executes the specified reaction in the system once.
rIndex | A size_t specifying the index of the reaction, which will be fired. |
Definition at line 1410 of file CHybridMethodODE45.cpp.
References C_FLOAT64, CModelEntity::getValue(), mLocalBalances, CMetab::refreshConcentration(), and CModelEntity::setValue().
Referenced by doSingleStep(), and fireSlowReaction4Hybrid().
|
protected |
Fire slow reaction and update populations and propensities when Hybrid Method is used
Definition at line 807 of file CHybridMethodODE45.cpp.
References calculateAmu(), fireReaction(), getReactionIndex4Hybrid(), CModel::getState(), mCalculateSet, mpModel, mpState, and mReactAffect.
Referenced by doSingleStep().
|
protected |
Generates a putative reaction time for the given reaction.
rIndex | A size_t specifying the index of the reaction |
Definition at line 1107 of file CHybridMethodODE45.cpp.
References C_FLOAT64, CRandom::getRandomOO(), mAmu, and mpRandomGenerator.
Referenced by setupPriorityQueue(), updatePriorityQueue(), and updateTauMu().
|
private |
Gets the set of metabolites which change number when a given reaction is executed.
rIndex | The index of the reaction being executed. |
Definition at line 1266 of file CHybridMethodODE45.cpp.
References mLocalBalances.
Referenced by setupDependencyGraph().
Calculate the default absolute tolerance
const | CModel * pModel |
Definition at line 839 of file CHybridMethodODE45.cpp.
References C_FLOAT64, CModel::getCompartments(), CModel::getQuantity2NumberFactor(), CCopasiParameter::getValue(), max, and CCopasiVector< T >::size().
Referenced by initMethod().
|
private |
Gets the set of metabolites on which a given reaction depends.
rIndex | The index of the reaction being executed. |
Definition at line 1235 of file CHybridMethodODE45.cpp.
References mpReactions, and CFunctionParameter::PARAMETER.
Referenced by setupDependencyGraph().
|
protected |
Function return a reaction index which is a slow reaction firing at the event time.
Definition at line 1441 of file CHybridMethodODE45.cpp.
References C_FLOAT64, CRandom::getRandomOO(), mAmu, mNumReactions, mpRandomGenerator, mReactionFlags, and SLOW.
Referenced by fireSlowReaction4Hybrid().
Find the reaction index and the reaction time of the stochastic (!) reaction with the lowest reaction time.
ds | A reference to a C_FLOAT64. The putative reaction time for the first stochastic reaction is written into this variable. |
rIndex | A reference to a size_t. The index of the first stochastic reaction is written into this variable. |
Definition at line 1100 of file CHybridMethodODE45.cpp.
References mPQ, CIndexedPriorityQueue::topIndex(), and CIndexedPriorityQueue::topKey().
Referenced by doSingleStep().
|
private |
Intialize the method parameter
Definition at line 175 of file CHybridMethodODE45.cpp.
References CCopasiParameterGroup::addParameter(), CCopasiParameterGroup::assertParameter(), CCopasiParameter::BOOL, C_FLOAT64, C_INT32, CCopasiParameterGroup::getParameter(), CCopasiParameter::getValue(), MAX_STEPS, CCopasiParameter::Value::pBOOL, CCopasiParameter::Value::pUINT, RANDOM_SEED, CCopasiParameterGroup::removeParameter(), CCopasiParameterGroup::setValue(), CCopasiParameter::UDOUBLE, CCopasiParameter::UINT, and USE_RANDOM_SEED.
Referenced by CHybridMethodODE45(), and elevateChildren().
Initializes the solver.
time | the current time |
Initializes the solver and sets the model to be used.
model | A reference to an instance of a CModel |
Definition at line 295 of file CHybridMethodODE45.cpp.
References C_FLOAT64, C_INT, calculateAmu(), CHybridMethodODE45::Data::dim, getDefaultAtol(), CModel::getMetabolitesX(), CCopasiProblem::getModel(), CModel::getNumDependentReactionMetabs(), CModel::getNumIndependentReactionMetabs(), CModel::getReactions(), CModel::getStoi(), CCopasiParameter::getValue(), CRandom::initialize(), INTERP_RECORD_NUM, mAmu, mAmuOld, mAtol, mData, mDefaultAtol, mDWork, mIWork, mMaxSteps, mMaxStepsReached, mNumReactions, mNumVariableMetabs, mODE45Status, mOldY, mpInterpolation, mpMetabolites, mpModel, CTrajectoryMethod::mpProblem, mpRandomGenerator, mpReactions, mRandomSeed, mRtol, mStateRecord, mStoi, mUpdateSet, mUseRandomSeed, mY, mYdot, NEW_STEP, CCopasiParameter::Value::pBOOL, CCopasiParameter::Value::pUDOUBLE, CCopasiParameter::Value::pUINT, CVector< CType >::resize(), setupBalances(), setupCalculateSet(), setupDependencyGraph(), setupMetab2React(), setupMetabFlags(), setupMethod(), setupPriorityQueue(), setupReactAffect(), setupReactionFlags(), CCopasiParameterGroup::setValue(), CCopasiVector< T >::size(), and temp.
Referenced by start().
Integrates the deterministic reactions of the system over the specified time interval.
ds | A C_FLOAT64 specifying the stepsize. |
Definition at line 870 of file CHybridMethodODE45.cpp.
References CVectorCore< CType >::array(), CState::beginIndependent(), C_FLOAT64, CONTINUE, CHybridMethodODE45::Data::dim, EvalF(), CCopasiMessage::EXCEPTION, CRandom::getRandomOO(), CModel::getState(), CState::getTime(), HAS_ERR, HAS_EVENT, mAtol, max, MCTrajectoryMethod, mData, mDWork, mErrorMsg, mIFlag, mIWork, mODE45Status, mOldTime, mOldY, mpModel, mpRandomGenerator, mpState, mRtol, mStateRecord, mTime, mY, NEW_STEP, REACH_END_TIME, rkf45_(), CModel::setState(), CState::setTime(), CModel::setTime(), and CModel::updateSimulatedValues().
Referenced by doSingleStep().
|
virtual |
Check if the method is suitable for this problem
Reimplemented from CTrajectoryMethod.
Definition at line 103 of file CHybridMethodODE45.cpp.
References CCopasiMessage::ERROR, CCopasiMessage::EXCEPTION, CModel::getCompartments(), CTrajectoryProblem::getDuration(), CModel::getEvents(), CModel::getMetabolites(), CCopasiProblem::getModel(), CModel::getModelValues(), CModel::getNumMetabs(), CModel::getNumModelValues(), CTrajectoryMethod::isValidProblem(), MCTrajectoryMethod, CModelEntity::ODE, and CCopasiVector< T >::size().
|
staticprotected |
tests if the model contains a global value with an assignment rule that is used in calculations
Definition at line 2869 of file CHybridMethodODE45.cpp.
References CModelEntity::ASSIGNMENT, CModel::getCompartments(), CModel::getMetabolites(), CModel::getModelValues(), CModel::getNumMetabs(), CModel::getNumModelValues(), and CCopasiVector< T >::size().
Referenced by start().
|
protected |
Prints out data on standard output.
Prints out data on standard output. Deprecated.
Definition at line 2698 of file CHybridMethodODE45.cpp.
References mDoCorrection, mFirstMetabIndex, mHasDetermReaction, mHasStoiReaction, mLocalBalances, mLocalSubstrates, mMetab2React, mMetabFlags, mNumReactions, mNumVariableMetabs, mpMetabolites, mReactAffect, mReactionFlags, mReducedModel, and CCopasiVector< T >::size().
|
protected |
Prints out various data on standard output for debugging purposes.
Definition at line 2476 of file CHybridMethodODE45.cpp.
References CCopasiObject::getObjectName(), CState::getTime(), mAmu, mAmuOld, mDG, mLocalBalances, mMaxBalance, mMaxSteps, mMetab2React, mMetabFlags, mNumVariableMetabs, CTrajectoryMethod::mpCurrentState, mpMetabolites, mPQ, mpRandomGenerator, mpReactions, mReactionFlags, mStoi, mUpdateSet, CMatrix< CType >::numCols(), CMatrix< CType >::numRows(), CCopasiVector< T >::size(), SLOW, and temp.
Print State Data for Debug
Definition at line 2832 of file CHybridMethodODE45.cpp.
References CState::beginDependent(), CState::beginFixed(), CState::beginIndependent(), C_FLOAT64, CState::endDependent(), CState::endFixed(), CState::endIndependent(), CState::getNumDependent(), CState::getNumIndependent(), and CState::getTime().
|
private |
Definition at line 1475 of file CHybridMethodODE45.cpp.
References C_INT, and rkfs_().
Referenced by integrateDeterministicPart().
|
private |
Definition at line 1700 of file CHybridMethodODE45.cpp.
References abs, C_INT, fehl_(), max, min, and mUseStateRecord.
Referenced by rkf45_().
|
protected |
Sets up an internal representation of the balances for each reaction. This is done in order to be able to deal with fixed metabolites and to avoid a time consuming search for the indices of metabolites in the model.
Definition at line 484 of file CHybridMethodODE45.cpp.
References C_INT32, CModelEntity::FIXED, CCopasiVector< T >::getIndex(), CModel::getMetabolitesX(), CModelEntity::getStatus(), CHybridODE45Balance::mIndex, mLocalBalances, mLocalSubstrates, mMaxBalance, CHybridODE45Balance::mMultiplicity, mNumReactions, CHybridODE45Balance::mpMetabolite, mpModel, and CCopasiVector< T >::size().
Referenced by initMethod().
|
protected |
Definition at line 632 of file CHybridMethodODE45.cpp.
References FAST, mCalculateSet, mMetab2React, and mMetabFlags.
Referenced by initMethod().
|
protected |
Sets up the dependency graph
Sets up the dependency graph.
Definition at line 1286 of file CHybridMethodODE45.cpp.
References CDependencyGraph::addDependent(), CDependencyGraph::clear(), getAffects(), getDependsOn(), mDG, mNumReactions, mpReactions, and CCopasiVector< T >::size().
Referenced by initMethod().
|
protected |
Sets up an internal representation of the balances for each reaction. This is done in order to be able to deal with fixed metabolites and to avoid a time consuming search for the indices of metabolites in the model.
Creates for each metabolite a set of reaction indices. If the metabolite participates in a reaction as substrate or modifiers, this reaction is added to the corresponding set.
Definition at line 563 of file CHybridMethodODE45.cpp.
References CCopasiObject::dependsOn(), CModelEntity::FIXED, CCopasiVector< T >::getIndex(), CModel::getMetabolitesX(), CReaction::getParticleFluxReference(), CModelEntity::getStatus(), CModelEntity::getValueReference(), mMetab2React, mNumReactions, mNumVariableMetabs, mpModel, and CCopasiVector< T >::size().
Referenced by initMethod().
|
protected |
setup mMetabFlags
Definition at line 402 of file CHybridMethodODE45.cpp.
References FAST, mLocalBalances, mMetabFlags, mNumReactions, mNumVariableMetabs, mReactionFlags, and SLOW.
Referenced by initMethod().
|
protected |
setup mMethod
Definition at line 466 of file CHybridMethodODE45.cpp.
References DETERMINISTIC, HYBRID, mHasDetermReaction, mHasStoiReaction, mMethod, and STOCHASTIC.
Referenced by initMethod().
Sets up the priority queue.
startTime | The time at which the simulation starts. |
Sets up the priority queue, for pure SSA.
startTime | The time at which the simulation starts. |
Definition at line 540 of file CHybridMethodODE45.cpp.
References C_FLOAT64, calculateAmu(), CIndexedPriorityQueue::clear(), generateReactionTime(), CIndexedPriorityQueue::initializeIndexPointer(), CIndexedPriorityQueue::insertStochReaction(), mNumReactions, and mPQ.
Referenced by initMethod().
|
protected |
Definition at line 661 of file CHybridMethodODE45.cpp.
References mLocalBalances, mMetab2React, mNumReactions, and mReactAffect.
Referenced by initMethod().
|
protected |
setup mReactionFlags
Definition at line 443 of file CHybridMethodODE45.cpp.
References FAST, mHasDetermReaction, mHasStoiReaction, mNumReactions, mpReactions, mReactionFlags, CVector< CType >::resize(), and SLOW.
Referenced by initMethod().
This instructs the method to prepare for integration starting with the initialState given.
const CState * | initialState |
Reimplemented from CTrajectoryMethod.
Definition at line 259 of file CHybridMethodODE45.cpp.
References CModel::deterministic, CCopasiProblem::getModel(), CModel::getState(), CModel::getTime(), initMethod(), mDoCorrection, mFirstMetabIndex, mHasAssignments, modelHasAssignments(), mpModel, CTrajectoryMethod::mpProblem, mpState, and CModel::setState().
|
virtual |
This instructs the method to calculate a time step of deltaT starting with the current state, i.e., the result of the previous step. The new state (after deltaT) is expected in the current state. The return value is the actual timestep taken.
const double & | deltaT |
Reimplemented from CTrajectoryMethod.
Definition at line 698 of file CHybridMethodODE45.cpp.
References C_FLOAT64, doSingleStep(), CModel::getTime(), mMaxSteps, mMaxStepsReached, CTrajectoryMethod::mpCurrentState, mpModel, mpState, CTrajectoryMethod::NORMAL, and CCopasiMessage::WARNING.
Updates the priority queue.
rIndex | A size_t giving the index of the fired reaction |
time | A C_FLOAT64 holding the time taken by this reaction |
Updates the priority queue.
rIndex | A size_t giving the index of the fired reaction (-1, if no stochastic reaction has fired) |
time | A C_FLOAT64 holding the current time |
Definition at line 1353 of file CHybridMethodODE45.cpp.
References C_FLOAT64, C_INVALID_INDEX, calculateAmu(), generateReactionTime(), mAmu, mAmuOld, mHasAssignments, mNumReactions, mpModel, mPQ, mReactAffect, CIndexedPriorityQueue::updateNode(), CModel::updateSimulatedValues(), and updateTauMu().
Referenced by doSingleStep().
Updates the putative reaction time of a stochastic reaction in the priority queue. The corresponding amu and amu_old must be set prior to the call of this method.
rIndex | A size_t specifying the index of the reaction |
time | A C_FLOAT64 specifying the current time |
Updates the putative reaction time of a stochastic reaction in the priority queue. The corresponding amu and amu_old must be set prior to the call of this method.
rIndex | A size_t specifying the index of the reaction |
Definition at line 1122 of file CHybridMethodODE45.cpp.
References C_FLOAT64, generateReactionTime(), CIndexedPriorityQueue::getKey(), mAmu, mAmuOld, mPQ, and CIndexedPriorityQueue::updateNode().
Referenced by updatePriorityQueue().
|
friend |
The propensities of the stochastic reactions.
Definition at line 653 of file CHybridMethodODE45.h.
Referenced by calculateAmu(), evalF(), generateReactionTime(), getReactionIndex4Hybrid(), initMethod(), outputDebug(), updatePriorityQueue(), and updateTauMu().
Definition at line 654 of file CHybridMethodODE45.h.
Referenced by initMethod(), outputDebug(), updatePriorityQueue(), and updateTauMu().
|
protected |
Absolute tolerance.
Definition at line 638 of file CHybridMethodODE45.h.
Referenced by initMethod(), and integrateDeterministicPart().
|
protected |
Set of the reactions, which must be updated. Reactions have at lease one fast metab as subtract with non-zero balance
Definition at line 661 of file CHybridMethodODE45.h.
Referenced by evalF(), fireSlowReaction4Hybrid(), and setupCalculateSet().
|
protected |
mData.dim is the dimension of the ODE system. mData.pMethod contains CLsodaMethod * this to be used in the static method EvalF
Definition at line 588 of file CHybridMethodODE45.h.
Referenced by CHybridMethodODE45(), doInverseInterpolation(), evalF(), initMethod(), and integrateDeterministicPart().
|
protected |
Definition at line 633 of file CHybridMethodODE45.h.
Referenced by initMethod().
|
protected |
The graph of reactions and their dependent reactions. When a reaction is executed, the propensities for each of its dependents must be updated.
Definition at line 713 of file CHybridMethodODE45.h.
Referenced by outputDebug(), and setupDependencyGraph().
|
protected |
indicates if the correction N^2 -> N*(N-1) should be performed
Definition at line 472 of file CHybridMethodODE45.h.
Referenced by calculateAmu(), outputData(), and start().
Definition at line 640 of file CHybridMethodODE45.h.
Referenced by initMethod(), and integrateDeterministicPart().
|
protected |
Requested end time.
Definition at line 608 of file CHybridMethodODE45.h.
|
protected |
Definition at line 751 of file CHybridMethodODE45.h.
Referenced by integrateDeterministicPart().
|
protected |
index of the first metab in CState
Definition at line 493 of file CHybridMethodODE45.h.
Referenced by outputData(), and start().
|
protected |
Indicates whether the model has global quantities with assignment rules. If it has, we will use a less efficient way to update the model state to handle this.
Definition at line 746 of file CHybridMethodODE45.h.
Referenced by start(), and updatePriorityQueue().
|
protected |
Definition at line 549 of file CHybridMethodODE45.h.
Referenced by outputData(), setupMethod(), and setupReactionFlags().
|
protected |
Bool value
Definition at line 544 of file CHybridMethodODE45.h.
Referenced by outputData(), setupMethod(), and setupReactionFlags().
|
protected |
ODE45 state, corresponding to iflag in rkf45, an ODE45 solver argument
Definition at line 614 of file CHybridMethodODE45.h.
Referenced by integrateDeterministicPart().
Definition at line 641 of file CHybridMethodODE45.h.
Referenced by initMethod(), and integrateDeterministicPart().
|
protected |
Internal representation of the balances of each reaction. The index of each metabolite in the reaction is provided.
Definition at line 522 of file CHybridMethodODE45.h.
Referenced by evalF(), fireReaction(), getAffects(), outputData(), outputDebug(), setupBalances(), setupMetabFlags(), and setupReactAffect().
|
protected |
Internal representation of the substrates of each reaction. The index of each substrate-metabolite is provided.
Definition at line 528 of file CHybridMethodODE45.h.
Referenced by calculateAmu(), outputData(), and setupBalances().
|
protected |
Is this useful in my method? maximal increase of a particle number in one step.
Definition at line 581 of file CHybridMethodODE45.h.
Referenced by outputDebug(), and setupBalances().
|
protected |
Max number of doSingleStep() per step()
Definition at line 575 of file CHybridMethodODE45.h.
Referenced by initMethod(), outputDebug(), and step().
|
protected |
Definition at line 576 of file CHybridMethodODE45.h.
Referenced by initMethod(), and step().
|
protected |
Vector of relations between metabolites with reactions.
Definition at line 533 of file CHybridMethodODE45.h.
Referenced by outputData(), outputDebug(), setupCalculateSet(), setupMetab2React(), and setupReactAffect().
|
protected |
Vector holding information on the status of metabolites. They can be FAST or SLOW.
Definition at line 499 of file CHybridMethodODE45.h.
Referenced by outputData(), outputDebug(), setupCalculateSet(), and setupMetabFlags().
|
protected |
An Integer showes the method now CHybridMethod used 0 == Stochastic 1 == Deterministic 2 == Hybrid
Definition at line 557 of file CHybridMethodODE45.h.
Referenced by doSingleStep(), and setupMethod().
|
protected |
Number of Reactions
Definition at line 505 of file CHybridMethodODE45.h.
Referenced by evalF(), getReactionIndex4Hybrid(), initMethod(), outputData(), setupBalances(), setupDependencyGraph(), setupMetab2React(), setupMetabFlags(), setupPriorityQueue(), setupReactAffect(), setupReactionFlags(), and updatePriorityQueue().
|
protected |
Dimension of the system. Total number of metabolites.
Definition at line 483 of file CHybridMethodODE45.h.
Referenced by initMethod(), outputData(), outputDebug(), setupMetab2React(), and setupMetabFlags().
|
protected |
state of ODE45, indicating what to do next in the step part -1, error emerge 0, finish all integration 1, finish one step integration 2, has event
Definition at line 623 of file CHybridMethodODE45.h.
Referenced by doSingleStep(), initMethod(), and integrateDeterministicPart().
|
protected |
Definition at line 674 of file CHybridMethodODE45.h.
Referenced by doInverseInterpolation(), and integrateDeterministicPart().
|
protected |
Record of y and time of the previous step
Definition at line 673 of file CHybridMethodODE45.h.
Referenced by cleanup(), doInverseInterpolation(), initMethod(), and integrateDeterministicPart().
|
protected |
Output counter.
Definition at line 738 of file CHybridMethodODE45.h.
|
protected |
File output stream to write data.
Definition at line 728 of file CHybridMethodODE45.h.
|
protected |
Output filename.
Definition at line 733 of file CHybridMethodODE45.h.
|
protected |
Pointer to the State at Event Happens
Definition at line 684 of file CHybridMethodODE45.h.
Referenced by doInverseInterpolation().
|
protected |
A Pointer to Object of CInterpolation
Definition at line 679 of file CHybridMethodODE45.h.
Referenced by cleanup(), doInverseInterpolation(), and initMethod().
|
protected |
A pointer to the metabolites of the model.
Definition at line 488 of file CHybridMethodODE45.h.
Referenced by initMethod(), outputData(), and outputDebug().
|
protected |
Pointer to the model
Definition at line 462 of file CHybridMethodODE45.h.
Referenced by cleanup(), doInverseInterpolation(), doSingleStep(), evalF(), fireSlowReaction4Hybrid(), initMethod(), integrateDeterministicPart(), setupBalances(), setupMetab2React(), start(), step(), and updatePriorityQueue().
|
protected |
The set of putative stochastic (!) reactions and associated times at which each reaction occurs. This is represented as a priority queue, sorted by the reaction time. This heap changes dynamically as stochastic reactions become deterministic (delete this reaction from the queue) or vice versa (insert a new reaction into the queue).
Definition at line 722 of file CHybridMethodODE45.h.
Referenced by getStochTimeAndIndex(), outputDebug(), setupPriorityQueue(), updatePriorityQueue(), and updateTauMu().
|
protected |
The random number generator.
Definition at line 695 of file CHybridMethodODE45.h.
Referenced by CHybridMethodODE45(), cleanup(), generateReactionTime(), getReactionIndex4Hybrid(), initMethod(), integrateDeterministicPart(), and outputDebug().
|
protected |
A pointer to the reactions of the model.
Definition at line 516 of file CHybridMethodODE45.h.
Referenced by checkModel(), getDependsOn(), initMethod(), outputDebug(), setupDependencyGraph(), and setupReactionFlags().
|
protected |
A pointer to the current state in complete model view.
Definition at line 563 of file CHybridMethodODE45.h.
Referenced by cleanup(), doInverseInterpolation(), doSingleStep(), evalF(), fireSlowReaction4Hybrid(), integrateDeterministicPart(), start(), and step().
|
protected |
The random seed to use.
Definition at line 706 of file CHybridMethodODE45.h.
Referenced by initMethod().
|
protected |
Vector of sets that the indeces of propencities which should be updated after one reaction has been fired
Definition at line 539 of file CHybridMethodODE45.h.
Referenced by fireSlowReaction4Hybrid(), outputData(), setupReactAffect(), and updatePriorityQueue().
|
protected |
Fast reactions are set FAST and slow ones are SLOW
Definition at line 511 of file CHybridMethodODE45.h.
Referenced by evalF(), getReactionIndex4Hybrid(), outputData(), outputDebug(), setupMetabFlags(), and setupReactionFlags().
|
protected |
Definition at line 477 of file CHybridMethodODE45.h.
Referenced by outputData().
|
protected |
Relative tolerance.
Definition at line 628 of file CHybridMethodODE45.h.
Referenced by initMethod(), and integrateDeterministicPart().
A vector to record middle state for interpolation
Definition at line 689 of file CHybridMethodODE45.h.
Referenced by doInverseInterpolation(), initMethod(), and integrateDeterministicPart().
The stoichometry matrix of the model.
Definition at line 467 of file CHybridMethodODE45.h.
Referenced by checkModel(), initMethod(), and outputDebug().
|
protected |
Current time.
Definition at line 603 of file CHybridMethodODE45.h.
Referenced by doInverseInterpolation(), and integrateDeterministicPart().
|
protected |
Set of the reactions, which must update after one slow reaction fires
Definition at line 667 of file CHybridMethodODE45.h.
Referenced by initMethod(), and outputDebug().
|
protected |
Specifies if the mRandomSeed should be used. otherwise a randomly chosen seed is used.
Definition at line 701 of file CHybridMethodODE45.h.
Referenced by initMethod().
|
protected |
A boolean variable to show whether mStateRecord is used or not. If t is too close to tout, rkfs45() won't go through into fehl() and uses Forward Euler method
Definition at line 648 of file CHybridMethodODE45.h.
Referenced by doInverseInterpolation(), and rkfs_().
|
protected |
Pointer to the array with left hand side values.
Definition at line 593 of file CHybridMethodODE45.h.
Referenced by cleanup(), doInverseInterpolation(), initMethod(), and integrateDeterministicPart().
Vector containig the derivatives after calling eval
Definition at line 598 of file CHybridMethodODE45.h.
Referenced by initMethod().
Vectors to hold the system state and intermediate results
Definition at line 568 of file CHybridMethodODE45.h.
Referenced by initMethod(), and outputDebug().