NEURON
solve_block_visitor.hpp
Go to the documentation of this file.
1 /*
2  * Copyright 2023 Blue Brain Project, EPFL.
3  * See the top-level LICENSE file for details.
4  *
5  * SPDX-License-Identifier: Apache-2.0
6  */
7 
8 #pragma once
9 
10 /**
11  * \file
12  * \brief \copybrief nmodl::visitor::SolveBlockVisitor
13  */
14 
15 #include "symtab/decl.hpp"
16 #include "visitors/ast_visitor.hpp"
17 
18 namespace nmodl {
19 namespace visitor {
20 
21 /**
22  * \addtogroup visitor_classes
23  * \{
24  */
25 
26 /**
27  * \class SolveBlockVisitor
28  * \brief Replace solve block statements with actual solution node in the AST
29  *
30  * Once SympySolverVisitor or NeuronSolveVisitor is ran, solve blocks can be replaced
31  * with solution expression node that represent solution that is going to be solved.
32  * All solve statements appearing in breakpoint block get added to NrnState block as
33  * solution expression.
34  */
36  private:
38 
39  bool in_breakpoint_block = false;
40 
41  /// solve expression statements for NrnState block
43 
45 
46  public:
47  SolveBlockVisitor() = default;
50  void visit_program(ast::Program& node) override;
51 };
52 
53 /** \} */ // end of visitor_classes
54 
55 } // namespace visitor
56 } // namespace nmodl
Concrete visitor for all AST classes.
Represents a BREAKPOINT block in NMODL.
Represents top level AST node for whole NMODL input.
Definition: program.hpp:39
Represent solution of a block in the AST.
Represent symbol table for a NMODL block.
Concrete visitor for all AST classes.
Definition: ast_visitor.hpp:37
Replace solve block statements with actual solution node in the AST.
void visit_breakpoint_block(ast::BreakpointBlock &node) override
visit node of type ast::BreakpointBlock
ast::SolutionExpression * create_solution_expression(ast::SolveBlock &solve_block)
Create solution expression node that will be used for solve block.
void visit_program(ast::Program &node) override
visit node of type ast::Program
ast::StatementVector nrn_state_solve_statements
solve expression statements for NrnState block
void visit_expression_statement(ast::ExpressionStatement &node) override
Replace solve blocks with solution expression.
std::vector< std::shared_ptr< Statement > > StatementVector
Definition: ast_decl.hpp:302
encapsulates code generation backend implementations
Definition: ast_common.hpp:26
static Node * node(Object *)
Definition: netcvode.cpp:291
Forward declarations of symbols in namespace nmodl::symtab.