COPASI API
4.40.278
|
#include <CExpression.h>
Public Member Functions | |
virtual const C_FLOAT64 & | calcValue () |
CExpression (const CExpression &src, const CDataContainer *pParent) | |
CExpression (const std::string &name="Expression", const CDataContainer *pParent=NO_PARENT) | |
virtual CIssue | compile (CObjectInterface::ContainerList listOfContainer=CDataContainer::EmptyList) |
std::string | getBerkeleyMadonnaString () const |
std::string | getCCodeString () const |
const std::string & | getDisplayString () const |
const CObjectInterface::ContainerList & | getListOfContainer () const |
virtual const CObjectInterface * | getNodeObject (const CCommonName &CN) const override |
std::string | getXPPString () const |
void | refresh () |
virtual CIssue | setInfix (const std::string &infix) override |
void | setIsBoolean (const bool &booleanRequired) |
bool | updateInfix () |
void | writeMathML (std::ostream &out, bool fullExpand, size_t l) const |
virtual | ~CExpression () |
Public Member Functions inherited from CEvaluationTree | |
virtual bool | applyData (const CData &data, CUndoData::CChangeSet &changes) |
bool | calls (std::set< std::string > &list) const |
CEvaluationTree (const CEvaluationTree &src, const CDataContainer *pParent) | |
CEvaluationTree (const std::string &name="NoName", const CDataContainer *pParent=NO_PARENT, const Type &type=Function) | |
virtual CIssue | compile () |
bool | containsCN (const DataObjectSet &elements) 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 | mapObjectNodes (const CDataContainer *pSrc, const CDataContainer *pTarget) |
bool | operator== (const CEvaluationTree &rhs) const |
virtual bool | setRoot (CEvaluationNode *pRootNode) |
bool | setTree (const ASTNode &pRootNode, bool isFunction) |
size_t | size () const |
virtual ASTNode * | toAST (const CDataModel *pDataModel) const |
virtual CData | toData () const |
CIssue | updateTree () |
virtual | ~CEvaluationTree () |
Public Member Functions inherited from CDataContainer | |
virtual bool | add (CDataObject *pObject, const bool &adopt=true) |
virtual bool | appendDeletedDependentData (CUndoData &undoData) const |
CDataContainer (const CDataContainer &src, const CDataContainer *pParent) | |
CDataContainer (const std::string &name, const CDataContainer *pParent=NO_PARENT, const std::string &type="CN", const CFlags< Flag > &flag=CFlags< Flag >::None) | |
virtual void | createUndoData (CUndoData &undoData, const CUndoData::Type &type, const CData &oldData=CData(), const CCore::Framework &framework=CCore::Framework::ParticleNumbers) const override |
virtual std::string | getChildObjectUnits (const CDataObject *pObject) const |
void | getDescendants (CDataObject::DataObjectSet &descendants, const bool &recursive=false) const |
virtual size_t | getIndex (const CDataObject *pObject) const |
virtual const CObjectInterface * | getObject (const CCommonName &cn) const override |
virtual objectMap & | getObjects () |
virtual const objectMap & | getObjects () const |
virtual const std::string | getUnits () const override |
virtual const CDataObject * | getValueObject () const override |
virtual CUndoObjectInterface * | insert (const CData &data) override |
void | objectRenamed (CDataObject *pObject, const std::string &oldName) |
virtual bool | remove (CDataObject *pObject) |
virtual | ~CDataContainer () |
Public Member Functions inherited from CDataObject | |
void | addIssue (const CIssue &issue) |
void | addReference (const CDataContainer *pReference) |
virtual void | calculateValue () override |
CDataObject (const CDataObject &src, const CDataContainer *pParent=NULL) | |
virtual void | destruct () override |
virtual CCommonName | getCN () const override |
virtual const CDataObject * | getDataObject () const override |
virtual const std::string & | getKey () const |
CDataContainer * | getObjectAncestor (const std::string &type) const |
CDataModel * | getObjectDataModel () const |
virtual std::string | getObjectDisplayName () const override |
const CObjectInterface * | getObjectFromCN (const CCommonName &cn) const |
const std::string & | getObjectName () const |
CDataContainer * | getObjectParent () const |
const std::string & | getObjectType () const |
virtual const CObjectInterface::ObjectSet & | getPrerequisites () const override |
virtual const CValidity & | getValidity () const override |
virtual void * | getValuePointer () const override |
bool | hasFlag (const Flag &flag) const |
virtual bool | isPrerequisiteForContext (const CObjectInterface *pObject, const CCore::SimulationContextFlag &context, const CObjectInterface::ObjectSet &changedObjects) const override |
bool | prerequisitsContains (const DataObjectSet &objects) const |
virtual void | print (std::ostream *ostream) const override |
void | removeIssue (const CIssue &issue) |
void | removeReference (const CDataContainer *pReference) |
bool | setObjectName (const std::string &name) |
virtual bool | setObjectParent (const CDataContainer *pParent) |
void | validityChanged (const CValidity &changedValidity) override |
void | validityRemoved (const CValidity &changedValidity) |
virtual | ~CDataObject () |
Public Member Functions inherited from CObjectInterface | |
CObjectInterface () | |
CObjectInterface (const CObjectInterface &src) | |
virtual | ~CObjectInterface () |
Public Member Functions inherited from CUndoObjectInterface | |
CUndoObjectInterface () | |
CUndoObjectInterface (const CUndoObjectInterface &src) | |
bool | generateUuid () |
const xg::Guid & | getUuid () const |
bool | setUuid (const std::string &uuid) |
bool | setUuid (const xg::Guid &uuid) |
virtual void | updateIndex (const size_t &index, const CUndoObjectInterface *pUndoObject) |
virtual | ~CUndoObjectInterface () |
Static Public Member Functions | |
static CExpression * | createInitialExpression (const CExpression &expression, const CDataModel *pDataModel) |
Static Public Member Functions inherited from CEvaluationTree | |
static CEvaluationTree * | copy (const CEvaluationTree &src) |
static CEvaluationTree * | create (CEvaluationTree::Type type) |
static CEvaluationNode * | fromAST (const ASTNode *pASTNode, bool isFunction) |
static CEvaluationTree * | fromData (const CData &data, CUndoObjectInterface *pParent) |
Static Public Member Functions inherited from CDataContainer | |
static CDataContainer * | fromData (const CData &data, CUndoObjectInterface *pParent) |
Static Public Member Functions inherited from CDataObject | |
static CDataObject * | fromData (const CData &data, CUndoObjectInterface *pParent) |
static void | sanitizeObjectName (std::string &name) |
Static Public Member Functions inherited from CObjectInterface | |
static const CDataObject * | DataObject (const CObjectInterface *pInterface) |
static CObjectInterface * | GetObjectFromCN (const ContainerList &listOfContainer, const CCommonName &objName) |
Static Public Member Functions inherited from CUndoObjectInterface | |
template<class CType > | |
static CType * | fromData (const CData &, CUndoObjectInterface *) |
Protected Attributes | |
std::string | mDisplayString |
bool | mIsBoolean |
const CObjectInterface::ContainerList * | mpListOfContainer |
Protected Attributes inherited from CEvaluationTree | |
CVector< CEvaluationNode * > | mCalculationSequence |
std::string | mInfix |
std::vector< CEvaluationNode * > * | mpNodeList |
const C_FLOAT64 * | mpRootValue |
CEvaluationTree::Type | mType |
C_FLOAT64 | mValue |
Protected Attributes inherited from CDataContainer | |
objectMap | mObjects |
Protected Attributes inherited from CDataObject | |
ObjectSet | mPrerequisits |
std::set< CDataContainer * > | mReferences |
Protected Attributes inherited from CObjectInterface | |
CValidity | mValidity |
Private Member Functions | |
void | initObjects () |
Additional Inherited Members | |
Public Types inherited from CEvaluationTree | |
enum | Type { Function = 0 , MassAction , PreDefined , UserDefined , Expression , MathExpression } |
Public Types inherited from CDataContainer | |
typedef CDataObjectMap | objectMap |
Public Types inherited from CDataObject | |
typedef std::set< const CDataObject * > | DataObjectSet |
enum | Flag { Container , Vector , Matrix , NameVector , Reference , ValueBool , ValueInt , ValueInt64 , ValueDbl , NonUniqueName , StaticString , ValueString , Separator , DisplayName , ModelEntity , Array , DataModel , Root , Gui , __SIZE } |
Public Types inherited from CObjectInterface | |
typedef std::vector< const CDataContainer * > | ContainerList |
typedef std::set< const CObjectInterface * > | ObjectSet |
Static Public Attributes inherited from CEvaluationTree | |
static const std::string | TypeName [] |
static const char * | XMLType [] |
Static Public Attributes inherited from CDataContainer | |
static const CObjectInterface::ContainerList | EmptyList |
Protected Member Functions inherited from CEvaluationTree | |
void | buildCalculationSequence () |
void | calculate () |
CEvaluationTree (const CEvaluationTree &src) | |
void | clearNodes () |
CIssue | compileNodes () |
CIssue | parse () |
void | setType (const CEvaluationTree::Type &type) |
Protected Member Functions inherited from CDataContainer | |
template<class CType > | |
CDataMatrixReference< CType > * | addMatrixReference (const std::string &name, CType &reference, const CFlags< Flag > &flag=CFlags< Flag >::None) |
template<class CType > | |
CDataObjectReference< CType > * | addObjectReference (const std::string &name, CType &reference, const CFlags< Flag > &flag=CFlags< Flag >::None) |
template<class CType > | |
CDataVectorReference< CType > * | addVectorReference (const std::string &name, CType &reference, const CFlags< Flag > &flag=CFlags< Flag >::None) |
CDataContainer (const CDataContainer &src) | |
void | initObjects () |
Protected Member Functions inherited from CDataObject | |
CDataObject () | |
CDataObject (const std::string &name, const CDataContainer *pParent=static_cast< CDataContainer * >((void *) 0), const std::string &type="CN", const CFlags< Flag > &flag=CFlags< Flag >::None) | |
CExpression::CExpression | ( | const std::string & | name = "Expression" , |
const CDataContainer * | pParent = NO_PARENT |
||
) |
Default constructor
const | std::string & name (default: "Expression") |
const | CDataContainer * pParent (default: NULL) |
References initObjects().
Referenced by createInitialExpression().
CExpression::CExpression | ( | const CExpression & | src, |
const CDataContainer * | pParent | ||
) |
Copy constructor
const CExpression & | src |
const | CDataContainer * pParent (default: NULL) |
References CEvaluationTree::compile(), and initObjects().
|
virtual |
Destructor
|
virtual |
Calculates the value of the function
References CEvaluationTree::calculate(), and CEvaluationTree::mValue.
Referenced by SBMLImporter::applyStoichiometricExpressions(), CModelEntity::calculate(), CEvaluationNodeCall::calculate(), CMetab::calculate(), CModelEntity::compile(), CMetab::compile(), and refresh().
|
virtual |
Compile the evaluation tree.
CObjectInterface::ContainerList | listOfContainer (Default: CDataContainer::EmptyList) |
References CValidity::add(), CFlags< Enum >::All, CEvaluationNode::buildDisplayString(), CEvaluationNode::buildInfix(), CEvaluationTree::compileNodes(), CIssue::ExpressionDataTypeInvalid, CIssue::ExpressionInvalid, CDataObject::getObjectParent(), CEvaluationTree::getRoot(), CIssue::HasCircularDependency, CIssue::isSuccess(), mDisplayString, CEvaluationTree::mInfix, mpListOfContainer, CObjectInterface::mValidity, and CValidity::remove().
Referenced by CMathEvent::CTrigger::allocate(), SBMLImporter::applyStoichiometricExpressions(), CModelParameter::compile(), CModelEntity::compile(), CReaction::compile(), CMetab::compile(), CEventAssignment::compile(), CEvent::compile(), CMathEvent::CTrigger::compile(), CMathEvent::compile(), CMathEvent::CAssignment::compile(), CMathObject::compileFlux(), CModel::createEventsForTimeseries(), CMathObject::createExtensiveNoiseExpression(), CMathObject::createExtensiveODERateExpression(), CModelExpansion::duplicateEvent(), COptProblem::initialize(), CModel::prepareElasticity(), 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 |
References CExpression(), CDataObject::getCN(), CMetab::getConcentrationReference(), CValidity::getFirstWorstIssue(), CMetab::getInitialConcentrationReference(), CModelEntity::getInitialValueReference(), CCopasiMessage::getLastMessage(), CEvaluationTree::getNodeList(), CDataContainer::getObject(), CEvaluationNodeObject::getObjectCN(), CDataObject::getObjectParent(), CDataObject::getValidity(), CModelEntity::getValueReference(), CIssue::isError(), 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.
References CEvaluationNode::buildBerkeleyMadonnaString(), and CEvaluationTree::getRoot().
std::string CExpression::getCCodeString | ( | ) | const |
Retrieve the display string in C syntax.
References CEvaluationNode::buildCCodeString(), and CEvaluationTree::getRoot().
const std::string & CExpression::getDisplayString | ( | ) | const |
Retrieve the human readable display string. Note, the expression must be compiled for this return a displayable string.
References mDisplayString.
const CObjectInterface::ContainerList & CExpression::getListOfContainer | ( | ) | const |
Retrieve the list of container used for compile
References mpListOfContainer.
|
overridevirtual |
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 | CCommonName & CN |
Reimplemented from CEvaluationTree.
References CEvaluationTree::getNodeObject(), CObjectInterface::getObject(), CObjectInterface::GetObjectFromCN(), and mpListOfContainer.
std::string CExpression::getXPPString | ( | ) | const |
Retrieve the display string in XPPAUT syntax.
References CEvaluationNode::buildXPPString(), and CEvaluationTree::getRoot().
|
private |
Initialize the contained CDataObjects
References CDataContainer::getObject().
Referenced by CExpression().
void CExpression::refresh | ( | ) |
Refresh the value of the expression
References calcValue().
|
overridevirtual |
Set the infix description of the tree and compile it.
const | std::string & infix |
Reimplemented from CEvaluationTree.
References CValidity::add(), CIssue::Error, CIssue::ExpressionDataTypeInvalid, CEvaluationTree::getRoot(), CEvaluationTree::isBoolean(), mIsBoolean, CEvaluationTree::mpNodeList, CObjectInterface::mValidity, CEvaluationTree::setInfix(), CEvaluationNode::VARIABLE, and CIssue::VariableInExpression.
Referenced by CMathContainer::addAnalysisObject(), CMathEvent::CTrigger::allocate(), CMathEvent::CTrigger::compile(), CMathEvent::compile(), CMathEvent::CAssignment::compile(), CMathObject::compileFlux(), CMathObject::createExtensiveNoiseExpression(), CMathObject::createExtensiveODERateExpression(), FunctionHandler::processEnd(), CEvent::setDelayExpression(), CEventAssignment::setExpression(), CModelEntity::setExpression(), CMathObject::setExpression(), CModelEntity::setInitialExpression(), CModelParameter::setInitialExpression(), CModelEntity::setNoiseExpression(), CReaction::setNoiseExpression(), COptProblem::setObjectiveFunction(), CEvent::setPriorityExpression(), and CEvent::setTriggerExpression().
void CExpression::setIsBoolean | ( | const bool & | booleanRequired | ) |
Set whether this a boolean expression or not
const | bool & isBoolean |
References CEvaluationTree::isBoolean(), and mIsBoolean.
Referenced by CMathEvent::CTrigger::allocate(), CMathEvent::CTrigger::compile(), SBMLImporter::importEvent(), CMathObject::setExpression(), and CEvent::setTriggerExpression().
bool CExpression::updateInfix | ( | ) |
This method performs an infix update if a referenced object has been renamed
References CEvaluationNode::buildInfix(), CEvaluationTree::getRoot(), and CEvaluationTree::mInfix.
Referenced by CEvent::getDelayExpression(), CEvent::getDelayExpressionPtr(), CEventAssignment::getExpression(), CModelEntity::getExpression(), CModelEntity::getExpressionPtr(), CEventAssignment::getExpressionPtr(), CModelParameter::getInitialExpression(), CModelEntity::getInitialExpression(), CModelEntity::getInitialExpressionPtr(), CModelEntity::getNoiseExpression(), CReaction::getNoiseExpression(), CModelEntity::getNoiseExpressionPtr(), CReaction::getNoiseExpressionPtr(), COptProblem::getObjectiveFunction(), CEvent::getPriorityExpression(), CEvent::getPriorityExpressionPtr(), CEvent::getTriggerExpression(), and CEvent::getTriggerExpressionPtr().
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
References CEvaluationNode::buildMMLString(), CEvaluationTree::getRoot(), and SPC.
Referenced by CMMLOutput::writeRHS_ModelEntity().
|
protected |
Human readable display string.
Referenced by compile(), and getDisplayString().
|
protected |
Indicates whether the expression is boolean or not.
Referenced by setInfix(), and setIsBoolean().
|
protected |
Pointer to the list of containers used for compilation.
Referenced by compile(), getListOfContainer(), and getNodeObject().