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

#include <CMathContainer.h>

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

Classes

struct  sDiscontinuous
 

Public Member Functions

void applyInitialValues ()
 
void applyUpdateSequence (const CObjectInterface::UpdateSequence &updateSequence)
 
 CMathContainer (CModel &model)
 
 CMathContainer (const CMathContainer &src)
 
CEvaluationNodecopyBranch (const CEvaluationNode *pSrc, const bool &replaceDiscontinuousNodes)
 
CEvaluationNodecopyBranch (const CEvaluationNode *pSrc, const CMath::Variables< CEvaluationNode * > &variables, const bool &replaceDiscontinuousNodes)
 
void fetchInitialState ()
 
void fetchState ()
 
virtual CCopasiObjectName getCN () const
 
const CVectorCore< C_FLOAT64 > & getInitialState () const
 
CVectorCore< C_FLOAT64 > & getInitialState ()
 
C_FLOAT64getInitialValuePointer (const C_FLOAT64 *pValue) const
 
CMathObjectgetMathObject (const CObjectInterface *pObject) const
 
CMathObjectgetMathObject (const C_FLOAT64 *pDataValue) const
 
CMathObjectgetMathObject (const CCopasiObjectName &cn) const
 
const CModelgetModel () const
 
virtual const CObjectInterfacegetObject (const CCopasiObjectName &cn) const
 
const CVectorCore< C_FLOAT64 > & getState () const
 
CVectorCore< C_FLOAT64 > & getState ()
 
const CVectorCore< C_FLOAT64 > & getStateReduced () const
 
CVectorCore< C_FLOAT64 > & getStateReduced ()
 
const CVectorCore< C_FLOAT64 > & getValues () const
 
CVectorCore< C_FLOAT64 > & getValues ()
 
void pushInitialState ()
 
void pushState ()
 
CEvaluationNodereplaceDiscontinuousNode (const CEvaluationNode *pSrc, const std::vector< CEvaluationNode * > &children)
 
void setInitialState (const CVectorCore< C_FLOAT64 > &initialState)
 
void setState (const CVectorCore< C_FLOAT64 > &state)
 
void setStateReduced (const CVectorCore< C_FLOAT64 > &stateReduced)
 
void setValues (const CVectorCore< C_FLOAT64 > &values)
 
void updateInitialValues (const CModelParameter::Framework &framework)
 
void updateSimulatedValues (const bool &useMoieties)
 
virtual ~CMathContainer ()
 
- Public Member Functions inherited from CCopasiContainer
virtual bool add (CCopasiObject *pObject, const bool &adopt=true)
 
 CCopasiContainer (const std::string &name, const CCopasiContainer *pParent=NULL, const std::string &type="CN", const unsigned C_INT32 &flag=CCopasiObject::Container)
 
 CCopasiContainer (const CCopasiContainer &src, const CCopasiContainer *pParent=NULL)
 
virtual std::string getChildObjectUnits (const CCopasiObject *pObject) const
 
virtual const objectMapgetObjects () const
 
virtual std::string getUnits () const
 
virtual const CCopasiObjectgetValueObject () const
 
virtual bool remove (CCopasiObject *pObject)
 
virtual ~CCopasiContainer ()
 
- Public Member Functions inherited from CCopasiObject
void addDirectDependency (const CCopasiObject *pObject)
 
 CCopasiObject (const CCopasiObject &src, const CCopasiContainer *pParent=NULL)
 
void clearDirectDependencies ()
 
void clearRefresh ()
 
bool dependsOn (DataObjectSet candidates, const DataObjectSet &context=DataObjectSet()) const
 
void getAllDependencies (DataObjectSet &dependencies, const DataObjectSet &context) const
 
virtual const DataObjectSetgetDirectDependencies (const DataObjectSet &context=DataObjectSet()) const
 
virtual const std::string & getKey () 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 ()
 

Private Member Functions

void allocate ()
 
 CMathContainer ()
 
bool compileDiscreteChanges ()
 
bool compileEvents ()
 
bool compileObjects ()
 
void createApplyInitialValuesSequence ()
 
void createDependencyGraphs ()
 
void createDiscontinuityDataEvent (const CEvaluationNode *pNode)
 
void createDiscontinuityEvents ()
 
void createDiscontinuityEvents (const CEvaluationTree *pTree)
 
std::string createDiscontinuityTriggerInfix (const CEvaluationNode *pNode)
 
CEvaluationNodecreateNodeFromObject (const CObjectInterface *pMathObject)
 
CEvaluationNodecreateNodeFromValue (const C_FLOAT64 *pDataValue)
 
void createSynchronizeInitialValuesSequence ()
 
void createUpdateSimulationValuesSequence ()
 
void init ()
 
void initializeDiscontinuousCreationPointer ()
 
void initializeEvents (CMath::sPointers &pointers)
 
void initializeMathObjects (const std::vector< const CModelEntity * > &entities, const CMath::SimulationType &simulationType, CMath::sPointers &pointers)
 
void initializeMathObjects (const std::vector< const CCopasiObject * > &parameters, CMath::sPointers &p)
 
void initializeMathObjects (const CCopasiVector< CReaction > &reactions, CMath::sPointers &p)
 
void initializeMathObjects (const CCopasiVector< CMoiety > &moieties, CMath::sPointers &p)
 
void initializeObjects (CMath::sPointers &pointers)
 
void initializePointers (CMath::sPointers &pointers)
 
void map (CCopasiObject *pDataObject, CMathObject *pMathObject)
 

Static Private Member Functions

static CMath::EntityType getEntityType (const CModelEntity *pEntity)
 
static bool hasDependencies (const CCopasiObject *pObject)
 

Private Attributes

CObjectInterface::UpdateSequence mApplyInitialValuesSequence
 
size_t mAssignmentCount
 
sDiscontinuous mCreateDiscontinuousPointer
 
std::map< CCopasiObject
*, CMathObject * > 
mDataObject2MathObject
 
std::map< C_FLOAT64
*, CMathObject * > 
mDataValue2MathObject
 
size_t mDependentCount
 
CVectorCore< C_FLOAT64mDependentMasses
 
CCopasiVector< CEventmDiscontinuityEvents
 
std::map< std::string,
CMathObject * > 
mDiscontinuityInfix2Object
 
CVectorCore< C_FLOAT64mDiscontinuous
 
CVectorCore< C_FLOAT64mEventAssignments
 
CVectorCore< C_FLOAT64mEventDelays
 
CVectorCore< C_FLOAT64mEventPriorities
 
CVectorCore< C_FLOAT64mEventRoots
 
CVectorCore< C_FLOAT64mEventRootStates
 
CVector< CMathEventNmEvents
 
size_t mEventTargetCount
 
CVectorCore< C_FLOAT64mEventTriggers
 
CVectorCore< C_FLOAT64mExtensiveRates
 
CVectorCore< C_FLOAT64mExtensiveValues
 
size_t mFixedCount
 
CVectorCore< C_FLOAT64mFluxes
 
size_t mIndependentCount
 
CMathDependencyGraph mInitialDependencies
 
CVectorCore< C_FLOAT64mInitialEventTriggers
 
CVectorCore< C_FLOAT64mInitialExtensiveRates
 
CVectorCore< C_FLOAT64mInitialExtensiveValues
 
CVectorCore< C_FLOAT64mInitialFluxes
 
CVectorCore< C_FLOAT64mInitialIntensiveRates
 
CVectorCore< C_FLOAT64mInitialIntensiveValues
 
CVectorCore< C_FLOAT64mInitialParticleFluxes
 
CVectorCore< C_FLOAT64mInitialState
 
CObjectInterface::ObjectSet mInitialStateValueExtensive
 
CObjectInterface::ObjectSet mInitialStateValueIntensive
 
CVectorCore< C_FLOAT64mInitialTotalMasses
 
CVectorCore< C_FLOAT64mIntensiveRates
 
CVectorCore< C_FLOAT64mIntensiveValues
 
CVector< CMathObjectmObjects
 
size_t mODECount
 
CVectorCore< C_FLOAT64mParticleFluxes
 
const CObjectInterfacempAvogadro
 
CModelmpModel
 
const CObjectInterfacempQuantity2NumberFactor
 
CVectorCore< C_FLOAT64mPropensities
 
CVector< CMathReactionmReactions
 
CObjectInterface::ObjectSet mReducedStateValues
 
CObjectInterface::ObjectSet mSimulationRequiredValues
 
CObjectInterface::UpdateSequence mSimulationValuesSequence
 
CObjectInterface::UpdateSequence mSimulationValuesSequenceReduced
 
CVectorCore< C_FLOAT64mState
 
CVectorCore< C_FLOAT64mStateReduced
 
CObjectInterface::ObjectSet mStateValues
 
CObjectInterface::UpdateSequence mSynchronizeInitialValuesSequenceExtensive
 
CObjectInterface::UpdateSequence mSynchronizeInitialValuesSequenceIntensive
 
CVectorCore< C_FLOAT64mTotalMasses
 
CMathDependencyGraph mTransientDependencies
 
std::map< std::string,
CMathEventN * > 
mTriggerInfix2Event
 
CVector< C_FLOAT64mValues
 

Additional Inherited Members

- 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 CCopasiObject
static std::vector< Refresh * > buildUpdateSequence (const DataObjectSet &objects, const DataObjectSet &uptoDateObjects, const DataObjectSet &context=DataObjectSet())
 
static void setRenameHandler (CRenameHandler *rh)
 
- 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 CCopasiContainer
objectMap mObjects
 
- Static Protected Attributes inherited from CCopasiObject
static CRenameHandlersmpRenameHandler = NULL
 

Detailed Description

Definition at line 28 of file CMathContainer.h.

Constructor & Destructor Documentation

CMathContainer::CMathContainer ( )
private

Default Constructor

Definition at line 17 of file CMathContainer.cpp.

17  :
18  CCopasiContainer("Math Container", NULL, "CMathContainer"),
19  mpModel(NULL),
20  mpAvogadro(NULL),
22  mValues(),
36  mFluxes(),
37  mTotalMasses(),
39  mEventDelays(),
42  mEventRoots(),
44  mPropensities(),
47  mFixedCount(0),
49  mODECount(0),
51  mDependentCount(0),
53  mInitialState(),
54  mState(),
55  mStateReduced(),
65  mStateValues(),
68  mObjects(),
69  mEvents(),
70  mReactions(),
74  mDiscontinuityEvents("Discontinuities", this),
77 {}
CVector< CMathObject > mObjects
CVectorCore< C_FLOAT64 > mEventAssignments
std::map< CCopasiObject *, CMathObject * > mDataObject2MathObject
CVectorCore< C_FLOAT64 > mParticleFluxes
CVector< C_FLOAT64 > mValues
CObjectInterface::ObjectSet mInitialStateValueExtensive
sDiscontinuous mCreateDiscontinuousPointer
const CObjectInterface * mpQuantity2NumberFactor
CObjectInterface::UpdateSequence mSimulationValuesSequence
CVectorCore< C_FLOAT64 > mExtensiveValues
std::map< C_FLOAT64 *, CMathObject * > mDataValue2MathObject
CVectorCore< C_FLOAT64 > mInitialIntensiveValues
CVectorCore< C_FLOAT64 > mTotalMasses
size_t mDependentCount
CObjectInterface::ObjectSet mInitialStateValueIntensive
CMathDependencyGraph mTransientDependencies
CVectorCore< C_FLOAT64 > mPropensities
std::map< std::string, CMathObject * > mDiscontinuityInfix2Object
CObjectInterface::ObjectSet mReducedStateValues
const CObjectInterface * mpAvogadro
CObjectInterface::UpdateSequence mSynchronizeInitialValuesSequenceIntensive
CVectorCore< C_FLOAT64 > mStateReduced
CObjectInterface::UpdateSequence mSimulationValuesSequenceReduced
std::map< std::string, CMathEventN * > mTriggerInfix2Event
CObjectInterface::UpdateSequence mSynchronizeInitialValuesSequenceExtensive
CObjectInterface::ObjectSet mStateValues
CObjectInterface::UpdateSequence mApplyInitialValuesSequence
CVectorCore< C_FLOAT64 > mEventTriggers
CVectorCore< C_FLOAT64 > mEventRoots
size_t mAssignmentCount
CVectorCore< C_FLOAT64 > mDiscontinuous
CVectorCore< C_FLOAT64 > mInitialEventTriggers
CVectorCore< C_FLOAT64 > mEventRootStates
size_t mIndependentCount
CVectorCore< C_FLOAT64 > mEventDelays
CVectorCore< C_FLOAT64 > mDependentMasses
CVectorCore< C_FLOAT64 > mState
CVectorCore< C_FLOAT64 > mInitialState
CObjectInterface::ObjectSet mSimulationRequiredValues
CVectorCore< C_FLOAT64 > mExtensiveRates
CCopasiVector< CEvent > mDiscontinuityEvents
CVectorCore< C_FLOAT64 > mInitialTotalMasses
size_t mEventTargetCount
CVectorCore< C_FLOAT64 > mIntensiveValues
CVectorCore< C_FLOAT64 > mIntensiveRates
CVectorCore< C_FLOAT64 > mInitialExtensiveValues
CVectorCore< C_FLOAT64 > mInitialFluxes
CVector< CMathReaction > mReactions
CVectorCore< C_FLOAT64 > mInitialIntensiveRates
CMathDependencyGraph mInitialDependencies
CVectorCore< C_FLOAT64 > mFluxes
CVectorCore< C_FLOAT64 > mInitialParticleFluxes
CVectorCore< C_FLOAT64 > mEventPriorities
CVectorCore< C_FLOAT64 > mInitialExtensiveRates
CVector< CMathEventN > mEvents
CMathContainer::CMathContainer ( CModel model)

Specific Constructor

Parameters
CModel& model

Definition at line 79 of file CMathContainer.cpp.

References CCopasiContainer::getObject(), init(), mpAvogadro, mpModel, mpQuantity2NumberFactor, and CCopasiObject::setObjectParent().

79  :
80  CCopasiContainer("Math Container", NULL, "CMathContainer"),
81  mpModel(&model),
82  mpAvogadro(NULL),
84  mValues(),
98  mFluxes(),
99  mTotalMasses(),
100  mEventTriggers(),
101  mEventDelays(),
104  mEventRoots(),
106  mPropensities(),
108  mDiscontinuous(),
109  mFixedCount(0),
111  mODECount(0),
113  mDependentCount(0),
114  mAssignmentCount(0),
115  mInitialState(),
116  mState(),
117  mStateReduced(),
127  mStateValues(),
130  mObjects(),
131  mEvents(),
132  mReactions(),
135  mDiscontinuityEvents("Discontinuities", this),
138 {
139  // We do not want the model to know about the math container therefore we
140  // do not use &model in the constructor of CCopasiContainer
142 
143  mpAvogadro = mpModel->getObject(CCopasiObjectName("Reference=Avogadro Constant"));
144  mpQuantity2NumberFactor = mpModel->getObject(CCopasiObjectName("Reference=Quantity Conversion Factor"));
145 
146  init();
147 }
CVector< CMathObject > mObjects
virtual bool setObjectParent(const CCopasiContainer *pParent)
CVectorCore< C_FLOAT64 > mEventAssignments
std::map< CCopasiObject *, CMathObject * > mDataObject2MathObject
CVectorCore< C_FLOAT64 > mParticleFluxes
CVector< C_FLOAT64 > mValues
CObjectInterface::ObjectSet mInitialStateValueExtensive
const CObjectInterface * mpQuantity2NumberFactor
CObjectInterface::UpdateSequence mSimulationValuesSequence
CVectorCore< C_FLOAT64 > mExtensiveValues
std::map< C_FLOAT64 *, CMathObject * > mDataValue2MathObject
CVectorCore< C_FLOAT64 > mInitialIntensiveValues
CVectorCore< C_FLOAT64 > mTotalMasses
size_t mDependentCount
CObjectInterface::ObjectSet mInitialStateValueIntensive
CMathDependencyGraph mTransientDependencies
CVectorCore< C_FLOAT64 > mPropensities
std::map< std::string, CMathObject * > mDiscontinuityInfix2Object
CObjectInterface::ObjectSet mReducedStateValues
const CObjectInterface * mpAvogadro
CObjectInterface::UpdateSequence mSynchronizeInitialValuesSequenceIntensive
CVectorCore< C_FLOAT64 > mStateReduced
CObjectInterface::UpdateSequence mSimulationValuesSequenceReduced
std::map< std::string, CMathEventN * > mTriggerInfix2Event
CObjectInterface::UpdateSequence mSynchronizeInitialValuesSequenceExtensive
CObjectInterface::ObjectSet mStateValues
CObjectInterface::UpdateSequence mApplyInitialValuesSequence
CVectorCore< C_FLOAT64 > mEventTriggers
CVectorCore< C_FLOAT64 > mEventRoots
size_t mAssignmentCount
CVectorCore< C_FLOAT64 > mDiscontinuous
CVectorCore< C_FLOAT64 > mInitialEventTriggers
CVectorCore< C_FLOAT64 > mEventRootStates
size_t mIndependentCount
CVectorCore< C_FLOAT64 > mEventDelays
CVectorCore< C_FLOAT64 > mDependentMasses
CVectorCore< C_FLOAT64 > mState
CVectorCore< C_FLOAT64 > mInitialState
CObjectInterface::ObjectSet mSimulationRequiredValues
CVectorCore< C_FLOAT64 > mExtensiveRates
CCopasiVector< CEvent > mDiscontinuityEvents
CVectorCore< C_FLOAT64 > mInitialTotalMasses
size_t mEventTargetCount
CVectorCore< C_FLOAT64 > mIntensiveValues
CVectorCore< C_FLOAT64 > mIntensiveRates
CVectorCore< C_FLOAT64 > mInitialExtensiveValues
CVectorCore< C_FLOAT64 > mInitialFluxes
CVector< CMathReaction > mReactions
virtual const CObjectInterface * getObject(const CCopasiObjectName &cn) const
CVectorCore< C_FLOAT64 > mInitialIntensiveRates
CMathDependencyGraph mInitialDependencies
CVectorCore< C_FLOAT64 > mFluxes
CVectorCore< C_FLOAT64 > mInitialParticleFluxes
CVectorCore< C_FLOAT64 > mEventPriorities
CVectorCore< C_FLOAT64 > mInitialExtensiveRates
CVector< CMathEventN > mEvents
CMathContainer::CMathContainer ( const CMathContainer src)

Copy constructor

Parameters
constCMathContainer & src

Definition at line 149 of file CMathContainer.cpp.

References CVectorCore< CType >::array(), C_FLOAT64, CMathObject::copy(), CMathReaction::copy(), CMathEventN::copy(), createDependencyGraphs(), mDataObject2MathObject, mDataValue2MathObject, mDependentMasses, mDiscontinuous, mEventAssignments, mEventDelays, mEventPriorities, mEventRoots, mEventRootStates, mEvents, mEventTriggers, mExtensiveRates, mExtensiveValues, mFluxes, mInitialEventTriggers, mInitialExtensiveRates, mInitialExtensiveValues, mInitialFluxes, mInitialIntensiveRates, mInitialIntensiveValues, mInitialParticleFluxes, mInitialState, mInitialTotalMasses, mIntensiveRates, mIntensiveValues, mObjects, mParticleFluxes, mpModel, mPropensities, mReactions, mState, mStateReduced, mTotalMasses, mValues, CCopasiObject::setObjectParent(), and CVectorCore< CType >::size().

149  :
150  CCopasiContainer(src, NULL),
151  mpModel(src.mpModel),
152  mpAvogadro(src.mpAvogadro),
154  mValues(src.mValues),
160  mInitialFluxes(),
165  mExtensiveRates(),
166  mIntensiveRates(),
167  mParticleFluxes(),
168  mFluxes(),
169  mTotalMasses(),
170  mEventTriggers(),
171  mEventDelays(),
174  mEventRoots(),
176  mPropensities(),
178  mDiscontinuous(),
181  mODECount(src.mODECount),
185  mInitialState(),
186  mState(),
187  mStateReduced(),
197  mStateValues(),
200  mObjects(src.mObjects.size()),
201  mEvents(src.mEvents.size()),
202  mReactions(src.mReactions.size()),
205  mDiscontinuityEvents("Discontinuities", this),
208 {
209  // We do not want the model to know about the math container therefore we
210  // do not use &model in the constructor of CCopasiContainer
212 
213  // Determine the offsets
214  // We have to cast all pointers to size_t to avoid pointer overflow.
215  size_t ValueOffset = ((size_t) mValues.array()) - ((size_t) src.mValues.array());
216  size_t ObjectOffset = ((size_t) mObjects.array()) - ((size_t) src.mObjects.array());
217 
219  (C_FLOAT64 *)((size_t) src.mInitialExtensiveValues.array() + ValueOffset));
221  (C_FLOAT64 *)((size_t) src.mInitialIntensiveValues.array() + ValueOffset));
223  (C_FLOAT64 *)((size_t) src.mInitialExtensiveRates.array() + ValueOffset));
225  (C_FLOAT64 *)((size_t) src.mInitialIntensiveRates.array() + ValueOffset));
227  (C_FLOAT64 *)((size_t) src.mInitialParticleFluxes.array() + ValueOffset));
229  (C_FLOAT64 *)((size_t) src.mInitialFluxes.array() + ValueOffset));
231  (C_FLOAT64 *)((size_t) src.mInitialTotalMasses.array() + ValueOffset));
233  (C_FLOAT64 *)((size_t) src.mInitialEventTriggers.array() + ValueOffset));
234 
236  (C_FLOAT64 *)((size_t) src.mExtensiveValues.array() + ValueOffset));
238  (C_FLOAT64 *)((size_t) src.mIntensiveValues.array() + ValueOffset));
240  (C_FLOAT64 *)((size_t) src.mExtensiveRates.array() + ValueOffset));
242  (C_FLOAT64 *)((size_t) src.mIntensiveRates.array() + ValueOffset));
244  (C_FLOAT64 *)((size_t) src.mParticleFluxes.array() + ValueOffset));
246  (C_FLOAT64 *)((size_t) src.mFluxes.array() + ValueOffset));
248  (C_FLOAT64 *)((size_t) src.mTotalMasses.array() + ValueOffset));
250  (C_FLOAT64 *)((size_t) src.mEventTriggers.array() + ValueOffset));
251 
253  (C_FLOAT64 *)((size_t) src.mEventDelays.array() + ValueOffset));
255  (C_FLOAT64 *)((size_t) src.mEventPriorities.array() + ValueOffset));
257  (C_FLOAT64 *)((size_t) src.mEventAssignments.array() + ValueOffset));
259  (C_FLOAT64 *)((size_t) src.mEventRoots.array() + ValueOffset));
261  (C_FLOAT64 *)((size_t) src.mEventRootStates.array() + ValueOffset));
263  (C_FLOAT64 *)((size_t) src.mPropensities.array() + ValueOffset));
265  (C_FLOAT64 *)((size_t) src.mDependentMasses.array() + ValueOffset));
267  (C_FLOAT64 *)((size_t) src.mDiscontinuous.array() + ValueOffset));
268 
270  (C_FLOAT64 *)((size_t) src.mInitialState.array() + ValueOffset));
272  (C_FLOAT64 *)((size_t) src.mState.array() + ValueOffset));
274  (C_FLOAT64 *)((size_t) src.mStateReduced.array() + ValueOffset));
275 
276  // Update the mappings
277  std::map< CCopasiObject *, CMathObject * >::const_iterator itData = src.mDataObject2MathObject.begin();
278  std::map< CCopasiObject *, CMathObject * >::const_iterator endData = src.mDataObject2MathObject.end();
279 
280  for (; itData != endData; ++itData)
281  {
282  mDataObject2MathObject[itData->first] = (CMathObject *)(((size_t) itData->second) + ObjectOffset);
283  }
284 
285  std::map< C_FLOAT64 *, CMathObject * >::const_iterator itValue = src.mDataValue2MathObject.begin();
286  std::map< C_FLOAT64 *, CMathObject * >::const_iterator endValue = src.mDataValue2MathObject.end();
287 
288  for (; itValue != endValue; ++itValue)
289  {
290  mDataValue2MathObject[itValue->first] = (CMathObject *)(((size_t) itValue->second) + ObjectOffset);
291  }
292 
293  // Copy the objects
294  CMathObject * pObject = mObjects.array();
295  CMathObject * pObjectEnd = pObject + mObjects.size();
296  const CMathObject * pObjectSrc = src.mObjects.array();
297 
298  for (; pObject != pObjectEnd; ++pObject, ++pObjectSrc)
299  {
300  pObject->copy(*pObjectSrc, *this, ValueOffset, ObjectOffset);
301  }
302 
303  CMathEventN * pEvent = mEvents.array();
304  CMathEventN * pEventEnd = pEvent + mEvents.size();
305  const CMathEventN * pEventSrc = src.mEvents.array();
306 
307  for (; pEvent != pEventEnd; ++pEvent, ++pEventSrc)
308  {
309  pEvent->copy(*pEventSrc, *this, ValueOffset, ObjectOffset);
310  }
311 
312  CMathReaction * pReaction = mReactions.array();
313  CMathReaction * pReactionEnd = pReaction + mReactions.size();
314  const CMathReaction * pReactionSrc = src.mReactions.array();
315 
316  for (; pReaction != pReactionEnd; ++pReaction, ++pReactionSrc)
317  {
318  pReaction->copy(*pReactionSrc, *this, ValueOffset, ObjectOffset);
319  }
320 
322 }
CVector< CMathObject > mObjects
virtual bool setObjectParent(const CCopasiContainer *pParent)
CVectorCore< C_FLOAT64 > mEventAssignments
std::map< CCopasiObject *, CMathObject * > mDataObject2MathObject
CVectorCore< C_FLOAT64 > mParticleFluxes
CVector< C_FLOAT64 > mValues
CObjectInterface::ObjectSet mInitialStateValueExtensive
void copy(const CMathEventN &src, CMathContainer &container, const size_t &valueOffset, const size_t &objectOffset)
Definition: CMathEvent.cpp:894
void copy(const CMathObject &src, CMathContainer &container, const size_t &valueOffset, const size_t &objectOffset)
Definition: CMathObject.cpp:64
const CObjectInterface * mpQuantity2NumberFactor
CObjectInterface::UpdateSequence mSimulationValuesSequence
CVectorCore< C_FLOAT64 > mExtensiveValues
std::map< C_FLOAT64 *, CMathObject * > mDataValue2MathObject
CVectorCore< C_FLOAT64 > mInitialIntensiveValues
CVectorCore< C_FLOAT64 > mTotalMasses
size_t mDependentCount
CObjectInterface::ObjectSet mInitialStateValueIntensive
CMathDependencyGraph mTransientDependencies
CVectorCore< C_FLOAT64 > mPropensities
std::map< std::string, CMathObject * > mDiscontinuityInfix2Object
CObjectInterface::ObjectSet mReducedStateValues
const CObjectInterface * mpAvogadro
CObjectInterface::UpdateSequence mSynchronizeInitialValuesSequenceIntensive
CVectorCore< C_FLOAT64 > mStateReduced
CObjectInterface::UpdateSequence mSimulationValuesSequenceReduced
std::map< std::string, CMathEventN * > mTriggerInfix2Event
CObjectInterface::UpdateSequence mSynchronizeInitialValuesSequenceExtensive
CObjectInterface::ObjectSet mStateValues
CObjectInterface::UpdateSequence mApplyInitialValuesSequence
CVectorCore< C_FLOAT64 > mEventTriggers
CVectorCore< C_FLOAT64 > mEventRoots
void copy(const CMathReaction &src, CMathContainer &container, const size_t &valueOffset, const size_t &objectOffset)
size_t mAssignmentCount
CVectorCore< C_FLOAT64 > mDiscontinuous
CVectorCore< C_FLOAT64 > mInitialEventTriggers
CVectorCore< C_FLOAT64 > mEventRootStates
size_t mIndependentCount
CVectorCore< C_FLOAT64 > mEventDelays
size_t size() const
Definition: CVector.h:100
CVectorCore< C_FLOAT64 > mDependentMasses
CVectorCore< C_FLOAT64 > mState
CVectorCore< C_FLOAT64 > mInitialState
CObjectInterface::ObjectSet mSimulationRequiredValues
#define C_FLOAT64
Definition: copasi.h:92
CVectorCore< C_FLOAT64 > mExtensiveRates
CType * array()
Definition: CVector.h:139
CCopasiVector< CEvent > mDiscontinuityEvents
CVectorCore< C_FLOAT64 > mInitialTotalMasses
void createDependencyGraphs()
size_t mEventTargetCount
CVectorCore< C_FLOAT64 > mIntensiveValues
CVectorCore< C_FLOAT64 > mIntensiveRates
CVectorCore< C_FLOAT64 > mInitialExtensiveValues
CVectorCore< C_FLOAT64 > mInitialFluxes
CVector< CMathReaction > mReactions
CVectorCore< C_FLOAT64 > mInitialIntensiveRates
CMathDependencyGraph mInitialDependencies
CVectorCore< C_FLOAT64 > mFluxes
CVectorCore< C_FLOAT64 > mInitialParticleFluxes
CVectorCore< C_FLOAT64 > mEventPriorities
CVectorCore< C_FLOAT64 > mInitialExtensiveRates
CVector< CMathEventN > mEvents
CMathContainer::~CMathContainer ( )
virtual

Destructor

Definition at line 324 of file CMathContainer.cpp.

325 {}

Member Function Documentation

void CMathContainer::allocate ( )
private

Allocate the memory for objects and values

Definition at line 850 of file CMathContainer.cpp.

References CObjectLists::ALL_LOCAL_PARAMETER_VALUES, CMathEventN::allocate(), CVectorCore< CType >::array(), CCopasiVector< T >::begin(), C_FLOAT64, createDiscontinuityEvents(), CCopasiVector< T >::end(), CMathEventN::getAssignments(), CModel::getEvents(), CObjectLists::getListOfConstObjects(), CModel::getMoieties(), CModel::getNumMetabs(), CModel::getReactions(), CMathEventN::CTrigger::getRoots(), CModel::getStateTemplate(), CMathEventN::getTrigger(), mDependentCount, mDependentMasses, mDiscontinuityEvents, mDiscontinuous, mEventAssignments, mEventDelays, mEventPriorities, mEventRoots, mEventRootStates, mEvents, mEventTargetCount, mEventTriggers, mExtensiveRates, mExtensiveValues, mFixedCount, mFluxes, mIndependentCount, mInitialEventTriggers, mInitialExtensiveRates, mInitialExtensiveValues, mInitialFluxes, mInitialIntensiveRates, mInitialIntensiveValues, mInitialParticleFluxes, mInitialState, mInitialTotalMasses, mIntensiveRates, mIntensiveValues, mObjects, mODECount, mParticleFluxes, mpModel, mPropensities, mState, mStateReduced, mTotalMasses, mValues, CVector< CType >::resize(), CVectorCore< CType >::size(), CStateTemplate::size(), and CCopasiVector< T >::size().

Referenced by init().

851 {
852  size_t nLocalReactionParameters =
854  size_t nExtensiveValues = mpModel->getStateTemplate().size() + nLocalReactionParameters;
855  size_t nIntensiveValues = mpModel->getNumMetabs();
856 
857  size_t nReactions = mpModel->getReactions().size();
858  size_t nMoieties = mpModel->getMoieties().size();
859 
860  size_t nDiscontinuities = 0;
861  size_t nEvents = 0;
862  size_t nEventAssignments = 0;
863  size_t nEventRoots = 0;
864 
865  // Determine the space requirements for events.
866  // We need to create events for nodes which are capable of introducing
867  // discontinuous changes.
869  nDiscontinuities += mDiscontinuityEvents.size();
870  nEvents += nDiscontinuities;
871 
872  // User defined events
873  const CCopasiVector< CEvent > & Events = mpModel->getEvents();
875  CCopasiVector< CEvent >::const_iterator endEvent = Events.end();
876 
877  nEvents += Events.size();
878  mEvents.resize(nEvents);
879 
880  CMathEventN * pEvent = mEvents.array();
881 
882  for (; itEvent != endEvent; ++itEvent, ++pEvent)
883  {
884  CMathEventN::allocate(pEvent, *itEvent, *this);
885 
886  nEventRoots += pEvent->getTrigger().getRoots().size();
887  nEventAssignments += pEvent->getAssignments().size();
888  }
889 
890  itEvent = mDiscontinuityEvents.begin();
891  endEvent = mDiscontinuityEvents.end();
892 
893  for (; itEvent != endEvent; ++itEvent, ++pEvent)
894  {
895  CMathEventN::allocate(pEvent, *itEvent, *this);
896  nEventRoots += pEvent->getTrigger().getRoots().size();
897 
898  // We do not have to allocate an assignment as discontinuity object suffices
899  // as target and assignment expression.
900  }
901 
902  mValues.resize(4 * (nExtensiveValues + nIntensiveValues) +
903  5 * nReactions +
904  3 * nMoieties +
905  nDiscontinuities +
906  4 * nEvents + nEventAssignments + 2 * nEventRoots);
907  mValues = std::numeric_limits< C_FLOAT64 >::quiet_NaN();
908 
909  C_FLOAT64 * pArray = mValues.array();
910 
911  mInitialExtensiveValues = CVectorCore< C_FLOAT64 >(nExtensiveValues, pArray);
912  pArray += nExtensiveValues;
913  mInitialIntensiveValues = CVectorCore< C_FLOAT64 >(nIntensiveValues, pArray);
914  pArray += nIntensiveValues;
915  mInitialExtensiveRates = CVectorCore< C_FLOAT64 >(nExtensiveValues, pArray);
916  pArray += nExtensiveValues;
917  mInitialIntensiveRates = CVectorCore< C_FLOAT64 >(nIntensiveValues, pArray);
918  pArray += nIntensiveValues;
919  mInitialParticleFluxes = CVectorCore< C_FLOAT64 >(nReactions, pArray);
920  pArray += nReactions;
921  mInitialFluxes = CVectorCore< C_FLOAT64 >(nReactions, pArray);
922  pArray += nReactions;
923  mInitialTotalMasses = CVectorCore< C_FLOAT64 >(nMoieties, pArray);
924  pArray += nMoieties;
926  pArray += nEvents;
927 
928  mExtensiveValues = CVectorCore< C_FLOAT64 >(nExtensiveValues, pArray);
929  pArray += nExtensiveValues;
930  mIntensiveValues = CVectorCore< C_FLOAT64 >(nIntensiveValues, pArray);
931  pArray += nIntensiveValues;
932  mExtensiveRates = CVectorCore< C_FLOAT64 >(nExtensiveValues, pArray);
933  pArray += nExtensiveValues;
934  mIntensiveRates = CVectorCore< C_FLOAT64 >(nIntensiveValues, pArray);
935  pArray += nIntensiveValues;
936  mParticleFluxes = CVectorCore< C_FLOAT64 >(nReactions, pArray);
937  pArray += nReactions;
938  mFluxes = CVectorCore< C_FLOAT64 >(nReactions, pArray);
939  pArray += nReactions;
940  mTotalMasses = CVectorCore< C_FLOAT64 >(nMoieties, pArray);
941  pArray += nMoieties;
942  mEventTriggers = CVectorCore< C_FLOAT64 >(nEvents, pArray);
943  pArray += nEvents;
944 
945  mEventDelays = CVectorCore< C_FLOAT64 >(nEvents, pArray);
946  pArray += nEvents;
947  mEventPriorities = CVectorCore< C_FLOAT64 >(nEvents, pArray);
948  pArray += nEvents;
949  mEventAssignments = CVectorCore< C_FLOAT64 >(nEventAssignments, pArray);
950  pArray += nEventAssignments;
951  mEventRoots = CVectorCore< C_FLOAT64 >(nEventRoots, pArray);
952  pArray += nEventRoots;
953  mEventRootStates = CVectorCore< C_FLOAT64 >(nEventRoots, pArray);
954  pArray += nEventRoots;
955  mPropensities = CVectorCore< C_FLOAT64 >(nReactions, pArray);
956  pArray += nReactions;
957  mDependentMasses = CVectorCore< C_FLOAT64 >(nMoieties, pArray);
958  pArray += nMoieties;
959  mDiscontinuous = CVectorCore< C_FLOAT64 >(nDiscontinuities, pArray);
960  pArray += nDiscontinuities;
961 
962  assert(pArray == mValues.array() + mValues.size());
963 
965 
967  mValues.array());
972 }
CVector< CMathObject > mObjects
CVectorCore< C_FLOAT64 > mEventAssignments
CVectorCore< C_FLOAT64 > mParticleFluxes
CVector< C_FLOAT64 > mValues
CCopasiVectorN< CEvent > & getEvents()
Definition: CModel.cpp:1110
static std::vector< const CCopasiObject * > getListOfConstObjects(ListType t, const CModel *model)
const CVector< CRoot > & getRoots() const
Definition: CMathEvent.cpp:287
virtual size_t size() const
size_t getNumMetabs() const
Definition: CModel.cpp:1118
iterator begin()
CVectorCore< C_FLOAT64 > mExtensiveValues
void resize(size_t size, const bool &copy=false)
Definition: CVector.h:301
CVectorCore< C_FLOAT64 > mInitialIntensiveValues
CVectorCore< C_FLOAT64 > mTotalMasses
size_t mDependentCount
const size_t & size() const
Definition: CState.cpp:242
const CCopasiVector< CMoiety > & getMoieties() const
Definition: CModel.cpp:1163
CVectorCore< C_FLOAT64 > mPropensities
CVectorCore< C_FLOAT64 > mStateReduced
iterator end()
CVectorCore< C_FLOAT64 > mEventTriggers
CVectorCore< C_FLOAT64 > mEventRoots
void createDiscontinuityEvents()
CVectorCore< C_FLOAT64 > mDiscontinuous
CVectorCore< C_FLOAT64 > mInitialEventTriggers
CVectorCore< C_FLOAT64 > mEventRootStates
size_t mIndependentCount
const CVector< CAssignment > & getAssignments() const
CVectorCore< C_FLOAT64 > mEventDelays
size_t size() const
Definition: CVector.h:100
CVectorCore< C_FLOAT64 > mDependentMasses
CVectorCore< C_FLOAT64 > mState
CVectorCore< C_FLOAT64 > mInitialState
#define C_FLOAT64
Definition: copasi.h:92
CVectorCore< C_FLOAT64 > mExtensiveRates
CType * array()
Definition: CVector.h:139
const CStateTemplate & getStateTemplate() const
Definition: CModel.cpp:1172
CCopasiVector< CEvent > mDiscontinuityEvents
CVectorCore< C_FLOAT64 > mInitialTotalMasses
size_t mEventTargetCount
CVectorCore< C_FLOAT64 > mIntensiveValues
CVectorCore< C_FLOAT64 > mIntensiveRates
CCopasiVectorNS< CReaction > & getReactions()
Definition: CModel.cpp:1039
static void allocate(CMathEventN *pEvent, const CEvent *pDataEvent, const CMathContainer &container)
Definition: CMathEvent.cpp:838
CVectorCore< C_FLOAT64 > mInitialExtensiveValues
CVectorCore< C_FLOAT64 > mInitialFluxes
const CTrigger & getTrigger() const
Definition: CMathEvent.cpp:863
CVectorCore< C_FLOAT64 > mInitialIntensiveRates
CVectorCore< C_FLOAT64 > mFluxes
CVectorCore< C_FLOAT64 > mInitialParticleFluxes
CVectorCore< C_FLOAT64 > mEventPriorities
CVectorCore< C_FLOAT64 > mInitialExtensiveRates
CVector< CMathEventN > mEvents
void CMathContainer::applyInitialValues ( )

Set the transient values to the initial values and calculate all dependent values. Please call updateInitialValues before calling this method to assure that all values are up to date.

Definition at line 409 of file CMathContainer.cpp.

References applyUpdateSequence(), CVectorCore< CType >::array(), C_FLOAT64, mApplyInitialValuesSequence, mExtensiveValues, and mInitialExtensiveValues.

410 {
411  C_FLOAT64 * pInitial = mInitialExtensiveValues.array();
412  C_FLOAT64 * pTransient = mExtensiveValues.array();
413 
414  memcpy(pTransient, pInitial, (pTransient - pInitial) * sizeof(C_FLOAT64));
415 
417 }
CVectorCore< C_FLOAT64 > mExtensiveValues
CObjectInterface::UpdateSequence mApplyInitialValuesSequence
void applyUpdateSequence(const CObjectInterface::UpdateSequence &updateSequence)
#define C_FLOAT64
Definition: copasi.h:92
CType * array()
Definition: CVector.h:139
CVectorCore< C_FLOAT64 > mInitialExtensiveValues
void CMathContainer::applyUpdateSequence ( const CObjectInterface::UpdateSequence updateSequence)

Apply the given update sequence to the mathematical objects in the container

Parameters
constCObjectInterface::UpdateSequence & updateSequence

Definition at line 431 of file CMathContainer.cpp.

References CMathObject::calculate().

Referenced by applyInitialValues(), updateInitialValues(), and updateSimulatedValues().

432 {
433  UpdateSequence::const_iterator it = updateSequence.begin();
434  UpdateSequence::const_iterator end = updateSequence.end();
435 
436  for (; it != end; ++it)
437  {
438  static_cast< CMathObject * >(*it)->calculate();
439  }
440 }
void calculate()
bool CMathContainer::compileDiscreteChanges ( )
private

Convert nodes which generate discrete changes into events and compiles them.

bool CMathContainer::compileEvents ( )
private

Compile the events

Definition at line 1144 of file CMathContainer.cpp.

References CVectorCore< CType >::array(), CCopasiVector< T >::begin(), CMathEventN::compile(), CCopasiVector< T >::end(), CModel::getEvents(), mEvents, and mpModel.

Referenced by init().

1145 {
1146  bool success = true;
1147 
1148  CMathEventN * pItEvent = mEvents.array();
1151 
1152  for (; itEvent != endEvent; ++pItEvent, ++itEvent)
1153  {
1154  success &= pItEvent->compile(*itEvent, *this);
1155  }
1156 
1157  // Events representing discontinuities are already compiled.
1158 
1159  return success;
1160 }
bool compile(CEvent *pDataEvent, CMathContainer &container)
Definition: CMathEvent.cpp:916
CCopasiVectorN< CEvent > & getEvents()
Definition: CModel.cpp:1110
iterator begin()
iterator end()
CType * array()
Definition: CVector.h:139
CVector< CMathEventN > mEvents
bool CMathContainer::compileObjects ( )
private

Compile the objects

Definition at line 1129 of file CMathContainer.cpp.

References CVectorCore< CType >::array(), CMathObject::compile(), mObjects, and CVectorCore< CType >::size().

Referenced by init().

1130 {
1131  bool success = true;
1132 
1133  CMathObject *pObject = mObjects.array();
1134  CMathObject *pObjectEnd = pObject + mObjects.size();
1135 
1136  for (; pObject != pObjectEnd; ++pObject)
1137  {
1138  success &= pObject->compile(*this);
1139  }
1140 
1141  return success;
1142 }
CVector< CMathObject > mObjects
bool compile(CMathContainer &container)
size_t size() const
Definition: CVector.h:100
CType * array()
Definition: CVector.h:139
CEvaluationNode * CMathContainer::copyBranch ( const CEvaluationNode pSrc,
const bool &  replaceDiscontinuousNodes 
)

Copy a node and all its children. Nodes are converted to suite the math container, i.e., objects nodes point to math object or numbers, function calls are expanded and discrete nodes are replaced by object node pointing to newly created math objects, which are and targets of automatically generated events.

Parameters
constCEvaluationNode * pSrc
constbool & replaceDiscontinuousNodes
Returns
CEvaluationNode * pCopy

Definition at line 657 of file CMathContainer.cpp.

Referenced by CMathExpression::CMathExpression(), CMathEventN::CTrigger::compile(), and copyBranch().

659 {
661 
662  return copyBranch(pSrc, Variables, replaceDiscontinuousNodes);
663 }
CEvaluationNode * copyBranch(const CEvaluationNode *pSrc, const bool &replaceDiscontinuousNodes)
CEvaluationNode * CMathContainer::copyBranch ( const CEvaluationNode pSrc,
const CMath::Variables< CEvaluationNode * > &  variables,
const bool &  replaceDiscontinuousNodes 
)

Copy a node and all its children. Nodes are converted to suite the math container, i.e., objects nodes point to math object or numbers, function calls are expanded and discrete nodes are replaced by object node pointing to newly created math objects, which are and targets of automatically generated events.

Parameters
constCEvaluationNode * pSrc
constCMath::Variables & variables
constbool & replaceDiscontinuousNodes
Returns
CEvaluationNode * pCopy

Definition at line 665 of file CMathContainer.cpp.

References CEvaluationNodeConstant::_NaN, CEvaluationNodeVariable::ANY, C_INVALID_INDEX, CEvaluationNode::CALL, CEvaluationNodeFunction::CEIL, CEvaluationNode::CHOICE, CEvaluationNodeObject::CN, CNodeContextIterator< Node, Context >::context(), copyBranch(), CEvaluationNode::copyNode(), createNodeFromObject(), CNodeContextIterator< Node, Context >::end(), CEvaluationNodeCall::EXPRESSION, CEvaluationNodeFunction::FLOOR, CEvaluationNodeCall::FUNCTION, CEvaluationNode::FUNCTION, CEvaluationNodeCall::getCalledTree(), CCopasiNode< _Data >::getData(), CEvaluationNodeVariable::getIndex(), getMathObject(), getObject(), CEvaluationTree::getRoot(), CEvaluationNode::getType(), CEvaluationNodeChoice::IF, CEvaluationNodeOperator::MODULUS, CNodeContextIterator< Node, Context >::next(), CEvaluationNode::OBJECT, CEvaluationNode::OPERATOR, CNodeContextIterator< Node, Context >::parentContextPtr(), CEvaluationNodeObject::POINTER, replaceDiscontinuousNode(), and CEvaluationNode::VARIABLE.

668 {
670  CEvaluationNode * pCopy = NULL;
671 
672  while (itNode.next() != itNode.end())
673  {
674  if (*itNode == NULL)
675  {
676  continue;
677  }
678 
679  // We need to replace variables, expand called trees, and handle discrete nodes.
680  switch ((int) itNode->getType())
681  {
682  // Handle object nodes which are of type CN
684  {
685  // We need to map the object to a math object if possible.
686  const CObjectInterface * pObject =
687  getObject(static_cast< const CEvaluationNodeObject *>(*itNode)->getObjectCN());
688 
689  // Create a converted node
690  pCopy = createNodeFromObject(pObject);
691  }
692  break;
693 
694  // Handle object nodes which are of type POINTER
696  {
697  const CObjectInterface * pObject =
698  getMathObject(static_cast< const CEvaluationNodeObject *>(*itNode)->getObjectValuePtr());
699 
700  // Create a converted node
701  pCopy = createNodeFromObject(pObject);
702  }
703  break;
704 
705  // Handle variables
707  {
708  size_t Index =
709  static_cast< const CEvaluationNodeVariable * >(*itNode)->getIndex();
710 
711  if (Index != C_INVALID_INDEX &&
712  Index < variables.size())
713  {
714  pCopy = variables[Index]->copyBranch();
715  }
716  else
717  {
718  pCopy = new CEvaluationNodeConstant(CEvaluationNodeConstant::_NaN, itNode->getData());
719  }
720  }
721  break;
722 
723  // Handle call nodes
726  {
727  const CEvaluationNode * pCalledNode =
728  static_cast< const CEvaluationNodeCall * >(*itNode)->getCalledTree()->getRoot();
729 
730  pCopy = copyBranch(pCalledNode, itNode.context(), replaceDiscontinuousNodes);
731 
732  // The variables have been copied into place we need to delete them.
733  std::vector< CEvaluationNode * >::iterator it = itNode.context().begin();
734  std::vector< CEvaluationNode * >::iterator end = itNode.context().end();
735 
736  for (; it != end; ++it)
737  {
738  delete *it;
739  }
740  }
741  break;
742 
743  // Handle discrete nodes
748 
749  if (replaceDiscontinuousNodes)
750  {
751  // The node is replaced with a pointer to a math object value.
752  // The math object is calculated by an assignment with the target being the
753  // math object
754  pCopy = replaceDiscontinuousNode(*itNode, itNode.context());
755  }
756  else
757  {
758  pCopy = itNode->copyNode(itNode.context());
759  }
760 
761  break;
762 
763  default:
764  pCopy = itNode->copyNode(itNode.context());
765  break;
766  }
767 
768  if (itNode.parentContextPtr() != NULL)
769  {
770  itNode.parentContextPtr()->push_back(pCopy);
771  }
772  }
773 
774  // assert(pCopy != NULL);
775 
776  return pCopy;
777 }
const CEvaluationTree * getCalledTree() const
CMathObject * getMathObject(const CObjectInterface *pObject) const
CEvaluationNode * copyNode(CEvaluationNode *child1, CEvaluationNode *child2) const
#define C_INVALID_INDEX
Definition: copasi.h:222
CEvaluationNode * copyBranch(const CEvaluationNode *pSrc, const bool &replaceDiscontinuousNodes)
CEvaluationNode * replaceDiscontinuousNode(const CEvaluationNode *pSrc, const std::vector< CEvaluationNode * > &children)
CEvaluationNode * createNodeFromObject(const CObjectInterface *pMathObject)
virtual const CObjectInterface * getObject(const CCopasiObjectName &cn) const
CEvaluationNode * getRoot()
void CMathContainer::createApplyInitialValuesSequence ( )
private

Create the update sequence used when applying the initial state

Definition at line 1312 of file CMathContainer.cpp.

References CVectorCore< CType >::array(), CMath::Default, CMathDependencyGraph::getUpdateSequence(), mApplyInitialValuesSequence, mEventDelays, mExtensiveValues, mObjects, mTransientDependencies, mValues, and CVectorCore< CType >::size().

Referenced by createDependencyGraphs().

1313 {
1314  // Collect all the changed objects, which are all transient values
1316  const CMathObject * pObject = mObjects.array() + (mExtensiveValues.array() - mValues.array());
1317  const CMathObject * pObjectEnd = mObjects.array() + (mEventDelays.array() - mValues.array());
1318 
1319  for (; pObject != pObjectEnd; ++pObject)
1320  {
1321  Changed.insert(pObject);
1322  }
1323 
1324  // Collect all the requested objects
1325  CObjectInterface::ObjectSet Requested;
1326  pObjectEnd = mObjects.array() + mObjects.size();
1327 
1328  for (; pObject != pObjectEnd; ++pObject)
1329  {
1330  Requested.insert(pObject);
1331  }
1332 
1333  // Build the update sequence
1335 }
CVector< CMathObject > mObjects
CVector< C_FLOAT64 > mValues
CVectorCore< C_FLOAT64 > mExtensiveValues
CMathDependencyGraph mTransientDependencies
CObjectInterface::UpdateSequence mApplyInitialValuesSequence
bool getUpdateSequence(const CMath::SimulationContextFlag &context, const CObjectInterface::ObjectSet &changedObjects, const CObjectInterface::ObjectSet &requestedObjects, CObjectInterface::UpdateSequence &updateSequence)
CVectorCore< C_FLOAT64 > mEventDelays
size_t size() const
Definition: CVector.h:100
std::set< const CObjectInterface * > ObjectSet
CType * array()
Definition: CVector.h:139
void CMathContainer::createDependencyGraphs ( )
private

Create Dependency Graphs

Definition at line 1212 of file CMathContainer.cpp.

References CMathDependencyGraph::addObject(), CVectorCore< CType >::array(), createApplyInitialValuesSequence(), createSynchronizeInitialValuesSequence(), createUpdateSimulationValuesSequence(), CMathDependencyGraph::exportDOTFormat(), mExtensiveValues, mInitialDependencies, mInitialExtensiveValues, mObjects, mTransientDependencies, and CVectorCore< CType >::size().

Referenced by CMathContainer(), and init().

1213 {
1214  CMathObject *pObject = mObjects.array();
1215  CMathObject *pObjectEnd = pObject + (mExtensiveValues.array() - mInitialExtensiveValues.array());
1216 
1217  for (; pObject != pObjectEnd; ++pObject)
1218  {
1220  }
1221 
1222  pObjectEnd = mObjects.array() + mObjects.size();
1223 
1224  for (; pObject != pObjectEnd; ++pObject)
1225  {
1227  }
1228 
1229 #ifdef COPASI_DEBUG_TRACE
1230  std::ofstream InitialDependencies("InitialDependencies.dot");
1231  mInitialDependencies.exportDOTFormat(InitialDependencies, "InitialDependencies");
1232 
1233  std::ofstream TransientDependencies("TransientDependencies.dot");
1234  mTransientDependencies.exportDOTFormat(TransientDependencies, "TransientDependencies");
1235 #endif // COPASI_DEBUG_TRACE
1236 
1240 
1241  return;
1242 }
CVector< CMathObject > mObjects
CVectorCore< C_FLOAT64 > mExtensiveValues
CMathDependencyGraph mTransientDependencies
void createSynchronizeInitialValuesSequence()
void createApplyInitialValuesSequence()
void exportDOTFormat(std::ostream &os, const std::string &name) const
size_t size() const
Definition: CVector.h:100
iterator addObject(const CObjectInterface *pObject)
CType * array()
Definition: CVector.h:139
CVectorCore< C_FLOAT64 > mInitialExtensiveValues
CMathDependencyGraph mInitialDependencies
void createUpdateSimulationValuesSequence()
void CMathContainer::createDiscontinuityDataEvent ( const CEvaluationNode pNode)
private

Create an event of type CEvent::Discontinuity for the given node

Parameters
constCEvaluationNode * pNode

Definition at line 1863 of file CMathContainer.cpp.

References CCopasiVector< T >::add(), createDiscontinuityTriggerInfix(), CEvent::Discontinuity, mDiscontinuityEvents, CEvent::setTriggerExpression(), and CEvent::setType().

Referenced by createDiscontinuityEvents().

1864 {
1865  // We can create a data event without knowing the variables as the number
1866  // of roots is independent from the variable value.
1867  CEvent * pEvent = new CEvent();
1868  pEvent->setType(CEvent::Discontinuity);
1869  mDiscontinuityEvents.add(pEvent, true);
1870 
1872 }
Definition: CEvent.h:152
std::string createDiscontinuityTriggerInfix(const CEvaluationNode *pNode)
bool setTriggerExpression(const std::string &expression)
Definition: CEvent.cpp:474
virtual bool add(const CType &src)
CCopasiVector< CEvent > mDiscontinuityEvents
void setType(const Type &type)
Definition: CEvent.cpp:704
void CMathContainer::createDiscontinuityEvents ( )
private

Create an event of type CEvent::Discontinuity for each discontinuity in the model

Definition at line 1808 of file CMathContainer.cpp.

References CEvaluationNodeConstant::_NaN, CModel::getTreesWithDiscontinuities(), and mpModel.

Referenced by allocate(), and createDiscontinuityEvents().

1809 {
1811  //size_t i, imax;
1812 
1813  // We need to create events for nodes which are capable of introducing
1814  // discontinuous changes.
1815 
1816  // Retrieve expression trees which contain discontinuities.
1817  std::vector< const CEvaluationTree * > TreesWithDiscontinuities = mpModel->getTreesWithDiscontinuities();
1818  std::vector< const CEvaluationTree * >::const_iterator it = TreesWithDiscontinuities.begin();
1819  std::vector< const CEvaluationTree * >::const_iterator end = TreesWithDiscontinuities.end();
1820 
1821  for (; it != end; ++it)
1822  {
1824  }
1825 }
void createDiscontinuityEvents()
std::vector< const CEvaluationTree * > getTreesWithDiscontinuities() const
Definition: CModel.cpp:4059
void CMathContainer::createDiscontinuityEvents ( const CEvaluationTree pTree)
private

Create an event of type CEvent::Discontinuity for each discontinuity the tree with root pNode

Parameters
constCEvaluationTree * pTree

Definition at line 1827 of file CMathContainer.cpp.

References CEvaluationNodeConstant::_NaN, CEvaluationNode::CALL, CEvaluationNodeFunction::CEIL, CEvaluationNode::CHOICE, createDiscontinuityDataEvent(), createDiscontinuityEvents(), CEvaluationNodeCall::EXPRESSION, CEvaluationNodeFunction::FLOOR, CEvaluationNodeCall::FUNCTION, CEvaluationNode::FUNCTION, CEvaluationTree::getRoot(), CEvaluationNodeChoice::IF, CEvaluationNodeOperator::MODULUS, and CEvaluationNode::OPERATOR.

1828 {
1831 
1832  while (itNode.next() != itNode.end())
1833  {
1834  if (*itNode == NULL)
1835  {
1836  continue;
1837  }
1838 
1839  switch ((int) itNode->getType())
1840  {
1846  break;
1847 
1848  // Call nodes may include discontinuities but each called tree is handled
1849  // separately.
1852  createDiscontinuityEvents(static_cast< const CEvaluationNodeCall * >(*itNode)->getCalledTree());
1853  break;
1854 
1855  default:
1856  break;
1857  }
1858  }
1859 
1860  return;
1861 }
void createDiscontinuityEvents()
void createDiscontinuityDataEvent(const CEvaluationNode *pNode)
CEvaluationNode * getRoot()
std::string CMathContainer::createDiscontinuityTriggerInfix ( const CEvaluationNode pNode)
private

Create the infix for trigger of the event which tracks changes in a discontinuity represented by the node.

Parameters
constCEvaluationNode * pNode

Definition at line 1874 of file CMathContainer.cpp.

References CEvaluationNodeFunction::CEIL, CEvaluationNode::CHOICE, fatalError, CEvaluationNodeFunction::FLOOR, CEvaluationNode::FUNCTION, CCopasiNode< _Data >::getChild(), CEvaluationNode::getType(), CEvaluationNodeChoice::IF, CEvaluationNodeOperator::MODULUS, and CEvaluationNode::OPERATOR.

Referenced by createDiscontinuityDataEvent(), and replaceDiscontinuousNode().

1875 {
1876  std::string TriggerInfix;
1877 
1878  // We need to define a data event for each discontinuity.
1879  switch ((int) pNode->getType())
1880  {
1882  TriggerInfix = static_cast< const CEvaluationNode * >(pNode->getChild())->buildInfix();
1883  break;
1884 
1887  TriggerInfix = "sin(PI*(" + static_cast< const CEvaluationNode * >(pNode->getChild())->buildInfix() + ")) > 0";
1888  break;
1889 
1891  TriggerInfix = "sin(PI*(" + static_cast< const CEvaluationNode * >(pNode->getChild())->buildInfix();
1892  TriggerInfix += ")) > 0 || sin(PI*(" + static_cast< const CEvaluationNode * >(pNode->getChild()->getSibling())->buildInfix() + ")) > 0";
1893  break;
1894 
1895  default:
1896  fatalError();
1897  break;
1898  }
1899 
1900  return TriggerInfix;
1901 }
#define fatalError()
const Type & getType() const
CCopasiNode< Data > * getChild()
Definition: CCopasiNode.h:210
CEvaluationNode * CMathContainer::createNodeFromObject ( const CObjectInterface pMathObject)
private

Create a node based on the given pointer to the math object

Parameters
constCObjectInterface * pMathObject
Returns
CEvaluationNode * pNode

Definition at line 1162 of file CMathContainer.cpp.

References CEvaluationNodeConstant::_NaN, C_FLOAT64, CObjectInterface::getValuePointer(), mpAvogadro, and mpQuantity2NumberFactor.

Referenced by copyBranch().

1163 {
1164  CEvaluationNode * pNode = NULL;
1165 
1166  if (pObject == NULL)
1167  {
1168  // We have an invalid value, i.e. NaN
1170  }
1171  else if (pObject == mpAvogadro ||
1172  pObject == mpQuantity2NumberFactor)
1173  {
1174  pNode = new CEvaluationNodeNumber(*(C_FLOAT64 *) pObject->getValuePointer());
1175  }
1176  else
1177  {
1178  pNode = new CEvaluationNodeObject((C_FLOAT64 *) pObject->getValuePointer());
1179  }
1180 
1181  return pNode;
1182 }
const CObjectInterface * mpQuantity2NumberFactor
const CObjectInterface * mpAvogadro
#define C_FLOAT64
Definition: copasi.h:92
CEvaluationNode * CMathContainer::createNodeFromValue ( const C_FLOAT64 pDataValue)
private

Create a node based on the given pointer to a data value

Parameters
constC_FLOAT64 * pDataValue
Returns
CEvaluationNode * pNode

Definition at line 1184 of file CMathContainer.cpp.

References CEvaluationNodeConstant::_NaN, C_FLOAT64, getMathObject(), and CMathObject::getValuePointer().

1185 {
1186  CEvaluationNode * pNode = NULL;
1187  CMathObject * pMathObject = NULL;
1188 
1189  if (pDataValue != NULL)
1190  {
1191  pMathObject = getMathObject(pDataValue);
1192 
1193  if (pMathObject != NULL)
1194  {
1195  pNode = new CEvaluationNodeObject((C_FLOAT64 *) pMathObject->getValuePointer());
1196  }
1197  else
1198  {
1199  // We must have a constant value like the conversion factor from the model.
1200  pNode = new CEvaluationNodeNumber(*pDataValue);
1201  }
1202  }
1203  else
1204  {
1205  // We have an invalid value, i.e. NaN
1207  }
1208 
1209  return pNode;
1210 }
CMathObject * getMathObject(const CObjectInterface *pObject) const
virtual void * getValuePointer() const
#define C_FLOAT64
Definition: copasi.h:92
void CMathContainer::createSynchronizeInitialValuesSequence ( )
private

Create the update sequences needed to synchronize the initial values

Definition at line 1244 of file CMathContainer.cpp.

References CVectorCore< CType >::array(), CMathObject::getEntityType(), CMathDependencyGraph::getUpdateSequence(), CMathObject::isIntensiveProperty(), mExtensiveValues, mInitialDependencies, mInitialExtensiveRates, mInitialStateValueExtensive, mInitialStateValueIntensive, mObjects, mSynchronizeInitialValuesSequenceExtensive, mSynchronizeInitialValuesSequenceIntensive, mValues, CMath::Species, and CMath::UpdateMoieties.

Referenced by createDependencyGraphs().

1245 {
1246  // TODO CRITICAL Issue 1170: We need to add elements of the stoichiometry, reduced stoichiometry,
1247  // and link matrices.
1248 
1249  // Collect all the changed objects, which are all transient values
1252  const CMathObject * pObject = mObjects.array();
1253  const CMathObject * pObjectEnd = pObject + (mInitialExtensiveRates.array() - mValues.array());
1254 
1255  for (; pObject != pObjectEnd; ++pObject)
1256  {
1257  if (pObject->getEntityType() != CMath::Species)
1258  {
1259  mInitialStateValueExtensive.insert(pObject);
1260  mInitialStateValueIntensive.insert(pObject);
1261  }
1262  else if (pObject->isIntensiveProperty())
1263  {
1264  mInitialStateValueIntensive.insert(pObject);
1265  }
1266  else
1267  {
1268  mInitialStateValueExtensive.insert(pObject);
1269  }
1270  }
1271 
1272  // Collect all the requested objects
1273  CObjectInterface::ObjectSet RequestedExtensive;
1274  CObjectInterface::ObjectSet RequestedIntensive;
1275  pObject = mObjects.array();
1276 
1277  for (; pObject != pObjectEnd; ++pObject)
1278  {
1279  if (pObject->getEntityType() != CMath::Species)
1280  {
1281  continue;
1282  }
1283  else if (pObject->isIntensiveProperty())
1284  {
1285  RequestedExtensive.insert(pObject);
1286  }
1287  else
1288  {
1289  RequestedIntensive.insert(pObject);
1290  }
1291  }
1292 
1293  pObjectEnd = mObjects.array() + (mExtensiveValues.array() - mValues.array());
1294 
1295  for (; pObject != pObjectEnd; ++pObject)
1296  {
1297  RequestedExtensive.insert(pObject);
1298  RequestedIntensive.insert(pObject);
1299  }
1300 
1301  // Build the update sequence
1304  RequestedExtensive,
1308  RequestedIntensive,
1310 }
CVector< CMathObject > mObjects
CVector< C_FLOAT64 > mValues
const CMath::EntityType & getEntityType() const
CObjectInterface::ObjectSet mInitialStateValueExtensive
CVectorCore< C_FLOAT64 > mExtensiveValues
CObjectInterface::ObjectSet mInitialStateValueIntensive
CObjectInterface::UpdateSequence mSynchronizeInitialValuesSequenceIntensive
CObjectInterface::UpdateSequence mSynchronizeInitialValuesSequenceExtensive
bool getUpdateSequence(const CMath::SimulationContextFlag &context, const CObjectInterface::ObjectSet &changedObjects, const CObjectInterface::ObjectSet &requestedObjects, CObjectInterface::UpdateSequence &updateSequence)
std::set< const CObjectInterface * > ObjectSet
CType * array()
Definition: CVector.h:139
const bool & isIntensiveProperty() const
CMathDependencyGraph mInitialDependencies
CVectorCore< C_FLOAT64 > mInitialExtensiveRates
void CMathContainer::createUpdateSimulationValuesSequence ( )
private

Create the update sequences used to calculate all values required for simulation

Definition at line 1337 of file CMathContainer.cpp.

References CVectorCore< CType >::array(), CMath::Default, CMath::Dependent, CMathObject::getSimulationType(), CMathDependencyGraph::getUpdateSequence(), CMath::Independent, mEventRoots, mEventRootStates, mEventTargetCount, mExtensiveRates, mExtensiveValues, mFixedCount, mIntensiveRates, mObjects, mReducedStateValues, mSimulationRequiredValues, mSimulationValuesSequence, mSimulationValuesSequenceReduced, mStateValues, mTransientDependencies, mValues, CMath::ODE, CMath::Time, and CMath::UseMoieties.

Referenced by createDependencyGraphs().

1338 {
1339  mStateValues.clear();
1340  mReducedStateValues.clear();
1341  mSimulationRequiredValues.clear();
1342 
1343  // Collect all the state objects, which are transient values of simulation type:
1344  // Time, ODE, Independent, and Dependent (not for reduced model)
1345 
1346  const CMathObject * pObject = mObjects.array() + (mExtensiveValues.array() - mValues.array());
1347  const CMathObject * pObjectEnd = mObjects.array() + (mExtensiveRates.array() - mValues.array());
1348 
1349  for (; pObject != pObjectEnd; ++pObject)
1350  {
1351  switch (pObject->getSimulationType())
1352  {
1353  case CMath::Time:
1354  case CMath::ODE:
1355  case CMath::Independent:
1356  mStateValues.insert(pObject);
1357  mReducedStateValues.insert(pObject);
1358  break;
1359 
1360  case CMath::Dependent:
1361  mStateValues.insert(pObject);
1362  break;
1363 
1364  default:
1365  break;
1366  }
1367  }
1368 
1369  // Collect all objects required for simulation, which are transient rates values of simulation type:
1370  // ODE, Independent, and Dependent (not needed for reduced model) and EventRoots
1371  // The additional cost for calculating the rates for dependent species is neglected.
1372  pObject = mObjects.array() + (mExtensiveRates.array() - mValues.array()) + mFixedCount + mEventTargetCount + 1 /* Time */;
1373  pObjectEnd = mObjects.array() + (mIntensiveRates.array() - mValues.array());
1374 
1375  for (; pObject != pObjectEnd; ++pObject)
1376  {
1377  mSimulationRequiredValues.insert(pObject);
1378  }
1379 
1380  pObject = mObjects.array() + (mEventRoots.array() - mValues.array());
1381  pObjectEnd = mObjects.array() + (mEventRootStates.array() - mValues.array());
1382 
1383  for (; pObject != pObjectEnd; ++pObject)
1384  {
1385  mSimulationRequiredValues.insert(pObject);
1386  }
1387 
1388  // Build the update sequence
1391 }
CVector< CMathObject > mObjects
CVector< C_FLOAT64 > mValues
const CMath::SimulationType & getSimulationType() const
CObjectInterface::UpdateSequence mSimulationValuesSequence
CVectorCore< C_FLOAT64 > mExtensiveValues
CMathDependencyGraph mTransientDependencies
CObjectInterface::ObjectSet mReducedStateValues
CObjectInterface::UpdateSequence mSimulationValuesSequenceReduced
CObjectInterface::ObjectSet mStateValues
CVectorCore< C_FLOAT64 > mEventRoots
bool getUpdateSequence(const CMath::SimulationContextFlag &context, const CObjectInterface::ObjectSet &changedObjects, const CObjectInterface::ObjectSet &requestedObjects, CObjectInterface::UpdateSequence &updateSequence)
CVectorCore< C_FLOAT64 > mEventRootStates
CObjectInterface::ObjectSet mSimulationRequiredValues
CVectorCore< C_FLOAT64 > mExtensiveRates
CType * array()
Definition: CVector.h:139
size_t mEventTargetCount
CVectorCore< C_FLOAT64 > mIntensiveRates
void CMathContainer::fetchInitialState ( )

Fetch the initial state from the associated model

Definition at line 442 of file CMathContainer.cpp.

References CVectorCore< CType >::array(), C_FLOAT64, CMathObject::getDataObject(), CCopasiObject::getValuePointer(), mInitialState, mObjects, and CVectorCore< CType >::size().

443 {
444  C_FLOAT64 * pValue = mInitialState.array();
445  C_FLOAT64 * pValueEnd = pValue + mInitialState.size();
446  CMathObject * pObject = mObjects.array();
447 
448  for (; pValue != pValueEnd; ++pValue, ++pObject)
449  {
450  const CCopasiObject * pDataObject = pObject->getDataObject();
451 
452  if (pDataObject != NULL)
453  {
454  *pValue = *(C_FLOAT64 *)pDataObject->getValuePointer();
455  }
456  }
457 
458  return;
459 }
CVector< CMathObject > mObjects
size_t size() const
Definition: CVector.h:100
CVectorCore< C_FLOAT64 > mInitialState
#define C_FLOAT64
Definition: copasi.h:92
CType * array()
Definition: CVector.h:139
virtual void * getValuePointer() const
const CCopasiObject * getDataObject() const
void CMathContainer::fetchState ( )

Fetch the state from the associated model

Definition at line 480 of file CMathContainer.cpp.

References CVectorCore< CType >::array(), C_FLOAT64, CMathObject::getDataObject(), CCopasiObject::getValuePointer(), mObjects, mState, and CVectorCore< CType >::size().

481 {
482  C_FLOAT64 * pValue = mState.array();
483  C_FLOAT64 * pValueEnd = pValue + mState.size();
484  CMathObject * pObject = mObjects.array();
485 
486  for (; pValue != pValueEnd; ++pValue, ++pObject)
487  {
488  const CCopasiObject * pDataObject = pObject->getDataObject();
489 
490  if (pDataObject != NULL)
491  {
492  *pValue = *(C_FLOAT64 *)pDataObject->getValuePointer();
493  }
494  }
495 
496  return;
497 }
CVector< CMathObject > mObjects
size_t size() const
Definition: CVector.h:100
CVectorCore< C_FLOAT64 > mState
#define C_FLOAT64
Definition: copasi.h:92
CType * array()
Definition: CVector.h:139
virtual void * getValuePointer() const
const CCopasiObject * getDataObject() const
CCopasiObjectName CMathContainer::getCN ( ) const
virtual

Retrieve the CN of the math container The math container provides values for the numerical values of model objects. For the CN mechanism to work properly it has to pretend to be the model.

Returns
CCopasiObjectName

Reimplemented from CCopasiObject.

Definition at line 519 of file CMathContainer.cpp.

References CCopasiObject::getCN(), and mpModel.

520 {
521  return mpModel->getCN();
522 }
virtual CCopasiObjectName getCN() const
CMath::EntityType CMathContainer::getEntityType ( const CModelEntity pEntity)
staticprivate

Determine the entity type of an entity

Parameters
constCModelEntity * pEntity
Returns
CMath::EntityType entityType

Definition at line 1533 of file CMathContainer.cpp.

References CMath::Compartment, CMath::EntityTypeUndefined, CMath::GlobalQuantity, and CMath::Species.

Referenced by initializeMathObjects().

1534 {
1535  const CMetab * pSpecies = dynamic_cast< const CMetab * >(pEntity);
1536 
1537  if (pSpecies != NULL)
1538  {
1539  return CMath::Species;
1540  }
1541  else if (dynamic_cast< const CCompartment * >(pEntity) != NULL)
1542  {
1543  return CMath::Compartment;
1544  }
1545  else if (dynamic_cast< const CModelValue * >(pEntity) != NULL)
1546  {
1547  return CMath::GlobalQuantity;
1548  }
1549 
1551 }
Definition: CMetab.h:178
const CVectorCore< C_FLOAT64 > & CMathContainer::getInitialState ( ) const

Retrieves the initial state values, i.e., all initial values of objects of simulation type Fixed, Time, ODE, Dependent, and Independent. It includes only extensive values for species.

Returns
const CVectorCore< C_FLOAT64 > & initialState

Definition at line 344 of file CMathContainer.cpp.

References mInitialState.

345 {
346  return mInitialState;
347 }
CVectorCore< C_FLOAT64 > mInitialState
CVectorCore< C_FLOAT64 > & CMathContainer::getInitialState ( )

Retrieves the initial state values, i.e., all initial values of objects of simulation type Fixed, Time, ODE, Dependent, and Independent. It includes only extensive values for species.

Returns
CVectorCore< C_FLOAT64 > & initialState

Definition at line 349 of file CMathContainer.cpp.

References mInitialState.

350 {
351  return mInitialState;
352 }
CVectorCore< C_FLOAT64 > mInitialState
C_FLOAT64 * CMathContainer::getInitialValuePointer ( const C_FLOAT64 pValue) const

Retrieve the pointer to the corresponding initial value

Parameters
constC_FLOAT64 * pValue
Returns
C_FLOAT64 * pInitialvalue

Definition at line 1794 of file CMathContainer.cpp.

References CVectorCore< CType >::array(), C_FLOAT64, mEventDelays, mExtensiveValues, mInitialExtensiveValues, mValues, and CVectorCore< CType >::size().

1795 {
1796  assert(mValues.array() <= pValue && pValue < mValues.array() + mValues.size());
1797 
1798  const C_FLOAT64 * pInitialValue = pValue;
1799 
1800  if (mExtensiveValues.array() <= pValue && pValue < mEventDelays.array())
1801  {
1802  pInitialValue = mInitialExtensiveValues.array() + (pValue - mExtensiveValues.array());
1803  }
1804 
1805  return const_cast< C_FLOAT64 * >(pInitialValue);
1806 }
CVector< C_FLOAT64 > mValues
CVectorCore< C_FLOAT64 > mExtensiveValues
CVectorCore< C_FLOAT64 > mEventDelays
size_t size() const
Definition: CVector.h:100
#define C_FLOAT64
Definition: copasi.h:92
CType * array()
Definition: CVector.h:139
CVectorCore< C_FLOAT64 > mInitialExtensiveValues
CMathObject * CMathContainer::getMathObject ( const CObjectInterface pObject) const

Retrieve a pointer to corresponding the mathematical object for the given abject if it exists otherwise NULL

Parameters
constCObjectInterface * pObject
Returns
CMathObject * pMathObject

Definition at line 554 of file CMathContainer.cpp.

References mDataObject2MathObject.

Referenced by CMathEventN::CAssignment::compile(), CMathObject::compileDependentMass(), CMathObject::compileInitialValue(), CMathObject::compileValue(), copyBranch(), createNodeFromValue(), getMathObject(), getObject(), and CMathReaction::initialize().

555 {
556  if (pObject == NULL)
557  return NULL;
558 
559  std::map< CCopasiObject *, CMathObject * >::const_iterator found =
560  mDataObject2MathObject.find(const_cast<CCopasiObject*>(static_cast< const CCopasiObject * >(pObject)));
561 
562  if (found != mDataObject2MathObject.end())
563  {
564  return found->second;
565  }
566 
567  return NULL;
568 }
std::map< CCopasiObject *, CMathObject * > mDataObject2MathObject
CMathObject * CMathContainer::getMathObject ( const C_FLOAT64 pDataValue) const

Retrieve a pointer to the mathematical object for data value pointer

Parameters
constC_FLOAT64 * pDataValue
Returns
CMathObject * pMathObject

Definition at line 570 of file CMathContainer.cpp.

References CVectorCore< CType >::array(), C_FLOAT64, mDataValue2MathObject, mObjects, mValues, and CVectorCore< CType >::size().

571 {
572  if (pDataValue == NULL)
573  return NULL;
574 
575  // Check whether we point to a math value.
576  const C_FLOAT64 * pValues = mValues.array();
577 
578  if (pValues <= pDataValue && pDataValue < pValues + mValues.size())
579  {
580  return const_cast< CMathObject * >(mObjects.array() + (pDataValue - pValues));
581  }
582 
583  std::map< C_FLOAT64 *, CMathObject * >::const_iterator found =
584  mDataValue2MathObject.find(const_cast< C_FLOAT64 * >(pDataValue));
585 
586  if (found != mDataValue2MathObject.end())
587  {
588  return found->second;
589  }
590 
591  return NULL;
592 }
CVector< CMathObject > mObjects
CVector< C_FLOAT64 > mValues
std::map< C_FLOAT64 *, CMathObject * > mDataValue2MathObject
size_t size() const
Definition: CVector.h:100
#define C_FLOAT64
Definition: copasi.h:92
CType * array()
Definition: CVector.h:139
CMathObject * CMathContainer::getMathObject ( const CCopasiObjectName cn) const

Retrieve a pointer to the mathematical object for the given CN

Parameters
constCCopasiObjectName & cn
Returns
CMathObject * pMathObject

Definition at line 594 of file CMathContainer.cpp.

References getMathObject(), CCopasiContainer::getObject(), and mpModel.

595 {
596  return getMathObject(mpModel->getObject(cn));
597 }
CMathObject * getMathObject(const CObjectInterface *pObject) const
virtual const CObjectInterface * getObject(const CCopasiObjectName &cn) const
const CModel & CMathContainer::getModel ( ) const
const CObjectInterface * CMathContainer::getObject ( const CCopasiObjectName cn) const
virtual

Retrieve a descendant object by its CN.

Reimplemented from CCopasiContainer.

Definition at line 525 of file CMathContainer.cpp.

References CCopasiObject::getCN(), getMathObject(), CCopasiObject::getObjectDataModel(), CCopasiObjectName::getPrimary(), mpModel, and CCopasiDataModel::ObjectFromCN().

Referenced by copyBranch().

526 {
527  std::vector< CCopasiContainer * > ListOfContainer;
528  ListOfContainer.push_back(mpModel);
529 
530  const CObjectInterface * pObject = NULL;
531  CCopasiObjectName ModelCN = mpModel->getCN();
532 
533  if (cn.getPrimary() != ModelCN.getPrimary())
534  {
535  pObject = mpModel->getObjectDataModel()->ObjectFromCN(ListOfContainer, ModelCN + "," + cn);
536  }
537  else
538  {
539  pObject = mpModel->getObjectDataModel()->ObjectFromCN(ListOfContainer, cn);
540  }
541 
542  const CMathObject * pMathObject = getMathObject(pObject);
543 
544  if (pMathObject != NULL)
545  {
546  return pMathObject;
547  }
548 
549  std::cout << "Data Object " << cn << " (0x" << pObject << ") has no corresponding Math Object." << std::endl;
550 
551  return pObject;
552 }
CCopasiDataModel * getObjectDataModel()
virtual CCopasiObjectName getCN() const
CMathObject * getMathObject(const CObjectInterface *pObject) const
CObjectInterface * ObjectFromCN(const std::vector< CCopasiContainer * > &listOfContainer, const CCopasiObjectName &objName) const
CCopasiObjectName getPrimary() const
const CVectorCore< C_FLOAT64 > & CMathContainer::getState ( ) const

Retrieves the state values, i.e., all initial values of objects of simulation type Time, ODE, Dependent, and Independent. It includes only extensive values for species.

Returns
const CVectorCore< C_FLOAT64 > & state

Definition at line 361 of file CMathContainer.cpp.

References mState.

362 {
363  return mState;
364 }
CVectorCore< C_FLOAT64 > mState
CVectorCore< C_FLOAT64 > & CMathContainer::getState ( )

Retrieves the state values, i.e., all initial values of objects of simulation type Time, ODE, Dependent, and Independent. It includes only extensive values for species.

Returns
const CVectorCore< C_FLOAT64 > & state

Definition at line 366 of file CMathContainer.cpp.

References mState.

367 {
368  return mState;
369 }
CVectorCore< C_FLOAT64 > mState
const CVectorCore< C_FLOAT64 > & CMathContainer::getStateReduced ( ) const

Retrieves the state values, i.e., all initial values of objects of simulation type Time, ODE, and Dependent. It includes only extensive values for species.

Returns
const CVectorCore< C_FLOAT64 > & stateReduced

Definition at line 378 of file CMathContainer.cpp.

References mStateReduced.

379 {
380  return mStateReduced;
381 }
CVectorCore< C_FLOAT64 > mStateReduced
CVectorCore< C_FLOAT64 > & CMathContainer::getStateReduced ( )

Retrieves the reduced state values, i.e., all initial values of objects of simulation type Time, ODE, and Dependent. It includes only extensive values for species.

Returns
const CVectorCore< C_FLOAT64 > & stateReduced

Definition at line 383 of file CMathContainer.cpp.

References mStateReduced.

384 {
385  return mStateReduced;
386 }
CVectorCore< C_FLOAT64 > mStateReduced
const CVectorCore< C_FLOAT64 > & CMathContainer::getValues ( ) const

Retrieve the values of all mathematical objects

Returns
const CVectorCore< C_FLOAT64 > & values

Definition at line 327 of file CMathContainer.cpp.

References mValues.

328 {
329  return mValues;
330 }
CVector< C_FLOAT64 > mValues
CVectorCore< C_FLOAT64 > & CMathContainer::getValues ( )

Retrieve the values of all mathematical objects

Returns
CVectorCore< C_FLOAT64 > & values

Definition at line 332 of file CMathContainer.cpp.

References mValues.

333 {
334  return mValues;
335 }
CVector< C_FLOAT64 > mValues
bool CMathContainer::hasDependencies ( const CCopasiObject pObject)
staticprivate

Determine whether on object has calculation dependencies.

Definition at line 1773 of file CMathContainer.cpp.

References CCopasiObject::getDirectDependencies(), and CCopasiObject::getObjectParent().

1774 {
1775  const CCopasiObject::DataObjectSet & Dependencies = pObject->getDirectDependencies();
1776 
1777  if (Dependencies.find(pObject->getObjectParent()) != Dependencies.end())
1778  {
1779  return Dependencies.size() > 1;
1780  }
1781 
1782  return Dependencies.size() > 0;
1783 }
virtual const DataObjectSet & getDirectDependencies(const DataObjectSet &context=DataObjectSet()) const
std::set< const CCopasiObject * > DataObjectSet
CCopasiContainer * getObjectParent() const
void CMathContainer::init ( )
private

Initialize the mathematical model

Definition at line 599 of file CMathContainer.cpp.

References allocate(), CVectorCore< CType >::array(), CCopasiVector< T >::begin(), CCopasiVector< T >::clear(), compileEvents(), compileObjects(), createDependencyGraphs(), CModel::getReactions(), CMathReaction::initialize(), initializeDiscontinuousCreationPointer(), initializeEvents(), initializeObjects(), initializePointers(), mDiscontinuityEvents, mDiscontinuityInfix2Object, mObjects, mpModel, mReactions, mTriggerInfix2Event, CModelParameter::ParticleNumbers, CVector< CType >::resize(), CVectorCore< CType >::size(), CCopasiVector< T >::size(), and updateInitialValues().

Referenced by CMathContainer().

600 {
601  allocate();
602 
603  CMath::sPointers Pointers;
604  initializePointers(Pointers);
605 #ifdef COPASI_DEBUG
606  printPointers(Pointers);
607 #endif
608 
610 
611  initializeObjects(Pointers);
612  initializeEvents(Pointers);
613 
614  compileObjects();
615  compileEvents();
616 
617  // These are only used during initialization for setting up the tracking of
618  // discontinuities and are cleared afterwards.
621  mTriggerInfix2Event.clear();
622 
623  // TODO We may have unused event triggers and roots due to optimization
624  // in the discontinuities.
626 
628  CMathReaction * pReaction = mReactions.array();
629  CMathReaction * pReactionEnd = pReaction + mReactions.size();
631 
632  for (; pReaction != pReactionEnd; ++itReaction, ++pReaction)
633  {
634  pReaction->initialize(*itReaction, *this);
635  }
636 
638 
639 #ifdef COPASI_DEBUG
640  CMathObject *pObject = mObjects.array();
641  CMathObject *pObjectEnd = pObject + mObjects.size();
642 
643  for (; pObject != pObjectEnd; ++pObject)
644  {
645  std::cout << *pObject;
646  }
647 
648  std::cout << std::endl;
649 #endif // COPASI_DEBUG
650 }
CVector< CMathObject > mObjects
virtual size_t size() const
iterator begin()
void initializePointers(CMath::sPointers &pointers)
void resize(size_t size, const bool &copy=false)
Definition: CVector.h:301
void updateInitialValues(const CModelParameter::Framework &framework)
std::map< std::string, CMathObject * > mDiscontinuityInfix2Object
std::map< std::string, CMathEventN * > mTriggerInfix2Event
std::vector< CType * >::const_iterator const_iterator
Definition: CCopasiVector.h:57
void initializeObjects(CMath::sPointers &pointers)
void initializeDiscontinuousCreationPointer()
void initializeEvents(CMath::sPointers &pointers)
size_t size() const
Definition: CVector.h:100
CType * array()
Definition: CVector.h:139
CCopasiVector< CEvent > mDiscontinuityEvents
void createDependencyGraphs()
CCopasiVectorNS< CReaction > & getReactions()
Definition: CModel.cpp:1039
virtual void clear()
CVector< CMathReaction > mReactions
void initialize(const CReaction *pReaction, CMathContainer &container)
void CMathContainer::initializeDiscontinuousCreationPointer ( )
private

Initialize the pointers used for the conversion of discontinuous nodes.

Definition at line 1512 of file CMathContainer.cpp.

References CVectorCore< CType >::array(), C_FLOAT64, mCreateDiscontinuousPointer, mDiscontinuous, mEvents, mObjects, mValues, CMathContainer::sDiscontinuous::pDiscontinuous, CMathContainer::sDiscontinuous::pEvent, and CVectorCore< CType >::size().

Referenced by init().

1513 {
1514  C_FLOAT64 * pValues = mValues.array();
1515  CMathObject * pObjects = mObjects.array();
1516 
1517  size_t nDiscontinuous = mDiscontinuous.size();
1518  size_t nEvents = mEvents.size() - nDiscontinuous;
1519 
1522 
1523  /*
1524  mCreateDiscontinuousPointer.pEventDelay = pObjects + (mEventDelays.array() - pValues) + nEvents;
1525  mCreateDiscontinuousPointer.pEventPriority = pObjects + (mEventPriorities.array() - pValues) + nEvents;
1526  mCreateDiscontinuousPointer.pEventAssignment = pObjects + (mEventAssignments.array() - pValues) + nEventAssignments;
1527  mCreateDiscontinuousPointer.pEventTrigger = pObjects + (mEventTriggers.array() - pValues) + nEvents;
1528  mCreateDiscontinuousPointer.pEventRoot = pObjects + (mEventRoots.array() - pValues) + nEventRoots;
1529  */
1530 }
CVector< CMathObject > mObjects
CVector< C_FLOAT64 > mValues
sDiscontinuous mCreateDiscontinuousPointer
CVectorCore< C_FLOAT64 > mDiscontinuous
size_t size() const
Definition: CVector.h:100
#define C_FLOAT64
Definition: copasi.h:92
CType * array()
Definition: CVector.h:139
CVector< CMathEventN > mEvents
void CMathContainer::initializeEvents ( CMath::sPointers pointers)
private

Initialize the events

Parameters
sPointers& pointers

Definition at line 1115 of file CMathContainer.cpp.

References CVectorCore< CType >::array(), CMathEventN::initialize(), mEvents, and CVectorCore< CType >::size().

Referenced by init().

1116 {
1117  // Initialize events.
1118  CMathEventN * pEvent = mEvents.array();
1119  CMathEventN * pEventEnd = pEvent + mEvents.size();
1120 
1121  for (; pEvent != pEventEnd; ++pEvent)
1122  {
1123  pEvent->initialize(p);
1124  }
1125 
1126  return;
1127 }
void initialize(CMath::sPointers &pointers)
Definition: CMathEvent.cpp:868
size_t size() const
Definition: CVector.h:100
CType * array()
Definition: CVector.h:139
CVector< CMathEventN > mEvents
void CMathContainer::initializeMathObjects ( const std::vector< const CModelEntity * > &  entities,
const CMath::SimulationType simulationType,
CMath::sPointers pointers 
)
private

Initialize several mathematical objects of a common simulation type and advance relevant pointers

Parameters
conststd::vector<const CModelEntity*> & entities
constCMath::SimulationType & simulationType
sPointers& pointers

Definition at line 1553 of file CMathContainer.cpp.

References CMath::Assignment, CMath::Conversion, CMath::EventTarget, CMath::Fixed, CMetab::getConcentrationRateReference(), CMetab::getConcentrationReference(), getEntityType(), CMetab::getInitialConcentrationReference(), CMathObject::initialize(), map(), CMath::sPointers::pExtensiveRates, CMath::sPointers::pExtensiveRatesObject, CMath::sPointers::pExtensiveValues, CMath::sPointers::pExtensiveValuesObject, CMath::sPointers::pInitialExtensiveRates, CMath::sPointers::pInitialExtensiveRatesObject, CMath::sPointers::pInitialExtensiveValues, CMath::sPointers::pInitialExtensiveValuesObject, CMath::sPointers::pInitialIntensiveRates, CMath::sPointers::pInitialIntensiveRatesObject, CMath::sPointers::pInitialIntensiveValues, CMath::sPointers::pInitialIntensiveValuesObject, CMath::sPointers::pIntensiveRates, CMath::sPointers::pIntensiveRatesObject, CMath::sPointers::pIntensiveValues, CMath::sPointers::pIntensiveValuesObject, CMath::Rate, CMath::Species, and CMath::Value.

Referenced by initializeObjects().

1556 {
1557  // Process entities.
1558  std::vector<const CModelEntity*>::const_iterator it = entities.begin();
1559  std::vector<const CModelEntity*>::const_iterator end = entities.end();
1560 
1561  CMath::EntityType EntityType;
1562 
1563  for (; it != end; ++it)
1564  {
1565  EntityType = getEntityType(*it);
1566 
1567  // Extensive Initial Value
1568 
1569  // The simulation type for initial values is either CMath::Assignment or CMath::Fixed
1570  // We must check whether the initial value must be calculated, i.e., whether it has
1571  // dependencies or not. In case of species it always possible that is must be calculated.
1572 
1573  CMath::SimulationType SimulationType = CMath::Fixed;
1574  CCopasiObject * pObject = (*it)->getInitialValueReference();
1575 
1576  if (EntityType == CMath::Species)
1577  {
1578  SimulationType = CMath::Conversion;
1579  }
1580  else if ((simulationType == CMath::Assignment && (*it)->getExpression() != "") ||
1581  (*it)->getInitialExpression() != "")
1582  {
1583  SimulationType = CMath::Assignment;
1584  }
1585 
1586  map(pObject, p.pInitialExtensiveValuesObject);
1587  CMathObject::initialize(p.pInitialExtensiveValuesObject, p.pInitialExtensiveValues,
1588  CMath::Value, EntityType, SimulationType, false, true,
1589  pObject);
1590 
1591  // Extensive Value
1592  SimulationType = simulationType;
1593 
1594  if (EntityType == CMath::Species &&
1595  (simulationType == CMath::EventTarget ||
1596  simulationType == CMath::Assignment))
1597  {
1598  SimulationType = CMath::Conversion;
1599  }
1600 
1601  map((*it)->getValueReference(), p.pExtensiveValuesObject);
1602  CMathObject::initialize(p.pExtensiveValuesObject, p.pExtensiveValues,
1603  CMath::Value, EntityType, SimulationType, false, false,
1604  (*it)->getValueReference());
1605 
1606  // Initial Extensive Rate
1607  SimulationType = simulationType;
1608 
1609  if (simulationType == CMath::EventTarget)
1610  {
1611  SimulationType = CMath::Fixed;
1612  }
1613 
1614  CMathObject::initialize(p.pInitialExtensiveRatesObject, p.pInitialExtensiveRates,
1615  CMath::Rate, EntityType, SimulationType, false, true,
1616  (*it)->getRateReference());
1617 
1618  // Extensive Rate
1619  map((*it)->getRateReference(), p.pExtensiveRatesObject);
1620  CMathObject::initialize(p.pExtensiveRatesObject, p.pExtensiveRates,
1621  CMath::Rate, EntityType, SimulationType, false, false,
1622  (*it)->getRateReference());
1623 
1624  // Species have intensive values in addition to the extensive ones.
1625  if (EntityType == CMath::Species)
1626  {
1627  const CMetab *pSpecies = static_cast<const CMetab*>(*it);
1628 
1629  // Intensive Initial Value
1630 
1631  // The simulation type for initial values is either CMath::Assignment or CMath::Conversion
1632  // In case of species it always possible that is must be calculated.
1633  SimulationType = CMath::Conversion;
1634 
1635  if (simulationType == CMath::Assignment)
1636  {
1637  SimulationType = CMath::Assignment;
1638  }
1639 
1640  map(pSpecies->getInitialConcentrationReference(), p.pInitialIntensiveValuesObject);
1641  CMathObject::initialize(p.pInitialIntensiveValuesObject, p.pInitialIntensiveValues,
1642  CMath::Value, CMath::Species, SimulationType, true, true,
1643  pSpecies->getInitialConcentrationReference());
1644 
1645  // Intensive Value
1646  SimulationType = CMath::Conversion;
1647 
1648  if (simulationType == CMath::EventTarget ||
1649  simulationType == CMath::Assignment)
1650  {
1651  SimulationType = simulationType;
1652  }
1653 
1654  map(pSpecies->getConcentrationReference(), p.pIntensiveValuesObject);
1655  CMathObject::initialize(p.pIntensiveValuesObject, p.pIntensiveValues,
1656  CMath::Value, CMath::Species, SimulationType, true, false,
1657  pSpecies->getConcentrationReference());
1658 
1659  // Initial Intensive Rate
1660  CMathObject::initialize(p.pInitialIntensiveRatesObject, p.pInitialIntensiveRates,
1662  pSpecies->getConcentrationRateReference());
1663 
1664  // Intensive Rate
1665  map(pSpecies->getConcentrationRateReference(), p.pIntensiveRatesObject);
1666  CMathObject::initialize(p.pIntensiveRatesObject, p.pIntensiveRates,
1668  pSpecies->getConcentrationRateReference());
1669  }
1670  }
1671 }
SimulationType
Definition: CMathEnum.h:182
Definition: CMetab.h:178
EntityType
Definition: CMathEnum.h:195
CCopasiObject * getConcentrationRateReference() const
Definition: CMetab.cpp:867
static CMath::EntityType getEntityType(const CModelEntity *pEntity)
static void initialize(CMathObject *&pObject, C_FLOAT64 *&pValue, const CMath::ValueType &valueType, const CMath::EntityType &entityType, const CMath::SimulationType &simulationType, const bool &isIntensiveProperty, const bool &isInitialValue, const CCopasiObject *pDataObject)
Definition: CMathObject.cpp:23
CConcentrationReference * getInitialConcentrationReference() const
Definition: CMetab.cpp:861
void map(CCopasiObject *pDataObject, CMathObject *pMathObject)
CConcentrationReference * getConcentrationReference() const
Definition: CMetab.cpp:864
void CMathContainer::initializeMathObjects ( const std::vector< const CCopasiObject * > &  parameters,
CMath::sPointers p 
)
private

Initialize several mathematical objects for local reaction parameters and advance relevant pointers

Parameters
conststd::vector<const CCopasiObject *> & parameters
CMathContainer::sPointers& p

Definition at line 1673 of file CMathContainer.cpp.

References CMath::Fixed, CMathObject::initialize(), CMath::LocalReactionParameter, map(), CMath::sPointers::pExtensiveRates, CMath::sPointers::pExtensiveRatesObject, CMath::sPointers::pExtensiveValues, CMath::sPointers::pExtensiveValuesObject, CMath::sPointers::pInitialExtensiveRates, CMath::sPointers::pInitialExtensiveRatesObject, CMath::sPointers::pInitialExtensiveValues, CMath::sPointers::pInitialExtensiveValuesObject, CMath::Rate, and CMath::Value.

1675 {
1676  // Process parameters.
1677  std::vector<const CCopasiObject *>::const_iterator it = parameters.begin();
1678  std::vector<const CCopasiObject *>::const_iterator end = parameters.end();
1679 
1680  for (; it != end; ++it)
1681  {
1682  // Extensive Initial Value
1683  map(const_cast< CCopasiObject * >(*it), p.pInitialExtensiveValuesObject);
1686  *it);
1687 
1688  // Extensive Value
1691  NULL);
1692 
1693  // Initial Extensive Rate
1696  NULL);
1697 
1698  // Extensive Rate
1701  NULL);
1702  }
1703 }
C_FLOAT64 * pInitialExtensiveRates
Definition: CMathEnum.h:91
CMathObject * pExtensiveValuesObject
Definition: CMathEnum.h:125
CMathObject * pInitialExtensiveValuesObject
Definition: CMathEnum.h:116
CMathObject * pExtensiveRatesObject
Definition: CMathEnum.h:127
C_FLOAT64 * pExtensiveRates
Definition: CMathEnum.h:100
C_FLOAT64 * pExtensiveValues
Definition: CMathEnum.h:98
C_FLOAT64 * pInitialExtensiveValues
Definition: CMathEnum.h:89
static void initialize(CMathObject *&pObject, C_FLOAT64 *&pValue, const CMath::ValueType &valueType, const CMath::EntityType &entityType, const CMath::SimulationType &simulationType, const bool &isIntensiveProperty, const bool &isInitialValue, const CCopasiObject *pDataObject)
Definition: CMathObject.cpp:23
CMathObject * pInitialExtensiveRatesObject
Definition: CMathEnum.h:118
void map(CCopasiObject *pDataObject, CMathObject *pMathObject)
void CMathContainer::initializeMathObjects ( const CCopasiVector< CReaction > &  reactions,
CMath::sPointers p 
)
private

Initialize several mathematical objects for local reaction parameters and advance relevant pointers

Parameters
constCCopasiVector< CReaction > & reactions
CMathContainer::sPointers& p

Definition at line 1705 of file CMathContainer.cpp.

References CCopasiVector< T >::begin(), CCopasiVector< T >::end(), CMath::Flux, CMathObject::initialize(), map(), CMath::ParticleFlux, CMath::sPointers::pFluxes, CMath::sPointers::pFluxesObject, CMath::sPointers::pInitialFluxes, CMath::sPointers::pInitialFluxesObject, CMath::sPointers::pInitialParticleFluxes, CMath::sPointers::pInitialParticleFluxesObject, CMath::sPointers::pParticleFluxes, CMath::sPointers::pParticleFluxesObject, CMath::sPointers::pPropensities, CMath::sPointers::pPropensitiesObject, CMath::Propensity, CMath::Reaction, and CMath::SimulationTypeUndefined.

1707 {
1708  // Process reactions.
1711 
1712  for (; it != end; ++it)
1713  {
1714  // Initial Particle Flux
1717  (*it)->getParticleFluxReference());
1718 
1719  // Particle Flux
1720  map((*it)->getParticleFluxReference(), p.pParticleFluxesObject);
1723  (*it)->getParticleFluxReference());
1724 
1725  // Initial Flux
1728  (*it)->getFluxReference());
1729 
1730  // Flux
1731  map((*it)->getFluxReference(), p.pFluxesObject);
1734  (*it)->getFluxReference());
1735 
1736  // Propensity
1737  map((*it)->getPropensityReference(), p.pPropensitiesObject);
1740  (*it)->getPropensityReference());
1741  }
1742 }
C_FLOAT64 * pPropensities
Definition: CMathEnum.h:112
iterator begin()
C_FLOAT64 * pInitialFluxes
Definition: CMathEnum.h:94
C_FLOAT64 * pParticleFluxes
Definition: CMathEnum.h:102
CMathObject * pFluxesObject
Definition: CMathEnum.h:130
iterator end()
std::vector< CType * >::const_iterator const_iterator
Definition: CCopasiVector.h:57
CMathObject * pParticleFluxesObject
Definition: CMathEnum.h:129
C_FLOAT64 * pInitialParticleFluxes
Definition: CMathEnum.h:93
static void initialize(CMathObject *&pObject, C_FLOAT64 *&pValue, const CMath::ValueType &valueType, const CMath::EntityType &entityType, const CMath::SimulationType &simulationType, const bool &isIntensiveProperty, const bool &isInitialValue, const CCopasiObject *pDataObject)
Definition: CMathObject.cpp:23
CMathObject * pInitialFluxesObject
Definition: CMathEnum.h:121
CMathObject * pPropensitiesObject
Definition: CMathEnum.h:139
void map(CCopasiObject *pDataObject, CMathObject *pMathObject)
C_FLOAT64 * pFluxes
Definition: CMathEnum.h:103
CMathObject * pInitialParticleFluxesObject
Definition: CMathEnum.h:120
void CMathContainer::initializeMathObjects ( const CCopasiVector< CMoiety > &  moieties,
CMath::sPointers p 
)
private

Initialize several mathematical objects for local reaction parameters and advance relevant pointers

Parameters
constCCopasiVector< CMoiety > & moieties
CMathContainer::sPointers& p

Definition at line 1744 of file CMathContainer.cpp.

References CCopasiVector< T >::begin(), CMath::DependentMass, CCopasiVector< T >::end(), CMathObject::initialize(), map(), CMath::Moiety, CMath::sPointers::pDependentMasses, CMath::sPointers::pDependentMassesObject, CMath::sPointers::pInitialTotalMasses, CMath::sPointers::pInitialTotalMassesObject, CMath::sPointers::pTotalMasses, CMath::sPointers::pTotalMassesObject, CMath::SimulationTypeUndefined, and CMath::TotalMass.

1746 {
1747  // Process reactions.
1750 
1751  for (; it != end; ++it)
1752  {
1753  // Initial Total Mass
1756  (*it)->getTotalNumberReference());
1757 
1758  // Total Mass
1759  map((*it)->getTotalNumberReference(), p.pTotalMassesObject);
1762  (*it)->getTotalNumberReference());
1763 
1764  // Dependent
1765  map((*it)->getDependentNumberReference(), p.pDependentMassesObject);
1768  (*it)->getDependentNumberReference());
1769  }
1770 }
CMathObject * pInitialTotalMassesObject
Definition: CMathEnum.h:122
iterator begin()
C_FLOAT64 * pTotalMasses
Definition: CMathEnum.h:104
iterator end()
static void initialize(CMathObject *&pObject, C_FLOAT64 *&pValue, const CMath::ValueType &valueType, const CMath::EntityType &entityType, const CMath::SimulationType &simulationType, const bool &isIntensiveProperty, const bool &isInitialValue, const CCopasiObject *pDataObject)
Definition: CMathObject.cpp:23
CMathObject * pDependentMassesObject
Definition: CMathEnum.h:140
C_FLOAT64 * pInitialTotalMasses
Definition: CMathEnum.h:95
C_FLOAT64 * pDependentMasses
Definition: CMathEnum.h:113
void map(CCopasiObject *pDataObject, CMathObject *pMathObject)
CMathObject * pTotalMassesObject
Definition: CMathEnum.h:131
void CMathContainer::initializeObjects ( CMath::sPointers pointers)
private

Initialize the objects

Parameters
sPointers& pointers

Definition at line 974 of file CMathContainer.cpp.

References CObjectLists::ALL_LOCAL_PARAMETER_VALUES, CModelEntity::ASSIGNMENT, CMath::Assignment, CStateTemplate::beginDependent(), CStateTemplate::beginFixed(), CStateTemplate::beginIndependent(), CMath::Dependent, CMath::Discontinuous, CStateTemplate::endDependent(), CStateTemplate::endFixed(), CStateTemplate::endIndependent(), CMath::Event, CMath::EventTarget, CMath::Fixed, CObjectLists::getEventTargets(), CModelEntity::getInitialValueReference(), CObjectLists::getListOfConstObjects(), CModel::getMoieties(), CModelEntity::getRateReference(), CModel::getReactions(), CModel::getStateTemplate(), CModelEntity::getStatus(), CModelEntity::getValueReference(), CMath::Independent, CMathObject::initialize(), initializeMathObjects(), map(), mAssignmentCount, mDependentCount, mDiscontinuous, mEventTargetCount, mFixedCount, mIndependentCount, mODECount, CMath::Model, mpModel, CModelEntity::ODE, CMath::ODE, CMath::sPointers::pDiscontinuous, CMath::sPointers::pDiscontinuousObject, CMath::sPointers::pExtensiveRates, CMath::sPointers::pExtensiveRatesObject, CMath::sPointers::pExtensiveValues, CMath::sPointers::pExtensiveValuesObject, CMath::sPointers::pInitialExtensiveRates, CMath::sPointers::pInitialExtensiveRatesObject, CMath::sPointers::pInitialExtensiveValues, CMath::sPointers::pInitialExtensiveValuesObject, CMath::Rate, CModelEntity::REACTIONS, CMath::SimulationTypeUndefined, CVectorCore< CType >::size(), CMath::Time, and CMath::Value.

Referenced by init().

975 {
976  std::set< const CModelEntity * > EventTargets = CObjectLists::getEventTargets(mpModel);
977 
978  std::vector< const CModelEntity * > FixedEntities;
979  std::vector< const CModelEntity * > FixedEventTargetEntities;
980 
981  const CStateTemplate & StateTemplate = mpModel->getStateTemplate();
982 
983  // Determine which fixed entities are modified by events and which not.
984  CModelEntity *const* ppEntities = StateTemplate.beginFixed();
985  CModelEntity *const* ppEntitiesEnd = StateTemplate.endFixed();
986 
987  for (; ppEntities != ppEntitiesEnd; ++ppEntities)
988  {
989  if ((*ppEntities)->getStatus() == CModelEntity::ASSIGNMENT)
990  continue;
991 
992  if (EventTargets.find(*ppEntities) == EventTargets.end())
993  {
994  FixedEntities.push_back(*ppEntities);
995  }
996  else
997  {
998  FixedEventTargetEntities.push_back(*ppEntities);
999  }
1000  }
1001 
1002  // Process fixed entities which are not event targets.
1003  initializeMathObjects(FixedEntities, CMath::Fixed, p);
1004  mFixedCount = FixedEntities.size();
1005 
1006  // Process local reaction parameters
1007  std::vector<const CCopasiObject*> LocalReactionParameter =
1009  initializeMathObjects(LocalReactionParameter, p);
1010  mFixedCount += LocalReactionParameter.size();
1011 
1012  // Process fixed entities which are event targets.
1013  initializeMathObjects(FixedEventTargetEntities, CMath::EventTarget, p);
1014  mEventTargetCount = FixedEventTargetEntities.size();
1015 
1016  // The simulation time
1017  // Extensive Initial Value
1018  map(mpModel->getInitialValueReference(), p.pInitialExtensiveValuesObject);
1019  CMathObject::initialize(p.pInitialExtensiveValuesObject, p.pInitialExtensiveValues,
1020  CMath::Value, CMath::Model, CMath::Time, false, true,
1022 
1023  // Extensive Value
1024  map(mpModel->getValueReference(), p.pExtensiveValuesObject);
1025  CMathObject::initialize(p.pExtensiveValuesObject, p.pExtensiveValues,
1026  CMath::Value, CMath::Model, CMath::Time, false, false,
1028 
1029  // Initial Extensive Rate
1030  CMathObject::initialize(p.pInitialExtensiveRatesObject, p.pInitialExtensiveRates,
1031  CMath::Rate, CMath::Model, CMath::Time, false, true,
1033  // Extensive Rate
1034  map(mpModel->getRateReference(), p.pExtensiveRatesObject);
1035  CMathObject::initialize(p.pExtensiveRatesObject, p.pExtensiveRates,
1036  CMath::Rate, CMath::Model, CMath::Time, false, false,
1038 
1039  // Process entities which are determined by ODEs
1040  std::vector< const CModelEntity * > ODEEntities;
1041 
1042  ppEntities = StateTemplate.beginIndependent();
1043  ppEntitiesEnd = StateTemplate.endIndependent();
1044 
1045  for (; ppEntities != ppEntitiesEnd && (*ppEntities)->getStatus() == CModelEntity::ODE; ++ppEntities)
1046  {
1047  ODEEntities.push_back(*ppEntities);
1048  }
1049 
1050  initializeMathObjects(ODEEntities, CMath::ODE, p);
1051  mODECount = ODEEntities.size();
1052 
1053  // Process independent species
1054  std::vector< const CModelEntity * > IndependentSpecies;
1055 
1056  ppEntities = StateTemplate.beginIndependent();
1057  ppEntitiesEnd = StateTemplate.endIndependent();
1058 
1059  for (; ppEntities != ppEntitiesEnd; ++ppEntities)
1060  {
1061  if ((*ppEntities)->getStatus() != CModelEntity::REACTIONS)
1062  continue;
1063 
1064  IndependentSpecies.push_back(*ppEntities);
1065  }
1066 
1067  initializeMathObjects(IndependentSpecies, CMath::Independent, p);
1068  mIndependentCount = IndependentSpecies.size();
1069 
1070  // Process dependent species
1071  std::vector< const CModelEntity * > DependentSpecies;
1072 
1073  ppEntities = StateTemplate.beginDependent();
1074  ppEntitiesEnd = StateTemplate.endDependent();
1075 
1076  for (; ppEntities != ppEntitiesEnd && (*ppEntities)->getStatus() == CModelEntity::REACTIONS; ++ppEntities)
1077  {
1078  DependentSpecies.push_back(*ppEntities);
1079  }
1080 
1081  initializeMathObjects(DependentSpecies, CMath::Dependent, p);
1082  mDependentCount = DependentSpecies.size();
1083 
1084  // Process entities which are determined by assignments
1085  std::vector< const CModelEntity * > AssignmentEntities;
1086 
1087  // We continue with the pointer ppEntities
1088  ppEntitiesEnd = StateTemplate.endFixed();
1089 
1090  for (; ppEntities != ppEntitiesEnd && (*ppEntities)->getStatus() == CModelEntity::ASSIGNMENT; ++ppEntities)
1091  {
1092  AssignmentEntities.push_back(*ppEntities);
1093  }
1094 
1095  initializeMathObjects(AssignmentEntities, CMath::Assignment, p);
1096  mAssignmentCount = AssignmentEntities.size();
1097 
1098  // Process Reactions
1100 
1101  // Process Moieties
1103 
1104  // Process Discontinuous Objects
1105  size_t n, nDiscontinuous = mDiscontinuous.size();
1106 
1107  for (n = 0; n != nDiscontinuous; ++n)
1108  {
1109  CMathObject::initialize(p.pDiscontinuousObject, p.pDiscontinuous,
1111  false, false, NULL);
1112  }
1113 }
static std::vector< const CCopasiObject * > getListOfConstObjects(ListType t, const CModel *model)
CCopasiObject * getInitialValueReference() const
CModelEntity ** endDependent()
Definition: CState.cpp:211
size_t mDependentCount
CModelEntity ** beginDependent()
Definition: CState.cpp:210
const CCopasiVector< CMoiety > & getMoieties() const
Definition: CModel.cpp:1163
void initializeMathObjects(const std::vector< const CModelEntity * > &entities, const CMath::SimulationType &simulationType, CMath::sPointers &pointers)
CModelEntity ** endFixed()
Definition: CState.cpp:213
CModelEntity ** beginFixed()
Definition: CState.cpp:212
size_t mAssignmentCount
CVectorCore< C_FLOAT64 > mDiscontinuous
CModelEntity ** beginIndependent()
Definition: CState.cpp:208
size_t mIndependentCount
size_t size() const
Definition: CVector.h:100
static void initialize(CMathObject *&pObject, C_FLOAT64 *&pValue, const CMath::ValueType &valueType, const CMath::EntityType &entityType, const CMath::SimulationType &simulationType, const bool &isIntensiveProperty, const bool &isInitialValue, const CCopasiObject *pDataObject)
Definition: CMathObject.cpp:23
const CStateTemplate & getStateTemplate() const
Definition: CModel.cpp:1172
size_t mEventTargetCount
CCopasiVectorNS< CReaction > & getReactions()
Definition: CModel.cpp:1039
const CModelEntity::Status & getStatus() const
CCopasiObject * getRateReference() const
void map(CCopasiObject *pDataObject, CMathObject *pMathObject)
CModelEntity ** endIndependent()
Definition: CState.cpp:209
static std::set< const CModelEntity * > getEventTargets(const CModel *pModel)
CCopasiObject * getValueReference() const
void CMathContainer::initializePointers ( CMath::sPointers pointers)
private

Initialize the pointers

Parameters
sPointers& pointers

Definition at line 1393 of file CMathContainer.cpp.

References CVectorCore< CType >::array(), C_FLOAT64, mDependentMasses, mDiscontinuous, mEventAssignments, mEventDelays, mEventPriorities, mEventRoots, mEventRootStates, mEventTriggers, mExtensiveRates, mExtensiveValues, mFluxes, mInitialEventTriggers, mInitialExtensiveRates, mInitialExtensiveValues, mInitialFluxes, mInitialIntensiveRates, mInitialIntensiveValues, mInitialParticleFluxes, mInitialTotalMasses, mIntensiveRates, mIntensiveValues, mObjects, mParticleFluxes, mPropensities, mTotalMasses, mValues, CMath::sPointers::pDependentMasses, CMath::sPointers::pDependentMassesObject, CMath::sPointers::pDiscontinuous, CMath::sPointers::pDiscontinuousObject, CMath::sPointers::pEventAssignments, CMath::sPointers::pEventAssignmentsObject, CMath::sPointers::pEventDelays, CMath::sPointers::pEventDelaysObject, CMath::sPointers::pEventPriorities, CMath::sPointers::pEventPrioritiesObject, CMath::sPointers::pEventRoots, CMath::sPointers::pEventRootsObject, CMath::sPointers::pEventRootStates, CMath::sPointers::pEventRootStatesObject, CMath::sPointers::pEventTriggers, CMath::sPointers::pEventTriggersObject, CMath::sPointers::pExtensiveRates, CMath::sPointers::pExtensiveRatesObject, CMath::sPointers::pExtensiveValues, CMath::sPointers::pExtensiveValuesObject, CMath::sPointers::pFluxes, CMath::sPointers::pFluxesObject, CMath::sPointers::pInitialEventTriggers, CMath::sPointers::pInitialEventTriggersObject, CMath::sPointers::pInitialExtensiveRates, CMath::sPointers::pInitialExtensiveRatesObject, CMath::sPointers::pInitialExtensiveValues, CMath::sPointers::pInitialExtensiveValuesObject, CMath::sPointers::pInitialFluxes, CMath::sPointers::pInitialFluxesObject, CMath::sPointers::pInitialIntensiveRates, CMath::sPointers::pInitialIntensiveRatesObject, CMath::sPointers::pInitialIntensiveValues, CMath::sPointers::pInitialIntensiveValuesObject, CMath::sPointers::pInitialParticleFluxes, CMath::sPointers::pInitialParticleFluxesObject, CMath::sPointers::pInitialTotalMasses, CMath::sPointers::pInitialTotalMassesObject, CMath::sPointers::pIntensiveRates, CMath::sPointers::pIntensiveRatesObject, CMath::sPointers::pIntensiveValues, CMath::sPointers::pIntensiveValuesObject, CMath::sPointers::pParticleFluxes, CMath::sPointers::pParticleFluxesObject, CMath::sPointers::pPropensities, CMath::sPointers::pPropensitiesObject, CMath::sPointers::pTotalMasses, and CMath::sPointers::pTotalMassesObject.

Referenced by init().

1394 {
1395  p.pInitialExtensiveValues = mInitialExtensiveValues.array();
1396  p.pInitialIntensiveValues = mInitialIntensiveValues.array();
1397  p.pInitialExtensiveRates = mInitialExtensiveRates.array();
1398  p.pInitialIntensiveRates = mInitialIntensiveRates.array();
1399  p.pInitialParticleFluxes = mInitialParticleFluxes.array();
1400  p.pInitialFluxes = mInitialFluxes.array();
1401  p.pInitialTotalMasses = mInitialTotalMasses.array();
1402  p.pInitialEventTriggers = mInitialEventTriggers.array();
1403 
1404  p.pExtensiveValues = mExtensiveValues.array();
1405  p.pIntensiveValues = mIntensiveValues.array();
1406  p.pExtensiveRates = mExtensiveRates.array();
1407  p.pIntensiveRates = mIntensiveRates.array();
1408  p.pParticleFluxes = mParticleFluxes.array();
1409  p.pFluxes = mFluxes.array();
1410  p.pTotalMasses = mTotalMasses.array();
1411  p.pEventTriggers = mEventTriggers.array();
1412 
1413  p.pEventDelays = mEventDelays.array();
1414  p.pEventPriorities = mEventPriorities.array();
1415  p.pEventAssignments = mEventAssignments.array();
1416  p.pEventRoots = mEventRoots.array();
1417  p.pEventRootStates = mEventRootStates.array();
1418  p.pPropensities = mPropensities.array();
1419  p.pDependentMasses = mDependentMasses.array();
1420  p.pDiscontinuous = mDiscontinuous.array();
1421 
1422  C_FLOAT64 * pValues = mValues.array();
1423  CMathObject * pObjects = mObjects.array();
1424 
1425  p.pInitialExtensiveValuesObject = pObjects + (p.pInitialExtensiveValues - pValues);
1426  p.pInitialIntensiveValuesObject = pObjects + (p.pInitialIntensiveValues - pValues);
1427  p.pInitialExtensiveRatesObject = pObjects + (p.pInitialExtensiveRates - pValues);
1428  p.pInitialIntensiveRatesObject = pObjects + (p.pInitialIntensiveRates - pValues);
1429  p.pInitialParticleFluxesObject = pObjects + (p.pInitialParticleFluxes - pValues);
1430  p.pInitialFluxesObject = pObjects + (p.pInitialFluxes - pValues);
1431  p.pInitialTotalMassesObject = pObjects + (p.pInitialTotalMasses - pValues);
1432  p.pInitialEventTriggersObject = pObjects + (p.pInitialEventTriggers - pValues);
1433 
1434  p.pExtensiveValuesObject = pObjects + (p.pExtensiveValues - pValues);
1435  p.pIntensiveValuesObject = pObjects + (p.pIntensiveValues - pValues);
1436  p.pExtensiveRatesObject = pObjects + (p.pExtensiveRates - pValues);
1437  p.pIntensiveRatesObject = pObjects + (p.pIntensiveRates - pValues);
1438  p.pParticleFluxesObject = pObjects + (p.pParticleFluxes - pValues);
1439  p.pFluxesObject = pObjects + (p.pFluxes - pValues);
1440  p.pTotalMassesObject = pObjects + (p.pTotalMasses - pValues);
1441  p.pEventTriggersObject = pObjects + (p.pEventTriggers - pValues);
1442 
1443  p.pEventDelaysObject = pObjects + (p.pEventDelays - pValues);
1444  p.pEventPrioritiesObject = pObjects + (p.pEventPriorities - pValues);
1445  p.pEventAssignmentsObject = pObjects + (p.pEventAssignments - pValues);
1446  p.pEventRootsObject = pObjects + (p.pEventRoots - pValues);
1447  p.pEventRootStatesObject = pObjects + (p.pEventRootStates - pValues);
1448  p.pPropensitiesObject = pObjects + (p.pPropensities - pValues);
1449  p.pDependentMassesObject = pObjects + (p.pDependentMasses - pValues);
1450  p.pDiscontinuousObject = pObjects + (p.pDiscontinuous - pValues);
1451 }
CVector< CMathObject > mObjects
CVectorCore< C_FLOAT64 > mEventAssignments
CVectorCore< C_FLOAT64 > mParticleFluxes
CVector< C_FLOAT64 > mValues
CVectorCore< C_FLOAT64 > mExtensiveValues
CVectorCore< C_FLOAT64 > mInitialIntensiveValues
CVectorCore< C_FLOAT64 > mTotalMasses
CVectorCore< C_FLOAT64 > mPropensities
CVectorCore< C_FLOAT64 > mEventTriggers
CVectorCore< C_FLOAT64 > mEventRoots
CVectorCore< C_FLOAT64 > mDiscontinuous
CVectorCore< C_FLOAT64 > mInitialEventTriggers
CVectorCore< C_FLOAT64 > mEventRootStates
CVectorCore< C_FLOAT64 > mEventDelays
CVectorCore< C_FLOAT64 > mDependentMasses
#define C_FLOAT64
Definition: copasi.h:92
CVectorCore< C_FLOAT64 > mExtensiveRates
CType * array()
Definition: CVector.h:139
CVectorCore< C_FLOAT64 > mInitialTotalMasses
CVectorCore< C_FLOAT64 > mIntensiveValues
CVectorCore< C_FLOAT64 > mIntensiveRates
CVectorCore< C_FLOAT64 > mInitialExtensiveValues
CVectorCore< C_FLOAT64 > mInitialFluxes
CVectorCore< C_FLOAT64 > mInitialIntensiveRates
CVectorCore< C_FLOAT64 > mFluxes
CVectorCore< C_FLOAT64 > mInitialParticleFluxes
CVectorCore< C_FLOAT64 > mEventPriorities
CVectorCore< C_FLOAT64 > mInitialExtensiveRates
void CMathContainer::map ( CCopasiObject pDataObject,
CMathObject pMathObject 
)
private

Map the data object to the math object

Parameters
CCopasiObject* pDataObject
CMathObject* pMathObject

Definition at line 1785 of file CMathContainer.cpp.

References C_FLOAT64, CCopasiObject::getValuePointer(), mDataObject2MathObject, and mDataValue2MathObject.

Referenced by initializeMathObjects(), and initializeObjects().

1786 {
1787  if (pDataObject != NULL)
1788  {
1789  mDataObject2MathObject[pDataObject] = pMathObject;
1790  mDataValue2MathObject[(C_FLOAT64 *) pDataObject->getValuePointer()] = pMathObject;
1791  }
1792 }
std::map< CCopasiObject *, CMathObject * > mDataObject2MathObject
std::map< C_FLOAT64 *, CMathObject * > mDataValue2MathObject
#define C_FLOAT64
Definition: copasi.h:92
virtual void * getValuePointer() const
void CMathContainer::pushInitialState ( )

Push the initial state to the associated model

Definition at line 461 of file CMathContainer.cpp.

References CVectorCore< CType >::array(), C_FLOAT64, CMathObject::getDataObject(), CCopasiObject::getValuePointer(), mInitialState, mObjects, and CVectorCore< CType >::size().

462 {
463  C_FLOAT64 * pValue = mInitialState.array();
464  C_FLOAT64 * pValueEnd = pValue + mInitialState.size();
465  CMathObject * pObject = mObjects.array();
466 
467  for (; pValue != pValueEnd; ++pValue, ++pObject)
468  {
469  const CCopasiObject * pDataObject = pObject->getDataObject();
470 
471  if (pDataObject != NULL)
472  {
473  *(C_FLOAT64 *)pDataObject->getValuePointer() = *pValue;
474  }
475  }
476 
477  return;
478 }
CVector< CMathObject > mObjects
size_t size() const
Definition: CVector.h:100
CVectorCore< C_FLOAT64 > mInitialState
#define C_FLOAT64
Definition: copasi.h:92
CType * array()
Definition: CVector.h:139
virtual void * getValuePointer() const
const CCopasiObject * getDataObject() const
void CMathContainer::pushState ( )

Push the state to the associated model

Definition at line 499 of file CMathContainer.cpp.

References CVectorCore< CType >::array(), C_FLOAT64, CMathObject::getDataObject(), CCopasiObject::getValuePointer(), mObjects, mState, and CVectorCore< CType >::size().

500 {
501  C_FLOAT64 * pValue = mState.array();
502  C_FLOAT64 * pValueEnd = pValue + mState.size();
503  CMathObject * pObject = mObjects.array();
504 
505  for (; pValue != pValueEnd; ++pValue, ++pObject)
506  {
507  const CCopasiObject * pDataObject = pObject->getDataObject();
508 
509  if (pDataObject != NULL)
510  {
511  *(C_FLOAT64 *)pDataObject->getValuePointer() = *pValue;
512  }
513  }
514 
515  return;
516 }
CVector< CMathObject > mObjects
size_t size() const
Definition: CVector.h:100
CVectorCore< C_FLOAT64 > mState
#define C_FLOAT64
Definition: copasi.h:92
CType * array()
Definition: CVector.h:139
virtual void * getValuePointer() const
const CCopasiObject * getDataObject() const
CEvaluationNode * CMathContainer::replaceDiscontinuousNode ( const CEvaluationNode pSrc,
const std::vector< CEvaluationNode * > &  children 
)

Replace a discontinuous node by an object node pointing to newly created math objects, which are targets of automatically generated events.

Parameters
constCEvaluationNode * pSrc
conststd::vector< CEvaluationNode * > & children
Returns
CEvaluationNode * pCopy

Definition at line 780 of file CMathContainer.cpp.

References CMathEventN::addAssignment(), CEvaluationNode::buildInfix(), C_FLOAT64, CEvaluationNode::copyNode(), createDiscontinuityTriggerInfix(), CMathObject::getValuePointer(), mCreateDiscontinuousPointer, mDiscontinuityInfix2Object, mTriggerInfix2Event, pdelete, CMathContainer::sDiscontinuous::pDiscontinuous, CMathContainer::sDiscontinuous::pEvent, CMathObject::setExpressionPtr(), and CMathEventN::setTriggerExpression().

Referenced by copyBranch().

782 {
783  bool success = true;
784 
785  CEvaluationNode * pNode = pSrc->copyNode(children);
786  std::string DiscontinuityInfix = pNode->buildInfix();
787 
788  // Check whether we have the discontinuous node already created. This can happen if the
789  // discontinuity was part of an expression for a variable in a function call.
790  std::map< std::string, CMathObject * >::iterator itObject = mDiscontinuityInfix2Object.find(DiscontinuityInfix);
791 
792  if (itObject != mDiscontinuityInfix2Object.end())
793  {
794  // No need to copy we have already on object
795  CMathObject * pDiscontinuity = itObject->second;
796 
797  // We need to advance both creation pointer to assure that we have the correct allocation
800 
801  pdelete(pNode);
802 
803  // Return a pointer to a node pointing to the value of discontinuous object.
804  return new CEvaluationNodeObject((C_FLOAT64 *) pDiscontinuity->getValuePointer());
805  }
806 
807  // We have a new discontinuity
810 
811  // Map the discontinuity infix to the discontinuous object.
812  mDiscontinuityInfix2Object[DiscontinuityInfix] = pDiscontinuity;
813 
814  // Create the expression to calculate the discontinuous object
815  CMathExpression * pExpression = new CMathExpression("DiscontinuousExpression", *this);
816  success &= static_cast< CEvaluationTree * >(pExpression)->setRoot(pNode);
817  success &= pDiscontinuity->setExpressionPtr(pExpression);
818 
819  CMathEventN * pEvent = NULL;
820 
821  // Check whether we have already an event with the current trigger
822  std::string TriggerInfix = createDiscontinuityTriggerInfix(pNode);
823  std::map< std::string, CMathEventN * >::iterator itEvent = mTriggerInfix2Event.find(TriggerInfix);
824 
825  // We need to create an event.
826  if (itEvent == mTriggerInfix2Event.end())
827  {
829 
830  // Set the trigger
831  pEvent->setTriggerExpression(TriggerInfix, *this);
832 
833  // Map the trigger infix to the event.
834  mTriggerInfix2Event[TriggerInfix] = pEvent;
835  }
836  else
837  {
838  pEvent = itEvent->second;
839  }
840 
842 
843  // Add the current discontinuity as an assignment.
844  pEvent->addAssignment(pDiscontinuity, pDiscontinuity);
845 
846  // Return a pointer to a node pointing to the value of discontinuous object.
847  return new CEvaluationNodeObject((C_FLOAT64 *) pDiscontinuity->getValuePointer());
848 }
std::string createDiscontinuityTriggerInfix(const CEvaluationNode *pNode)
#define pdelete(p)
Definition: copasi.h:215
void setTriggerExpression(const std::string &infix, CMathContainer &container)
Definition: CMathEvent.cpp:972
CEvaluationNode * copyNode(CEvaluationNode *child1, CEvaluationNode *child2) const
sDiscontinuous mCreateDiscontinuousPointer
std::string buildInfix() const
virtual void * getValuePointer() const
void addAssignment(CMathObject *pTarget, CMathObject *pExpression)
Definition: CMathEvent.cpp:991
std::map< std::string, CMathObject * > mDiscontinuityInfix2Object
std::map< std::string, CMathEventN * > mTriggerInfix2Event
#define C_FLOAT64
Definition: copasi.h:92
bool setExpressionPtr(CMathExpression *pMathExpression)
void CMathContainer::setInitialState ( const CVectorCore< C_FLOAT64 > &  initialState)

Set the initial state values, i.e., all initial values of objects of simulation type Fixed, Time, ODE, Dependent, and Independent. It includes only extensive values for species.

Parameters
constCVectorCore< C_FLOAT64 > & initialState

Definition at line 354 of file CMathContainer.cpp.

References CVectorCore< CType >::array(), C_FLOAT64, mInitialState, and CVectorCore< CType >::size().

355 {
356  assert(mInitialState.size() == initialState.size());
357 
358  memcpy(mInitialState.array(), initialState.array(), mInitialState.size() * sizeof(C_FLOAT64));
359 }
size_t size() const
Definition: CVector.h:100
CVectorCore< C_FLOAT64 > mInitialState
#define C_FLOAT64
Definition: copasi.h:92
CType * array()
Definition: CVector.h:139
void CMathContainer::setState ( const CVectorCore< C_FLOAT64 > &  state)

Set the state values, i.e., all initial values of objects of simulation type Time, ODE, Dependent, and Independent. It includes only extensive values for species.

Parameters
constCVectorCore< C_FLOAT64 > & state

Definition at line 371 of file CMathContainer.cpp.

References CVectorCore< CType >::array(), C_FLOAT64, mState, and CVectorCore< CType >::size().

372 {
373  assert(mState.size() == state.size());
374 
375  memcpy(mState.array(), state.array(), mState.size() * sizeof(C_FLOAT64));
376 }
size_t size() const
Definition: CVector.h:100
CVectorCore< C_FLOAT64 > mState
#define C_FLOAT64
Definition: copasi.h:92
CType * array()
Definition: CVector.h:139
void CMathContainer::setStateReduced ( const CVectorCore< C_FLOAT64 > &  stateReduced)

Set the reduced state values, i.e., all initial values of objects of simulation type Time, ODE, Dependent, and Independent. It includes only extensive values for species.

Parameters
constCVectorCore< C_FLOAT64 > & stateReduced

Definition at line 388 of file CMathContainer.cpp.

References CVectorCore< CType >::array(), C_FLOAT64, mStateReduced, and CVectorCore< CType >::size().

389 {
390  assert(mStateReduced.size() == stateReduced.size());
391 
392  memcpy(mStateReduced.array(), stateReduced.array(), mStateReduced.size() * sizeof(C_FLOAT64));
393 }
CVectorCore< C_FLOAT64 > mStateReduced
size_t size() const
Definition: CVector.h:100
#define C_FLOAT64
Definition: copasi.h:92
CType * array()
Definition: CVector.h:139
void CMathContainer::setValues ( const CVectorCore< C_FLOAT64 > &  values)

Set the values of all mathematical objects

Parameters
constCVectorCore< C_FLOAT64 > & values

Definition at line 337 of file CMathContainer.cpp.

References mValues, and CVectorCore< CType >::size().

338 {
339  assert(mValues.size() == values.size());
340 
341  mValues = values;
342 }
CVector< C_FLOAT64 > mValues
size_t size() const
Definition: CVector.h:100
void CMathContainer::updateInitialValues ( const CModelParameter::Framework framework)

Calculate all dependent initial values based on initial extensive or intensive values

Parameters
constCModelParameter::Framework & framework

Definition at line 395 of file CMathContainer.cpp.

References applyUpdateSequence(), CModelParameter::Concentration, mSynchronizeInitialValuesSequenceExtensive, mSynchronizeInitialValuesSequenceIntensive, and CModelParameter::ParticleNumbers.

Referenced by init().

396 {
397  switch (framework)
398  {
401  break;
402 
405  break;
406  }
407 }
CObjectInterface::UpdateSequence mSynchronizeInitialValuesSequenceIntensive
CObjectInterface::UpdateSequence mSynchronizeInitialValuesSequenceExtensive
void applyUpdateSequence(const CObjectInterface::UpdateSequence &updateSequence)
void CMathContainer::updateSimulatedValues ( const bool &  useMoieties)

Calculate all values required for simulation based on the current state

Parameters
constbool & useMoieties

Definition at line 419 of file CMathContainer.cpp.

References applyUpdateSequence(), mSimulationValuesSequence, and mSimulationValuesSequenceReduced.

420 {
421  if (useMoieties)
422  {
424  }
425  else
426  {
428  }
429 }
CObjectInterface::UpdateSequence mSimulationValuesSequence
CObjectInterface::UpdateSequence mSimulationValuesSequenceReduced
void applyUpdateSequence(const CObjectInterface::UpdateSequence &updateSequence)

Member Data Documentation

CObjectInterface::UpdateSequence CMathContainer::mApplyInitialValuesSequence
private

The sequence of updates needed to apply the initial values

Definition at line 542 of file CMathContainer.h.

Referenced by applyInitialValues(), and createApplyInitialValuesSequence().

size_t CMathContainer::mAssignmentCount
private

Definition at line 500 of file CMathContainer.h.

Referenced by initializeObjects().

sDiscontinuous CMathContainer::mCreateDiscontinuousPointer
private

Structure of pointers used for creating discontinuities.

Definition at line 610 of file CMathContainer.h.

Referenced by initializeDiscontinuousCreationPointer(), and replaceDiscontinuousNode().

std::map< CCopasiObject *, CMathObject * > CMathContainer::mDataObject2MathObject
private

A map from data objects to math objects

Definition at line 615 of file CMathContainer.h.

Referenced by CMathContainer(), getMathObject(), and map().

std::map< C_FLOAT64 *, CMathObject * > CMathContainer::mDataValue2MathObject
private

A map from data objects values to math objects

Definition at line 620 of file CMathContainer.h.

Referenced by CMathContainer(), getMathObject(), and map().

size_t CMathContainer::mDependentCount
private

Definition at line 499 of file CMathContainer.h.

Referenced by allocate(), and initializeObjects().

CVectorCore< C_FLOAT64 > CMathContainer::mDependentMasses
private

Definition at line 492 of file CMathContainer.h.

Referenced by allocate(), CMathContainer(), and initializePointers().

CCopasiVector< CEvent > CMathContainer::mDiscontinuityEvents
private

A vector of data events for discontinuities

Definition at line 625 of file CMathContainer.h.

Referenced by allocate(), createDiscontinuityDataEvent(), and init().

std::map< std::string, CMathObject * > CMathContainer::mDiscontinuityInfix2Object
private

A map from the infix of the expression of a discontinuity to the object representing it.

Definition at line 631 of file CMathContainer.h.

Referenced by init(), and replaceDiscontinuousNode().

CVectorCore< C_FLOAT64 > CMathContainer::mDiscontinuous
private
CVectorCore< C_FLOAT64 > CMathContainer::mEventAssignments
private

Definition at line 488 of file CMathContainer.h.

Referenced by allocate(), CMathContainer(), and initializePointers().

CVectorCore< C_FLOAT64 > CMathContainer::mEventDelays
private
CVectorCore< C_FLOAT64 > CMathContainer::mEventPriorities
private

Definition at line 487 of file CMathContainer.h.

Referenced by allocate(), CMathContainer(), and initializePointers().

CVectorCore< C_FLOAT64 > CMathContainer::mEventRoots
private
CVectorCore< C_FLOAT64 > CMathContainer::mEventRootStates
private
CVector< CMathEventN > CMathContainer::mEvents
private

A vector containing all math events.

Definition at line 600 of file CMathContainer.h.

Referenced by allocate(), CMathContainer(), compileEvents(), initializeDiscontinuousCreationPointer(), and initializeEvents().

size_t CMathContainer::mEventTargetCount
private
CVectorCore< C_FLOAT64 > CMathContainer::mEventTriggers
private

Definition at line 484 of file CMathContainer.h.

Referenced by allocate(), CMathContainer(), and initializePointers().

CVectorCore< C_FLOAT64 > CMathContainer::mExtensiveRates
private
CVectorCore< C_FLOAT64 > CMathContainer::mExtensiveValues
private
size_t CMathContainer::mFixedCount
private
CVectorCore< C_FLOAT64 > CMathContainer::mFluxes
private

Definition at line 482 of file CMathContainer.h.

Referenced by allocate(), CMathContainer(), and initializePointers().

size_t CMathContainer::mIndependentCount
private

Definition at line 498 of file CMathContainer.h.

Referenced by allocate(), and initializeObjects().

CMathDependencyGraph CMathContainer::mInitialDependencies
private

Dependency graph for initial value calculations

Definition at line 520 of file CMathContainer.h.

Referenced by createDependencyGraphs(), and createSynchronizeInitialValuesSequence().

CVectorCore< C_FLOAT64 > CMathContainer::mInitialEventTriggers
private

Definition at line 475 of file CMathContainer.h.

Referenced by allocate(), CMathContainer(), and initializePointers().

CVectorCore< C_FLOAT64 > CMathContainer::mInitialExtensiveRates
private
CVectorCore< C_FLOAT64 > CMathContainer::mInitialExtensiveValues
private
CVectorCore< C_FLOAT64 > CMathContainer::mInitialFluxes
private

Definition at line 473 of file CMathContainer.h.

Referenced by allocate(), CMathContainer(), and initializePointers().

CVectorCore< C_FLOAT64 > CMathContainer::mInitialIntensiveRates
private

Definition at line 471 of file CMathContainer.h.

Referenced by allocate(), CMathContainer(), and initializePointers().

CVectorCore< C_FLOAT64 > CMathContainer::mInitialIntensiveValues
private

Definition at line 469 of file CMathContainer.h.

Referenced by allocate(), CMathContainer(), and initializePointers().

CVectorCore< C_FLOAT64 > CMathContainer::mInitialParticleFluxes
private

Definition at line 472 of file CMathContainer.h.

Referenced by allocate(), CMathContainer(), and initializePointers().

CVectorCore< C_FLOAT64 > CMathContainer::mInitialState
private

The initial state contains also all fixed values

Definition at line 505 of file CMathContainer.h.

Referenced by allocate(), CMathContainer(), fetchInitialState(), getInitialState(), pushInitialState(), and setInitialState().

CObjectInterface::ObjectSet CMathContainer::mInitialStateValueExtensive
private

The set of objects which determine the initial state of the model based on extensive values

Definition at line 560 of file CMathContainer.h.

Referenced by createSynchronizeInitialValuesSequence().

CObjectInterface::ObjectSet CMathContainer::mInitialStateValueIntensive
private

The set of objects which determine the initial state of the model based on intensive values

Definition at line 566 of file CMathContainer.h.

Referenced by createSynchronizeInitialValuesSequence().

CVectorCore< C_FLOAT64 > CMathContainer::mInitialTotalMasses
private

Definition at line 474 of file CMathContainer.h.

Referenced by allocate(), CMathContainer(), and initializePointers().

CVectorCore< C_FLOAT64 > CMathContainer::mIntensiveRates
private
CVectorCore< C_FLOAT64 > CMathContainer::mIntensiveValues
private

Definition at line 478 of file CMathContainer.h.

Referenced by allocate(), CMathContainer(), and initializePointers().

CVector< CMathObject > CMathContainer::mObjects
private

The objects which are required to be up to date for simulation of the reduced model, i.e., the right hand side of ODEs, rates of independent species determined by reaction, and event roots. A vector containing all math objects.

Definition at line 595 of file CMathContainer.h.

Referenced by allocate(), CMathContainer(), compileObjects(), createApplyInitialValuesSequence(), createDependencyGraphs(), createSynchronizeInitialValuesSequence(), createUpdateSimulationValuesSequence(), fetchInitialState(), fetchState(), getMathObject(), init(), initializeDiscontinuousCreationPointer(), initializePointers(), pushInitialState(), and pushState().

size_t CMathContainer::mODECount
private

Definition at line 497 of file CMathContainer.h.

Referenced by allocate(), and initializeObjects().

CVectorCore< C_FLOAT64 > CMathContainer::mParticleFluxes
private

Definition at line 481 of file CMathContainer.h.

Referenced by allocate(), CMathContainer(), and initializePointers().

const CObjectInterface* CMathContainer::mpAvogadro
private

Definition at line 463 of file CMathContainer.h.

Referenced by CMathContainer(), and createNodeFromObject().

CModel* CMathContainer::mpModel
private

A pointer to the data model which mathematics are contained

Definition at line 462 of file CMathContainer.h.

Referenced by allocate(), CMathContainer(), compileEvents(), createDiscontinuityEvents(), getCN(), getMathObject(), getModel(), getObject(), init(), and initializeObjects().

const CObjectInterface* CMathContainer::mpQuantity2NumberFactor
private

Definition at line 464 of file CMathContainer.h.

Referenced by CMathContainer(), and createNodeFromObject().

CVectorCore< C_FLOAT64 > CMathContainer::mPropensities
private

Definition at line 491 of file CMathContainer.h.

Referenced by allocate(), CMathContainer(), and initializePointers().

CVector< CMathReaction > CMathContainer::mReactions
private

A vector containing all math reactions.

Definition at line 605 of file CMathContainer.h.

Referenced by CMathContainer(), and init().

CObjectInterface::ObjectSet CMathContainer::mReducedStateValues
private

The set of objects which determine the transient state of the reduced model

Definition at line 576 of file CMathContainer.h.

Referenced by createUpdateSimulationValuesSequence().

CObjectInterface::ObjectSet CMathContainer::mSimulationRequiredValues
private

The objects which are required to be up to date for simulation of the full model, i.e., the right hand side of ODEs, rates of species determined by reaction, and event roots.

Definition at line 583 of file CMathContainer.h.

Referenced by createUpdateSimulationValuesSequence().

CObjectInterface::UpdateSequence CMathContainer::mSimulationValuesSequence
private

The sequence of updates needed to calculate all simulation required values based on the assumption that all state values may have changed

Definition at line 548 of file CMathContainer.h.

Referenced by createUpdateSimulationValuesSequence(), and updateSimulatedValues().

CObjectInterface::UpdateSequence CMathContainer::mSimulationValuesSequenceReduced
private

The sequence of updates needed to calculate all simulation required values based on the assumption that all state values may have changed

Definition at line 554 of file CMathContainer.h.

Referenced by createUpdateSimulationValuesSequence(), and updateSimulatedValues().

CVectorCore< C_FLOAT64 > CMathContainer::mState
private

The state contains values of type Time, ODE, Independent, and Dependent

Definition at line 510 of file CMathContainer.h.

Referenced by allocate(), CMathContainer(), fetchState(), getState(), pushState(), and setState().

CVectorCore< C_FLOAT64 > CMathContainer::mStateReduced
private

The state contains values of type Time, ODE, Independent

Definition at line 515 of file CMathContainer.h.

Referenced by allocate(), CMathContainer(), getStateReduced(), and setStateReduced().

CObjectInterface::ObjectSet CMathContainer::mStateValues
private

The set of objects which determine the transient state of the model

Definition at line 571 of file CMathContainer.h.

Referenced by createUpdateSimulationValuesSequence().

CObjectInterface::UpdateSequence CMathContainer::mSynchronizeInitialValuesSequenceExtensive
private

The sequence of updates needed to synchronize the initial values based on extensive values, i.e., species amounts

Definition at line 531 of file CMathContainer.h.

Referenced by createSynchronizeInitialValuesSequence(), and updateInitialValues().

CObjectInterface::UpdateSequence CMathContainer::mSynchronizeInitialValuesSequenceIntensive
private

The sequence of updates needed to synchronize the initial values based on intensive values, i.e., species concentrations.

Definition at line 537 of file CMathContainer.h.

Referenced by createSynchronizeInitialValuesSequence(), and updateInitialValues().

CVectorCore< C_FLOAT64 > CMathContainer::mTotalMasses
private

Definition at line 483 of file CMathContainer.h.

Referenced by allocate(), CMathContainer(), and initializePointers().

CMathDependencyGraph CMathContainer::mTransientDependencies
private

Dependency graph for transient value calculations

Definition at line 525 of file CMathContainer.h.

Referenced by createApplyInitialValuesSequence(), createDependencyGraphs(), and createUpdateSimulationValuesSequence().

std::map< std::string, CMathEventN * > CMathContainer::mTriggerInfix2Event
private

A map from the discontinuity trigger infix of to event representing it.

Definition at line 637 of file CMathContainer.h.

Referenced by init(), and replaceDiscontinuousNode().

CVector< C_FLOAT64 > CMathContainer::mValues
private

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