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

#include <CMathExpression.h>

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

Public Member Functions

 CMathExpression (const std::string &name, CMathContainer &container)
 
 CMathExpression (const CExpression &src, CMathContainer &container, const bool &replaceDiscontinuousNodes)
 
 CMathExpression (const CFunction &src, const CCallParameters< C_FLOAT64 > &callParameters, CMathContainer &container, const bool &replaceDiscontinuousNodes)
 
virtual bool compile ()
 
bool convertToInitialExpression ()
 
virtual const
CObjectInterface::ObjectSet
getPrerequisites () const
 
const C_FLOAT64value ()
 
virtual ~CMathExpression ()
 
- Public Member Functions inherited from CEvaluationTree
bool calls (std::set< std::string > &list) const
 
 CEvaluationTree (const std::string &name="NoName", const CCopasiContainer *pParent=NULL, const Type &type=Function)
 
 CEvaluationTree (const CEvaluationTree &src, const CCopasiContainer *pParent=NULL)
 
bool dependsOnTree (const std::string &name) const
 
CCopasiObject::DataObjectSet getDeletedObjects () const
 
std::string::size_type getErrorPosition () const
 
const std::string & getInfix () const
 
const std::vector
< CEvaluationNode * > & 
getNodeList () const
 
CEvaluationNodegetRoot ()
 
const CEvaluationNodegetRoot () const
 
const CEvaluationTree::TypegetType () const
 
virtual size_t getVariableIndex (const std::string &name) const
 
virtual const C_FLOAT64getVariableValue (const size_t &index) const
 
bool hasCircularDependency () const
 
bool hasDiscontinuity () const
 
bool isBoolean () const
 
bool isUsable () const
 
bool operator== (const CEvaluationTree &rhs) const
 
virtual bool setInfix (const std::string &infix)
 
bool setTree (const ASTNode &pRootNode)
 
virtual ASTNode * toAST (const CCopasiDataModel *pDataModel) const
 
bool updateTree ()
 
virtual ~CEvaluationTree ()
 
- 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 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 ()
 

Static Public Member Functions

static CMathExpressioncopy (const CMathExpression &src, CMathContainer &container, const size_t &valueOffset, const size_t &objectOffset)
 
- Static Public Member Functions inherited from CEvaluationTree
static CEvaluationTreecopy (const CEvaluationTree &src)
 
static CEvaluationTreecreate (CEvaluationTree::Type type)
 
static CEvaluationNodefromAST (const ASTNode *pASTNode)
 
- 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)
 

Private Member Functions

 CMathExpression ()
 
CEvaluationNodecreateMassActionPart (const C_FLOAT64 *pK, const CCallParameters< C_FLOAT64 > *pSpecies)
 
CEvaluationNodecreateNodeFromValue (const C_FLOAT64 *pDataValue)
 
virtual bool setRoot (CEvaluationNode *pRootNode)
 

Private Attributes

CObjectInterface::ObjectSet mPrerequisites
 

Additional Inherited Members

- Public Types inherited from CEvaluationTree
enum  Type {
  Function = 0, MassAction, PreDefined, UserDefined,
  Expression, MathExpression
}
 
- 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 Attributes inherited from CEvaluationTree
static const std::string TypeName []
 
static const char * XMLType []
 
- 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 CEvaluationTree
void buildCalculationSequence ()
 
void calculate ()
 
bool compileNodes ()
 
bool parse ()
 
void setType (const CEvaluationTree::Type &type)
 
- 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 CEvaluationTree
std::vector< CEvaluationNode * > mCalculationSequence
 
std::string mInfix
 
std::vector< CEvaluationNode * > * mpNodeList
 
CEvaluationNodempRoot
 
CEvaluationTree::Type mType
 
bool mUsable
 
C_FLOAT64 mValue
 
- Protected Attributes inherited from CCopasiContainer
objectMap mObjects
 
- Static Protected Attributes inherited from CCopasiObject
static CRenameHandlersmpRenameHandler = NULL
 

Detailed Description

Definition at line 20 of file CMathExpression.h.

Constructor & Destructor Documentation

CMathExpression::CMathExpression ( )
private

Hidden default constructor

Definition at line 20 of file CMathExpression.cpp.

Referenced by copy().

20  :
23 {}
CObjectInterface::ObjectSet mPrerequisites
CEvaluationTree(const std::string &name="NoName", const CCopasiContainer *pParent=NULL, const Type &type=Function)
CMathExpression::CMathExpression ( const std::string &  name,
CMathContainer container 
)

Specific constructor.

Parameters
conststd::string & name
CMathContainer& container

Definition at line 25 of file CMathExpression.cpp.

26  :
29 {}
CObjectInterface::ObjectSet mPrerequisites
CEvaluationTree(const std::string &name="NoName", const CCopasiContainer *pParent=NULL, const Type &type=Function)
CMathExpression::CMathExpression ( const CExpression src,
CMathContainer container,
const bool &  replaceDiscontinuousNodes 
)

Specific constructor. The src expression must have been successfully compiled in the context of the current model

Parameters
constCExpression & src
CMathContainer& container
constbool & replaceDiscontinuousNodes

Definition at line 31 of file CMathExpression.cpp.

References compile(), CMathContainer::copyBranch(), CEvaluationTree::getRoot(), and CEvaluationTree::mpRoot.

33  :
36 {
37  // Create a converted copy of the existing expression tree.
38  mpRoot = container.copyBranch(src.getRoot(), replaceDiscontinuousNodes);
39 
40  compile();
41 }
const std::string & getObjectName() const
CEvaluationNode * copyBranch(const CEvaluationNode *pSrc, const bool &replaceDiscontinuousNodes)
virtual bool compile()
CObjectInterface::ObjectSet mPrerequisites
CEvaluationTree(const std::string &name="NoName", const CCopasiContainer *pParent=NULL, const Type &type=Function)
CEvaluationNode * getRoot()
CEvaluationNode * mpRoot
CMathExpression::CMathExpression ( const CFunction src,
const CCallParameters< C_FLOAT64 > &  callParameters,
CMathContainer container,
const bool &  replaceDiscontinuousNodes 
)

Specific constructor. The src function must have been successfully compiled in the context of the current model

Parameters
constCFunction & src
constCCallParameters< C_FLOAT64 > & callParameters
CMathContainer& container
constbool & replaceDiscontinuousNodes

Definition at line 43 of file CMathExpression.cpp.

References CCopasiNode< _Data >::addChild(), CCallParameters< Type >::begin(), C_FLOAT64, compile(), CMathContainer::copyBranch(), createMassActionPart(), createNodeFromValue(), CCallParameters< Type >::end(), CEvaluationTree::Expression, CEvaluationTree::Function, CEvaluationTree::getRoot(), CEvaluationTree::getType(), CEvaluationTree::MassAction, CEvaluationTree::MathExpression, CEvaluationNodeOperator::MINUS, CEvaluationTree::mpRoot, CEvaluationTree::PreDefined, and CEvaluationTree::UserDefined.

46  :
49 {
50  // Deal with the different function types
51  switch (src.getType())
52  {
56  {
57  // Create a vector of CEvaluationNodeObject for each variable
59 
62 
63  for (; it != end; ++it)
64  {
65  Variables.push_back(createNodeFromValue(it->value));
66  }
67 
68  // Create a converted copy of the existing expression tree.
69  mpRoot = container.copyBranch(src.getRoot(), Variables, replaceDiscontinuousNodes);
70  }
71 
72  break;
73 
75  {
76  // We build a mass action expression based on the call parameters.
78 
79  // We always have reactants
80  const C_FLOAT64 * pK = it->value;
81  ++it;
82  const CCallParameters< C_FLOAT64 > * pSpecies = it->vector;
83  ++it;
84 
85  CEvaluationNode * pPart = createMassActionPart(pK, pSpecies);
86 
87  if (it != callParameters.end())
88  {
90  mpRoot->addChild(pPart);
91 
92  pK = it->value;
93  ++it;
94  pSpecies = it->vector;
95  ++it;
96 
97  pPart = createMassActionPart(pK, pSpecies);
98 
99  mpRoot->addChild(pPart);
100  }
101  else
102  {
103  mpRoot = pPart;
104  }
105  }
106  break;
107 
110  // This cannot happen and is only here to satisfy the compiler.
111  break;
112  }
113 
114  compile();
115 }
const_iterator begin() const
CEvaluationNode * createNodeFromValue(const C_FLOAT64 *pDataValue)
const std::string & getObjectName() const
const CEvaluationTree::Type & getType() const
CEvaluationNode * copyBranch(const CEvaluationNode *pSrc, const bool &replaceDiscontinuousNodes)
virtual bool addChild(CCopasiNode< Data > *pChild, CCopasiNode< Data > *pAfter=NULL)
Definition: CCopasiNode.h:156
virtual bool compile()
#define C_FLOAT64
Definition: copasi.h:92
CObjectInterface::ObjectSet mPrerequisites
const_iterator end() const
CEvaluationNode * createMassActionPart(const C_FLOAT64 *pK, const CCallParameters< C_FLOAT64 > *pSpecies)
CEvaluationTree(const std::string &name="NoName", const CCopasiContainer *pParent=NULL, const Type &type=Function)
CEvaluationNode * getRoot()
CEvaluationNode * mpRoot
CMathExpression::~CMathExpression ( )
virtual

Destructor

Definition at line 118 of file CMathExpression.cpp.

119 {}

Member Function Documentation

bool CMathExpression::compile ( )
virtual

Compile the evaluation tree.

Reimplemented from CEvaluationTree.

Definition at line 163 of file CMathExpression.cpp.

References CEvaluationTree::buildCalculationSequence(), C_FLOAT64, CEvaluationTree::mCalculationSequence, CEvaluationTree::mInfix, mpContainer, CEvaluationTree::mpNodeList, mPrerequisites, CEvaluationTree::mUsable, CEvaluationNode::OBJECT, CEvaluationNodeObject::POINTER, stringToPointer(), and CEvaluationTree::updateTree().

Referenced by CMathExpression(), copy(), and CMathObject::setExpressionPtr().

164 {
165  mPrerequisites.clear();
166  mUsable = true;
167 
168  if (!updateTree())
169  {
170  mUsable = false;
171  mCalculationSequence.clear();
172 
173  return mUsable;
174  }
175 
176  std::vector< CEvaluationNode * >::iterator it = mpNodeList->begin();
177  std::vector< CEvaluationNode * >::iterator end = mpNodeList->end();
178 
179  for (; it != end; ++it)
180  {
181  mUsable &= (*it)->compile(this);
182 
183  if ((*it)->getType() == (CEvaluationNode::OBJECT | CEvaluationNodeObject::POINTER))
184  {
185  void * pValue = stringToPointer((*it)->getData());
186 
187  // TODO CRITICAL It is possible that the user selects non model objects, i.e.,
188  // problem or method values within the expression. These cannot be mapped to a
189  // math objects and therefore dependencies will be broken.
190 
191  CMathObject * pMathObject = mpContainer->getMathObject((C_FLOAT64 *) pValue);
192 
193  if (pMathObject != NULL)
194  {
195  mPrerequisites.insert(pMathObject);
196  }
197  else
198  {
199  // For the moment we stop.
200  assert(false);
201  }
202  }
203  }
204 
205  if (mInfix == "@")
206  {
207  mUsable = true;
208  }
209 
211 
212  return mUsable;
213 }
std::vector< CEvaluationNode * > * mpNodeList
std::string mInfix
std::vector< CEvaluationNode * > mCalculationSequence
void buildCalculationSequence()
#define mpContainer
#define C_FLOAT64
Definition: copasi.h:92
void * stringToPointer(const std::string str)
Definition: utility.cpp:414
CObjectInterface::ObjectSet mPrerequisites
bool CMathExpression::convertToInitialExpression ( )

Convert to a corresponding initial expression.

Returns
bool success

Definition at line 215 of file CMathExpression.cpp.

References CEvaluationNode::buildInfix(), C_FLOAT64, CCopasiObject::getObjectName(), CEvaluationNodeObject::getObjectValuePtr(), CEvaluationTree::mInfix, mpContainer, CEvaluationTree::mpNodeList, mPrerequisites, CEvaluationTree::mpRoot, CEvaluationNode::OBJECT, CEvaluationNodeObject::POINTER, CCopasiObject::setObjectName(), and CEvaluationNodeObject::setObjectValuePtr().

Referenced by CMathObject::compileExpression().

216 {
217  if (getObjectName().substr(0, 7) != "Initial")
218  {
219  setObjectName("Initial" + getObjectName());
220  }
221 
222  if (mpNodeList == NULL)
223  {
224  return false;
225  }
226 
227  std::vector< CEvaluationNode * >::iterator it = mpNodeList->begin();
228  std::vector< CEvaluationNode * >::iterator end = mpNodeList->end();
229  bool changed = false;
230 
231  for (; it != end; ++it)
232  {
233  if ((*it)->getType() == (CEvaluationNode::OBJECT | CEvaluationNodeObject::POINTER))
234  {
235  CEvaluationNodeObject * pNode = static_cast< CEvaluationNodeObject *>(*it);
236  const C_FLOAT64 * pValue = pNode->getObjectValuePtr();
237  C_FLOAT64 * pInitialValue = mpContainer->getInitialValuePointer(pValue);
238 
239  if (pValue != pInitialValue)
240  {
241  changed = true;
242  pNode->setObjectValuePtr(pInitialValue);
243 
244  mPrerequisites.erase(mpContainer->getMathObject(pValue));
245  mPrerequisites.insert(mpContainer->getMathObject(pInitialValue));
246  }
247  }
248  }
249 
250  if (changed)
251  {
252  mInfix = mpRoot->buildInfix();
253  }
254 
255  return true;
256 }
std::vector< CEvaluationNode * > * mpNodeList
const std::string & getObjectName() const
void setObjectValuePtr(C_FLOAT64 *pObjectValue)
std::string buildInfix() const
std::string mInfix
#define mpContainer
const C_FLOAT64 * getObjectValuePtr() const
#define C_FLOAT64
Definition: copasi.h:92
CObjectInterface::ObjectSet mPrerequisites
bool setObjectName(const std::string &name)
CEvaluationNode * mpRoot
CMathExpression * CMathExpression::copy ( const CMathExpression src,
CMathContainer container,
const size_t &  valueOffset,
const size_t &  objectOffset 
)
static

Copy an expression with the given offsets

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

Definition at line 122 of file CMathExpression.cpp.

References C_FLOAT64, CMathExpression(), compile(), CEvaluationNode::copyBranch(), CCopasiObject::getObjectName(), CEvaluationTree::getRoot(), CEvaluationNode::OBJECT, CEvaluationNodeObject::POINTER, setRoot(), and stringToPointer().

Referenced by CMathObject::copy().

126 {
127  CMathExpression * pExpression = new CMathExpression(src.getObjectName(), container);
128 
129  pExpression->setRoot(src.getRoot()->copyBranch());
130 
131  // Apply the offset to all nodes
134 
135  for (; it != end; ++it)
136  {
138  {
139  C_FLOAT64 * pPointer = (C_FLOAT64 *) stringToPointer(it->getData());
140  static_cast< CEvaluationNodeObject * >(&*it)->setObjectValuePtr((C_FLOAT64 *)((size_t) pPointer + valueOffset));
141  }
142  }
143 
144  pExpression->compile();
145 
146  return pExpression;
147 }
CEvaluationNode * copyBranch() const
const std::string & getObjectName() const
virtual bool compile()
#define C_FLOAT64
Definition: copasi.h:92
void * stringToPointer(const std::string str)
Definition: utility.cpp:414
virtual bool setRoot(CEvaluationNode *pRootNode)
CEvaluationNode * getRoot()
CEvaluationNode * CMathExpression::createMassActionPart ( const C_FLOAT64 pK,
const CCallParameters< C_FLOAT64 > *  pSpecies 
)
private

Create a part of Mass Action kinetics

Parameters
constC_FLOAT64 * pK
constCCallParameters< C_FLOAT64 > * pSpecies
Returns
CEvaluationNode * massActionPart

Definition at line 291 of file CMathExpression.cpp.

References CCopasiNode< _Data >::addChild(), CCallParameters< Type >::begin(), createNodeFromValue(), CCallParameters< Type >::end(), and CEvaluationNodeOperator::MULTIPLY.

Referenced by CMathExpression().

293 {
295  pPart->addChild(createNodeFromValue(pK));
296 
297  CEvaluationNode * pNode = pPart;
298  CCallParameters< C_FLOAT64 >::const_iterator itSpecies = pSpecies->begin();
299  CCallParameters< C_FLOAT64 >::const_iterator endSpecies = pSpecies->end();
300 
301  for (; itSpecies != endSpecies - 1; ++itSpecies)
302  {
304  p->addChild(createNodeFromValue(itSpecies->value));
305  pNode->addChild(p);
306  pNode = p;
307  }
308 
309  pNode->addChild(createNodeFromValue(itSpecies->value));
310 
311  return pPart;
312 }
const_iterator begin() const
CEvaluationNode * createNodeFromValue(const C_FLOAT64 *pDataValue)
virtual bool addChild(CCopasiNode< Data > *pChild, CCopasiNode< Data > *pAfter=NULL)
Definition: CCopasiNode.h:156
const_iterator end() const
CEvaluationNode * CMathExpression::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 263 of file CMathExpression.cpp.

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

Referenced by CMathExpression(), and createMassActionPart().

264 {
265  CEvaluationNode * pNode = NULL;
266  CMathObject * pMathObject = NULL;
267 
268  if (pDataValue != NULL)
269  {
270  pMathObject = mpContainer->getMathObject(pDataValue);
271 
272  if (pMathObject != NULL)
273  {
274  pNode = new CEvaluationNodeObject((C_FLOAT64 *) pMathObject->getValuePointer());
275  }
276  else
277  {
278  // We must have a constant value like the conversion factor from the model.
279  pNode = new CEvaluationNodeNumber(*pDataValue);
280  }
281  }
282  else
283  {
284  // We have an invalid value, i.e. NaN
286  }
287 
288  return pNode;
289 }
virtual void * getValuePointer() const
#define mpContainer
#define C_FLOAT64
Definition: copasi.h:92
const CObjectInterface::ObjectSet & CMathExpression::getPrerequisites ( ) const
virtual

Retrieve the prerequisites, i.e., the objects which need to be evaluated before this.

Returns
const CObjectInterface::ObjectSet & prerequisites

Reimplemented from CCopasiObject.

Definition at line 157 of file CMathExpression.cpp.

References mPrerequisites.

Referenced by CMathObject::compileExpression().

158 {
159  return mPrerequisites;
160 }
CObjectInterface::ObjectSet mPrerequisites
bool CMathExpression::setRoot ( CEvaluationNode pRootNode)
privatevirtual

Sets the root node of the tree. Note: This is private to assure that only valid root node representing mathematical expressions are set.

Parameters
CEvaluationNode*root node of the tree
Returns
bool success

Reimplemented from CEvaluationTree.

Definition at line 258 of file CMathExpression.cpp.

References CEvaluationTree::setRoot().

Referenced by copy().

259 {
260  return CEvaluationTree::setRoot(pRootNode);
261 }
virtual bool setRoot(CEvaluationNode *pRootNode)
const C_FLOAT64 & CMathExpression::value ( )

Evaluate the expression

Returns
const C_FLOAT64 & value

Definition at line 149 of file CMathExpression.cpp.

References CEvaluationTree::calculate(), and CEvaluationTree::mValue.

Referenced by CMathObject::calculate().

150 {
151  calculate();
152 
153  return mValue;
154 }

Member Data Documentation

CObjectInterface::ObjectSet CMathExpression::mPrerequisites
private

The prerequisites for calculating the expression.

Definition at line 132 of file CMathExpression.h.

Referenced by compile(), convertToInitialExpression(), and getPrerequisites().


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