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

#include <CMathModel.h>

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

Public Member Functions

void applyInitialValues ()
 
std::vector< Refresh * > buildDependendRefreshList (const std::set< const CCopasiObject * > &changedObjects) const
 
std::vector< Refresh * > buildRequiredRefreshList (const std::set< const CCopasiObject * > &requiredObjects) const
 
void calculateRootDerivatives (CVector< C_FLOAT64 > &rootDerivatives)
 
 CMathModel (const CCopasiContainer *pParent=NULL)
 
 CMathModel (const CMathModel &src, const CCopasiContainer *pParent=NULL)
 
bool compile (CModel *pModel)
 
void evaluateRoots (CVectorCore< C_FLOAT64 > &rootValues, const bool &ignoreDiscrete)
 
const C_FLOAT64getInitialTime () const
 
size_t getNumRoots () const
 
const CProcessQueuegetProcessQueue () const
 
CProcessQueuegetProcessQueue ()
 
const C_FLOAT64getProcessQueueExecutionTime () const
 
const CVector
< CMathTrigger::CRootFinder * > & 
getRootFinders () const
 
bool processQueue (const C_FLOAT64 &time, const bool &equality, CProcessQueue::resolveSimultaneousAssignments pResolveSimultaneousAssignments)
 
void processRoots (const C_FLOAT64 &time, const bool &equality, const bool &correct, const CVector< C_INT > &roots)
 
void processRoots (const C_FLOAT64 &time, const CVector< C_INT > &roots)
 
virtual ~CMathModel ()
 
- 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 calculateRootJacobian (CMatrix< C_FLOAT64 > &jacobian, const CVector< C_FLOAT64 > &rates)
 
bool determineInitialRoots (CVector< C_INT > &foundRoots)
 

Private Attributes

CCopasiVector< CMathEventmEvents
 
CModelmpModel
 
CProcessQueue mProcessQueue
 
CVector< bool > mRootDiscrete
 
CVector< CMathEvent * > mRootIndex2Event
 
CVector
< CMathTrigger::CRootFinder * > 
mRootIndex2RootFinder
 
std::vector< Refresh * > mRootRefreshes
 
CVector< C_FLOAT64 * > mRootValues
 

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 23 of file CMathModel.h.

Constructor & Destructor Documentation

CMathModel::CMathModel ( const CCopasiContainer pParent = NULL)

Default constructor

Parameters
constCCopasiContainer * pParent (default: NULL)

Definition at line 21 of file CMathModel.cpp.

21  :
22  CCopasiContainer("MathModel", pParent, "CMathModel"),
23  mpModel(NULL),
24  mProcessQueue(),
25  mEvents("ListOfMathEvents", this),
26  mRootValues(),
27  mRootDiscrete(),
31 {}
CVector< C_FLOAT64 * > mRootValues
Definition: CMathModel.h:192
CProcessQueue mProcessQueue
Definition: CMathModel.h:182
CModel * mpModel
Definition: CMathModel.h:177
std::vector< Refresh * > mRootRefreshes
Definition: CMathModel.h:204
CVector< bool > mRootDiscrete
Definition: CMathModel.h:198
CVector< CMathTrigger::CRootFinder * > mRootIndex2RootFinder
Definition: CMathModel.h:214
CCopasiVector< CMathEvent > mEvents
Definition: CMathModel.h:187
CVector< CMathEvent * > mRootIndex2Event
Definition: CMathModel.h:209
CMathModel::CMathModel ( const CMathModel src,
const CCopasiContainer pParent = NULL 
)

Copy constructor

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

Definition at line 33 of file CMathModel.cpp.

References compile(), and mpModel.

34  :
35  CCopasiContainer(src, pParent),
36  mpModel(src.mpModel),
38  mEvents("ListOfMathEvents", this),
39  mRootValues(),
40  mRootDiscrete(),
44 {
45  // Compile the math model.
47 
48  // TODO
49  // The problem is that the pointers to events in the process queue point
50  // to events in the source model. We can construct a mapping of source event pointers
51  // to event pointers and update each process queue entry.
52 }
CVector< C_FLOAT64 * > mRootValues
Definition: CMathModel.h:192
CProcessQueue mProcessQueue
Definition: CMathModel.h:182
CModel * mpModel
Definition: CMathModel.h:177
std::vector< Refresh * > mRootRefreshes
Definition: CMathModel.h:204
CVector< bool > mRootDiscrete
Definition: CMathModel.h:198
CVector< CMathTrigger::CRootFinder * > mRootIndex2RootFinder
Definition: CMathModel.h:214
CCopasiVector< CMathEvent > mEvents
Definition: CMathModel.h:187
CVector< CMathEvent * > mRootIndex2Event
Definition: CMathModel.h:209
bool compile(CModel *pModel)
Definition: CMathModel.cpp:58
CMathModel::~CMathModel ( )
virtual

Destructor

Definition at line 55 of file CMathModel.cpp.

56 {}

Member Function Documentation

void CMathModel::applyInitialValues ( )

Initialize all values of the math model with their initial values.

Definition at line 372 of file CMathModel.cpp.

References CCopasiVector< T >::begin(), determineInitialRoots(), CCopasiVector< T >::end(), CModel::getInitialTime(), CProcessQueue::initialize(), mEvents, mpModel, mProcessQueue, mRootRefreshes, and processRoots().

Referenced by CModel::applyInitialValues().

373 {
374  // Clear the process queue.
376 
377  // Prepare the roots, i.e., evaluate them
378  // Apply all needed refresh calls to calculate the current root values.
379  std::vector< Refresh * >::const_iterator itRefresh = mRootRefreshes.begin();
380  std::vector< Refresh * >::const_iterator endRefresh = mRootRefreshes.end();
381 
382  while (itRefresh != endRefresh)
383  (**itRefresh++)();
384 
385  // Now calculate the current root activities
388 
389  // for each event
390  for (; itMathEvent != endMathEvent; ++itMathEvent)
391  {
392  (*itMathEvent)->getMathTrigger().applyInitialValues();
393  }
394 
395  // We need to schedule events which fire at t > t_0
396 
397  // The roots which are checked for inequality with a current root value
398  // zero are the candidates. We should toggle them if their time derivative
399  // is positive.
400 
401  // The time derivative of the roots can be calculated as:
402  // Dr_i/Dt = sum_j (dr_i/dx_j dx_j/dt) + dr_i/dt
403  // dx_j/dt are the rates of the state variables
404  CVector< C_INT > InitialRoots;
405 
406  if (determineInitialRoots(InitialRoots))
407  {
408  processRoots(mpModel->getInitialTime(), false, false, InitialRoots);
409  }
410 }
void initialize(CMathModel *pMathModel)
iterator begin()
CProcessQueue mProcessQueue
Definition: CMathModel.h:182
CModel * mpModel
Definition: CMathModel.h:177
iterator end()
const C_FLOAT64 & getInitialTime() const
Definition: CModel.cpp:1184
std::vector< Refresh * > mRootRefreshes
Definition: CMathModel.h:204
CCopasiVector< CMathEvent > mEvents
Definition: CMathModel.h:187
bool determineInitialRoots(CVector< C_INT > &foundRoots)
Definition: CMathModel.cpp:550
void processRoots(const C_FLOAT64 &time, const bool &equality, const bool &correct, const CVector< C_INT > &roots)
Definition: CMathModel.cpp:218
std::vector< Refresh * > CMathModel::buildDependendRefreshList ( const std::set< const CCopasiObject * > &  changedObjects) const

Build a list of refresh calls needed to assure that all objects depending on the changed objects are up to date.

Parameters
conststd::set< const CCopasiObject * > & changedObjects
Returns
std::vector< Refresh * > refreshList

Definition at line 461 of file CMathModel.cpp.

References CModelEntity::ASSIGNMENT, CCopasiVector< T >::begin(), CCopasiObject::buildUpdateSequence(), CCopasiObject::dependsOn(), CCopasiVector< T >::end(), CModelEntity::FIXED, CStateTemplate::getEntities(), CModel::getMoieties(), CModel::getStateTemplate(), CModelEntity::getValueReference(), mpModel, CModelEntity::ODE, CModelEntity::REACTIONS, CStateTemplate::size(), and CModelEntity::TIME.

Referenced by CMathEvent::compile().

462 {
463  if (mpModel == NULL)
464  return std::vector< Refresh * >();
465 
466  // We cannot use the default dependencies for a species which concentration was changed
467  // by an event as the concentration is the dependent value. This must not be done for
468  // species which where not changed by the event, i.e., the solution must be context specific.
469  // This implies that the methods getDirectDependencies and its callers must be aware of the species
470  // concentrations in the list of the changed objects.
471 
472  // CCopasiObject::mDependencies is private this means the only place where can be accessed is
473  // CCopasiObject itself. We need to replace all read access the mDirectDependencies with
474  // getDirectDependencies in CCopasiObject and than make this method context sensitive. This new
475  // method will be virtual and must be overloaded for the concentration and particle number in species.
476 
477  // We build a list of all simulated objects which depend on the changed values.
478  std::set< const CCopasiObject * > RequiredObjects;
479 
480  // The values which need to be updated are all values needed for simulation.
481  // These are all objects which are required to calculate the reaction rates and
482  // the right hand side of ODEs in other words all rates of entities of type reaction
483  // or ODE.
484 
485  // Due to the context sensitivity, i.e., the changed concentration is no longer dependent
486  // on the particle number and compartment volume, we will miss all particle numbers of changed
487  // species which do not directly appear in any calculation.
488 
489  CModelEntity *const* ppEntity = mpModel->getStateTemplate().getEntities();
490  CModelEntity *const* ppEndEntity = ppEntity + mpModel->getStateTemplate().size();
491 
492  const CMetab * pSpecies;
493 
494  for (; ppEntity != ppEndEntity; ++ppEntity)
495  {
496  switch ((*ppEntity)->getStatus())
497  {
498  // First rates of all entities depending on ODEs and species depending on reactions.
499  case CModelEntity::ODE:
501 
502  if ((*ppEntity)->getRateReference()->dependsOn(changedObjects, changedObjects))
503  {
504  RequiredObjects.insert((*ppEntity)->getRateReference());
505  }
506 
507  // The break statement is intentionally missing since we need to check
508  // the particle values of species for the above and for fixed.
509  case CModelEntity::FIXED:
510  pSpecies = dynamic_cast< const CMetab * >(*ppEntity);
511 
512  if (pSpecies != NULL &&
513  pSpecies->getValueReference()->dependsOn(changedObjects, changedObjects))
514  {
515  RequiredObjects.insert(pSpecies->getValueReference());
516  }
517 
518  break;
519 
521  // Assignments may have to be recalculated but only if an ODE or a
522  // reaction flux depends on it.
523  break;
524 
525  case CModelEntity::TIME:
526  // The model time will not advance during an event. For discrete time
527  // simulation the users should add a global quantity representing the time.
528  break;
529  }
530  }
531 
532  // Since we have discontinuous change we have to evaluate the total amount of the moieties
533  // which participant changed concentration.
534 
537 
538  for (; itMoiety != endMoiety; ++itMoiety)
539  {
540  if ((*itMoiety)->getValueReference()->dependsOn(changedObjects, changedObjects))
541  {
542  RequiredObjects.insert((*itMoiety)->getValueReference());
543  }
544  }
545 
546  std::set< const CCopasiObject * > UpToDate;
547  return CCopasiObject::buildUpdateSequence(RequiredObjects, UpToDate, changedObjects);
548 }
iterator begin()
Definition: CMetab.h:178
const size_t & size() const
Definition: CState.cpp:242
const CCopasiVector< CMoiety > & getMoieties() const
Definition: CModel.cpp:1163
CModel * mpModel
Definition: CMathModel.h:177
iterator end()
bool dependsOn(DataObjectSet candidates, const DataObjectSet &context=DataObjectSet()) const
const CStateTemplate & getStateTemplate() const
Definition: CModel.cpp:1172
static std::vector< Refresh * > buildUpdateSequence(const DataObjectSet &objects, const DataObjectSet &uptoDateObjects, const DataObjectSet &context=DataObjectSet())
CModelEntity ** getEntities()
Definition: CState.cpp:204
CCopasiObject * getValueReference() const
std::vector< Refresh * > CMathModel::buildRequiredRefreshList ( const std::set< const CCopasiObject * > &  requiredObjects) const

Build a list of refresh calls needed to assure that required objects are up to date.

Parameters
conststd::set< const CCopasiObject * > & requiredObjects
Returns
std::vector< Refresh * > refreshList

Definition at line 452 of file CMathModel.cpp.

References CCopasiObject::buildUpdateSequence().

Referenced by compile(), and CMathEvent::compile().

453 {
454  // We assume that all values determined by ODEs and reactions are current.
455  // This means for reduced models moieties must have been applied.
456  std::set< const CCopasiObject * > UpToDate;
457 
458  return CCopasiObject::buildUpdateSequence(requiredObjects, UpToDate);
459 }
static std::vector< Refresh * > buildUpdateSequence(const DataObjectSet &objects, const DataObjectSet &uptoDateObjects, const DataObjectSet &context=DataObjectSet())
void CMathModel::calculateRootDerivatives ( CVector< C_FLOAT64 > &  rootDerivatives)

Calculate the time derivative of all roots

Parameters
CVector<C_FLOAT64 > & rootDerivatives

Definition at line 417 of file CMathModel.cpp.

References CVectorCore< CType >::array(), CMatrix< CType >::array(), C_FLOAT64, C_INT, CModel::calculateDerivatives(), calculateRootJacobian(), dgemm_(), CModel::getNumDependentReactionMetabs(), CStateTemplate::getNumIndependent(), CModel::getStateTemplate(), K, mpModel, mRootValues, CVector< CType >::resize(), CVectorCore< CType >::size(), and CModel::updateSimulatedValues().

Referenced by CModel::calculateRootDerivatives(), and determineInitialRoots().

418 {
419  size_t NumCols =
421 
422  CVector< C_FLOAT64 > Rates(NumCols);
423  C_FLOAT64 * pRate = Rates.array();
424  *pRate = 1.0; // for time
425 
427  mpModel->calculateDerivatives(pRate + 1);
428 
429  CMatrix< C_FLOAT64 > Jacobian;
430  calculateRootJacobian(Jacobian, Rates);
431 
432  rootDerivatives.resize(mRootValues.size());
433  C_FLOAT64 * pDerivative = rootDerivatives.array();
434 
435  // Now calculate derivatives of all metabolites determined by reactions
436  char T = 'N';
437  C_INT M = 1;
438  C_INT N = (C_INT) mRootValues.size();
439  C_INT K = (C_INT) NumCols;
440  C_FLOAT64 Alpha = 1.0;
441  C_FLOAT64 Beta = 0.0;
442 
443  dgemm_(&T, &T, &M, &N, &K, &Alpha, Rates.array(), &M,
444  Jacobian.array(), &K, &Beta, pDerivative, &M);
445 }
#define C_INT
Definition: copasi.h:115
#define K
size_t getNumIndependent() const
Definition: CState.cpp:222
CVector< C_FLOAT64 * > mRootValues
Definition: CMathModel.h:192
void calculateRootJacobian(CMatrix< C_FLOAT64 > &jacobian, const CVector< C_FLOAT64 > &rates)
Definition: CMathModel.cpp:591
void updateSimulatedValues(const bool &updateMoieties)
Definition: CModel.cpp:1851
void resize(size_t size, const bool &copy=false)
Definition: CVector.h:301
CModel * mpModel
Definition: CMathModel.h:177
size_t getNumDependentReactionMetabs() const
Definition: CModel.cpp:1133
int dgemm_(char *transa, char *transb, integer *m, integer *n, integer *k, doublereal *alpha, doublereal *a, integer *lda, doublereal *b, integer *ldb, doublereal *beta, doublereal *c, integer *ldc)
size_t size() const
Definition: CVector.h:100
#define C_FLOAT64
Definition: copasi.h:92
CType * array()
Definition: CVector.h:139
const CStateTemplate & getStateTemplate() const
Definition: CModel.cpp:1172
void calculateDerivatives(C_FLOAT64 *derivatives)
Definition: CModel.cpp:1903
virtual CType * array()
Definition: CMatrix.h:337
void CMathModel::calculateRootJacobian ( CMatrix< C_FLOAT64 > &  jacobian,
const CVector< C_FLOAT64 > &  rates 
)
private

Calculate the Jacobian for the roots.

Parameters
CMatrix<C_FLOAT64 > & jacobian
constCVector< C_FLOAT64 > & rates

Definition at line 591 of file CMathModel.cpp.

References CVectorCore< CType >::array(), CMatrix< CType >::array(), CState::beginIndependent(), C_FLOAT64, evaluateRoots(), CModel::getNumDependentReactionMetabs(), CState::getNumIndependent(), CModel::getState(), min, mpModel, mRootValues, CMatrix< CType >::resize(), CModel::setState(), CVectorCore< CType >::size(), and CMatrix< CType >::size().

Referenced by calculateRootDerivatives().

593 {
594  CState State = mpModel->getState();
595 
596  size_t NumRows = mRootValues.size();
597 
598  // Partial derivatives with respect to time and all variables determined by ODEs and reactions.
599  size_t NumCols =
601 
602  size_t Col = 0;
603 
604  jacobian.resize(NumRows, NumCols);
605 
606  C_FLOAT64 X1 = 0.0;
607  C_FLOAT64 X2 = 0.0;
608  C_FLOAT64 InvDelta = 0.0;
609 
610  CVector< C_FLOAT64 > Y1(NumRows);
611  CVector< C_FLOAT64 > Y2(NumRows);
612 
613  C_FLOAT64 * pX = State.beginIndependent() - 1;
614  C_FLOAT64 * pXEnd = pX + NumCols;
615 
616  C_FLOAT64 * pJacobian = jacobian.array();
617  C_FLOAT64 * pJacobianEnd = pJacobian + jacobian.size();
618 
619  const C_FLOAT64 * pRate = rates.array();
620 
621  for (; pX != pXEnd; ++pX, ++Col, ++pRate)
622  {
623  C_FLOAT64 Store = *pX;
624 
625  if (fabs(*pRate) < 1e4 * std::numeric_limits< C_FLOAT64 >::epsilon() * fabs(Store) ||
626  fabs(*pRate) < 1e4 * std::numeric_limits< C_FLOAT64 >::min())
627  {
628  if (fabs(Store) < 100.0 * std::numeric_limits< C_FLOAT64 >::min())
629  {
630  X1 = 0.0;
631 
632  if (Store < 0.0)
634  else
636 
637  InvDelta = X2;
638  }
639  else
640  {
641  X1 = 0.999 * Store;
642  X2 = 1.001 * Store;
643  InvDelta = 500.0 / Store;
644  }
645  }
646  else
647  {
648  X1 = Store - 0.001 * *pRate;
649  X2 = Store + 0.001 * *pRate;
650  InvDelta = 500.0 / *pRate;
651  }
652 
653  *pX = X1;
654  mpModel->setState(State);
655  evaluateRoots(Y1, true);
656 
657  *pX = X2;
658  mpModel->setState(State);
659  evaluateRoots(Y2, true);
660 
661  *pX = Store;
662 
663  pJacobian = jacobian.array() + Col;
664  C_FLOAT64 * pY1 = Y1.array();
665  C_FLOAT64 * pY2 = Y2.array();
666 
667  for (; pJacobian < pJacobianEnd; pJacobian += NumCols, ++pY1, ++pY2)
668  * pJacobian = (*pY2 - *pY1) * InvDelta;
669  }
670 
671  // Undo the changes from evaluateRoots.
672  mpModel->setState(State);
673  evaluateRoots(Y2, true);
674 }
CVector< C_FLOAT64 * > mRootValues
Definition: CMathModel.h:192
void evaluateRoots(CVectorCore< C_FLOAT64 > &rootValues, const bool &ignoreDiscrete)
Definition: CMathModel.cpp:169
Definition: CState.h:305
CModel * mpModel
Definition: CMathModel.h:177
size_t getNumDependentReactionMetabs() const
Definition: CModel.cpp:1133
void setState(const CState &state)
Definition: CModel.cpp:1785
size_t getNumIndependent() const
Definition: CState.cpp:342
virtual void resize(size_t rows, size_t cols, const bool &copy=false)
Definition: CMatrix.h:151
size_t size() const
Definition: CVector.h:100
#define C_FLOAT64
Definition: copasi.h:92
CType * array()
Definition: CVector.h:139
virtual size_t size() const
Definition: CMatrix.h:132
const CState & getState() const
Definition: CModel.cpp:1771
virtual CType * array()
Definition: CMatrix.h:337
#define min(a, b)
Definition: f2c.h:175
C_FLOAT64 * beginIndependent()
Definition: CState.cpp:328
bool CMathModel::compile ( CModel pModel)

Compile the mathematical model based on given the model.

Parameters
CModel* pModel
Returns
bool success

Definition at line 58 of file CMathModel.cpp.

References CCopasiVector< T >::add(), CVectorCore< CType >::array(), CCopasiVector< T >::begin(), buildRequiredRefreshList(), C_FLOAT64, CCopasiVector< T >::clear(), CMathEvent::compile(), CCopasiVector< T >::end(), CStateTemplate::endDependent(), CStateTemplate::getEntities(), CModel::getEvents(), CMathEvent::getMathTrigger(), CMathTrigger::getRootFinders(), CModel::getStateTemplate(), mEvents, mpModel, mRootDiscrete, mRootIndex2Event, mRootIndex2RootFinder, mRootRefreshes, mRootValues, and CVector< CType >::resize().

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

59 {
60  // For each CEvent we need to create a CMathEvent
61  mEvents.clear();
62 
63  // We clear the sequence of root refreshes to avoid accessing invalid pointers.
64  mRootRefreshes.clear();
65 
66  // We clear the map to avoid accessing no longer existing events.
68 
69  // We clear the map to avoid accessing no longer existing root finders.
71 
72  mpModel = pModel;
73 
74  if (mpModel == NULL)
75  return false;
76 
77  // Now we are ready to start the compilations.
78  bool success = true;
79 
80  // The context in which this model is compiled.
81  // TODO When the math model is the only thing required for simulation this should be changed
82  // to this.
83  std::vector< CCopasiContainer * > Context;
84  Context.push_back(mpModel);
85 
88 
89  size_t RootFinderCount = 0;
90 
91  for (; itEvent != endEvent; ++itEvent)
92  {
93  CMathEvent * pEvent = new CMathEvent();
94  mEvents.add(pEvent, true);
95  success &= pEvent->compile(*itEvent, Context);
96 
97  RootFinderCount += pEvent->getMathTrigger().getRootFinders().size();
98  }
99 
100  // We need to create a CVector of pointers to the current root finder values
101  mRootValues.resize(RootFinderCount);
102  C_FLOAT64 ** ppRootValue = mRootValues.array();
103 
104  // We need to create a CVector indicating whether the roots only change
105  // during discrete events.
106  mRootDiscrete.resize(RootFinderCount);
107  bool * pRootDiscrete = mRootDiscrete.array();
108 
109  // We need create a map of root indexes to events.
110  mRootIndex2Event.resize(RootFinderCount);
111  CMathEvent ** ppEvent = mRootIndex2Event.array();
112 
113  // We need create a map of root indexes to root finders.
114  mRootIndex2RootFinder.resize(RootFinderCount);
116 
117  // We need to list all state variables to find out whether the roots
118  // only change during discrete events.
119  std::set< const CCopasiObject * > StateVariables;
120  CModelEntity *const*ppEntity = mpModel->getStateTemplate().getEntities();
121  CModelEntity *const*ppEntityEnd = mpModel->getStateTemplate().endDependent();
122 
123  for (; ppEntity != ppEntityEnd; ++ppEntity)
124  {
125  StateVariables.insert((*ppEntity)->getValueReference());
126  }
127 
128  std::set< const CCopasiObject * > RootValuesDependencies;
129 
132 
133  // for each event
134  for (; itMathEvent != endMathEvent; ++itMathEvent)
135  {
137  (*itMathEvent)->getMathTrigger().getRootFinders().begin();
139  (*itMathEvent)->getMathTrigger().getRootFinders().end();
140 
141  // for each root finder
142  for (; itRootFinder != endRootFinder;
143  ++itRootFinder, ++ppRootValue, ++pRootDiscrete, ++ppEvent, ++ppRootFinder)
144  {
145  // Update the vector of pointers to current root values.
146  *ppRootValue = (*itRootFinder)->getRootValuePtr();
147 
148  // Store whether a root changes only during discrete events.
149  (*itRootFinder)->determineDiscrete(StateVariables);
150  *pRootDiscrete = (*itRootFinder)->isDiscrete();
151 
152  // Build the mapping from root values indexes to CMathEvents
153  *ppEvent = *itMathEvent;
154 
155  // Build the mapping from root values indexes to root finders
156  *ppRootFinder = *itRootFinder;
157 
158  // The root finder needs to be up to date
159  RootValuesDependencies.insert(*itRootFinder);
160  }
161  }
162 
163  // We need to compile a refresh sequence which calculates all root values.
164  mRootRefreshes = buildRequiredRefreshList(RootValuesDependencies);
165 
166  return success;
167 }
CCopasiVectorN< CEvent > & getEvents()
Definition: CModel.cpp:1110
bool compile(const CEvent *pEvent, std::vector< CCopasiContainer * > listOfContainer)
CVector< C_FLOAT64 * > mRootValues
Definition: CMathModel.h:192
iterator begin()
std::vector< Refresh * > buildRequiredRefreshList(const std::set< const CCopasiObject * > &requiredObjects) const
Definition: CMathModel.cpp:452
void resize(size_t size, const bool &copy=false)
Definition: CVector.h:301
CModelEntity ** endDependent()
Definition: CState.cpp:211
CModel * mpModel
Definition: CMathModel.h:177
CMathTrigger & getMathTrigger()
iterator end()
virtual bool add(const CType &src)
std::vector< Refresh * > mRootRefreshes
Definition: CMathModel.h:204
CVector< bool > mRootDiscrete
Definition: CMathModel.h:198
#define C_FLOAT64
Definition: copasi.h:92
CType * array()
Definition: CVector.h:139
const CStateTemplate & getStateTemplate() const
Definition: CModel.cpp:1172
virtual void clear()
CVector< CMathTrigger::CRootFinder * > mRootIndex2RootFinder
Definition: CMathModel.h:214
CCopasiVector< CMathEvent > mEvents
Definition: CMathModel.h:187
CVector< CMathEvent * > mRootIndex2Event
Definition: CMathModel.h:209
CModelEntity ** getEntities()
Definition: CState.cpp:204
CCopasiVector< CRootFinder > & getRootFinders()
bool CMathModel::determineInitialRoots ( CVector< C_INT > &  foundRoots)
private

Determine whether there are any initial roots and mark them.

Parameters
CVector<C_INT > & foundRoots
Returns
bool found

Definition at line 550 of file CMathModel.cpp.

References CVectorCore< CType >::array(), C_FLOAT64, C_INT, calculateRootDerivatives(), mRootIndex2RootFinder, mRootValues, CVector< CType >::resize(), and CVectorCore< CType >::size().

Referenced by applyInitialValues().

551 {
552  bool Found = false;
553 
554  CVector< C_FLOAT64 > RootDerivatives;
555  calculateRootDerivatives(RootDerivatives);
556 
557  foundRoots.resize(mRootValues.size());
558  C_INT * pFoundRoot = foundRoots.array();
559  C_FLOAT64 ** pRootValue = mRootValues.array();
560  C_FLOAT64 * pDerivative = RootDerivatives.array();
562  CMathTrigger::CRootFinder ** ppEndRootFinder = ppRootFinder + mRootIndex2RootFinder.size();
563 
564  for (; ppRootFinder != ppEndRootFinder;
565  ++ppRootFinder, ++pRootValue, ++pDerivative, ++pFoundRoot)
566  {
567  if (**pRootValue == 0.0)
568  {
569  if (!(*ppRootFinder)->isEquality() &&
570  *pDerivative > 0.0)
571  {
572  *pFoundRoot = 1;
573  Found = true;
574 
575  continue;
576  }
577 
578  if ((*ppRootFinder)->isEquality() &&
579  *pDerivative < 0.0)
580  {
581  (*ppRootFinder)->toggle(std::numeric_limits< C_FLOAT64 >::quiet_NaN(), true, false);
582  }
583  }
584 
585  *pFoundRoot = 0;
586  }
587 
588  return Found;
589 }
#define C_INT
Definition: copasi.h:115
CVector< C_FLOAT64 * > mRootValues
Definition: CMathModel.h:192
void resize(size_t size, const bool &copy=false)
Definition: CVector.h:301
size_t size() const
Definition: CVector.h:100
#define C_FLOAT64
Definition: copasi.h:92
CType * array()
Definition: CVector.h:139
CVector< CMathTrigger::CRootFinder * > mRootIndex2RootFinder
Definition: CMathModel.h:214
void calculateRootDerivatives(CVector< C_FLOAT64 > &rootDerivatives)
Definition: CMathModel.cpp:417
void CMathModel::evaluateRoots ( CVectorCore< C_FLOAT64 > &  rootValues,
const bool &  ignoreDiscrete 
)

Evaluate all root values for the current state of the model. If ignoreDiscrete is true discrete roots evaluate to 1.0.

Parameters
CVectorCore<double > & rootValues
constbool & ignoreDiscrete

Definition at line 169 of file CMathModel.cpp.

References CVectorCore< CType >::array(), C_FLOAT64, mRootDiscrete, mRootRefreshes, mRootValues, and CVectorCore< CType >::size().

Referenced by calculateRootJacobian(), CModel::evaluateRoots(), CProcessQueue::process(), and CProcessQueue::rootsFound().

171 {
172  // Apply all needed refresh calls to calculate the current root values.
173  std::vector< Refresh * >::const_iterator itRefresh = mRootRefreshes.begin();
174  std::vector< Refresh * >::const_iterator endRefresh = mRootRefreshes.end();
175 
176  while (itRefresh != endRefresh)
177  (**itRefresh++)();
178 
179  // Copy the current values to the output vector.
180  assert(rootValues.size() == mRootValues.size());
181 
182  C_FLOAT64 *pTarget = rootValues.array();
183  C_FLOAT64 **pSrc = mRootValues.array();
184  C_FLOAT64 **pSrcEnd = pSrc + mRootValues.size();
185 
186  if (ignoreDiscrete)
187  {
188  bool *pDiscrete = mRootDiscrete.array();
189 
190  for (; pSrc != pSrcEnd; ++pSrc, ++pDiscrete, ++pTarget)
191  {
192  *pTarget = (*pDiscrete) ? 1.0 : **pSrc;
193  }
194  }
195  else
196  {
197  for (; pSrc != pSrcEnd; ++pSrc, ++pTarget)
198  {
199  *pTarget = **pSrc;
200  }
201  }
202 
203  return;
204 }
CVector< C_FLOAT64 * > mRootValues
Definition: CMathModel.h:192
size_t size() const
Definition: CVector.h:100
std::vector< Refresh * > mRootRefreshes
Definition: CMathModel.h:204
CVector< bool > mRootDiscrete
Definition: CMathModel.h:198
#define C_FLOAT64
Definition: copasi.h:92
CType * array()
Definition: CVector.h:139
const C_FLOAT64 & CMathModel::getInitialTime ( ) const

Retreive the initial time

Returns
const C_FLOAT64 & initialTime

Definition at line 206 of file CMathModel.cpp.

References CModel::getInitialTime(), and mpModel.

Referenced by CProcessQueue::initialize().

207 {
208  return mpModel->getInitialTime();
209 }
CModel * mpModel
Definition: CMathModel.h:177
const C_FLOAT64 & getInitialTime() const
Definition: CModel.cpp:1184
size_t CMathModel::getNumRoots ( ) const

Retrieve the number of roots used in checking for discontinuities.

Returns
size_t numRoots

Definition at line 412 of file CMathModel.cpp.

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

Referenced by CModel::getNumRoots(), and CProcessQueue::initialize().

413 {
414  return mRootValues.size();
415 }
CVector< C_FLOAT64 * > mRootValues
Definition: CMathModel.h:192
size_t size() const
Definition: CVector.h:100
const CProcessQueue & CMathModel::getProcessQueue ( ) const

Definition at line 362 of file CMathModel.cpp.

References mProcessQueue.

Referenced by CCrossSectionTask::finish(), CTrajectoryTask::initialize(), CCrossSectionTask::process(), and CCrossSectionTask::restore().

363 {
364  return mProcessQueue;
365 }
CProcessQueue mProcessQueue
Definition: CMathModel.h:182
CProcessQueue & CMathModel::getProcessQueue ( )

Definition at line 367 of file CMathModel.cpp.

References mProcessQueue.

368 {
369  return mProcessQueue;
370 }
CProcessQueue mProcessQueue
Definition: CMathModel.h:182
const C_FLOAT64 & CMathModel::getProcessQueueExecutionTime ( ) const

Retrieve the next execution time scheduled in the process queue

Returns
const C_FLOAT64 & processQueueExecutionTime

Definition at line 357 of file CMathModel.cpp.

References CProcessQueue::getProcessQueueExecutionTime(), and mProcessQueue.

Referenced by CModel::getProcessQueueExecutionTime().

358 {
360 }
const C_FLOAT64 & getProcessQueueExecutionTime() const
CProcessQueue mProcessQueue
Definition: CMathModel.h:182
const CVector< CMathTrigger::CRootFinder * > & CMathModel::getRootFinders ( ) const

Retrieve a vector of root finders

Returns
const CVector< CMathTrigger::CRootFinder * > & rootFinders

Definition at line 447 of file CMathModel.cpp.

References mRootIndex2RootFinder.

Referenced by CModel::getRootFinders(), and CProcessQueue::rootsFound().

448 {
449  return mRootIndex2RootFinder;
450 }
CVector< CMathTrigger::CRootFinder * > mRootIndex2RootFinder
Definition: CMathModel.h:214
bool CMathModel::processQueue ( const C_FLOAT64 time,
const bool &  equality,
CProcessQueue::resolveSimultaneousAssignments  pResolveSimultaneousAssignments 
)

Process events scheduled at the given which a are checked for equality or not

Parameters
constC_FLOAT64 & time
constbool & equality
CProcessQueue::resolveSimultaneousAssignmentspResolveSimultaneousAssignments
Returns
bool stateChanged

Definition at line 211 of file CMathModel.cpp.

References mProcessQueue, and CProcessQueue::process().

Referenced by CModel::processQueue().

214 {
215  return mProcessQueue.process(time, equality, pResolveSimultaneousAssignments);
216 }
CProcessQueue mProcessQueue
Definition: CMathModel.h:182
bool process(const C_FLOAT64 &time, const bool &priorToOutput, resolveSimultaneousAssignments pResolveSimultaneousAssignments)
void CMathModel::processRoots ( const C_FLOAT64 time,
const bool &  equality,
const bool &  correct,
const CVector< C_INT > &  roots 
)

Check whether the roots which have value 1 lead to firing of events and schedule them if needed. This method is intended to be called from integration methods, which can distinguish between equality and inequality.

Parameters
constC_FLOAT64 & time
constbool & equality
constbool & correct
constCVector< C_INT > & roots

Definition at line 218 of file CMathModel.cpp.

References CVectorCore< CType >::array(), C_INT, CMathTrigger::calculate(), CMathTrigger::CRootFinder::calculateTrueValue(), CMathEvent::fire(), CMathEvent::getMathTrigger(), mProcessQueue, mRootIndex2Event, mRootIndex2RootFinder, mRootRefreshes, and CVectorCore< CType >::size().

Referenced by applyInitialValues(), CProcessQueue::process(), and CModel::processRoots().

222 {
223  // Apply all needed refresh calls to calculate the current root values.
224  std::vector< Refresh * >::const_iterator itRefresh = mRootRefreshes.begin();
225  std::vector< Refresh * >::const_iterator endRefresh = mRootRefreshes.end();
226 
227  while (itRefresh != endRefresh)
228  (**itRefresh++)();
229 
230  assert(foundRoots.size() == mRootIndex2Event.size());
231 
232  // All events associated with the found roots need to be evaluated whether they fire.
233  // In case one fires the corresponding event needs to be scheduled in the process queue.
234 
235  const C_INT *pFoundRoot = foundRoots.array();
236  const C_INT *pFoundRootEnd = pFoundRoot + foundRoots.size();
237 
238  CMathEvent ** ppEvent = mRootIndex2Event.array();
239  CMathEvent * pProcessEvent = NULL;
240 
242 
243  if (correct)
244  {
245  while (pFoundRoot != pFoundRootEnd)
246  {
247  // We reevaluate the state of the non found roots, which should be save.
248  if (*pFoundRoot < 1 && (*ppRootFinder)->isEquality() == equality)
249  {
250  (*ppRootFinder)->calculateTrueValue();
251  }
252 
253  ++pFoundRoot; ++ppRootFinder;
254  }
255  }
256 
257  pFoundRoot = foundRoots.array();
258  ppRootFinder = mRootIndex2RootFinder.array();
259 
260  // We go through the list of roots and process the events
261  // which need to be checked whether they fire.
262  bool TriggerBefore = true;
263 
264  while (pFoundRoot != pFoundRootEnd)
265  {
266  pProcessEvent = *ppEvent;
267  TriggerBefore = pProcessEvent->getMathTrigger().calculate();
268 
269  // Process the events for which we have found a root.
270  // A found root is indicated by roots[i] = 1 or 0 otherwise.
271  while (pFoundRoot != pFoundRootEnd &&
272  *ppEvent == pProcessEvent)
273  {
274  // We must only toggle the roots which are marked.
275  if (*pFoundRoot > 0)
276  {
277  (*ppRootFinder)->toggle(time, equality, correct);
278  }
279 
280  ++pFoundRoot; ++ppEvent; ++ppRootFinder;
281  }
282 
283  bool TriggerAfter = pProcessEvent->getMathTrigger().calculate();
284 
285  // Check whether the event fires
286  if (TriggerAfter == true &&
287  TriggerBefore == false)
288  {
289  pProcessEvent->fire(time, equality, mProcessQueue);
290  }
291  }
292 
293  return;
294 }
#define C_INT
Definition: copasi.h:115
void fire(const C_FLOAT64 &time, const bool &equality, CProcessQueue &processQueue)
CProcessQueue mProcessQueue
Definition: CMathModel.h:182
CMathTrigger & getMathTrigger()
size_t size() const
Definition: CVector.h:100
std::vector< Refresh * > mRootRefreshes
Definition: CMathModel.h:204
CType * array()
Definition: CVector.h:139
CVector< CMathTrigger::CRootFinder * > mRootIndex2RootFinder
Definition: CMathModel.h:214
CVector< CMathEvent * > mRootIndex2Event
Definition: CMathModel.h:209
void CMathModel::processRoots ( const C_FLOAT64 time,
const CVector< C_INT > &  roots 
)

Check whether the roots which have value 1 lead to firing of events and schedule them if needed. This method is intended to be called during discrete event processing e.g. while processing the event queue.

Parameters
constC_FLOAT64 & time
constbool & equality
constbool & correct
constCVector< C_INT > & roots

Definition at line 296 of file CMathModel.cpp.

References CVectorCore< CType >::array(), C_INT, CMathTrigger::calculate(), CMathEvent::fire(), CMathEvent::getMathTrigger(), mProcessQueue, mRootIndex2Event, mRootIndex2RootFinder, mRootRefreshes, and CVectorCore< CType >::size().

298 {
299  // Apply all needed refresh calls to calculate the current root values.
300  std::vector< Refresh * >::const_iterator itRefresh = mRootRefreshes.begin();
301  std::vector< Refresh * >::const_iterator endRefresh = mRootRefreshes.end();
302 
303  while (itRefresh != endRefresh)
304  (**itRefresh++)();
305 
306  assert(foundRoots.size() == mRootIndex2Event.size());
307 
308  // All events associated with the found roots need to be evaluated whether they fire.
309  // In case one fires the corresponding event needs to be scheduled in the process queue.
310 
311  const C_INT *pFoundRoot = foundRoots.array();
312  const C_INT *pFoundRootEnd = pFoundRoot + foundRoots.size();
313 
314  CMathEvent ** ppEvent = mRootIndex2Event.array();
315  CMathEvent * pProcessEvent = NULL;
316 
318 
319  // We go through the list of roots and process the events
320  // which need to be checked whether they fire.
321  bool TriggerBefore = true;
322 
323  while (pFoundRoot != pFoundRootEnd)
324  {
325  pProcessEvent = *ppEvent;
326  TriggerBefore = pProcessEvent->getMathTrigger().calculate();
327 
328  // Process the events for which we have found a root.
329  // A found root is indicated by roots[i] = 1 or 0 otherwise.
330  while (pFoundRoot != pFoundRootEnd &&
331  *ppEvent == pProcessEvent)
332  {
333  // We must only toggle the roots which are marked.
334  if (*pFoundRoot > 0)
335  {
336  (*ppRootFinder)->toggle(time);
337  }
338 
339  ++pFoundRoot; ++ppEvent; ++ppRootFinder;
340  }
341 
342  bool TriggerAfter = pProcessEvent->getMathTrigger().calculate();
343 
344  // Check whether the event fires
345  if (TriggerAfter == true &&
346  TriggerBefore == false)
347  {
348  // We are dealing with discrete root processing and can not distinguish
349  // between equality and inequality. Thus we just pick equality = true
350  pProcessEvent->fire(time, true, mProcessQueue);
351  }
352  }
353 
354  return;
355 }
#define C_INT
Definition: copasi.h:115
void fire(const C_FLOAT64 &time, const bool &equality, CProcessQueue &processQueue)
CProcessQueue mProcessQueue
Definition: CMathModel.h:182
CMathTrigger & getMathTrigger()
size_t size() const
Definition: CVector.h:100
std::vector< Refresh * > mRootRefreshes
Definition: CMathModel.h:204
CType * array()
Definition: CVector.h:139
CVector< CMathTrigger::CRootFinder * > mRootIndex2RootFinder
Definition: CMathModel.h:214
CVector< CMathEvent * > mRootIndex2Event
Definition: CMathModel.h:209

Member Data Documentation

CCopasiVector< CMathEvent > CMathModel::mEvents
private

List of events

Definition at line 187 of file CMathModel.h.

Referenced by applyInitialValues(), and compile().

CModel* CMathModel::mpModel
private
CProcessQueue CMathModel::mProcessQueue
private

The event process queue

Definition at line 182 of file CMathModel.h.

Referenced by applyInitialValues(), getProcessQueue(), getProcessQueueExecutionTime(), processQueue(), and processRoots().

CVector< bool > CMathModel::mRootDiscrete
private

A vector indicating whether a root may only change during discrete events.

Definition at line 198 of file CMathModel.h.

Referenced by compile(), and evaluateRoots().

CVector< CMathEvent * > CMathModel::mRootIndex2Event
private

A map from the index of a root value to the associated event

Definition at line 209 of file CMathModel.h.

Referenced by compile(), and processRoots().

CVector< CMathTrigger::CRootFinder * > CMathModel::mRootIndex2RootFinder
private

A map from the index of a root value to the associated root finder

Definition at line 214 of file CMathModel.h.

Referenced by compile(), determineInitialRoots(), getRootFinders(), and processRoots().

std::vector< Refresh * > CMathModel::mRootRefreshes
private

The sequence of refresh calls needed to calculate the current root values.

Definition at line 204 of file CMathModel.h.

Referenced by applyInitialValues(), compile(), evaluateRoots(), and processRoots().

CVector< C_FLOAT64 *> CMathModel::mRootValues
private

A vector of pointers to the current root finder values

Definition at line 192 of file CMathModel.h.

Referenced by calculateRootDerivatives(), calculateRootJacobian(), compile(), determineInitialRoots(), evaluateRoots(), and getNumRoots().


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