COPASI API  4.16.103
compare_utilities.h
Go to the documentation of this file.
1 // Copyright (C) 2010 - 2013 by Pedro Mendes, Virginia Tech Intellectual
2 // Properties, Inc., University of Heidelberg, and The University
3 // of Manchester.
4 // All rights reserved.
5 
6 // Copyright (C) 2008 - 2009 by Pedro Mendes, Virginia Tech Intellectual
7 // Properties, Inc., EML Research, gGmbH, University of Heidelberg,
8 // and The University of Manchester.
9 // All rights reserved.
10 
11 // Copyright (C) 2007 by Pedro Mendes, Virginia Tech Intellectual
12 // Properties, Inc. and EML Research, gGmbH.
13 // All rights reserved.
14 
15 #ifndef COMPARE_UTILITIES_H__
16 #define COMPARE_UTILITIES_H__
17 
18 #ifndef SWIG
19 #include <string>
20 #include <map>
21 
22 class ASTNode;
23 class CNormalFraction;
24 class ListOfFunctionDefinitions;
25 class CNormalBase;
26 class ConverterASTNode;
27 class CEvaluationNode;
29 class CFunctionDB;
30 class CModel;
31 class CChemEq;
32 class CChemEqElement;
33 class CNormalProduct;
34 template<typename T> class CCopasiVector;
35 
36 ASTNode* create_expression(const ASTNode* pSource, const ListOfFunctionDefinitions* pFunctions);
37 
38 CNormalFraction* create_simplified_normalform(const ASTNode* pSource);
39 
40 CNormalFraction* create_normalform(const ASTNode* pSource);
41 
42 bool are_equal(const CNormalFraction* pLHS, const CNormalFraction* pRHS);
43 
44 void normalize_variable_names(CNormalBase* pBase, std::map<std::string, std::string>& variableMap);
45 
46 ASTNode* replace_variable_names(const ASTNode* pNode, const std::map<std::string, const ASTNode*>& argumentMap);
47 
48 ASTNode* expand_function_call(const ASTNode* pCall, const ListOfFunctionDefinitions* pFunctions);
49 
50 ASTNode* expand_function_calls(const ASTNode* pNode, const ListOfFunctionDefinitions* pFunctions);
51 
53 
55 
56 CEvaluationNode* replace_variable_names(const CEvaluationNode* pNode, const std::map<std::string, const CEvaluationNode*>& argumentMap);
57 
58 /**
59  * This function replaces a call to SEC by 1/COS.
60  */
61 ASTNode* replace_SEC(const ASTNode* pChild);
62 
63 /**
64  * This function replaces a call to CSC by 1/SIN.
65  */
66 ASTNode* replace_CSC(const ASTNode* pChild);
67 
68 /**
69  * This function replaces a call to COT by COS/SIN.
70  */
71 ASTNode* replace_COT(const ASTNode* pChild);
72 
73 /**
74  * This function replaces a call to SINH by (e^X-e^(-X))/2.
75  */
76 ASTNode* replace_SINH(const ASTNode* pChild);
77 
78 /**
79  * This function replaces a call to COSH by (e^X+e^(-X))/2
80  */
81 ASTNode* replace_COSH(const ASTNode* pChild);
82 
83 /**
84  * This function replaces a call to TANH by (e^X-e^(-X))/(e^X+e^(-X))
85  */
86 ASTNode* replace_TANH(const ASTNode* pChild);
87 
88 /**
89  * This function replaces a call to SECH by 2/(e^X+e^(-X))
90  */
91 ASTNode* replace_SECH(const ASTNode* pChild);
92 
93 /**
94  * This function replaces a call to CSCH by 2/(e^X-e^(-X))
95  */
96 ASTNode* replace_CSCH(const ASTNode* pChild);
97 
98 /**
99  * This function replaces a call to COTH by (e^X+e^(-X))/(e^X-e^(-X))
100  */
101 ASTNode* replace_COTH(const ASTNode* pChild);
102 
103 /**
104  * This function replaces a call to ARCSINH by log(X + sqrt(X^2 + 1))
105  */
106 ASTNode* replace_ARCSINH(const ASTNode* pChild);
107 
108 /**
109  * This function replaces a call to ARCCOSH by log(X + sqrt(X-1) * sqrt(X+1))
110  */
111 ASTNode* replace_ARCCOSH(const ASTNode* pChild);
112 
113 /**
114  * This function replaces a call to ARCTANH by 1/2 * (log(1+X) - log(1-X))
115  */
116 ASTNode* replace_ARCTANH(const ASTNode* pChild);
117 
118 /**
119  * This function replaces a call to ARCSECH by log(sqrt((1/X)-1) * sqrt(1+(1/X)) + 1/X)
120  */
121 ASTNode* replace_ARCSECH(const ASTNode* pChild);
122 
123 /**
124  * This function replaces a call to ARCCSCH by log(sqrt(1+ (1/ (X^2)))+(1/X))
125  */
126 ASTNode* replace_ARCCSCH(const ASTNode* pChild);
127 
128 /**
129  * This function determines if a given kinetic law represents a constant flux
130  * reaction.
131 bool isConstantFlux(const ASTNode* pNode,bool singleCompartment);
132  */
133 
134 /**
135  * This function determines if a given kinetic law represents an
136  * irreversible mass action kinetics.
137 bool isIrevMassAction(const ASTNode* pNode,const std::vector<std::pair<std::string,double> >& substrates);
138  */
139 
140 /**
141  * This function determines if a given kinetic law represents an
142  * reversible mass action kinetics.
143 bool isRevMassAction(const ASTNode* pNode,const std::vector<std::pair<std::string,double> >& substrates,const std::vector<std::pair<std::string,double> >& products);
144  */
145 
146 /**
147  * Returns true if the given CNormalFraction represents a mass action kinetics for the
148  * provided chemical equation.
149  */
150 bool is_mass_action(const CNormalFraction* pFrac, const CModel* pModel, const CChemEq* pChemEq);
151 
152 /**
153  * Returns true if the CNormalProduct contains objects fro all elements
154  * in the elements vector with the correct stoichiometry plut one item
155  * that represents the mass action kinetic parameter.
156  * This method i sused in is_mass_action once for the substrates and if the
157  * reaction is reversible once for the products.
158  */
159 bool contains_necessary_mass_action_elements(const CCopasiVector<CChemEqElement>& elements, const CNormalProduct* pProduct, const CModel* pModel);
160 
161 #endif /* SWIG */
162 #endif /* COMPARE_UTILITIES_H__ */
CNormalFraction * create_normalform(const ASTNode *pSource)
ASTNode * replace_COT(const ASTNode *pChild)
ASTNode * replace_CSC(const ASTNode *pChild)
ASTNode * replace_SINH(const ASTNode *pChild)
ASTNode * replace_ARCTANH(const ASTNode *pChild)
bool is_mass_action(const CNormalFraction *pFrac, const CModel *pModel, const CChemEq *pChemEq)
ASTNode * expand_function_calls(const ASTNode *pNode, const ListOfFunctionDefinitions *pFunctions)
bool contains_necessary_mass_action_elements(const CCopasiVector< CChemEqElement > &elements, const CNormalProduct *pProduct, const CModel *pModel)
ASTNode * replace_SEC(const ASTNode *pChild)
ASTNode * replace_COTH(const ASTNode *pChild)
ASTNode * replace_ARCCSCH(const ASTNode *pChild)
ASTNode * replace_SECH(const ASTNode *pChild)
ASTNode * create_expression(const ASTNode *pSource, const ListOfFunctionDefinitions *pFunctions)
ASTNode * replace_variable_names(const ASTNode *pNode, const std::map< std::string, const ASTNode * > &argumentMap)
ASTNode * expand_function_call(const ASTNode *pCall, const ListOfFunctionDefinitions *pFunctions)
CNormalFraction * create_simplified_normalform(const ASTNode *pSource)
void normalize_variable_names(CNormalBase *pBase, std::map< std::string, std::string > &variableMap)
ASTNode * replace_ARCSECH(const ASTNode *pChild)
ASTNode * replace_TANH(const ASTNode *pChild)
Definition: CModel.h:50
ASTNode * replace_ARCCOSH(const ASTNode *pChild)
ASTNode * replace_ARCSINH(const ASTNode *pChild)
ASTNode * replace_COSH(const ASTNode *pChild)
ASTNode * replace_CSCH(const ASTNode *pChild)
bool are_equal(const CNormalFraction *pLHS, const CNormalFraction *pRHS)