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

#include <CMassAction.h>

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

Public Member Functions

virtual const C_FLOAT64calcValue (const CCallParameters< C_FLOAT64 > &callParameters)
 
 CMassAction (const std::string &name="NoName", const CCopasiContainer *pParent=NULL)
 
 CMassAction (const CFunction &src, const CCopasiContainer *pParent=NULL)
 
 CMassAction (const TriLogic &reversible, const CCopasiContainer *pParent=NULL)
 
virtual bool compile ()
 
virtual bool dependsOn (const C_FLOAT64 *parameter, const CCallParameters< C_FLOAT64 > &callParameters) const
 
virtual bool setInfix (const std::string &infix)
 
virtual std::string writeMathML (const std::vector< std::vector< std::string > > &variables, bool expand=true, bool fullExpand=true) const
 
 ~CMassAction ()
 
- Public Member Functions inherited from CFunction
bool addVariable (const std::string &name, CFunctionParameter::Role usage=CFunctionParameter::VARIABLE, const CFunctionParameter::DataType &type=CFunctionParameter::FLOAT64)
 
 CFunction (const std::string &name="NoName", const CCopasiContainer *pParent=NULL, const Type &type=Function)
 
 CFunction (const CFunction &src, const CCopasiContainer *pParent=NULL)
 
CFunctioncreateCopy () const
 
void createListOfParametersForMathML (std::vector< std::vector< std::string > > &env)
 
const std::string & getKey () const
 
const std::string & getSBMLId () const
 
virtual size_t getVariableIndex (const std::string &name) const
 
CFunctionParametersgetVariables ()
 
const CFunctionParametersgetVariables () const
 
virtual const C_FLOAT64getVariableValue (const size_t &index) const
 
const TriLogicisReversible () const
 
bool isSuitable (const size_t noSubstrates, const size_t noProducts, const TriLogic reversible)
 
virtual void load (CReadConfig &configBuffer, CReadConfig::Mode mode=CReadConfig::SEARCH)
 
bool operator== (const CFunction &rhs) const
 
virtual bool setInfix (const std::string &infix, bool compile)
 
void setReversible (const TriLogic &reversible)
 
void setSBMLId (const std::string &id)
 
std::pair< CFunction
*, CFunction * > 
splitFunction (const CEvaluationNode *node, const std::string &name1, const std::string &name2) const
 
virtual void writeMathML (std::ostream &out, size_t l=0) const
 
virtual ~CFunction ()
 
- 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
 
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 ()
 
- 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
 
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 const
CObjectInterface::ObjectSet
getPrerequisites () 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 ()
 
- Public Member Functions inherited from CAnnotation
bool addUnsupportedAnnotation (const std::string &name, const std::string &xml)
 
 CAnnotation ()
 
 CAnnotation (const CAnnotation &src)
 
const std::string & getMiriamAnnotation () const
 
const std::string & getNotes () const
 
UnsupportedAnnotationgetUnsupportedAnnotations ()
 
const UnsupportedAnnotationgetUnsupportedAnnotations () const
 
bool operator== (const CAnnotation &rhs) const
 
bool removeUnsupportedAnnotation (const std::string &name)
 
bool replaceUnsupportedAnnotation (const std::string &name, const std::string &xml)
 
void setMiriamAnnotation (const std::string &miriamAnnotation, const std::string &newId, const std::string &oldId)
 
void setNotes (const std::string &notes)
 
virtual ~CAnnotation ()
 

Static Public Attributes

static const char * Infix []
 
- 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
 

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
 
- Public Types inherited from CAnnotation
typedef std::map< std::string,
std::string > 
UnsupportedAnnotation
 
- Static Public Member Functions inherited from CFunction
static bool completeFunctionList (std::vector< CFunction * > &list, const size_t &added=0)
 
- 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)
 
- Static Public Member Functions inherited from CAnnotation
static CAnnotationcastObject (CCopasiObject *pObject)
 
static const CAnnotationcastObject (const CCopasiObject *pObject)
 
- 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 CFunction
bool initVariables ()
 
- 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
 
- Protected Attributes inherited from CAnnotation
std::string mKey
 
- Static Protected Attributes inherited from CCopasiObject
static CRenameHandlersmpRenameHandler = NULL
 

Detailed Description

CMassAction

Created for Copasi by Stefan Hoops (C) Stefan Hoops 2001

Definition at line 30 of file CMassAction.h.

Constructor & Destructor Documentation

CMassAction::CMassAction ( const std::string &  name = "NoName",
const CCopasiContainer pParent = NULL 
)

Default constructor

Parameters
conststd::string & name (default: "NoName")
constCCopasiContainer * pParent (default: NULL)

Definition at line 38 of file CMassAction.cpp.

39  :
41 {}
CFunction(const std::string &name="NoName", const CCopasiContainer *pParent=NULL, const Type &type=Function)
Definition: CFunction.cpp:25
CMassAction::CMassAction ( const CFunction src,
const CCopasiContainer pParent = NULL 
)

Copy constructor

Parameters
const CFunction &src
constCCopasiContainer * pParent (default: NULL)

Definition at line 43 of file CMassAction.cpp.

44  :
45  CFunction(src, pParent)
46 {}
CFunction(const std::string &name="NoName", const CCopasiContainer *pParent=NULL, const Type &type=Function)
Definition: CFunction.cpp:25
CMassAction::CMassAction ( const TriLogic reversible,
const CCopasiContainer pParent = NULL 
)

Specified constructor

Parameters
constCCopasiContainer * pParent (default: NULL)

Definition at line 48 of file CMassAction.cpp.

References CONSTRUCTOR_TRACE, CCopasiMessage::ERROR, Infix, MCMassAction, setInfix(), TriFalse, and TriTrue.

49  :
50  CFunction((reversible == TriTrue) ?
51  "Mass action (reversible)" :
52  "Mass action (irreversible)",
53  pParent,
55 {
57 
58  if (reversible != TriFalse && reversible != TriTrue)
60 
61  if (reversible == TriTrue)
62  setInfix(Infix[0]);
63  else
64  setInfix(Infix[1]);
65 }
static const char * Infix[]
Definition: CMassAction.h:34
#define MCMassAction
CFunction(const std::string &name="NoName", const CCopasiContainer *pParent=NULL, const Type &type=Function)
Definition: CFunction.cpp:25
#define CONSTRUCTOR_TRACE
Definition: copasi.h:202
virtual bool setInfix(const std::string &infix)
CMassAction::~CMassAction ( )

Destructor

Definition at line 67 of file CMassAction.cpp.

References DESTRUCTOR_TRACE.

#define DESTRUCTOR_TRACE
Definition: copasi.h:206

Member Function Documentation

const C_FLOAT64 & CMassAction::calcValue ( const CCallParameters< C_FLOAT64 > &  callParameters)
virtual

Calculates the value of the function

Parameters
constCCallParameters<C_FLOAT64> & callParameters
Returns
const C_FLOAT64 & result

Reimplemented from CFunction.

Definition at line 69 of file CMassAction.cpp.

References CCallParameters< Type >::begin(), C_FLOAT64, CCallParameters< Type >::end(), CFunction::isReversible(), CEvaluationTree::mValue, and TriFalse.

70 {
71  CCallParameters<C_FLOAT64>::const_iterator pCallParameters = callParameters.begin();
72 
73  CCallParameters<C_FLOAT64>::const_iterator Factor = (pCallParameters + 1)->vector->begin();
74  CCallParameters<C_FLOAT64>::const_iterator End = (pCallParameters + 1)->vector->end();
75 
76  mValue = 0.0;
77 
78  if (Factor != End)
79  {
80  mValue = *(pCallParameters + 0)->value // k1
81  * *(Factor++)->value; // first substrate.
82 
83  while (Factor != End)
84  mValue *= *(Factor++)->value;
85  }
86 
87  if (isReversible() == TriFalse)
88  return mValue;
89 
90  C_FLOAT64 Products = 0.0;
91 
92  Factor = (pCallParameters + 3)->vector->begin();
93  End = (pCallParameters + 3)->vector->end();
94 
95  if (Factor != End)
96  {
97  Products = *(pCallParameters + 2)->value // k2
98  * *(Factor++)->value; // first product.
99 
100  while (Factor != End)
101  Products *= *(Factor++)->value;
102  }
103 
104  return mValue -= Products;
105 }
const_iterator begin() const
const TriLogic & isReversible() const
Definition: CFunction.cpp:145
#define C_FLOAT64
Definition: copasi.h:92
const_iterator end() const
bool CMassAction::compile ( )
virtual

Compile the evaluation tree.

Reimplemented from CEvaluationTree.

Definition at line 164 of file CMassAction.cpp.

References CEvaluationTree::mUsable.

165 {
166  mUsable = true;
167  return true;
168 }
bool CMassAction::dependsOn ( const C_FLOAT64 parameter,
const CCallParameters< C_FLOAT64 > &  callParameters 
) const
virtual

Returns whether the function depends on the given parameter &param const void * parameter &param const CCallParameters<C_FLOAT64> & callParameters &param bool dependsOn

Reimplemented from CFunction.

Definition at line 107 of file CMassAction.cpp.

References CCallParameters< Type >::begin(), CCallParameters< Type >::end(), CFunction::isReversible(), and TriTrue.

109 {
110  if (parameter == callParameters[0].value) return true;
111 
114 
115  it = callParameters[1].vector->begin();
116  end = callParameters[1].vector->end();
117 
118  for (; it != end; it++) if (parameter == it->value) return true;
119 
120  if (isReversible() != TriTrue) return false;
121 
122  if (parameter == callParameters[2].value) return true;
123 
124  it = callParameters[3].vector->begin();
125  end = callParameters[3].vector->end();
126 
127  for (; it != end; it++) if (parameter == it->value) return true;
128 
129  return false;
130 }
const_iterator begin() const
const TriLogic & isReversible() const
Definition: CFunction.cpp:145
const_iterator end() const
bool CMassAction::setInfix ( const std::string &  infix)
virtual

Set the infix description of the tree and compile it.

Parameters
conststd::string & infix
Returns
bool success

Reimplemented from CFunction.

Definition at line 132 of file CMassAction.cpp.

References CFunctionParameters::add(), CFunctionParameters::cleanup(), CFunctionParameter::FLOAT64, CFunction::getVariables(), CFunction::isReversible(), CFunctionParameter::PARAMETER, CFunctionParameter::PRODUCT, CFunction::setInfix(), CFunction::setReversible(), CFunctionParameter::SUBSTRATE, TriFalse, TriTrue, and CFunctionParameter::VFLOAT64.

Referenced by CMassAction().

133 {
134  if (infix == "k1*PRODUCT<substrate_i>-k2*PRODUCT<product_j>")
136  else if (infix == "k1*PRODUCT<substrate_i>")
138  else
139  return false;
140 
141  CFunction::setInfix(infix);
142  getVariables().cleanup();
143 
144  getVariables().add("k1",
147  getVariables().add("substrate",
150 
151  if (isReversible() == TriTrue)
152  {
153  getVariables().add("k2",
156  getVariables().add("product",
159  }
160 
161  return true;
162 }
virtual bool setInfix(const std::string &infix)
Definition: CFunction.cpp:73
void setReversible(const TriLogic &reversible)
Definition: CFunction.cpp:142
void add(const CFunctionParameter &parameter)
const TriLogic & isReversible() const
Definition: CFunction.cpp:145
CFunctionParameters & getVariables()
Definition: CFunction.cpp:148
std::string CMassAction::writeMathML ( const std::vector< std::vector< std::string > > &  variables,
bool  expand = true,
bool  fullExpand = true 
) const
virtual

Function to write the mathematical formula in format of MathML.

Parameters
std::ostream& out
conststd::vector< std::vector< std::string > > & variables
boolexpand = true
boolfullExpand
Returns
std::string

Reimplemented from CFunction.

Definition at line 173 of file CMassAction.cpp.

References CFunction::isReversible(), and TriTrue.

Referenced by CQExpressionWidget::writeMathML().

175 {
176  std::ostringstream out;
177 
178  bool rev = (isReversible() == TriTrue);
179 
180  if (rev)
181  out << "<mfenced>" << std::endl;
182 
183  out << "<mrow>" << std::endl;
184 
185  out << variables[0][0] << std::endl;
186 
187  size_t i, imax = variables[1].size();
188 
189  for (i = 0; i < imax; ++i)
190  {
191  out << "<mo>&CenterDot;</mo>" << std::endl;
192  out << variables[1][i] << std::endl;
193  }
194 
195  if (rev)
196  {
197  out << "<mo>-</mo>" << std::endl;
198  out << variables[2][0] << std::endl;
199 
200  size_t i, imax = variables[3].size();
201 
202  for (i = 0; i < imax; ++i)
203  {
204  out << "<mo>&CenterDot;</mo>" << std::endl;
205  out << variables[3][i] << std::endl;
206  }
207  }
208 
209  out << "</mrow>" << std::endl;
210 
211  if (rev)
212  out << "</mfenced>" << std::endl;
213 
214  return out.str();
215 }
const TriLogic & isReversible() const
Definition: CFunction.cpp:145

Member Data Documentation

const char * CMassAction::Infix
static
Initial value:
=
{"k1*PRODUCT<substrate_i>-k2*PRODUCT<product_j>", "k1*PRODUCT<substrate_i>"}

CMassAction

Created for COPASI by Stefan Hoops (C) Stefan Hoops 2001

Definition at line 34 of file CMassAction.h.

Referenced by CMassAction(), CQValidatorFunction::validate(), and CQExpressionWidget::writeMathML().


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