17 #include <unordered_map>
18 #include <unordered_set>
70 std::vector<std::vector<int>>
nu_L;
71 std::vector<std::vector<int>>
nu_R;
72 std::vector<std::string>
k_f;
73 std::vector<std::string>
k_b;
92 std::vector<std::string>
odes;
Concrete visitor for all AST classes.
Represent COMPARTMENT statement in NMODL.
Represent CONSERVE statement in NMODL.
Represents top level AST node for whole NMODL input.
Represents block encapsulating list of statements.
Wrap any other expression type.
Concrete visitor for all AST classes.
Visitor for kinetic block statements
int state_var_count
number of state variables
void visit_kinetic_block(ast::KineticBlock &node) override
visit node of type ast::KineticBlock
std::string modfile_fflux
current expressions for the fflux, bflux variables that can be used in the mod file and that are dete...
void visit_reaction_operator(ast::ReactionOperator &node) override
visit node of type ast::ReactionOperator
struct nmodl::visitor::KineticBlockVisitor::RateEqs rate_eqs
void compute_compartment_factor(ast::Compartment &node, const ast::Name &name)
void visit_reaction_statement(ast::ReactionStatement &node) override
visit node of type ast::ReactionStatement
int i_statement
current statement index
void visit_react_var_name(ast::ReactVarName &node) override
visit node of type ast::ReactVarName
bool in_conserve_statement
true if we are visiting a CONSERVE statement
KineticBlockVisitor()=default
std::string modfile_bflux
std::string conserve_equation_str
conserve statement equation as string
std::vector< std::string > non_state_var_bflux
std::vector< ast::KineticBlock * > kinetic_blocks
vector of kinetic block nodes
std::vector< std::string > fflux
generated set of fluxes and ODEs
int conserve_statement_count
counts the number of CONSERVE statements in Kinetic blocks
void unroll_kinetic_blocks(ast::Program &node)
Unroll loops in KINETIC blocks.
void visit_statement_block(ast::StatementBlock &node) override
visit node of type ast::StatementBlock
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...
std::vector< std::string > compartment_factors
multiplicative factors for ODEs from COMPARTMENT statements
std::vector< std::string > additive_terms
additive constant terms for ODEs from reaction statements like ~ x << (a)
std::unordered_set< ast::Statement * > statements_to_remove
statements to remove from block
void visit_conserve(ast::Conserve &node) override
visit node of type ast::Conserve
void visit_wrapped_expression(ast::WrappedExpression &node) override
visit node of type ast::WrappedExpression
std::vector< std::string > odes
void visit_compartment(ast::Compartment &node) override
visit node of type ast::Compartment
int get_conserve_statement_count() const
void process_conserve_reac_var(const std::string &varname, int count=1)
update CONSERVE statement with reaction var term
void visit_program(ast::Program &node) override
visit node of type ast::Program
void compute_indexed_compartment_factor(ast::Compartment &node, const ast::Name &name)
std::string conserve_equation_factor
conserve statement: current state var multiplicative factor being processed
std::string conserve_equation_statevar
conserve statement: current state variable being processed
void set_compartment_factor(int var_index, const std::string &factor)
ast::StatementBlock * current_statement_block
current statement block being visited
std::unordered_map< std::string, int > state_var_index
unordered_map from state variable to corresponding index
void process_reac_var(const std::string &varname, int count=1)
update stoichiometric matrices with reaction var term
std::vector< std::string > bflux
std::vector< std::string > non_state_var_fflux
multiplicate constant terms for fluxes from non-state vars as reactants e.g.
bool in_reaction_statement_lhs
true if we are visiting the left hand side of reaction statement
std::vector< std::string > state_var
state variables vector
bool in_reaction_statement
true if we are visiting a reaction statement
encapsulates code generation backend implementations
static Node * node(Object *)
stochiometric matrices nu_L, nu_R forwards/backwards fluxes k_f, k_b (see kinetic_schemes....
std::vector< std::vector< int > > nu_L
std::vector< std::string > k_b
std::vector< std::string > k_f
std::vector< std::vector< int > > nu_R