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

#include <CMathEvent.h>

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

Classes

class  CAssignment
 

Public Member Functions

void applyDelayRefreshes ()
 
 CMathEvent (const CCopasiContainer *pParent=NULL)
 
 CMathEvent (const CMathEvent &src, const CCopasiContainer *pParent=NULL)
 
bool compile (const CEvent *pEvent, std::vector< CCopasiContainer * > listOfContainer)
 
const bool & delayAssignment () const
 
bool executeAssignment ()
 
void fire (const C_FLOAT64 &time, const bool &equality, CProcessQueue &processQueue)
 
C_FLOAT64 getAssignmentTime (const C_FLOAT64 &currentTime)
 
C_FLOAT64 getCalculationTime (const C_FLOAT64 &currentTime)
 
CMathTriggergetMathTrigger ()
 
const size_t & getOrder () const
 
CVector< C_FLOAT64getTargetValues ()
 
const CEvent::TypegetType () const
 
bool setTargetValues (const CVector< C_FLOAT64 > &targetValues)
 
 ~CMathEvent ()
 
- Public Member Functions inherited from CCopasiContainer
virtual bool add (CCopasiObject *pObject, const bool &adopt=true)
 
 CCopasiContainer (const std::string &name, const CCopasiContainer *pParent=NULL, const std::string &type="CN", const unsigned C_INT32 &flag=CCopasiObject::Container)
 
 CCopasiContainer (const CCopasiContainer &src, const CCopasiContainer *pParent=NULL)
 
virtual std::string getChildObjectUnits (const CCopasiObject *pObject) const
 
virtual const CObjectInterfacegetObject (const CCopasiObjectName &cn) const
 
virtual const objectMapgetObjects () const
 
virtual std::string getUnits () const
 
virtual const CCopasiObjectgetValueObject () const
 
virtual bool remove (CCopasiObject *pObject)
 
virtual ~CCopasiContainer ()
 
- Public Member Functions inherited from CCopasiObject
void addDirectDependency (const CCopasiObject *pObject)
 
 CCopasiObject (const CCopasiObject &src, const CCopasiContainer *pParent=NULL)
 
void clearDirectDependencies ()
 
void clearRefresh ()
 
bool dependsOn (DataObjectSet candidates, const DataObjectSet &context=DataObjectSet()) const
 
void getAllDependencies (DataObjectSet &dependencies, const DataObjectSet &context) const
 
virtual CCopasiObjectName getCN () const
 
virtual const DataObjectSetgetDirectDependencies (const DataObjectSet &context=DataObjectSet()) const
 
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 applyDependentRefreshes ()
 
void applyValueRefreshes ()
 
C_FLOAT64 calculateDelayedTime (const C_FLOAT64 &currentTime)
 

Private Attributes

CCopasiVector< CAssignmentmAssignments
 
std::vector< Refresh * > mAssignmentValueRefreshes
 
CExpression mDelay
 
bool mDelayAssignment
 
std::vector< Refresh * > mDelayValueRefreshes
 
std::vector< Refresh * > mDependentValueRefreshes
 
bool mHaveDelay
 
size_t mOrder
 
CMathTrigger mTrigger
 
CEvent::Type mType
 

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 279 of file CMathEvent.h.

Constructor & Destructor Documentation

CMathEvent::CMathEvent ( const CCopasiContainer pParent = NULL)

Default constructor

Parameters
constCCopasiContainer * pParent (default: NULL)

Definition at line 1048 of file CMathEvent.cpp.

1048  :
1049  CCopasiContainer("MathEvent", pParent, "MathEvent"),
1050  mTrigger(this),
1051  mOrder(false),
1052  mHaveDelay(false),
1053  mDelay("DelayExpression", this),
1054  mDelayAssignment(true),
1055  mAssignments("ListOfMathEventAssignment", this),
1060 {}
std::vector< Refresh * > mDependentValueRefreshes
Definition: CMathEvent.h:501
CMathTrigger mTrigger
Definition: CMathEvent.h:457
std::vector< Refresh * > mDelayValueRefreshes
Definition: CMathEvent.h:489
CExpression mDelay
Definition: CMathEvent.h:473
bool mHaveDelay
Definition: CMathEvent.h:468
size_t mOrder
Definition: CMathEvent.h:463
bool mDelayAssignment
Definition: CMathEvent.h:478
CEvent::Type mType
Definition: CMathEvent.h:506
CCopasiVector< CAssignment > mAssignments
Definition: CMathEvent.h:483
std::vector< Refresh * > mAssignmentValueRefreshes
Definition: CMathEvent.h:495
CMathEvent::CMathEvent ( const CMathEvent src,
const CCopasiContainer pParent = NULL 
)

Copy constructor

Parameters
const CMathEvent &src
"constCCopasiContainer * pParent (default: NULL)

Definition at line 1062 of file CMathEvent.cpp.

1063  :
1064  CCopasiContainer(src, pParent),
1065  mTrigger(src.mTrigger, this),
1066  mOrder(src.mOrder),
1067  mHaveDelay(src.mHaveDelay),
1068  mDelay(src.mDelay, this),
1070  mAssignments(src.mAssignments, this),
1074  mType(src.mType)
1075 {}
std::vector< Refresh * > mDependentValueRefreshes
Definition: CMathEvent.h:501
CMathTrigger mTrigger
Definition: CMathEvent.h:457
std::vector< Refresh * > mDelayValueRefreshes
Definition: CMathEvent.h:489
CExpression mDelay
Definition: CMathEvent.h:473
bool mHaveDelay
Definition: CMathEvent.h:468
size_t mOrder
Definition: CMathEvent.h:463
bool mDelayAssignment
Definition: CMathEvent.h:478
CEvent::Type mType
Definition: CMathEvent.h:506
CCopasiVector< CAssignment > mAssignments
Definition: CMathEvent.h:483
std::vector< Refresh * > mAssignmentValueRefreshes
Definition: CMathEvent.h:495
CMathEvent::~CMathEvent ( )

Destructor

Definition at line 1077 of file CMathEvent.cpp.

1078 {}

Member Function Documentation

void CMathEvent::applyDelayRefreshes ( )

Apply all needed refreshes so that the delay expression are correctly calculated.

Definition at line 1198 of file CMathEvent.cpp.

References mDelayValueRefreshes.

Referenced by calculateDelayedTime().

1199 {
1200  std::vector< Refresh * >::const_iterator itRefresh = mDelayValueRefreshes.begin();
1201  std::vector< Refresh * >::const_iterator endRefresh = mDelayValueRefreshes.end();
1202 
1203  while (itRefresh != endRefresh)
1204  (**itRefresh++)();
1205 
1206  return;
1207 }
std::vector< Refresh * > mDelayValueRefreshes
Definition: CMathEvent.h:489
void CMathEvent::applyDependentRefreshes ( )
private

Apply all needed refreshes to update all values depending on the assignment targets.

Definition at line 1220 of file CMathEvent.cpp.

References mDependentValueRefreshes.

Referenced by setTargetValues().

1221 {
1222  std::vector< Refresh * >::const_iterator itRefresh = mDependentValueRefreshes.begin();
1223  std::vector< Refresh * >::const_iterator endRefresh = mDependentValueRefreshes.end();
1224 
1225  while (itRefresh != endRefresh)
1226  (**itRefresh++)();
1227 
1228  return;
1229 }
std::vector< Refresh * > mDependentValueRefreshes
Definition: CMathEvent.h:501
void CMathEvent::applyValueRefreshes ( )
private

Apply all needed refreshes so that the assignment expressions are correctly calculated.

Definition at line 1209 of file CMathEvent.cpp.

References mAssignmentValueRefreshes.

Referenced by getTargetValues().

1210 {
1211  std::vector< Refresh * >::const_iterator itRefresh = mAssignmentValueRefreshes.begin();
1212  std::vector< Refresh * >::const_iterator endRefresh = mAssignmentValueRefreshes.end();
1213 
1214  while (itRefresh != endRefresh)
1215  (**itRefresh++)();
1216 
1217  return;
1218 }
std::vector< Refresh * > mAssignmentValueRefreshes
Definition: CMathEvent.h:495
C_FLOAT64 CMathEvent::calculateDelayedTime ( const C_FLOAT64 currentTime)
private

Calculate the time for delays. This accounts for small errors relative to the current time.

Parameters
constC_FLOAT64 & currentTime
Returns
C_FLOAT64 delayedTime

Definition at line 1266 of file CMathEvent.cpp.

References applyDelayRefreshes(), C_FLOAT64, CExpression::calcValue(), CCopasiMessage::EXCEPTION, CEvaluationTree::getInfix(), MCMathModel, mDelay, and min.

Referenced by getAssignmentTime(), and getCalculationTime().

1267 {
1268  if (mDelay.getInfix() == "")
1269  {
1270  return currentTime;
1271  }
1272 
1273  // We make sure everything is up to date.
1275 
1276  C_FLOAT64 DelayedTime = currentTime + mDelay.calcValue();
1277 
1278  // Events are only allowed in forward integration. Thus the ExecutionTime
1279  // must not be less than the time.
1280  if (DelayedTime - currentTime < 0.0)
1281  {
1282  // We allow small numerical errors.
1283  C_FLOAT64 Scale =
1284  (fabs(DelayedTime) + fabs(currentTime)) * 50.0 * std::numeric_limits< C_FLOAT64 >::epsilon();
1285 
1286  // Both are approximately zero
1287  if (Scale < 100.0 * std::numeric_limits< C_FLOAT64 >::min())
1288  {
1289  DelayedTime = currentTime;
1290  }
1291  // The difference is small compared to the scale
1292  else if (fabs(DelayedTime - currentTime) < Scale)
1293  {
1294  DelayedTime = currentTime;
1295  }
1296  // The execution time is definitely in the past
1297  else
1298  {
1299  // Create an error message and throw an exception.
1300  CCopasiMessage(CCopasiMessage::EXCEPTION, MCMathModel + 2, DelayedTime, currentTime);
1301  }
1302  }
1303 
1304  return DelayedTime;
1305 }
#define MCMathModel
CExpression mDelay
Definition: CMathEvent.h:473
virtual const C_FLOAT64 & calcValue()
#define C_FLOAT64
Definition: copasi.h:92
void applyDelayRefreshes()
#define min(a, b)
Definition: f2c.h:175
const std::string & getInfix() const
bool CMathEvent::compile ( const CEvent pEvent,
std::vector< CCopasiContainer * >  listOfContainer 
)

Compile the root finder

Parameters
constCEvent * pEvent
std::vector<CCopasiContainer * > listOfContainer

Definition at line 1080 of file CMathEvent.cpp.

References CCopasiVector< T >::begin(), CMathModel::buildDependendRefreshList(), CMathModel::buildRequiredRefreshList(), CExpression::compile(), CMathTrigger::compile(), CMathEvent::CAssignment::compile(), CCopasiVector< T >::end(), CEvent::getAssignments(), CEvent::getDelayAssignment(), CEvent::getDelayExpression(), CCopasiObject::getDirectDependencies(), CEvaluationTree::getInfix(), CCopasiObject::getObjectAncestor(), CEvent::getTriggerExpressionPtr(), CEvent::getType(), mAssignments, mAssignmentValueRefreshes, mDelay, mDelayAssignment, mDelayValueRefreshes, mDependentValueRefreshes, mHaveDelay, mTrigger, mType, and CExpression::setInfix().

Referenced by CMathModel::compile().

1082 {
1083  // A CMathEvent must be part of CMathModel to be compiled.
1084  CMathModel * pMathModel = dynamic_cast< CMathModel *>(getObjectAncestor("CMathModel"));
1085 
1086  if (pMathModel == NULL)
1087  return false;
1088 
1089  bool success = true;
1090 
1091  success &= mTrigger.compile(pEvent->getTriggerExpressionPtr(), listOfContainer);
1092 
1093  success &= mDelay.setInfix(pEvent->getDelayExpression());
1094  success &= mDelay.compile(listOfContainer);
1095 
1096  mHaveDelay = (mDelay.getInfix() != "");
1097 
1098  mType = pEvent->getType();
1099 
1100  // Build the list of refresh calls needed to assure that the delay expression
1101  // can be calculated.
1102 
1104 
1106 
1107  mAssignments.clear();
1108 
1111 
1112  std::set< const CCopasiObject * > Assignments;
1113  std::set< const CCopasiObject * > Targets;
1114 
1115  for (; it != end; ++it)
1116  {
1117  CAssignment * pAssignment = new CAssignment();
1118 
1119  mAssignments.add(pAssignment, true);
1120  success &= pAssignment->compile(*it, listOfContainer);
1121 
1122  Assignments.insert(pAssignment);
1123  Targets.insert((*it)->getTargetObject());
1124  }
1125 
1126  // Build the list of refresh calls needed to assure that the assignment expressions
1127  // can be calculated.
1128  mAssignmentValueRefreshes = pMathModel->buildRequiredRefreshList(Assignments);
1129 
1130  // Build the list of refresh calls needed to assure that all dependent model values
1131  // are updated after the assignments are executed.
1132  mDependentValueRefreshes = pMathModel->buildDependendRefreshList(Targets);
1133 
1134  return success;
1135 }
CCopasiContainer * getObjectAncestor(const std::string &type) const
std::vector< Refresh * > mDependentValueRefreshes
Definition: CMathEvent.h:501
const CCopasiVectorN< CEventAssignment > & getAssignments() const
Definition: CEvent.cpp:678
virtual bool setInfix(const std::string &infix)
Definition: CExpression.cpp:63
const bool & getDelayAssignment() const
Definition: CEvent.cpp:419
CMathTrigger mTrigger
Definition: CMathEvent.h:457
iterator begin()
std::vector< Refresh * > buildRequiredRefreshList(const std::set< const CCopasiObject * > &requiredObjects) const
Definition: CMathModel.cpp:452
std::vector< Refresh * > mDelayValueRefreshes
Definition: CMathEvent.h:489
virtual bool compile(std::vector< CCopasiContainer * > listOfContainer=CCopasiContainer::EmptyList)
Definition: CExpression.cpp:97
std::vector< Refresh * > buildDependendRefreshList(const std::set< const CCopasiObject * > &changedObjects) const
Definition: CMathModel.cpp:461
CExpression mDelay
Definition: CMathEvent.h:473
const Type & getType() const
Definition: CEvent.cpp:699
iterator end()
bool mHaveDelay
Definition: CMathEvent.h:468
std::string getDelayExpression() const
Definition: CEvent.cpp:591
bool mDelayAssignment
Definition: CMathEvent.h:478
virtual const DataObjectSet & getDirectDependencies(const DataObjectSet &context=DataObjectSet()) const
const CExpression * getTriggerExpressionPtr() const
Definition: CEvent.cpp:534
CEvent::Type mType
Definition: CMathEvent.h:506
CCopasiVector< CAssignment > mAssignments
Definition: CMathEvent.h:483
std::vector< Refresh * > mAssignmentValueRefreshes
Definition: CMathEvent.h:495
const std::string & getInfix() const
bool compile(const CExpression *pTriggerExpression, std::vector< CCopasiContainer * > listOfContainer)
const bool & CMathEvent::delayAssignment ( ) const

Check whether to delay the assignment

Returns
const bool & delayAssignment

Definition at line 1241 of file CMathEvent.cpp.

References mDelayAssignment.

1242 {
1243  return mDelayAssignment;
1244 }
bool mDelayAssignment
Definition: CMathEvent.h:478
bool CMathEvent::executeAssignment ( )

Calculate and assign the new target values

Returns
bool stateChanged

Definition at line 1193 of file CMathEvent.cpp.

References getTargetValues(), and setTargetValues().

1194 {
1195  return setTargetValues(getTargetValues());
1196 }
bool setTargetValues(const CVector< C_FLOAT64 > &targetValues)
CVector< C_FLOAT64 > getTargetValues()
void CMathEvent::fire ( const C_FLOAT64 time,
const bool &  equality,
CProcessQueue processQueue 
)

The event fires and the appropriate actions are scheduled in the process queue.

Parameters
constC_FLOAT64 & time
constbool & equality
CProcessQueue& processQueue

Definition at line 1137 of file CMathEvent.cpp.

References CProcessQueue::addAssignment(), CProcessQueue::addCalculation(), getAssignmentTime(), getCalculationTime(), getTargetValues(), and mDelayAssignment.

Referenced by CMathModel::processRoots().

1140 {
1141  if (mDelayAssignment)
1142  {
1143  processQueue.addAssignment(getAssignmentTime(time), equality, getTargetValues(), this);
1144  }
1145  else
1146  {
1147  processQueue.addCalculation(getCalculationTime(time), equality, this);
1148  }
1149 }
bool addAssignment(const C_FLOAT64 &executionTime, const bool &equality, const CVector< C_FLOAT64 > &values, CMathEvent *pEvent)
CVector< C_FLOAT64 > getTargetValues()
C_FLOAT64 getAssignmentTime(const C_FLOAT64 &currentTime)
bool mDelayAssignment
Definition: CMathEvent.h:478
C_FLOAT64 getCalculationTime(const C_FLOAT64 &currentTime)
bool addCalculation(const C_FLOAT64 &executionTime, const bool &equality, CMathEvent *pEvent)
C_FLOAT64 CMathEvent::getAssignmentTime ( const C_FLOAT64 currentTime)

Retrieve the time for executing the assignmentS

Parameters
constC_FLOAT64 & currentTime
Returns
C_FLOAT64 executionTime

Definition at line 1256 of file CMathEvent.cpp.

References calculateDelayedTime(), and mDelayAssignment.

Referenced by fire().

1257 {
1258  if (!mDelayAssignment)
1259  {
1260  return currentTime;
1261  }
1262 
1263  return calculateDelayedTime(currentTime);
1264 }
bool mDelayAssignment
Definition: CMathEvent.h:478
C_FLOAT64 calculateDelayedTime(const C_FLOAT64 &currentTime)
C_FLOAT64 CMathEvent::getCalculationTime ( const C_FLOAT64 currentTime)

Retrieve the time for calculating the assignment expression

Parameters
constC_FLOAT64 & currentTime
Returns
C_FLOAT64 calculationTime

Definition at line 1246 of file CMathEvent.cpp.

References calculateDelayedTime(), and mDelayAssignment.

Referenced by fire().

1247 {
1248  if (mDelayAssignment)
1249  {
1250  return currentTime;
1251  }
1252 
1253  return calculateDelayedTime(currentTime);
1254 }
bool mDelayAssignment
Definition: CMathEvent.h:478
C_FLOAT64 calculateDelayedTime(const C_FLOAT64 &currentTime)
CMathTrigger & CMathEvent::getMathTrigger ( )

Retrieve the trigger for this event.

Returns
CMathTrigger & mathTrigger

Definition at line 1231 of file CMathEvent.cpp.

References mTrigger.

Referenced by CMathModel::compile(), and CMathModel::processRoots().

1232 {
1233  return mTrigger;
1234 }
CMathTrigger mTrigger
Definition: CMathEvent.h:457
const size_t & CMathEvent::getOrder ( ) const

Retrieve the order in which this event shall be processed

Returns
const size_t & order

Definition at line 1236 of file CMathEvent.cpp.

References mOrder.

1237 {
1238  return mOrder;
1239 }
size_t mOrder
Definition: CMathEvent.h:463
CVector< C_FLOAT64 > CMathEvent::getTargetValues ( )

Calculate and retrieve the new target values

Returns
CVector< C_FLOAT64 > targetValues

Definition at line 1151 of file CMathEvent.cpp.

References applyValueRefreshes(), C_FLOAT64, and mAssignments.

Referenced by executeAssignment(), and fire().

1152 {
1154 
1155  CVector< C_FLOAT64 > Values(mAssignments.size());
1156  C_FLOAT64 * pValue = Values.array();
1159 
1160  for (; itAssignment != endAssignment; ++itAssignment, ++pValue)
1161  {
1162  *pValue = (*itAssignment)->mExpression.calcValue();
1163  }
1164 
1165  return Values;
1166 }
void applyValueRefreshes()
#define C_FLOAT64
Definition: copasi.h:92
CCopasiVector< CAssignment > mAssignments
Definition: CMathEvent.h:483
std::vector< CType * >::iterator iterator
Definition: CCopasiVector.h:56
const CEvent::Type & CMathEvent::getType ( ) const

Retrieve the type of the event

Returns
const CEvent::Type & type

Definition at line 1307 of file CMathEvent.cpp.

References mType.

Referenced by CProcessQueue::CAction::CAction().

1308 {
1309  return mType;
1310 }
CEvent::Type mType
Definition: CMathEvent.h:506
bool CMathEvent::setTargetValues ( const CVector< C_FLOAT64 > &  targetValues)

Set the target values

Parameters
constCVector< C_FLOAT64 > & targetValues
Returns
bool stateChanged

Definition at line 1168 of file CMathEvent.cpp.

References applyDependentRefreshes(), CVectorCore< CType >::array(), C_FLOAT64, and mAssignments.

Referenced by executeAssignment().

1169 {
1170  bool StateChanged = false;
1171 
1172  const C_FLOAT64 * pValue = values.array();
1175 
1176  for (; itAssignment != endAssignment; ++itAssignment, ++pValue)
1177  {
1178  if (*(*itAssignment)->mpTarget != *pValue)
1179  {
1180  StateChanged = true;
1181  *(*itAssignment)->mpTarget = *pValue;
1182  }
1183  }
1184 
1185  if (StateChanged)
1186  {
1188  }
1189 
1190  return StateChanged;
1191 }
#define C_FLOAT64
Definition: copasi.h:92
CCopasiVector< CAssignment > mAssignments
Definition: CMathEvent.h:483
std::vector< CType * >::iterator iterator
Definition: CCopasiVector.h:56
void applyDependentRefreshes()

Member Data Documentation

CCopasiVector< CAssignment > CMathEvent::mAssignments
private

List of assignments

Definition at line 483 of file CMathEvent.h.

Referenced by compile(), getTargetValues(), and setTargetValues().

std::vector< Refresh * > CMathEvent::mAssignmentValueRefreshes
private

A sequence of refresh calls needed to prepare to calculate the current values of the assignments.

Definition at line 495 of file CMathEvent.h.

Referenced by applyValueRefreshes(), and compile().

CExpression CMathEvent::mDelay
private

Delay expression.

Definition at line 473 of file CMathEvent.h.

Referenced by calculateDelayedTime(), and compile().

bool CMathEvent::mDelayAssignment
private

Boolean value indicating whether the calculation or the assignment is delayed.

Definition at line 478 of file CMathEvent.h.

Referenced by compile(), delayAssignment(), fire(), getAssignmentTime(), and getCalculationTime().

std::vector< Refresh * > CMathEvent::mDelayValueRefreshes
private

A sequence of refresh calls needed to prepare to calculate the delay value.

Definition at line 489 of file CMathEvent.h.

Referenced by applyDelayRefreshes(), and compile().

std::vector< Refresh * > CMathEvent::mDependentValueRefreshes
private

A sequence of refresh calls needed to calculate all values which depend on the target values of the assignments.

Definition at line 501 of file CMathEvent.h.

Referenced by applyDependentRefreshes(), and compile().

bool CMathEvent::mHaveDelay
private

Boolean value indicating whether the event involves a delay.

Definition at line 468 of file CMathEvent.h.

Referenced by compile().

size_t CMathEvent::mOrder
private

The order in which the event is processed in case of simultaneous assignments

Definition at line 463 of file CMathEvent.h.

Referenced by getOrder().

CMathTrigger CMathEvent::mTrigger
private

Trigger expression.

Definition at line 457 of file CMathEvent.h.

Referenced by compile(), and getMathTrigger().

CEvent::Type CMathEvent::mType
private

The type of the event

Definition at line 506 of file CMathEvent.h.

Referenced by compile(), and getType().


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