COPASI API  4.16.103
Public Member Functions | Public Attributes | List of all members
CMathEventN::CTrigger::CRoot Class Reference

#include <CMathEvent.h>

Collaboration diagram for CMathEventN::CTrigger::CRoot:
Collaboration graph
[legend]

Public Member Functions

bool compile (CEvaluationNode *pRootNode, const bool &equality, CMathContainer &container)
 
void copy (const CRoot &src, CMathContainer &container, const size_t &valueOffset, const size_t &objectOffset)
 
CEvaluationNodecreateTriggerExpressionNode () const
 
 CRoot ()
 
void initialize (CMath::sPointers &pointers)
 
 ~CRoot ()
 

Public Attributes

bool mDiscrete
 
bool mEquality
 
CMathObjectmpRoot
 
CMathObjectmpRootState
 

Detailed Description

Definition at line 62 of file CMathEvent.h.

Constructor & Destructor Documentation

CMathEventN::CTrigger::CRoot::CRoot ( )

Default constructor

Definition at line 83 of file CMathEvent.cpp.

83  :
84  mpRoot(NULL),
85  mpRootState(NULL),
86  mEquality(false),
87  mDiscrete(false)
88 {}
CMathEventN::CTrigger::CRoot::~CRoot ( )

Destructor

Definition at line 90 of file CMathEvent.cpp.

91 {}

Member Function Documentation

bool CMathEventN::CTrigger::CRoot::compile ( CEvaluationNode pRootNode,
const bool &  equality,
CMathContainer container 
)

Definition at line 121 of file CMathEvent.cpp.

References CCopasiNode< _Data >::addChild(), C_FLOAT64, CEvaluationNodeNumber::DOUBLE, and CEvaluationNodeLogical::GT.

Referenced by CMathEventN::CTrigger::compileLE().

124 {
125  mEquality = equality;
126 
127  std::vector< CCopasiContainer * > ListOfContainer;
128  ListOfContainer.push_back(const_cast< CMathContainer * >(&container));
129 
130  CMathExpression * pExpression = new CMathExpression("RootExpression", container);
131  bool success = static_cast< CEvaluationTree * >(pExpression)->setRoot(pRootNode);
132  success &= mpRoot->setExpressionPtr(pExpression);
133 
134  // Compile the root state object
135  CMathExpression * pStateExpression = new CMathExpression("RootStateExpression", container);
136 
137  CEvaluationNode * pStateExpressionNode = new CEvaluationNodeLogical(CEvaluationNodeLogical::GT, "GT");
138  pStateExpressionNode->addChild(new CEvaluationNodeObject((C_FLOAT64 *) mpRoot->getValuePointer()));
139  pStateExpressionNode->addChild(new CEvaluationNodeNumber(CEvaluationNodeNumber::DOUBLE, "0.5"));
140 
141  success &= static_cast< CEvaluationTree * >(pStateExpression)->setRoot(pStateExpressionNode);
142  success &= mpRootState->setExpressionPtr(pStateExpression);
143 
144  return success;
145 }
virtual void * getValuePointer() const
virtual bool addChild(CCopasiNode< Data > *pChild, CCopasiNode< Data > *pAfter=NULL)
Definition: CCopasiNode.h:156
#define C_FLOAT64
Definition: copasi.h:92
bool setExpressionPtr(CMathExpression *pMathExpression)
void CMathEventN::CTrigger::CRoot::copy ( const CRoot src,
CMathContainer container,
const size_t &  valueOffset,
const size_t &  objectOffset 
)

Copy an existing object

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

Definition at line 110 of file CMathEvent.cpp.

References mDiscrete, mEquality, mpRoot, and mpRootState.

Referenced by CMathEventN::CTrigger::copy().

114 {
115  mpRoot = src.mpRoot + objectOffset;
116  mpRootState = src.mpRootState + objectOffset;
117  mEquality = src.mEquality;
118  mDiscrete = src.mDiscrete;
119 }
CEvaluationNode * CMathEventN::CTrigger::CRoot::createTriggerExpressionNode ( ) const

Definition at line 148 of file CMathEvent.cpp.

References C_FLOAT64.

Referenced by CMathEventN::CTrigger::compileLE().

149 {
151 }
virtual void * getValuePointer() const
#define C_FLOAT64
Definition: copasi.h:92
void CMathEventN::CTrigger::CRoot::initialize ( CMath::sPointers pointers)

Definition at line 93 of file CMathEvent.cpp.

References CMath::Event, CMath::EventRoot, CMath::EventRootState, CMathObject::initialize(), CMath::sPointers::pEventRoots, CMath::sPointers::pEventRootsObject, CMath::sPointers::pEventRootStates, CMath::sPointers::pEventRootStatesObject, and CMath::SimulationTypeUndefined.

Referenced by CMathEventN::CTrigger::initialize().

94 {
95  // Initialize the root object!
96  mpRoot = pointers.pEventRootsObject;
97  *pointers.pEventRoots = 1.0;
100  false, false, NULL);
101 
102  // Initialize the root state object!
104  *pointers.pEventRootStates = 1.0;
107  false, false, NULL);
108 }
CMathObject * pEventRootsObject
Definition: CMathEnum.h:137
C_FLOAT64 * pEventRoots
Definition: CMathEnum.h:110
C_FLOAT64 * pEventRootStates
Definition: CMathEnum.h:111
CMathObject * pEventRootStatesObject
Definition: CMathEnum.h:138
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

Member Data Documentation

bool CMathEventN::CTrigger::CRoot::mDiscrete

Definition at line 96 of file CMathEvent.h.

Referenced by copy().

bool CMathEventN::CTrigger::CRoot::mEquality

Definition at line 95 of file CMathEvent.h.

Referenced by copy().

CMathObject* CMathEventN::CTrigger::CRoot::mpRoot

Definition at line 93 of file CMathEvent.h.

Referenced by copy(), and CMathEventN::CTrigger::setExpression().

CMathObject* CMathEventN::CTrigger::CRoot::mpRootState

Definition at line 94 of file CMathEvent.h.

Referenced by copy(), and CMathEventN::CTrigger::setExpression().


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