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... | |
void | set_compartment_factor (int var_index, const std::string &factor) |
void | compute_compartment_factor (ast::Compartment &node, const ast::Name &name) |
void | compute_indexed_compartment_factor (ast::Compartment &node, const ast::Name &name) |
void | unroll_kinetic_blocks (ast::Program &node) |
Unroll loops in KINETIC blocks. 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 |
|
private |
Definition at line 161 of file kinetic_block_visitor.cpp.
|
private |
Definition at line 178 of file kinetic_block_visitor.cpp.
|
inline |
Definition at line 148 of file kinetic_block_visitor.hpp.
|
private |
update CONSERVE statement with reaction var term
Definition at line 68 of file kinetic_block_visitor.cpp.
|
private |
update stoichiometric matrices with reaction var term
Definition at line 27 of file kinetic_block_visitor.cpp.
|
private |
Definition at line 149 of file kinetic_block_visitor.cpp.
|
private |
Unroll loops in KINETIC blocks.
The subsequent processing in KineticBlockVisitor fails if there's any reaction equation inside a FROM .. TO ..
block. The solution is to unroll any loops first to satisfy the assumption.
Definition at line 647 of file kinetic_block_visitor.cpp.
|
overridevirtual |
visit node of type ast::Compartment
Implements nmodl::visitor::Visitor.
Definition at line 202 of file kinetic_block_visitor.cpp.
|
overridevirtual |
visit node of type ast::Conserve
Implements nmodl::visitor::Visitor.
Definition at line 107 of file kinetic_block_visitor.cpp.
|
overridevirtual |
visit node of type ast::KineticBlock
Implements nmodl::visitor::Visitor.
Definition at line 403 of file kinetic_block_visitor.cpp.
|
overridevirtual |
visit node of type ast::Program
Implements nmodl::visitor::Visitor.
Definition at line 682 of file kinetic_block_visitor.cpp.
|
overridevirtual |
visit node of type ast::ReactVarName
Implements nmodl::visitor::Visitor.
Definition at line 229 of file kinetic_block_visitor.cpp.
|
overridevirtual |
visit node of type ast::ReactionOperator
Implements nmodl::visitor::Visitor.
Definition at line 219 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 251 of file kinetic_block_visitor.cpp.
|
overridevirtual |
visit node of type ast::StatementBlock
Implements nmodl::visitor::Visitor.
Definition at line 394 of file kinetic_block_visitor.cpp.
|
overridevirtual |
visit node of type ast::WrappedExpression
Implements nmodl::visitor::Visitor.
Definition at line 374 of file kinetic_block_visitor.cpp.
|
private |
additive constant terms for ODEs from reaction statements like ~ x << (a)
Definition at line 80 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 111 of file kinetic_block_visitor.hpp.
|
private |
Definition at line 91 of file kinetic_block_visitor.hpp.
|
private |
multiplicative factors for ODEs from COMPARTMENT statements
Definition at line 77 of file kinetic_block_visitor.hpp.
|
private |
conserve statement: current state var multiplicative factor being processed
Definition at line 132 of file kinetic_block_visitor.hpp.
|
private |
conserve statement: current state variable being processed
Definition at line 129 of file kinetic_block_visitor.hpp.
|
private |
conserve statement equation as string
Definition at line 126 of file kinetic_block_visitor.hpp.
|
private |
counts the number of CONSERVE statements in Kinetic blocks
Definition at line 123 of file kinetic_block_visitor.hpp.
|
private |
current statement block being visited
Definition at line 144 of file kinetic_block_visitor.hpp.
|
private |
generated set of fluxes and ODEs
Definition at line 90 of file kinetic_block_visitor.hpp.
|
private |
current statement index
Definition at line 135 of file kinetic_block_visitor.hpp.
|
private |
true if we are visiting a CONSERVE statement
Definition at line 120 of file kinetic_block_visitor.hpp.
|
private |
true if we are visiting a reaction statement
Definition at line 114 of file kinetic_block_visitor.hpp.
|
private |
true if we are visiting the left hand side of reaction statement
Definition at line 117 of file kinetic_block_visitor.hpp.
|
private |
vector of kinetic block nodes
Definition at line 138 of file kinetic_block_visitor.hpp.
|
private |
Definition at line 98 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 97 of file kinetic_block_visitor.hpp.
|
private |
Definition at line 87 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 86 of file kinetic_block_visitor.hpp.
|
private |
Definition at line 92 of file kinetic_block_visitor.hpp.
|
private |
|
private |
state variables vector
Definition at line 104 of file kinetic_block_visitor.hpp.
|
private |
number of state variables
Definition at line 101 of file kinetic_block_visitor.hpp.
|
private |
unordered_map from state variable to corresponding index
Definition at line 107 of file kinetic_block_visitor.hpp.
|
private |
statements to remove from block
Definition at line 141 of file kinetic_block_visitor.hpp.