COPASI API  4.16.103
Public Member Functions | Private Attributes | List of all members
CMathReaction Class Reference

#include <CMathReaction.h>

Collaboration diagram for CMathReaction:
Collaboration graph
[legend]

Public Member Functions

 CMathReaction ()
 
void copy (const CMathReaction &src, CMathContainer &container, const size_t &valueOffset, const size_t &objectOffset)
 
void fire (const C_FLOAT64 &count)
 
const CMathObjectgetFluxObject () const
 
const CReactiongetModelReaction () const
 
const CObjectInterface::ObjectSetgetModifiedSpecies () const
 
const CMathObjectgetParticleFluxObject () const
 
const CMathObjectgetPropensityObject () const
 
void initialize (const CReaction *pReaction, CMathContainer &container)
 
 ~CMathReaction ()
 

Private Attributes

CObjectInterface::ObjectSet mModifiedSpecies
 
CMathObjectmpFlux
 
CMathObjectmpParticleFlux
 
CMathObjectmpPropensity
 
const CReactionmpReaction
 
CVector< std::pair< C_FLOAT64,
C_FLOAT64 * > > 
mStepUpdates
 

Detailed Description

Definition at line 18 of file CMathReaction.h.

Constructor & Destructor Documentation

CMathReaction::CMathReaction ( )

Constructor

Definition at line 13 of file CMathReaction.cpp.

13  :
14  mpReaction(NULL),
15  mpParticleFlux(NULL),
16  mpFlux(NULL),
17  mpPropensity(NULL),
19  mStepUpdates()
20 {}
CMathObject * mpParticleFlux
Definition: CMathReaction.h:92
CMathObject * mpPropensity
CObjectInterface::ObjectSet mModifiedSpecies
CMathObject * mpFlux
Definition: CMathReaction.h:97
CVector< std::pair< C_FLOAT64, C_FLOAT64 * > > mStepUpdates
const CReaction * mpReaction
Definition: CMathReaction.h:87
CMathReaction::~CMathReaction ( )

Destructor

Definition at line 22 of file CMathReaction.cpp.

23 {}

Member Function Documentation

void CMathReaction::copy ( const CMathReaction src,
CMathContainer container,
const size_t &  valueOffset,
const size_t &  objectOffset 
)

Copy an existing object

Parameters
constCMathReaction & src
CMathContainer& container
constsize_t & valueOffset
constsize_t & objectOffset

Definition at line 50 of file CMathReaction.cpp.

References CVectorCore< CType >::array(), mModifiedSpecies, mpFlux, mpParticleFlux, mpPropensity, mpReaction, mStepUpdates, CVector< CType >::resize(), and CVectorCore< CType >::size().

Referenced by CMathContainer::CMathContainer().

54 {
55  mpReaction = src.mpReaction;
56 
57  mpParticleFlux = src.mpParticleFlux + objectOffset;
58  mpFlux = src.mpFlux + objectOffset;
59  mpPropensity = src.mpPropensity + objectOffset;
60 
62  std::pair< C_FLOAT64, C_FLOAT64 * > * pStepUpdate = mStepUpdates.array();
63  std::pair< C_FLOAT64, C_FLOAT64 * > * pStepUpdateEnd = pStepUpdate + mStepUpdates.size();
64  const std::pair< C_FLOAT64, C_FLOAT64 * > * pStepUpdateSrc = src.mStepUpdates.array();
65 
66  for (; pStepUpdate != pStepUpdateEnd; ++pStepUpdate, ++pStepUpdateSrc)
67  {
68  pStepUpdate->first = pStepUpdateSrc->first;
69  pStepUpdate->second = pStepUpdateSrc->second + valueOffset;
70  }
71 
72  CObjectInterface::ObjectSet::const_iterator it = src.mModifiedSpecies.begin();
73  CObjectInterface::ObjectSet::const_iterator end = src.mModifiedSpecies.end();
74 
75  for (; it != end; ++it)
76  {
77  mModifiedSpecies.insert(*it + objectOffset);
78  }
79 }
CMathObject * mpParticleFlux
Definition: CMathReaction.h:92
CMathObject * mpPropensity
void resize(size_t size, const bool &copy=false)
Definition: CVector.h:301
CObjectInterface::ObjectSet mModifiedSpecies
CMathObject * mpFlux
Definition: CMathReaction.h:97
CVector< std::pair< C_FLOAT64, C_FLOAT64 * > > mStepUpdates
size_t size() const
Definition: CVector.h:100
const CReaction * mpReaction
Definition: CMathReaction.h:87
CType * array()
Definition: CVector.h:139
void CMathReaction::fire ( const C_FLOAT64 count)

Fire the reaction count times. Note count must not necessarily be an integer

Parameters
constC_FLOAT64 & count

Definition at line 81 of file CMathReaction.cpp.

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

82 {
83  std::pair< C_FLOAT64, C_FLOAT64 * > * pStepUpdate = mStepUpdates.array();
84  std::pair< C_FLOAT64, C_FLOAT64 * > * pStepUpdateEnd = pStepUpdate + mStepUpdates.size();
85 
86  for (; pStepUpdate != pStepUpdateEnd; ++pStepUpdate)
87  {
88  *pStepUpdate->second += pStepUpdate->first * count;
89  }
90 }
CVector< std::pair< C_FLOAT64, C_FLOAT64 * > > mStepUpdates
size_t size() const
Definition: CVector.h:100
CType * array()
Definition: CVector.h:139
const CMathObject * CMathReaction::getFluxObject ( ) const

Retrieve a pointer to the mathematical object for the flux.

Returns
const CMathObject * pFluxObject

Definition at line 97 of file CMathReaction.cpp.

References mpFlux.

98 {
99  return mpFlux;
100 }
CMathObject * mpFlux
Definition: CMathReaction.h:97
const CReaction * CMathReaction::getModelReaction ( ) const

Retrieve a pointer to the model reaction

Returns
const CReaction * pModelReaction

Definition at line 112 of file CMathReaction.cpp.

References mpReaction.

113 {
114  return mpReaction;
115 }
const CReaction * mpReaction
Definition: CMathReaction.h:87
const CObjectInterface::ObjectSet & CMathReaction::getModifiedSpecies ( ) const

Retrieve the set of modified species

Returns
const CObjectInterface::ObjectSet & modifiedSpecies

Definition at line 107 of file CMathReaction.cpp.

References mModifiedSpecies.

108 {
109  return mModifiedSpecies;
110 }
CObjectInterface::ObjectSet mModifiedSpecies
const CMathObject * CMathReaction::getParticleFluxObject ( ) const

Retrieve a pointer to the mathematical object for the particle flux.

Returns
const CMathObject * pParticleFluxObject

Definition at line 92 of file CMathReaction.cpp.

References mpParticleFlux.

93 {
94  return mpParticleFlux;
95 }
CMathObject * mpParticleFlux
Definition: CMathReaction.h:92
const CMathObject * CMathReaction::getPropensityObject ( ) const

Retrieve a pointer to the mathematical object for the propensity.

Returns
const CMathObject * pPropensityObject

Definition at line 102 of file CMathReaction.cpp.

References mpPropensity.

103 {
104  return mpPropensity;
105 }
CMathObject * mpPropensity
void CMathReaction::initialize ( const CReaction pReaction,
CMathContainer container 
)

Initialize the reaction from the model reaction in the given container context

Parameters
constCReaction * pReaction
CMathContainer& container

Definition at line 25 of file CMathReaction.cpp.

References CVectorCore< CType >::array(), CCopasiVector< T >::begin(), C_FLOAT64, CChemEq::getBalances(), CReaction::getChemEq(), CReaction::getFluxReference(), CMathContainer::getMathObject(), CReaction::getParticleFluxReference(), CReaction::getPropensityReference(), CMathObject::getValuePointer(), mModifiedSpecies, mpFlux, mpParticleFlux, mpPropensity, mpReaction, mStepUpdates, CVector< CType >::resize(), CVectorCore< CType >::size(), and CCopasiVector< T >::size().

Referenced by CMathContainer::init().

26 {
27  mpReaction = pReaction;
28 
29  // Sanity Check
30  if (mpReaction == NULL) return;
31 
35 
37  std::pair< C_FLOAT64, C_FLOAT64 * > * pStepUpdate = mStepUpdates.array();
38  std::pair< C_FLOAT64, C_FLOAT64 * > * pStepUpdateEnd = pStepUpdate + mStepUpdates.size();
40 
41  for (; pStepUpdate != pStepUpdateEnd; ++pStepUpdate, ++it)
42  {
43  CMathObject * pParticleNumber = container.getMathObject((*it)->getMetabolite()->getValueReference());
44  mModifiedSpecies.insert(pParticleNumber);
45  pStepUpdate->first = (*it)->getMultiplicity();
46  pStepUpdate->second = (C_FLOAT64 *) pParticleNumber->getValuePointer();
47  }
48 }
CMathObject * mpParticleFlux
Definition: CMathReaction.h:92
CCopasiObject * getParticleFluxReference()
Definition: CReaction.cpp:207
CMathObject * getMathObject(const CObjectInterface *pObject) const
virtual size_t size() const
iterator begin()
CMathObject * mpPropensity
void resize(size_t size, const bool &copy=false)
Definition: CVector.h:301
CObjectInterface::ObjectSet mModifiedSpecies
CCopasiObject * getPropensityReference()
Definition: CReaction.cpp:210
const CCopasiVector< CChemEqElement > & getBalances() const
Definition: CChemEq.cpp:69
virtual void * getValuePointer() const
CMathObject * mpFlux
Definition: CMathReaction.h:97
CVector< std::pair< C_FLOAT64, C_FLOAT64 * > > mStepUpdates
size_t size() const
Definition: CVector.h:100
const CReaction * mpReaction
Definition: CMathReaction.h:87
#define C_FLOAT64
Definition: copasi.h:92
CType * array()
Definition: CVector.h:139
const CChemEq & getChemEq() const
Definition: CReaction.cpp:223
CCopasiObject * getFluxReference()
Definition: CReaction.cpp:198

Member Data Documentation

CObjectInterface::ObjectSet CMathReaction::mModifiedSpecies
private

The set of modified species

Definition at line 107 of file CMathReaction.h.

Referenced by copy(), getModifiedSpecies(), and initialize().

CMathObject* CMathReaction::mpFlux
private

A pointer to the mathematical flux.

Definition at line 97 of file CMathReaction.h.

Referenced by copy(), getFluxObject(), and initialize().

CMathObject* CMathReaction::mpParticleFlux
private

A pointer to the mathematical particle flux.

Definition at line 92 of file CMathReaction.h.

Referenced by copy(), getParticleFluxObject(), and initialize().

CMathObject* CMathReaction::mpPropensity
private

A pointer to the mathematical propensity.

Definition at line 102 of file CMathReaction.h.

Referenced by copy(), getPropensityObject(), and initialize().

const CReaction* CMathReaction::mpReaction
private

A pointer to model reaction.

Definition at line 87 of file CMathReaction.h.

Referenced by copy(), getModelReaction(), and initialize().

CVector< std::pair< C_FLOAT64, C_FLOAT64 * > > CMathReaction::mStepUpdates
private

Information for updating the species particle numbers when the reaction fires.

Definition at line 113 of file CMathReaction.h.

Referenced by copy(), fire(), and initialize().


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