User Guide
|
Visitor for kinetic block statements More...
Visitor for kinetic block statements
Replaces each KINETIC block with a DERIVATIVE block containing a system of ODEs that is equivalent to the original set of reaction statements
Note: assumes that the order of statements between the first and last reaction statement (those starting with "~") does not matter.
If there is a CONSERVE statement it is rewritten in an equivalent form which is then be used by the SympySolver visitor to replace the ODE for the last state variable on the LHS of the CONSERVE statement
Definition at line 47 of file kinetic_block_visitor.hpp.
#include <kinetic_block_visitor.hpp>
Classes | |
struct | RateEqs |
stochiometric matrices nu_L, nu_R forwards/backwards fluxes k_f, k_b (see kinetic_schemes.ipynb notebook for details) More... | |
Private Member Functions | |
void | process_reac_var (const std::string &varname, int count=1) |
update stoichiometric matrices with reaction var term More... | |
void | process_conserve_reac_var (const std::string &varname, int count=1) |
update CONSERVE statement with reaction var term More... | |
Private Attributes | |
struct nmodl::visitor::KineticBlockVisitor::RateEqs | rate_eqs |
std::vector< std::string > | compartment_factors |
multiplicative factors for ODEs from COMPARTMENT statements More... | |
std::vector< std::string > | additive_terms |
additive constant terms for ODEs from reaction statements like ~ x << (a) More... | |
std::vector< std::string > | non_state_var_fflux |
multiplicate constant terms for fluxes from non-state vars as reactants e.g. More... | |
std::vector< std::string > | non_state_var_bflux |
std::vector< std::string > | fflux |
generated set of fluxes and ODEs More... | |
std::vector< std::string > | bflux |
std::vector< std::string > | odes |
std::string | modfile_fflux |
current expressions for the fflux , bflux variables that can be used in the mod file and that are determined by the preceeding kinetic reaction statement, i.e. More... | |
std::string | modfile_bflux |
int | state_var_count = 0 |
number of state variables More... | |
std::vector< std::string > | state_var |
state variables vector More... | |
std::unordered_map< std::string, int > | state_var_index |
unordered_map from state variable to corresponding index More... | |
std::unordered_map< std::string, int > | array_state_var_size |
unordered_map from array state variable to its size (for summing over each element of any array state vars in a CONSERVE statement) More... | |
bool | in_reaction_statement = false |
true if we are visiting a reaction statement More... | |
bool | in_reaction_statement_lhs = false |
true if we are visiting the left hand side of reaction statement More... | |
bool | in_conserve_statement = false |
true if we are visiting a CONSERVE statement More... | |
int | conserve_statement_count = 0 |
counts the number of CONSERVE statements in Kinetic blocks More... | |
std::string | conserve_equation_str |
conserve statement equation as string More... | |
std::string | conserve_equation_statevar |
conserve statement: current state variable being processed More... | |
std::string | conserve_equation_factor |
conserve statement: current state var multiplicative factor being processed More... | |
int | i_statement = 0 |
current statement index More... | |
std::vector< ast::KineticBlock * > | kinetic_blocks |
vector of kinetic block nodes More... | |
std::unordered_set< ast::Statement * > | statements_to_remove |
statements to remove from block More... | |
ast::StatementBlock * | current_statement_block = nullptr |
current statement block being visited More... | |
|
default |
|
inline |
Definition at line 137 of file kinetic_block_visitor.hpp.
|
private |
update CONSERVE statement with reaction var term
Definition at line 63 of file kinetic_block_visitor.cpp.
|
private |
update stoichiometric matrices with reaction var term
Definition at line 22 of file kinetic_block_visitor.cpp.
|
overridevirtual |
visit node of type ast::Compartment
Implements nmodl::visitor::Visitor.
Definition at line 144 of file kinetic_block_visitor.cpp.
|
overridevirtual |
visit node of type ast::Conserve
Implements nmodl::visitor::Visitor.
Definition at line 102 of file kinetic_block_visitor.cpp.
|
overridevirtual |
visit node of type ast::KineticBlock
Implements nmodl::visitor::Visitor.
Definition at line 354 of file kinetic_block_visitor.cpp.
|
overridevirtual |
visit node of type ast::Program
Implements nmodl::visitor::Visitor.
Definition at line 432 of file kinetic_block_visitor.cpp.
|
overridevirtual |
visit node of type ast::ReactVarName
Implements nmodl::visitor::Visitor.
Definition at line 179 of file kinetic_block_visitor.cpp.
|
overridevirtual |
visit node of type ast::ReactionOperator
Implements nmodl::visitor::Visitor.
Definition at line 169 of file kinetic_block_visitor.cpp.
|
overridevirtual |
visit node of type ast::ReactionStatement
check if reaction statement is a single state variable
Implements nmodl::visitor::Visitor.
Definition at line 201 of file kinetic_block_visitor.cpp.
|
overridevirtual |
visit node of type ast::StatementBlock
Implements nmodl::visitor::Visitor.
Definition at line 345 of file kinetic_block_visitor.cpp.
|
overridevirtual |
visit node of type ast::WrappedExpression
Implements nmodl::visitor::Visitor.
Definition at line 325 of file kinetic_block_visitor.cpp.
|
private |
additive constant terms for ODEs from reaction statements like ~ x << (a)
Definition at line 69 of file kinetic_block_visitor.hpp.
|
private |
unordered_map from array state variable to its size (for summing over each element of any array state vars in a CONSERVE statement)
Definition at line 100 of file kinetic_block_visitor.hpp.
|
private |
Definition at line 80 of file kinetic_block_visitor.hpp.
|
private |
multiplicative factors for ODEs from COMPARTMENT statements
Definition at line 66 of file kinetic_block_visitor.hpp.
|
private |
conserve statement: current state var multiplicative factor being processed
Definition at line 121 of file kinetic_block_visitor.hpp.
|
private |
conserve statement: current state variable being processed
Definition at line 118 of file kinetic_block_visitor.hpp.
|
private |
conserve statement equation as string
Definition at line 115 of file kinetic_block_visitor.hpp.
|
private |
counts the number of CONSERVE statements in Kinetic blocks
Definition at line 112 of file kinetic_block_visitor.hpp.
|
private |
current statement block being visited
Definition at line 133 of file kinetic_block_visitor.hpp.
|
private |
generated set of fluxes and ODEs
Definition at line 79 of file kinetic_block_visitor.hpp.
|
private |
current statement index
Definition at line 124 of file kinetic_block_visitor.hpp.
|
private |
true if we are visiting a CONSERVE statement
Definition at line 109 of file kinetic_block_visitor.hpp.
|
private |
true if we are visiting a reaction statement
Definition at line 103 of file kinetic_block_visitor.hpp.
|
private |
true if we are visiting the left hand side of reaction statement
Definition at line 106 of file kinetic_block_visitor.hpp.
|
private |
vector of kinetic block nodes
Definition at line 127 of file kinetic_block_visitor.hpp.
|
private |
Definition at line 87 of file kinetic_block_visitor.hpp.
|
private |
current expressions for the fflux
, bflux
variables that can be used in the mod file and that are determined by the preceeding kinetic reaction statement, i.e.
their value changes depending on their location inside the kinetic block
Definition at line 86 of file kinetic_block_visitor.hpp.
|
private |
Definition at line 76 of file kinetic_block_visitor.hpp.
|
private |
multiplicate constant terms for fluxes from non-state vars as reactants e.g.
reaction statements like ~ x <-> c (a,a) where c is not a state var, which is equivalent to the ODE x' = a * (c - x)
Definition at line 75 of file kinetic_block_visitor.hpp.
|
private |
Definition at line 81 of file kinetic_block_visitor.hpp.
|
private |
|
private |
state variables vector
Definition at line 93 of file kinetic_block_visitor.hpp.
|
private |
number of state variables
Definition at line 90 of file kinetic_block_visitor.hpp.
|
private |
unordered_map from state variable to corresponding index
Definition at line 96 of file kinetic_block_visitor.hpp.
|
private |
statements to remove from block
Definition at line 130 of file kinetic_block_visitor.hpp.