COPASI API
4.40.278
|
#include <CMathExpression.h>
Public Member Functions | |
CMathExpression (const CExpression &src, CMathContainer &container, const bool &replaceDiscontinuousNodes) | |
CMathExpression (const CFunction &src, const CCallParameters< C_FLOAT64 > &callParameters, CMathContainer &container, const bool &replaceDiscontinuousNodes) | |
CMathExpression (const std::string &name, CMathContainer &container) | |
virtual CIssue | compile () override |
bool | convertToInitialExpression () |
virtual const CObjectInterface::ObjectSet & | getPrerequisites () const override |
void | relocate (const CMathContainer *pContainer, const std::vector< CMath::sRelocate > &relocations) |
const C_FLOAT64 & | value () |
virtual | ~CMathExpression () |
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) | |
bool | containsCN (const DataObjectSet &elements) const |
std::string::size_type | getErrorPosition () const |
const std::string & | getInfix () const |
const std::vector< CEvaluationNode * > & | getNodeList () const |
virtual const CObjectInterface * | getNodeObject (const CCommonName &CN) 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 CIssue | setInfix (const std::string &infix) |
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 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 CMathExpression * | copy (const CMathExpression &src, CMathContainer &container) |
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 *) |
Private Member Functions | |
CMathExpression () | |
CMathExpression (const CMathExpression &src)=delete | |
CEvaluationNode * | createMassActionPart (const C_FLOAT64 *pK, const CCallParameters< C_FLOAT64 > *pSpecies) |
CEvaluationNode * | createNodeFromValue (const C_FLOAT64 *pDataValue) |
virtual bool | setRoot (CEvaluationNode *pRootNode) override |
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 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) | |
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 |
Hidden default constructor
Referenced by copy().
|
privatedelete |
CMathExpression::CMathExpression | ( | const std::string & | name, |
CMathContainer & | container | ||
) |
Specific constructor.
const | std::string & name |
CMathContainer | & container |
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
const | CExpression & src |
CMathContainer | & container |
const | bool & replaceDiscontinuousNodes |
References CEvaluationTree::clearNodes(), compile(), CMathContainer::copyBranch(), CEvaluationTree::getRoot(), and setRoot().
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
const | CFunction & src |
const | CCallParameters< C_FLOAT64 > & callParameters |
CMathContainer | & container |
const | bool & replaceDiscontinuousNodes |
References CCopasiNode< _Data >::addChild(), CCallParameters< Type >::begin(), C_FLOAT64, CEvaluationTree::clearNodes(), compile(), CMathContainer::copyBranch(), createMassActionPart(), createNodeFromValue(), CCallParameters< Type >::end(), CEvaluationTree::Expression, CEvaluationTree::Function, CEvaluationTree::getRoot(), CEvaluationTree::getType(), CEvaluationTree::MassAction, CEvaluationTree::MathExpression, CEvaluationNode::MINUS, pdelete, CEvaluationTree::PreDefined, setRoot(), CCallParameters< Type >::size(), and CEvaluationTree::UserDefined.
|
virtual |
Destructor
|
overridevirtual |
Compile the evaluation tree.
Reimplemented from CEvaluationTree.
References CValidity::add(), CEvaluationTree::buildCalculationSequence(), CValidity::clear(), CEvaluationNodeObject::getObjectInterfacePtr(), CDataObject::getObjectParent(), CEvaluationTree::mCalculationSequence, CEvaluationTree::mInfix, CEvaluationTree::mpNodeList, mPrerequisites, CObjectInterface::mValidity, CEvaluationNode::POINTER, CVector< CType >::resize(), CEvaluationNode::RGAMMA, CEvaluationNode::RNORMAL, CEvaluationNode::RPOISSON, CEvaluationNode::RUNIFORM, CIssue::Success, and CEvaluationTree::updateTree().
Referenced by CMathExpression(), CMathObject::compileDependentMass(), CMathObject::compileParticleFlux(), CMathObject::compilePropensity(), CMathObject::compileReactionNoise(), CMathObject::compileTotalMass(), CMathObject::compileTransitionTime(), CMathObject::createExtensiveReactionNoiseExpression(), CMathObject::createExtensiveReactionRateExpression(), CMathObject::createExtensiveValueExpression(), CMathObject::createIntensiveRateExpression(), CMathObject::createIntensiveValueExpression(), and CMathObject::setExpressionPtr().
bool CMathExpression::convertToInitialExpression | ( | ) |
Convert to a corresponding initial expression.
References CEvaluationNode::buildInfix(), C_FLOAT64, CDataObject::getObjectName(), CEvaluationNodeObject::getObjectValuePtr(), CEvaluationTree::getRoot(), CEvaluationNode::getValuePointer(), CEvaluationTree::mInfix, CEvaluationTree::mpNodeList, mPrerequisites, CEvaluationTree::mpRootValue, CEvaluationNode::OBJECT, pMathContainer, CEvaluationNode::POINTER, CDataObject::setObjectName(), and CEvaluationNodeObject::setObjectValuePtr().
Referenced by CMathContainer::addAnalysisObject(), and CMathObject::compileExpression().
|
static |
Copy an expression with the given offsets
const | CMathExpression & src |
CMathContainer | & container |
References CEvaluationTree::buildCalculationSequence(), CMathExpression(), CEvaluationNode::copyBranch(), CDataObject::getObjectName(), CEvaluationTree::getRoot(), mPrerequisites, and setRoot().
Referenced by CMathObject::copy(), and CMathObject::relocate().
|
private |
Create a part of Mass Action kinetics
const | C_FLOAT64 * pK |
const | CCallParameters< C_FLOAT64 > * pSpecies |
References CCopasiNode< _Data >::addChild(), CCallParameters< Type >::begin(), createNodeFromValue(), CCallParameters< Type >::end(), CEvaluationNode::MULTIPLY, CEvaluationNode::NaN, and CCallParameters< Type >::size().
Referenced by CMathExpression().
|
private |
Create a node based on the given pointer to a data value
const | C_FLOAT64 * pDataValue |
References C_FLOAT64, CMathObject::getValuePointer(), CEvaluationNode::NaN, and pMathContainer.
Referenced by CMathExpression(), and createMassActionPart().
|
overridevirtual |
Retrieve the prerequisites, i.e., the objects which need to be evaluated before this.
Reimplemented from CDataObject.
References mPrerequisites.
Referenced by CMathObject::compileExpression(), and COptProblem::initialize().
void CMathExpression::relocate | ( | const CMathContainer * | pContainer, |
const std::vector< CMath::sRelocate > & | relocations | ||
) |
Copy an expression with the given offsets
const | CMathContainer * pContainer |
const | std::vector< CMath::sRelocate > & relocations |
References CEvaluationNode::buildInfix(), C_FLOAT64, CEvaluationTree::getRoot(), CEvaluationTree::mInfix, mPrerequisites, CEvaluationNode::OBJECT, CEvaluationNode::POINTER, CMathContainer::relocateObjectSet(), CMathContainer::relocateValue(), and stringToPointer().
Referenced by CMathContainer::createDelays(), and CMathObject::relocate().
|
overrideprivatevirtual |
Sets the root node of the tree. Note: This is private to assure that only valid root node representing mathematical expressions are set.
CEvaluationNode* | root node of the tree |
Reimplemented from CEvaluationTree.
References CEvaluationTree::setRoot().
Referenced by CMathExpression(), and copy().
const C_FLOAT64 & CMathExpression::value | ( | ) |
Evaluate the expression
References CEvaluationTree::calculate(), and CEvaluationTree::mValue.
Referenced by COptProblem::calculate(), and CMathObject::calculateExpression().
|
private |
The prerequisites for calculating the expression.
Referenced by compile(), convertToInitialExpression(), copy(), getPrerequisites(), and relocate().