COPASI API
4.16.103
|
#include <CExpression.h>
Public Member Functions | |
virtual const C_FLOAT64 & | calcValue () |
CExpression (const std::string &name="Expression", const CCopasiContainer *pParent=NULL) | |
CExpression (const CExpression &src, const CCopasiContainer *pParent=NULL) | |
virtual bool | compile (std::vector< CCopasiContainer * > listOfContainer=CCopasiContainer::EmptyList) |
std::string | getBerkeleyMadonnaString () const |
std::string | getCCodeString () const |
const std::string & | getDisplayString () const |
const std::vector < CCopasiContainer * > & | getListOfContainer () const |
const CObjectInterface * | getNodeObject (const CCopasiObjectName &CN) const |
std::string | getXPPString () const |
void | refresh () |
virtual bool | setInfix (const std::string &infix) |
void | setIsBoolean (const bool &booleanRequired) |
bool | updateInfix () |
void | writeMathML (std::ostream &out, bool fullExpand, size_t l) const |
virtual | ~CExpression () |
![]() | |
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) | |
virtual bool | compile () |
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 |
CEvaluationNode * | getRoot () |
const CEvaluationNode * | getRoot () const |
const CEvaluationTree::Type & | getType () const |
virtual size_t | getVariableIndex (const std::string &name) const |
virtual const C_FLOAT64 & | getVariableValue (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 | setRoot (CEvaluationNode *pRootNode) |
bool | setTree (const ASTNode &pRootNode) |
virtual ASTNode * | toAST (const CCopasiDataModel *pDataModel) const |
bool | updateTree () |
virtual | ~CEvaluationTree () |
![]() | |
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 CObjectInterface * | getObject (const CCopasiObjectName &cn) const |
virtual const objectMap & | getObjects () const |
virtual std::string | getUnits () const |
virtual const CCopasiObject * | getValueObject () const |
virtual bool | remove (CCopasiObject *pObject) |
virtual | ~CCopasiContainer () |
![]() | |
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 DataObjectSet & | getDirectDependencies (const DataObjectSet &context=DataObjectSet()) const |
virtual const std::string & | getKey () const |
CCopasiContainer * | getObjectAncestor (const std::string &type) const |
CCopasiDataModel * | getObjectDataModel () |
const CCopasiDataModel * | getObjectDataModel () const |
virtual std::string | getObjectDisplayName (bool regular=true, bool richtext=false) const |
const std::string & | getObjectName () const |
CCopasiContainer * | getObjectParent () const |
const std::string & | getObjectType () const |
virtual const CObjectInterface::ObjectSet & | getPrerequisites () const |
virtual Refresh * | getRefresh () const |
UpdateMethod * | getUpdateMethod () const |
virtual void * | getValuePointer () 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 () |
![]() | |
CObjectInterface () | |
virtual | ~CObjectInterface () |
Static Public Member Functions | |
static CExpression * | createInitialExpression (const CExpression &expression, const CCopasiDataModel *pDataModel) |
![]() | |
static CEvaluationTree * | copy (const CEvaluationTree &src) |
static CEvaluationTree * | create (CEvaluationTree::Type type) |
static CEvaluationNode * | fromAST (const ASTNode *pASTNode) |
![]() | |
static std::vector< Refresh * > | buildUpdateSequence (const DataObjectSet &objects, const DataObjectSet &uptoDateObjects, const DataObjectSet &context=DataObjectSet()) |
static void | setRenameHandler (CRenameHandler *rh) |
Protected Attributes | |
std::string | mDisplayString |
bool | mIsBoolean |
const std::vector < CCopasiContainer * > * | mpListOfContainer |
![]() | |
std::vector< CEvaluationNode * > | mCalculationSequence |
std::string | mInfix |
std::vector< CEvaluationNode * > * | mpNodeList |
CEvaluationNode * | mpRoot |
CEvaluationTree::Type | mType |
bool | mUsable |
C_FLOAT64 | mValue |
![]() | |
objectMap | mObjects |
Private Member Functions | |
void | initObjects () |
Additional Inherited Members | |
![]() | |
enum | Type { Function = 0, MassAction, PreDefined, UserDefined, Expression, MathExpression } |
![]() | |
typedef std::multimap < std::string, CCopasiObject * > | objectMap |
![]() | |
typedef std::set< const CCopasiObject * > | DataObjectSet |
typedef std::vector< Refresh * > | DataUpdateSequence |
![]() | |
typedef std::set< const CObjectInterface * > | ObjectSet |
typedef std::vector < CObjectInterface * > | UpdateSequence |
![]() | |
static const std::string | TypeName [] |
static const char * | XMLType [] |
![]() | |
static const std::vector < CCopasiContainer * > | EmptyList |
![]() | |
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 } |
![]() | |
void | buildCalculationSequence () |
void | calculate () |
bool | compileNodes () |
bool | parse () |
void | setType (const CEvaluationTree::Type &type) |
![]() | |
template<class CType > | |
CCopasiObject * | addMatrixReference (const std::string &name, CType &reference, const unsigned C_INT32 &flag=0) |
template<class CType > | |
CCopasiObject * | addObjectReference (const std::string &name, CType &reference, const unsigned C_INT32 &flag=0) |
template<class CType > | |
CCopasiObject * | addVectorReference (const std::string &name, CType &reference, const unsigned C_INT32 &flag=0) |
void | initObjects () |
![]() | |
CCopasiObject () | |
CCopasiObject (const std::string &name, const CCopasiContainer *pParent=NULL, const std::string &type="CN", const unsigned C_INT32 &flag=0) | |
![]() | |
static CRenameHandler * | smpRenameHandler = NULL |
Definition at line 28 of file CExpression.h.
CExpression::CExpression | ( | const std::string & | name = "Expression" , |
const CCopasiContainer * | pParent = NULL |
||
) |
Default constructor
const | std::string & name (default: "Expression") |
const | CCopasiContainer * pParent (default: NULL) |
Definition at line 26 of file CExpression.cpp.
References initObjects().
Referenced by createInitialExpression().
CExpression::CExpression | ( | const CExpression & | src, |
const CCopasiContainer * | pParent = NULL |
||
) |
Copy constructor
const CExpression & | src |
const | CCopasiContainer * pParent (default: NULL) |
Definition at line 36 of file CExpression.cpp.
References CEvaluationTree::compile(), and initObjects().
|
virtual |
|
virtual |
Calculates the value of the function
Definition at line 122 of file CExpression.cpp.
References CEvaluationTree::calculate(), and CEvaluationTree::mValue.
Referenced by SBMLImporter::applyStoichiometricExpressions(), CEvaluationNodeCall::calculate(), CModelEntity::calculate(), COptProblem::calculate(), CMathTrigger::calculate(), CMetab::calculate(), CMathEvent::calculateDelayedTime(), CModelEntity::compile(), CMetab::compileInitialValueDependencies(), refresh(), CMetab::refreshInitialConcentration(), and CModelEntity::refreshInitialValue().
|
virtual |
Compile the evaluation tree.
std::vector< | CCopasiContainer * > listOfContainer (Default: CCopasiContainer::EmptyList) |
Definition at line 97 of file CExpression.cpp.
References CEvaluationNode::buildDisplayString(), CEvaluationNode::buildInfix(), CEvaluationTree::compileNodes(), CCopasiObject::getObjectParent(), mDisplayString, CEvaluationTree::mInfix, mpListOfContainer, and CEvaluationTree::mpRoot.
Referenced by CMathEventN::CTrigger::allocate(), SBMLImporter::applyStoichiometricExpressions(), CMathEventN::CAssignment::compile(), CEventAssignment::compile(), CEvaluationNodeCall::compile(), CModelEntity::compile(), CMathEventN::CTrigger::compile(), CMathTrigger::compile(), CModelParameter::compile(), CEvent::compile(), CMathEventN::compile(), CMetab::compile(), CMathEvent::compile(), CMetab::compileInitialValueDependencies(), CModelExpansion::duplicateEvent(), COptProblem::initialize(), CEvent::setDelayExpressionPtr(), CMathObject::setExpression(), CEventAssignment::setExpressionPtr(), CEvent::setPriorityExpressionPtr(), and CEvent::setTriggerExpressionPtr().
|
static |
Creates the corresponding initial expression for the given expression by converting each transient value to the corresponding initial value.
const | CExpression & expression |
Definition at line 219 of file CExpression.cpp.
References CExpression(), CCopasiObject::getCN(), CMetab::getConcentrationReference(), CMetab::getInitialConcentrationReference(), CModelEntity::getInitialValueReference(), CCopasiMessage::getLastMessage(), CEvaluationTree::getNodeList(), CCopasiContainer::getObject(), CEvaluationNodeObject::getObjectCN(), CCopasiObject::getObjectParent(), CModelEntity::getValueReference(), CEvaluationNodeObject::setData(), CCopasiMessage::size(), and CEvaluationTree::updateTree().
Referenced by CModelEntity::compile(), CMetab::compile(), and CModelEntity::setStatus().
std::string CExpression::getBerkeleyMadonnaString | ( | ) | const |
Retrieve the display string in Berkeley Madonna syntax.
Definition at line 175 of file CExpression.cpp.
References CEvaluationNode::buildBerkeleyMadonnaString(), and CEvaluationTree::mpRoot.
std::string CExpression::getCCodeString | ( | ) | const |
Retrieve the display string in C syntax.
Definition at line 163 of file CExpression.cpp.
References CEvaluationNode::buildCCodeString(), and CEvaluationTree::mpRoot.
const std::string & CExpression::getDisplayString | ( | ) | const |
Retrieve the human readable display string. Note, the expression must be compiled for this return a displayable string.
Definition at line 160 of file CExpression.cpp.
References mDisplayString.
Referenced by CQParameterOverviewDM::assignmentData(), CQEventDM::data(), CQGlobalQuantityDM::data(), CQCompartmentDM::data(), CQSpecieDM::data(), and operator<<().
const std::vector< CCopasiContainer * > & CExpression::getListOfContainer | ( | ) | const |
Retrieve the list of container used for compile
Definition at line 148 of file CExpression.cpp.
References mpListOfContainer.
const CObjectInterface * CExpression::getNodeObject | ( | const CCopasiObjectName & | CN | ) | const |
Retrieve a pointer to the object defined by CN. This method may only be called during compile() since the list mpListOfContainer is only valid then.
const | CCopasiObjectName & CN |
Definition at line 132 of file CExpression.cpp.
References CCopasiDataModel::getDataObject(), CCopasiObject::getObjectDataModel(), mpListOfContainer, and CCopasiDataModel::ObjectFromCN().
Referenced by CEvaluationNodeObject::compile().
std::string CExpression::getXPPString | ( | ) | const |
Retrieve the display string in XPPAUT syntax.
Definition at line 187 of file CExpression.cpp.
References CEvaluationNode::buildXPPString(), and CEvaluationTree::mpRoot.
|
private |
Initialize the contained CCopasiObjects
Definition at line 49 of file CExpression.cpp.
References CCopasiContainer::getObject(), refresh(), and CCopasiObject::setRefresh().
Referenced by CExpression().
void CExpression::refresh | ( | ) |
Refresh the value of the expression
Definition at line 129 of file CExpression.cpp.
References calcValue().
Referenced by CMathTrigger::CRootFinder::initObjects(), and initObjects().
|
virtual |
Set the infix description of the tree and compile it.
const | std::string & infix |
Reimplemented from CEvaluationTree.
Definition at line 63 of file CExpression.cpp.
References CEvaluationNode::isBoolean(), mIsBoolean, CEvaluationTree::mpNodeList, CEvaluationTree::mpRoot, CEvaluationTree::setInfix(), and CEvaluationNode::VARIABLE.
Referenced by CMathEventN::CTrigger::allocate(), CMathEventN::CAssignment::compile(), CMathEventN::CTrigger::compile(), CMathTrigger::compile(), CMathEventN::compile(), CMathEvent::compile(), CMathObject::compileDependentMass(), CMathObject::compileParticleFlux(), CMathObject::compilePropensity(), CMathObject::compileTotalMass(), CMathObject::createExtensiveODERateExpression(), CMathObject::createExtensiveReactionRateExpression(), CMathObject::createExtensiveValueExpression(), CMathObject::createIntensiveRateExpression(), CMathObject::createIntensiveValueExpression(), CCopasiXMLParser::FunctionElement::end(), CEvent::setDelayExpression(), CEventAssignment::setExpression(), CMathObject::setExpression(), CModelEntity::setExpression(), CModelParameter::setInitialExpression(), CModelEntity::setInitialExpression(), COptProblem::setObjectiveFunction(), CEvent::setPriorityExpression(), and CEvent::setTriggerExpression().
void CExpression::setIsBoolean | ( | const bool & | booleanRequired | ) |
Set whether this a boolean expression or not
const | bool & isBoolean |
Definition at line 58 of file CExpression.cpp.
References CEvaluationTree::isBoolean(), and mIsBoolean.
Referenced by CMathEventN::CTrigger::allocate(), CMathEventN::CTrigger::compile(), CQValidatorExpression::CQValidatorExpression(), SBMLImporter::importEvent(), CQValidatorExpression::setBooleanRequired(), CMathObject::setExpression(), and CEvent::setTriggerExpression().
bool CExpression::updateInfix | ( | ) |
This method performs an infix update if a referenced object has been renamed
Definition at line 151 of file CExpression.cpp.
References CEvaluationNode::buildInfix(), CEvaluationTree::mInfix, CEvaluationTree::mpNodeList, and CEvaluationTree::mpRoot.
Referenced by CEvent::getDelayExpression(), CEventAssignment::getExpression(), CModelEntity::getExpression(), CModelEntity::getInitialExpression(), CEvent::getPriorityExpression(), and CEvent::getTriggerExpression().
void CExpression::writeMathML | ( | std::ostream & | out, |
bool | fullExpand, | ||
size_t | l | ||
) | const |
Write display mathml of the expression into the ostream "out" level specifies indentation fullExpand==true means function calls are expanded
Definition at line 201 of file CExpression.cpp.
References CEvaluationNode::buildMMLString(), CEvaluationTree::mpRoot, and SPC.
Referenced by CQExpressionWidget::writeMathML(), and CMMLOutput::writeRHS_ModelEntity().
|
protected |
Human readable display string.
Definition at line 161 of file CExpression.h.
Referenced by compile(), and getDisplayString().
|
protected |
Indicates whether the expression is boolean or not.
Definition at line 166 of file CExpression.h.
Referenced by setInfix(), and setIsBoolean().
|
protected |
Pointer to the list of containers used for compilation.
Definition at line 156 of file CExpression.h.
Referenced by compile(), getListOfContainer(), and getNodeObject().