User Guide
nmodl::codegen::CodegenNeuronCppVisitor Class Reference

Visitor for printing C++ code compatible with legacy api of NEURON More...

Detailed Description

Visitor for printing C++ code compatible with legacy api of NEURON

Todo:
  • Handle define statement (i.e. macros)
  • If there is a return statement in the verbatim block of inlined function then it will be error. Need better error checking. For example, see netstim.mod where we have removed return from verbatim block.

Definition at line 92 of file codegen_neuron_cpp_visitor.hpp.

#include <codegen_neuron_cpp_visitor.hpp>

Inheritance diagram for nmodl::codegen::CodegenNeuronCppVisitor:
nmodl::codegen::CodegenCppVisitor nmodl::visitor::ConstAstVisitor nmodl::visitor::ConstVisitor

Public Member Functions

ParamVector functor_params () override
 The parameters of the Newton solver "functor". More...
 
void print_mechanism_range_var_structure (bool print_initializers) override
 Print the structure that wraps all range and int variables required for the NMODL. More...
 
void print_node_data_structure (bool print_initializers)
 Print the structure that wraps all node variables required for the NMODL. More...
 
void print_thread_variables_structure (bool print_initializers)
 Print the data structure used to access thread variables. More...
 
 CodegenCppVisitor (std::string mod_filename, std::ostream &stream, std::string float_type, const bool optimize_ionvar_copies, std::unique_ptr< nmodl::utils::Blame > blame=nullptr)
 Constructs the C++ code generator visitor. More...
 
 CodegenCppVisitor (std::string mod_filename, std::ostream &stream, std::string float_type, const bool optimize_ionvar_copies, const bool enable_cvode, std::unique_ptr< nmodl::utils::Blame > blame=nullptr)
 
- Public Member Functions inherited from nmodl::codegen::CodegenCppVisitor
 CodegenCppVisitor (std::string mod_filename, std::ostream &stream, std::string float_type, const bool optimize_ionvar_copies, std::unique_ptr< nmodl::utils::Blame > blame=nullptr)
 Constructs the C++ code generator visitor. More...
 
 CodegenCppVisitor (std::string mod_filename, std::ostream &stream, std::string float_type, const bool optimize_ionvar_copies, const bool enable_cvode, std::unique_ptr< nmodl::utils::Blame > blame=nullptr)
 
void visit_program (const ast::Program &program) override
 Main and only member function to call after creating an instance of this class. More...
 
- Public Member Functions inherited from nmodl::visitor::ConstAstVisitor
void visit_node (const ast::Node &node) override
 visit node of type ast::Node More...
 
void visit_statement (const ast::Statement &node) override
 visit node of type ast::Statement More...
 
void visit_expression (const ast::Expression &node) override
 visit node of type ast::Expression More...
 
void visit_block (const ast::Block &node) override
 visit node of type ast::Block More...
 
void visit_identifier (const ast::Identifier &node) override
 visit node of type ast::Identifier More...
 
void visit_number (const ast::Number &node) override
 visit node of type ast::Number More...
 
void visit_string (const ast::String &node) override
 visit node of type ast::String More...
 
void visit_integer (const ast::Integer &node) override
 visit node of type ast::Integer More...
 
void visit_float (const ast::Float &node) override
 visit node of type ast::Float More...
 
void visit_double (const ast::Double &node) override
 visit node of type ast::Double More...
 
void visit_boolean (const ast::Boolean &node) override
 visit node of type ast::Boolean More...
 
void visit_name (const ast::Name &node) override
 visit node of type ast::Name More...
 
void visit_prime_name (const ast::PrimeName &node) override
 visit node of type ast::PrimeName More...
 
void visit_indexed_name (const ast::IndexedName &node) override
 visit node of type ast::IndexedName More...
 
void visit_var_name (const ast::VarName &node) override
 visit node of type ast::VarName More...
 
void visit_argument (const ast::Argument &node) override
 visit node of type ast::Argument More...
 
void visit_react_var_name (const ast::ReactVarName &node) override
 visit node of type ast::ReactVarName More...
 
void visit_read_ion_var (const ast::ReadIonVar &node) override
 visit node of type ast::ReadIonVar More...
 
void visit_write_ion_var (const ast::WriteIonVar &node) override
 visit node of type ast::WriteIonVar More...
 
void visit_nonspecific_cur_var (const ast::NonspecificCurVar &node) override
 visit node of type ast::NonspecificCurVar More...
 
void visit_electrode_cur_var (const ast::ElectrodeCurVar &node) override
 visit node of type ast::ElectrodeCurVar More...
 
void visit_range_var (const ast::RangeVar &node) override
 visit node of type ast::RangeVar More...
 
void visit_global_var (const ast::GlobalVar &node) override
 visit node of type ast::GlobalVar More...
 
void visit_pointer_var (const ast::PointerVar &node) override
 visit node of type ast::PointerVar More...
 
void visit_random_var (const ast::RandomVar &node) override
 visit node of type ast::RandomVar More...
 
void visit_bbcore_pointer_var (const ast::BbcorePointerVar &node) override
 visit node of type ast::BbcorePointerVar More...
 
void visit_extern_var (const ast::ExternVar &node) override
 visit node of type ast::ExternVar More...
 
void visit_param_block (const ast::ParamBlock &node) override
 visit node of type ast::ParamBlock More...
 
void visit_independent_block (const ast::IndependentBlock &node) override
 visit node of type ast::IndependentBlock More...
 
void visit_assigned_block (const ast::AssignedBlock &node) override
 visit node of type ast::AssignedBlock More...
 
void visit_state_block (const ast::StateBlock &node) override
 visit node of type ast::StateBlock More...
 
void visit_initial_block (const ast::InitialBlock &node) override
 visit node of type ast::InitialBlock More...
 
void visit_constructor_block (const ast::ConstructorBlock &node) override
 visit node of type ast::ConstructorBlock More...
 
void visit_destructor_block (const ast::DestructorBlock &node) override
 visit node of type ast::DestructorBlock More...
 
void visit_statement_block (const ast::StatementBlock &node) override
 visit node of type ast::StatementBlock More...
 
void visit_derivative_block (const ast::DerivativeBlock &node) override
 visit node of type ast::DerivativeBlock More...
 
void visit_linear_block (const ast::LinearBlock &node) override
 visit node of type ast::LinearBlock More...
 
void visit_non_linear_block (const ast::NonLinearBlock &node) override
 visit node of type ast::NonLinearBlock More...
 
void visit_discrete_block (const ast::DiscreteBlock &node) override
 visit node of type ast::DiscreteBlock More...
 
void visit_function_table_block (const ast::FunctionTableBlock &node) override
 visit node of type ast::FunctionTableBlock More...
 
void visit_function_block (const ast::FunctionBlock &node) override
 visit node of type ast::FunctionBlock More...
 
void visit_procedure_block (const ast::ProcedureBlock &node) override
 visit node of type ast::ProcedureBlock More...
 
void visit_net_receive_block (const ast::NetReceiveBlock &node) override
 visit node of type ast::NetReceiveBlock More...
 
void visit_solve_block (const ast::SolveBlock &node) override
 visit node of type ast::SolveBlock More...
 
void visit_breakpoint_block (const ast::BreakpointBlock &node) override
 visit node of type ast::BreakpointBlock More...
 
void visit_before_block (const ast::BeforeBlock &node) override
 visit node of type ast::BeforeBlock More...
 
void visit_after_block (const ast::AfterBlock &node) override
 visit node of type ast::AfterBlock More...
 
void visit_ba_block (const ast::BABlock &node) override
 visit node of type ast::BABlock More...
 
void visit_for_netcon (const ast::ForNetcon &node) override
 visit node of type ast::ForNetcon More...
 
void visit_kinetic_block (const ast::KineticBlock &node) override
 visit node of type ast::KineticBlock More...
 
void visit_unit_block (const ast::UnitBlock &node) override
 visit node of type ast::UnitBlock More...
 
void visit_constant_block (const ast::ConstantBlock &node) override
 visit node of type ast::ConstantBlock More...
 
void visit_neuron_block (const ast::NeuronBlock &node) override
 visit node of type ast::NeuronBlock More...
 
void visit_unit (const ast::Unit &node) override
 visit node of type ast::Unit More...
 
void visit_double_unit (const ast::DoubleUnit &node) override
 visit node of type ast::DoubleUnit More...
 
void visit_local_var (const ast::LocalVar &node) override
 visit node of type ast::LocalVar More...
 
void visit_limits (const ast::Limits &node) override
 visit node of type ast::Limits More...
 
void visit_number_range (const ast::NumberRange &node) override
 visit node of type ast::NumberRange More...
 
void visit_constant_var (const ast::ConstantVar &node) override
 visit node of type ast::ConstantVar More...
 
void visit_binary_operator (const ast::BinaryOperator &node) override
 visit node of type ast::BinaryOperator More...
 
void visit_unary_operator (const ast::UnaryOperator &node) override
 visit node of type ast::UnaryOperator More...
 
void visit_reaction_operator (const ast::ReactionOperator &node) override
 visit node of type ast::ReactionOperator More...
 
void visit_paren_expression (const ast::ParenExpression &node) override
 visit node of type ast::ParenExpression More...
 
void visit_binary_expression (const ast::BinaryExpression &node) override
 visit node of type ast::BinaryExpression More...
 
void visit_diff_eq_expression (const ast::DiffEqExpression &node) override
 visit node of type ast::DiffEqExpression More...
 
void visit_unary_expression (const ast::UnaryExpression &node) override
 visit node of type ast::UnaryExpression More...
 
void visit_non_lin_equation (const ast::NonLinEquation &node) override
 visit node of type ast::NonLinEquation More...
 
void visit_lin_equation (const ast::LinEquation &node) override
 visit node of type ast::LinEquation More...
 
void visit_function_call (const ast::FunctionCall &node) override
 visit node of type ast::FunctionCall More...
 
void visit_watch (const ast::Watch &node) override
 visit node of type ast::Watch More...
 
void visit_ba_block_type (const ast::BABlockType &node) override
 visit node of type ast::BABlockType More...
 
void visit_unit_def (const ast::UnitDef &node) override
 visit node of type ast::UnitDef More...
 
void visit_factor_def (const ast::FactorDef &node) override
 visit node of type ast::FactorDef More...
 
void visit_valence (const ast::Valence &node) override
 visit node of type ast::Valence More...
 
void visit_unit_state (const ast::UnitState &node) override
 visit node of type ast::UnitState More...
 
void visit_local_list_statement (const ast::LocalListStatement &node) override
 visit node of type ast::LocalListStatement More...
 
void visit_model (const ast::Model &node) override
 visit node of type ast::Model More...
 
void visit_define (const ast::Define &node) override
 visit node of type ast::Define More...
 
void visit_include (const ast::Include &node) override
 visit node of type ast::Include More...
 
void visit_param_assign (const ast::ParamAssign &node) override
 visit node of type ast::ParamAssign More...
 
void visit_assigned_definition (const ast::AssignedDefinition &node) override
 visit node of type ast::AssignedDefinition More...
 
void visit_conductance_hint (const ast::ConductanceHint &node) override
 visit node of type ast::ConductanceHint More...
 
void visit_expression_statement (const ast::ExpressionStatement &node) override
 visit node of type ast::ExpressionStatement More...
 
void visit_protect_statement (const ast::ProtectStatement &node) override
 visit node of type ast::ProtectStatement More...
 
void visit_from_statement (const ast::FromStatement &node) override
 visit node of type ast::FromStatement More...
 
void visit_while_statement (const ast::WhileStatement &node) override
 visit node of type ast::WhileStatement More...
 
void visit_if_statement (const ast::IfStatement &node) override
 visit node of type ast::IfStatement More...
 
void visit_else_if_statement (const ast::ElseIfStatement &node) override
 visit node of type ast::ElseIfStatement More...
 
void visit_else_statement (const ast::ElseStatement &node) override
 visit node of type ast::ElseStatement More...
 
void visit_watch_statement (const ast::WatchStatement &node) override
 visit node of type ast::WatchStatement More...
 
void visit_mutex_lock (const ast::MutexLock &node) override
 visit node of type ast::MutexLock More...
 
void visit_mutex_unlock (const ast::MutexUnlock &node) override
 visit node of type ast::MutexUnlock More...
 
void visit_conserve (const ast::Conserve &node) override
 visit node of type ast::Conserve More...
 
void visit_compartment (const ast::Compartment &node) override
 visit node of type ast::Compartment More...
 
void visit_lon_diffuse (const ast::LonDiffuse &node) override
 visit node of type ast::LonDiffuse More...
 
void visit_reaction_statement (const ast::ReactionStatement &node) override
 visit node of type ast::ReactionStatement More...
 
void visit_lag_statement (const ast::LagStatement &node) override
 visit node of type ast::LagStatement More...
 
void visit_constant_statement (const ast::ConstantStatement &node) override
 visit node of type ast::ConstantStatement More...
 
void visit_table_statement (const ast::TableStatement &node) override
 visit node of type ast::TableStatement More...
 
void visit_suffix (const ast::Suffix &node) override
 visit node of type ast::Suffix More...
 
void visit_useion (const ast::Useion &node) override
 visit node of type ast::Useion More...
 
void visit_nonspecific (const ast::Nonspecific &node) override
 visit node of type ast::Nonspecific More...
 
void visit_electrode_current (const ast::ElectrodeCurrent &node) override
 visit node of type ast::ElectrodeCurrent More...
 
void visit_range (const ast::Range &node) override
 visit node of type ast::Range More...
 
void visit_global (const ast::Global &node) override
 visit node of type ast::Global More...
 
void visit_random_var_list (const ast::RandomVarList &node) override
 visit node of type ast::RandomVarList More...
 
void visit_pointer (const ast::Pointer &node) override
 visit node of type ast::Pointer More...
 
void visit_bbcore_pointer (const ast::BbcorePointer &node) override
 visit node of type ast::BbcorePointer More...
 
void visit_external (const ast::External &node) override
 visit node of type ast::External More...
 
void visit_thread_safe (const ast::ThreadSafe &node) override
 visit node of type ast::ThreadSafe More...
 
void visit_verbatim (const ast::Verbatim &node) override
 visit node of type ast::Verbatim More...
 
void visit_line_comment (const ast::LineComment &node) override
 visit node of type ast::LineComment More...
 
void visit_block_comment (const ast::BlockComment &node) override
 visit node of type ast::BlockComment More...
 
void visit_ontology_statement (const ast::OntologyStatement &node) override
 visit node of type ast::OntologyStatement More...
 
void visit_program (const ast::Program &node) override
 visit node of type ast::Program More...
 
void visit_nrn_state_block (const ast::NrnStateBlock &node) override
 visit node of type ast::NrnStateBlock More...
 
void visit_eigen_newton_solver_block (const ast::EigenNewtonSolverBlock &node) override
 visit node of type ast::EigenNewtonSolverBlock More...
 
void visit_eigen_linear_solver_block (const ast::EigenLinearSolverBlock &node) override
 visit node of type ast::EigenLinearSolverBlock More...
 
void visit_cvode_block (const ast::CvodeBlock &node) override
 visit node of type ast::CvodeBlock More...
 
void visit_longitudinal_diffusion_block (const ast::LongitudinalDiffusionBlock &node) override
 visit node of type ast::LongitudinalDiffusionBlock More...
 
void visit_wrapped_expression (const ast::WrappedExpression &node) override
 visit node of type ast::WrappedExpression More...
 
void visit_derivimplicit_callback (const ast::DerivimplicitCallback &node) override
 visit node of type ast::DerivimplicitCallback More...
 
void visit_solution_expression (const ast::SolutionExpression &node) override
 visit node of type ast::SolutionExpression More...
 
void visit_update_dt (const ast::UpdateDt &node) override
 visit node of type ast::UpdateDt More...
 
- Public Member Functions inherited from nmodl::visitor::ConstVisitor
virtual ~ConstVisitor ()=default
 

Protected Member Functions

std::string simulator_name () override
 Name of the simulator the code was generated for. More...
 
std::string backend_name () const override
 Name of the code generation backend. More...
 
std::string table_thread_function_name () const
 Name of the threaded table checking function. More...
 
bool needs_v_unused () const override
 
int position_of_float_var (const std::string &name) const override
 Determine the position in the data array for a given float variable. More...
 
int position_of_int_var (const std::string &name) const override
 Determine the position in the data array for a given int variable. More...
 
bool optimize_ion_variable_copies () const override
 Check if ion variable copies should be avoided. More...
 
void print_net_init ()
 Print NET_RECEIVE{ INITIAL{ ... More...
 
void print_net_send_call (const ast::FunctionCall &node) override
 Print call to net_send. More...
 
void print_net_move_call (const ast::FunctionCall &node) override
 Print call to net_move. More...
 
void print_net_event_call (const ast::FunctionCall &node) override
 Print call to net_event. More...
 
void print_function_table_call (const ast::FunctionCall &node) override
 Print special code when calling FUNCTION_TABLEs. More...
 
void print_net_receive ()
 Print net_receive call-back. More...
 
void print_net_receive_common_code ()
 
ParamVector net_receive_args ()
 
void print_net_receive_registration ()
 Print code to register the call-back for the NET_RECEIVE block. More...
 
void print_point_process_function_definitions ()
 Print POINT_PROCESS related functions Wrap external NEURON functions related to POINT_PROCESS mechanisms. More...
 
void print_setdata_functions ()
 Print NEURON functions related to setting global variables of the mechanism. More...
 
void print_function_prototypes () override
 Print function and procedures prototype declaration. More...
 
void print_function_definitions ()
 Print function and procedures prototype definitions. More...
 
void print_check_table_entrypoint ()
 Print all check_* function declarations. More...
 
void print_function_or_procedure (const ast::Block &node, const std::string &name, const std::unordered_set< CppObjectSpecifier > &specifiers={ CppObjectSpecifier::Inline}) override
 Print nmodl function or procedure (common code) More...
 
void print_function_procedure_helper (const ast::Block &node) override
 Common helper function to help printing function or procedure blocks. More...
 
void print_hoc_py_wrapper (const ast::Block *function_or_procedure_block, InterpreterWrapper wrapper_type)
 Print the wrapper for calling FUNCION/PROCEDURES from HOC/Py. More...
 
void print_hoc_py_wrapper_setup (const ast::Block *function_or_procedure_block, InterpreterWrapper wrapper_type)
 Print the setup code for HOC/Py wrapper. More...
 
void print_hoc_py_wrapper_call_impl (const ast::Block *function_or_procedure_block, InterpreterWrapper wrapper_type)
 Print the code that calls the impl from the HOC/Py wrapper. More...
 
std::string hoc_py_wrapper_signature (const ast::Block *function_or_procedure_block, InterpreterWrapper wrapper_type)
 Return the wrapper signature. More...
 
void print_hoc_py_wrapper_function_definitions ()
 
void print_longitudinal_diffusion_callbacks ()
 Prints the callbacks required for LONGITUDINAL_DIFFUSION. More...
 
ParamVector ldifusfunc1_parameters () const
 Parameters for what NEURON calls ldifusfunc1_t. More...
 
ParamVector ldifusfunc3_parameters () const
 Parameters for what NEURON calls ldifusfunc3_t. More...
 
void add_variable_tqitem (std::vector< IndexVariableInfo > &variables) override
 Add the variable tqitem during get_int_variables. More...
 
void add_variable_point_process (std::vector< IndexVariableInfo > &variables) override
 Add the variable point_process during get_int_variables. More...
 
std::string internal_method_arguments () override
 Arguments for functions that are defined and used internally. More...
 
ParamVector internal_method_parameters () override
 Parameters for internally defined functions. More...
 
const std::string external_method_arguments () noexcept override
 Arguments for external functions called from generated code. More...
 
const ParamVector external_method_parameters (bool table=false) noexcept override
 Parameters for functions in generated code that are called back from external code. More...
 
ParamVector internalthreadargs_parameters ()
 The parameters for the four macros _internalthreadargs*_. More...
 
ParamVector threadargs_parameters ()
 The parameters for the four macros _threadargs*_. More...
 
std::string nrn_thread_arguments () const override
 Arguments for "_threadargs_" macro in neuron implementation. More...
 
std::string nrn_thread_internal_arguments () override
 Arguments for "_threadargs_" macro in neuron implementation. More...
 
std::pair< ParamVector, ParamVectorfunction_table_parameters (const ast::FunctionTableBlock &) override
 Parameters of the function itself "{}" and "table_{}". More...
 
std::vector< std::string > print_verbatim_setup (const ast::Verbatim &node, const std::string &verbatim)
 Print compatibility macros required for VERBATIM blocks. More...
 
void print_verbatim_cleanup (const std::vector< std::string > &macros_defined)
 Print #undefs to erase all compatibility macros. More...
 
std::string register_mechanism_arguments () const override
 Arguments for register_mech or point_register_mech function. More...
 
void append_conc_write_statements (std::vector< ShadowUseStatement > &statements, const Ion &ion, const std::string &concentration) override
 Generate Function call statement for nrn_wrote_conc. More...
 
std::string hoc_function_name (const std::string &function_or_procedure_name) const
 All functions and procedures need a hoc <func_or_proc_name> to be available to the HOC interpreter. More...
 
std::string hoc_function_signature (const std::string &function_or_procedure_name) const
 Get the signature of the hoc <func_or_proc_name> function. More...
 
std::string py_function_name (const std::string &function_or_procedure_name) const
 In non POINT_PROCESS mechanisms all functions and procedures need a py <func_or_proc_name> to be available to the HOC interpreter. More...
 
std::string py_function_signature (const std::string &function_or_procedure_name) const
 Get the signature of the npy <func_or_proc_name> function. More...
 
std::string namespace_name () override
 Name of "our" namespace. More...
 
std::string float_variable_name (const SymbolType &symbol, bool use_instance) const override
 Determine the name of a float variable given its symbol. More...
 
std::string int_variable_name (const IndexVariableInfo &symbol, const std::string &name, bool use_instance) const override
 Determine the name of an int variable given its symbol. More...
 
std::string global_variable_name (const SymbolType &symbol, bool use_instance=true) const override
 Determine the variable name for a global variable given its symbol. More...
 
std::string thread_variable_name (const ThreadVariableInfo &var_info, bool use_instance=true) const
 Determine the C++ string to print for thread variables. More...
 
std::string get_variable_name (const std::string &name, bool use_instance=true) const override
 Determine the C++ string to replace variable names with. More...
 
std::string get_pointer_name (const std::string &name) const
 Determine the C++ string to replace pointer names with. More...
 
void print_standard_includes () override
 Print standard C/C++ includes. More...
 
void print_neuron_includes ()
 Print includes from NEURON. More...
 
void print_sdlists_init (bool print_initializers) override
 
void print_mechanism_global_var_structure (bool print_initializers) override
 Print the structure that wraps all global variables used in the NMODL. More...
 
void print_global_variables_for_hoc () override
 Print byte arrays that register scalar and vector variables for hoc interface. More...
 
void print_global_var_external_access ()
 Print functions for EXTERNAL use. More...
 
void print_global_param_default_values ()
 Print global struct with default value of RANGE PARAMETERs. More...
 
void print_mechanism_register () override
 Print the mechanism registration function. More...
 
void print_mechanism_register_regular ()
 Function body for anything not SUFFIX nothing. More...
 
void print_mechanism_register_nothing ()
 Function body for SUFFIX nothing. More...
 
void print_thread_memory_callbacks ()
 Print thread variable (de-)initialization functions. More...
 
void print_global_function_common_code (BlockType type, const std::string &function_name="") override
 Print common code for global functions like nrn_init, nrn_cur and nrn_state. More...
 
void print_entrypoint_setup_code_from_memb_list ()
 Prints setup code for entrypoints from NEURON. More...
 
void print_entrypoint_setup_code_from_prop ()
 Prints setup code for entrypoints NEURON. More...
 
void print_nrn_init (bool skip_init_check=true)
 Print the nrn_init function definition. More...
 
void print_initial_block (const ast::InitialBlock *node)
 Print the initial block. More...
 
void print_nrn_constructor () override
 Print nrn_constructor function definition. More...
 
void print_nrn_constructor_declaration ()
 
void print_nrn_destructor () override
 Print nrn_destructor function definition. More...
 
void print_nrn_destructor_declaration ()
 
void print_nrn_alloc () override
 Print nrn_alloc function definition. More...
 
void print_nrn_jacob ()
 Print nrn_jacob function definition. More...
 
void print_nrn_state () override
 Print nrn_state / state update function definition. More...
 
std::string nrn_current_arguments ()
 
ParamVector nrn_current_parameters ()
 
void print_nrn_current (const ast::BreakpointBlock &node) override
 Print the nrn_current kernel. More...
 
void print_nrn_cur_conductance_kernel (const ast::BreakpointBlock &node) override
 Print the nrn_cur kernel with NMODL conductance keyword provisions. More...
 
void print_nrn_cur_non_conductance_kernel () override
 Print the nrn_cur kernel without NMODL conductance keyword provisions. More...
 
void print_nrn_cur_kernel (const ast::BreakpointBlock &node) override
 Print main body of nrn_cur function. More...
 
void print_fast_imem_calculation () override
 Print fast membrane current calculation code. More...
 
void print_nrn_cur () override
 Print nrn_cur / current update function definition. More...
 
void print_headers_include () override
 Print all includes. More...
 
void print_macro_definitions ()
 Print all NEURON macros. More...
 
void print_neuron_global_variable_declarations ()
 Print extern declarations for neuron global variables. More...
 
void print_global_macros ()
 Print NEURON global variable macros. More...
 
void print_mechanism_variables_macros ()
 Print mechanism variables' related macros. More...
 
void print_data_structures (bool print_initializers) override
 Print all classes. More...
 
void print_make_instance () const
 Print make_*_instance. More...
 
void print_make_node_data () const
 Print make_*_node_data. More...
 
void print_v_unused () const override
 Set v_unused (voltage) for NRN_PRCELLSTATE feature. More...
 
void print_g_unused () const override
 Set g_unused (conductance) for NRN_PRCELLSTATE feature. More...
 
void print_compute_functions () override
 Print all compute functions for every backend. More...
 
void print_codegen_routines () override
 Print entry point to code generation. More...
 
void print_codegen_routines_regular ()
 Anything not SUFFIX nothing. More...
 
void print_codegen_routines_nothing ()
 SUFFIX nothing is special. More...
 
void print_ion_variable () override
 
ParamVector cvode_setup_parameters ()
 Get the parameters for functions that setup (initialize) CVODE. More...
 
ParamVector cvode_update_parameters ()
 Get the parameters for functions that update state at given timestep in CVODE. More...
 
void print_cvode_definitions ()
 Print all callbacks for CVODE. More...
 
void print_cvode_count ()
 Print the CVODE function returning the number of ODEs to solve. More...
 
void print_cvode_tolerances ()
 Print the CVODE function for setup of tolerances. More...
 
void print_cvode_update (const std::string &name, const ast::StatementBlock &block)
 Print the CVODE update function name contained in block. More...
 
void print_cvode_setup (const std::string &setup_name, const std::string &update_name)
 Print the CVODE setup function setup_name that calls the CVODE update function update_name. More...
 
std::string process_verbatim_text (const std::string &verbatim)
 
void visit_verbatim (const ast::Verbatim &node) override
 visit node of type ast::Verbatim More...
 
void visit_watch_statement (const ast::WatchStatement &node) override
 TODO: Edit for NEURON. More...
 
void visit_for_netcon (const ast::ForNetcon &node) override
 visit node of type ast::ForNetcon More...
 
void visit_longitudinal_diffusion_block (const ast::LongitudinalDiffusionBlock &node) override
 visit node of type ast::LongitudinalDiffusionBlock More...
 
void visit_lon_diffuse (const ast::LonDiffuse &node) override
 visit node of type ast::LonDiffuse More...
 
void visit_protect_statement (const ast::ProtectStatement &node) override
 visit node of type ast::ProtectStatement More...
 
- Protected Member Functions inherited from nmodl::codegen::CodegenCppVisitor
std::string nmodl_version () const noexcept
 Return Nmodl language version. More...
 
std::string instance_struct () const
 Name of structure that wraps range variables. More...
 
std::string node_data_struct () const
 Name of structure that wraps node variables. More...
 
std::string thread_variables_struct () const
 
std::string global_struct () const
 Name of structure that wraps global variables. More...
 
std::string global_struct_instance () const
 Name of the (host-only) global instance of global_struct More...
 
const char * local_var_type () const noexcept
 Data type for the local variables. More...
 
const char * default_float_data_type () const noexcept
 Default data type for floating point elements. More...
 
const std::string & float_data_type () const noexcept
 Data type for floating point elements specified on command line. More...
 
const char * default_int_data_type () const noexcept
 Default data type for integer (offset) elements. More...
 
const char * operator_for_rhs () const noexcept
 Operator for rhs vector update (matrix update) More...
 
const char * operator_for_d () const noexcept
 Operator for diagonal vector update (matrix update) More...
 
std::string get_channel_info_var_name () const noexcept
 Name of channel info variable. More...
 
bool ion_variable_struct_required () const
 Check if a structure for ion variables is required. More...
 
template<typename T >
bool has_parameter_of_name (const T &node, const std::string &name)
 Check if function or procedure node has parameter with given name. More...
 
bool net_send_buffer_required () const noexcept
 Check if net_send_buffer is required. More...
 
bool net_receive_buffering_required () const noexcept
 Check if net receive/send buffering kernels required. More...
 
bool nrn_state_required () const noexcept
 Check if nrn_state function is required. More...
 
bool nrn_cur_required () const noexcept
 Check if nrn_cur function is required. More...
 
bool net_receive_required () const noexcept
 Check if net_receive function is required. More...
 
bool range_variable_setup_required () const noexcept
 Check if setup_range_variable function is required. More...
 
bool net_receive_exist () const noexcept
 Check if net_receive node exist. More...
 
bool breakpoint_exist () const noexcept
 Check if breakpoint node exist. More...
 
bool defined_method (const std::string &name) const
 Check if given method is defined in this model. More...
 
bool is_net_send (const std::string &name) const noexcept
 Checks if given function name is net_send. More...
 
bool is_nrn_pointing (const std::string &name) const noexcept
 
bool is_net_move (const std::string &name) const noexcept
 Checks if given function name is net_move. More...
 
bool is_net_event (const std::string &name) const noexcept
 Checks if given function name is net_event. More...
 
bool is_function_table_call (const std::string &name) const
 
int float_variables_size () const
 Number of float variables in the model. More...
 
int int_variables_size () const
 Number of integer variables in the model. More...
 
std::string format_double_string (const std::string &value)
 Convert a given double value to its string representation. More...
 
std::string format_float_string (const std::string &value)
 Convert a given float value to its string representation. More...
 
void update_index_semantics ()
 populate all index semantics needed for registration with coreneuron More...
 
std::vector< SymbolTypeget_float_variables () const
 Determine all float variables required during code generation. More...
 
std::vector< IndexVariableInfoget_int_variables ()
 Determine all int variables required during code generation. More...
 
std::vector< std::string > ion_read_statements (BlockType type) const
 For a given output block type, return statements for all read ion variables. More...
 
std::vector< std::string > ion_read_statements_optimized (BlockType type) const
 For a given output block type, return minimal statements for all read ion variables. More...
 
std::vector< ShadowUseStatemention_write_statements (BlockType type)
 For a given output block type, return statements for writing back ion variables. More...
 
std::string process_shadow_update_statement (const ShadowUseStatement &statement, BlockType type)
 Process shadow update statement. More...
 
std::string breakpoint_current (std::string current) const
 Determine the variable name for the "current" used in breakpoint block taking into account intermediate code transformations. More...
 
virtual void print_parallel_iteration_hint (BlockType type, const ast::Block *block)
 Print pragma annotations for channel iterations. More...
 
virtual void print_global_var_struct_decl ()
 Instantiate global var instance. More...
 
void print_statement_block (const ast::StatementBlock &node, bool open_brace=true, bool close_brace=true)
 Print any statement block in nmodl with option to (not) print braces. More...
 
virtual void print_function_call (const ast::FunctionCall &node)
 Print call to internal or external function. More...
 
virtual void print_nrn_pointing (const ast::FunctionCall &node)
 Print nrn_pointing. More...
 
void print_procedure (const ast::ProcedureBlock &node)
 Print NMODL procedure in target backend code. More...
 
void print_function (const ast::FunctionBlock &node)
 Print NMODL function in target backend code. More...
 
void print_function_tables (const ast::FunctionTableBlock &node)
 Print the internal function for FUNCTION_TABLES. More...
 
bool is_functor_const (const ast::StatementBlock &variable_block, const ast::StatementBlock &functor_block)
 Checks whether the functor_block generated by sympy solver modifies any variable outside its scope. More...
 
void print_functor_definition (const ast::EigenNewtonSolverBlock &node)
 Based on the EigenNewtonSolverBlock passed print the definition needed for its functor. More...
 
void print_functors_definitions ()
 Print all Newton functor structs. More...
 
void print_eigen_linear_solver (const std::string &float_type, int N)
 Print linear solver using Eigen. More...
 
template<typename T >
void print_vector_elements (const std::vector< T > &elements, const std::string &separator, const std::string &prefix="")
 Print the items in a vector as a list. More...
 
std::string add_escape_quote (const std::string &text) const
 Add quotes to string to be output. More...
 
std::string method_name (const std::string &name) const
 Constructs the name of a function or procedure. More...
 
std::tuple< bool, int > check_if_var_is_array (const std::string &name)
 Check if the given name exist in the symbol. More...
 
SymbolType make_symbol (const std::string &name) const
 Creates a temporary symbol. More...
 
void print_namespace_start ()
 Prints the start of the simulator namespace. More...
 
void print_namespace_stop ()
 Prints the end of the simulator namespace. More...
 
void print_using_namespace ()
 Prints f"using namespace {namespace_name()}". More...
 
std::string update_if_ion_variable_name (const std::string &name) const
 Determine the updated name if the ion variable has been optimized. More...
 
std::string table_update_function_name (const std::string &block_name) const
 The name of the function that updates the table value if the parameters changed. More...
 
int get_int_variable_index (const std::string &var_name)
 
void print_backend_info ()
 Print top file header printed in generated code. More...
 
virtual void print_global_var_struct_assertions () const
 Print static assertions about the global variable struct. More...
 
virtual void print_global_struct_function_table_ptrs ()
 Print the entries of for FUNCTION_TABLEs in the global struct. More...
 
void print_prcellstate_macros () const
 Print declaration of macro NRN_PRCELLSTATE for debugging. More...
 
void print_mechanism_info ()
 Print backend code for byte array that has mechanism information (to be registered with NEURON/CoreNEURON) More...
 
void print_nmodl_constants ()
 Print the nmodl constants used in backend code. More...
 
void print_top_verbatim_blocks ()
 Print top level (global scope) verbatim blocks. More...
 
void visit_binary_expression (const ast::BinaryExpression &node) override
 visit node of type ast::BinaryExpression More...
 
void visit_binary_operator (const ast::BinaryOperator &node) override
 visit node of type ast::BinaryOperator More...
 
void visit_boolean (const ast::Boolean &node) override
 visit node of type ast::Boolean More...
 
void visit_double (const ast::Double &node) override
 visit node of type ast::Double More...
 
void visit_else_if_statement (const ast::ElseIfStatement &node) override
 visit node of type ast::ElseIfStatement More...
 
void visit_else_statement (const ast::ElseStatement &node) override
 visit node of type ast::ElseStatement More...
 
void visit_float (const ast::Float &node) override
 visit node of type ast::Float More...
 
void visit_from_statement (const ast::FromStatement &node) override
 visit node of type ast::FromStatement More...
 
void visit_function_call (const ast::FunctionCall &node) override
 visit node of type ast::FunctionCall More...
 
void visit_if_statement (const ast::IfStatement &node) override
 visit node of type ast::IfStatement More...
 
void visit_indexed_name (const ast::IndexedName &node) override
 visit node of type ast::IndexedName More...
 
void visit_integer (const ast::Integer &node) override
 visit node of type ast::Integer More...
 
void visit_local_list_statement (const ast::LocalListStatement &node) override
 visit node of type ast::LocalListStatement More...
 
void visit_name (const ast::Name &node) override
 visit node of type ast::Name More...
 
void visit_paren_expression (const ast::ParenExpression &node) override
 visit node of type ast::ParenExpression More...
 
void visit_prime_name (const ast::PrimeName &node) override
 visit node of type ast::PrimeName More...
 
void visit_statement_block (const ast::StatementBlock &node) override
 
void visit_string (const ast::String &node) override
 visit node of type ast::String More...
 
void visit_unary_operator (const ast::UnaryOperator &node) override
 visit node of type ast::UnaryOperator More...
 
void visit_unit (const ast::Unit &node) override
 visit node of type ast::Unit More...
 
void visit_var_name (const ast::VarName &node) override
 
void visit_while_statement (const ast::WhileStatement &node) override
 visit node of type ast::WhileStatement More...
 
void visit_update_dt (const ast::UpdateDt &node) override
 visit node of type ast::UpdateDt More...
 
void visit_mutex_lock (const ast::MutexLock &node) override
 visit node of type ast::MutexLock More...
 
void visit_mutex_unlock (const ast::MutexUnlock &node) override
 visit node of type ast::MutexUnlock More...
 
void visit_solution_expression (const ast::SolutionExpression &node) override
 visit node of type ast::SolutionExpression More...
 
void visit_eigen_newton_solver_block (const ast::EigenNewtonSolverBlock &node) override
 visit node of type ast::EigenNewtonSolverBlock More...
 
void visit_eigen_linear_solver_block (const ast::EigenLinearSolverBlock &node) override
 visit node of type ast::EigenLinearSolverBlock More...
 
std::string compute_method_name (BlockType type) const
 
virtual void setup (const ast::Program &node)
 
void print_table_replacement_function (const ast::Block &)
 Print replacement function for function or procedure using table. More...
 
void print_table_check_function (const ast::Block &)
 Print check_function() for functions or procedure using table. More...
 
const ast::TableStatementget_table_statement (const ast::Block &)
 
std::string get_object_specifiers (const std::unordered_set< CppObjectSpecifier > &)
 
template<typename T >
void print_function_declaration (const T &node, const std::string &name, const std::unordered_set< CppObjectSpecifier > &={CppObjectSpecifier::Static, CppObjectSpecifier::Inline})
 Print prototype declarations of functions or procedures. More...
 
void print_rename_state_vars () const
 

Protected Attributes

std::vector< ThreadVariableInfocodegen_thread_variables
 GLOBAL variables in THREADSAFE MOD files that are not read-only are converted to thread variables. More...
 
- Protected Attributes inherited from nmodl::codegen::CodegenCppVisitor
std::unique_ptr< CodePrinterprinter
 Code printer object for target (C++) More...
 
std::string mod_filename
 Name of mod file (without .mod suffix) More...
 
std::string float_type = codegen::naming::DEFAULT_FLOAT_TYPE
 Data type of floating point variables. More...
 
bool optimize_ionvar_copies = true
 Flag to indicate if visitor should avoid ion variable copies. More...
 
codegen::CodegenInfo info
 All ast information for code generation. More...
 
symtab::SymbolTableprogram_symtab = nullptr
 Symbol table for the program. More...
 
std::vector< SymbolTypecodegen_float_variables
 All float variables for the model. More...
 
std::vector< IndexVariableInfocodegen_int_variables
 All int variables for the model. More...
 
std::vector< SymbolTypecodegen_global_variables
 All global variables for the model. More...
 
bool enable_variable_name_lookup = true
 Variable name should be converted to instance name (but not for function arguments) More...
 
bool printing_net_receive = false
 true if currently net_receive block being printed More...
 
bool printing_net_init = false
 true if currently initial block of net_receive being printed More...
 
bool printing_top_verbatim_blocks = false
 true if currently printing top level verbatim blocks More...
 
bool internal_method_call_encountered = false
 true if internal method call was encountered while processing verbatim block More...
 
int current_watch_statement = 0
 Index of watch statement being printed. More...
 
std::unordered_map< CppObjectSpecifier, std::string > object_specifier_map
 

Additional Inherited Members

- Protected Types inherited from nmodl::codegen::CodegenCppVisitor
using SymbolType = std::shared_ptr< symtab::Symbol >
 
using ParamVector = std::vector< std::tuple< std::string, std::string, std::string, std::string > >
 A vector of parameters represented by a 4-tuple of strings: More...
 
- Static Protected Member Functions inherited from nmodl::codegen::CodegenCppVisitor
static bool need_semicolon (const ast::Statement &node)
 Check if a semicolon is required at the end of given statement. More...
 
static std::string get_parameter_str (const ParamVector &params)
 Generate the string representing the procedure parameter declaration. More...
 
static std::string get_arg_str (const ParamVector &params)
 Generate the string representing the parameters in a function call. More...
 
static bool statement_to_skip (const ast::Statement &node)
 Check if given statement should be skipped during code generation. More...
 
static std::pair< std::string, std::string > read_ion_variable_name (const std::string &name)
 Return ion variable name and corresponding ion read variable name. More...
 
static std::pair< std::string, std::string > write_ion_variable_name (const std::string &name)
 Return ion variable name and corresponding ion write variable name. More...
 

Member Function Documentation

◆ add_variable_point_process()

void nmodl::codegen::CodegenNeuronCppVisitor::add_variable_point_process ( std::vector< IndexVariableInfo > &  variables)
overrideprotectedvirtual

Add the variable point_process during get_int_variables.

Implements nmodl::codegen::CodegenCppVisitor.

Definition at line 562 of file codegen_neuron_cpp_visitor.cpp.

◆ add_variable_tqitem()

void nmodl::codegen::CodegenNeuronCppVisitor::add_variable_tqitem ( std::vector< IndexVariableInfo > &  variables)
overrideprotectedvirtual

Add the variable tqitem during get_int_variables.

Implements nmodl::codegen::CodegenCppVisitor.

Definition at line 554 of file codegen_neuron_cpp_visitor.cpp.

◆ append_conc_write_statements()

void nmodl::codegen::CodegenNeuronCppVisitor::append_conc_write_statements ( std::vector< ShadowUseStatement > &  statements,
const Ion ion,
const std::string &  concentration 
)
overrideprotectedvirtual

Generate Function call statement for nrn_wrote_conc.

Parameters
statementsStatements are appended to this vector.
ionThe ion variable.
concentrationThe name of the concentration variable
Returns
The string representing the function call

Implements nmodl::codegen::CodegenCppVisitor.

Definition at line 862 of file codegen_neuron_cpp_visitor.cpp.

◆ backend_name()

std::string nmodl::codegen::CodegenNeuronCppVisitor::backend_name ( ) const
overrideprotectedvirtual

Name of the code generation backend.

Implements nmodl::codegen::CodegenCppVisitor.

Definition at line 51 of file codegen_neuron_cpp_visitor.cpp.

◆ CodegenCppVisitor() [1/2]

nmodl::codegen::CodegenCppVisitor::CodegenCppVisitor
inline

Definition at line 269 of file codegen_cpp_visitor.hpp.

◆ CodegenCppVisitor() [2/2]

nmodl::codegen::CodegenCppVisitor::CodegenCppVisitor
inline

Constructs the C++ code generator visitor.

This constructor instantiates an NMODL C++ code generator and allows writing generated code into an output stream.

Note
No code generation is performed at this stage. Since the code generator classes are all based on AstVisitor the AST must be visited using e.g. visit_program in order to generate the C++ code corresponding to the AST.
Parameters
mod_filenameThe name of the model for which code should be generated. It is used for constructing an output filename.
streamThe output stream onto which to write the generated code
float_typeThe float type to use in the generated code. The string will be used as-is in the target code. This defaults to double.

Definition at line 259 of file codegen_cpp_visitor.hpp.

◆ cvode_setup_parameters()

CodegenCppVisitor::ParamVector nmodl::codegen::CodegenNeuronCppVisitor::cvode_setup_parameters ( )
protected

Get the parameters for functions that setup (initialize) CVODE.

Definition at line 2833 of file codegen_neuron_cpp_visitor.cpp.

◆ cvode_update_parameters()

CodegenCppVisitor::ParamVector nmodl::codegen::CodegenNeuronCppVisitor::cvode_update_parameters ( )
protected

Get the parameters for functions that update state at given timestep in CVODE.

Definition at line 2840 of file codegen_neuron_cpp_visitor.cpp.

◆ external_method_arguments()

const std::string nmodl::codegen::CodegenNeuronCppVisitor::external_method_arguments ( )
overrideprotectedvirtualnoexcept

Arguments for external functions called from generated code.

TODO: Edit for NEURON.

Returns
A string representing the arguments passed to an external function

Implements nmodl::codegen::CodegenCppVisitor.

Definition at line 597 of file codegen_neuron_cpp_visitor.cpp.

◆ external_method_parameters()

const CodegenCppVisitor::ParamVector nmodl::codegen::CodegenNeuronCppVisitor::external_method_parameters ( bool  table = false)
overrideprotectedvirtualnoexcept

Parameters for functions in generated code that are called back from external code.

TODO: Edit for NEURON.

Functions registered in NEURON during initialization for callback must adhere to a prescribed calling convention. This method generates the string representing the function parameters for these externally called functions.

Parameters
table
Returns
A string representing the parameters of the function

Implements nmodl::codegen::CodegenCppVisitor.

Definition at line 603 of file codegen_neuron_cpp_visitor.cpp.

◆ float_variable_name()

std::string nmodl::codegen::CodegenNeuronCppVisitor::float_variable_name ( const SymbolType symbol,
bool  use_instance 
) const
overrideprotectedvirtual

Determine the name of a float variable given its symbol.

This function typically returns the accessor expression in backend code for the given symbol. Since the model variables are stored in data arrays and accessed by offset, this function will return the C++ string representing the array access at the correct offset

Parameters
symbolThe symbol of a variable for which we want to obtain its name
use_instanceShould the variable be accessed via instance or data array
Returns
The backend code string representing the access to the given variable symbol

Implements nmodl::codegen::CodegenCppVisitor.

Definition at line 888 of file codegen_neuron_cpp_visitor.cpp.

◆ function_table_parameters()

std::pair< CodegenNeuronCppVisitor::ParamVector, CodegenNeuronCppVisitor::ParamVector > nmodl::codegen::CodegenNeuronCppVisitor::function_table_parameters ( const ast::FunctionTableBlock node)
overrideprotectedvirtual

Parameters of the function itself "{}" and "table_{}".

Implements nmodl::codegen::CodegenCppVisitor.

Definition at line 636 of file codegen_neuron_cpp_visitor.cpp.

◆ functor_params()

CodegenCppVisitor::ParamVector nmodl::codegen::CodegenNeuronCppVisitor::functor_params ( )
overridevirtual

The parameters of the Newton solver "functor".

Implements nmodl::codegen::CodegenCppVisitor.

Definition at line 1154 of file codegen_neuron_cpp_visitor.cpp.

◆ get_pointer_name()

std::string nmodl::codegen::CodegenNeuronCppVisitor::get_pointer_name ( const std::string &  name) const
protected

Determine the C++ string to replace pointer names with.

Given a variable name such as _p_ptr or _p_rng, return the C++ code required to get a pointer to ptr (or rng).

Parameters
nameVariable name that is being printed
Returns
The C++ string representing the variable. thread structure

Definition at line 975 of file codegen_neuron_cpp_visitor.cpp.

◆ get_variable_name()

std::string nmodl::codegen::CodegenNeuronCppVisitor::get_variable_name ( const std::string &  name,
bool  use_instance = true 
) const
overrideprotectedvirtual

Determine the C++ string to replace variable names with.

Given a variable name such as ion_cai or v, return the C++ code required to get the value.

Parameters
nameVariable name that is being printed
use_instanceShould the variable be accessed via instance or data array
Returns
The C++ string representing the variable. thread structure

Implements nmodl::codegen::CodegenCppVisitor.

Definition at line 989 of file codegen_neuron_cpp_visitor.cpp.

◆ global_variable_name()

std::string nmodl::codegen::CodegenNeuronCppVisitor::global_variable_name ( const SymbolType symbol,
bool  use_instance = true 
) const
overrideprotectedvirtual

Determine the variable name for a global variable given its symbol.

Parameters
symbolThe symbol of a variable for which we want to obtain its name
use_instanceShould the variable be accessed via the (host-only) global variable or the instance-specific copy (also available on GPU).
Returns
The C++ string representing the access to the global variable

Implements nmodl::codegen::CodegenCppVisitor.

Definition at line 965 of file codegen_neuron_cpp_visitor.cpp.

◆ hoc_function_name()

std::string nmodl::codegen::CodegenNeuronCppVisitor::hoc_function_name ( const std::string &  function_or_procedure_name) const
protected

All functions and procedures need a hoc <func_or_proc_name> to be available to the HOC interpreter.

Definition at line 825 of file codegen_neuron_cpp_visitor.cpp.

◆ hoc_function_signature()

std::string nmodl::codegen::CodegenNeuronCppVisitor::hoc_function_signature ( const std::string &  function_or_procedure_name) const
protected

Get the signature of the hoc <func_or_proc_name> function.

Definition at line 831 of file codegen_neuron_cpp_visitor.cpp.

◆ hoc_py_wrapper_signature()

std::string nmodl::codegen::CodegenNeuronCppVisitor::hoc_py_wrapper_signature ( const ast::Block function_or_procedure_block,
InterpreterWrapper  wrapper_type 
)
protected

Return the wrapper signature.

Everything without the { or ;. Roughly, as an example: <return_type> <function_name>(<internal_args>, <args>)

were `<internal_args> is the list of arguments required by the codegen to be passed along, while <args> are the arguments of of the function as they appear in the MOD file.

Definition at line 406 of file codegen_neuron_cpp_visitor.cpp.

◆ int_variable_name()

std::string nmodl::codegen::CodegenNeuronCppVisitor::int_variable_name ( const IndexVariableInfo symbol,
const std::string &  name,
bool  use_instance 
) const
overrideprotectedvirtual

Determine the name of an int variable given its symbol.

This function typically returns the accessor expression in backend code for the given symbol. Since the model variables are stored in data arrays and accessed by offset, this function will return the C++ string representing the array access at the correct offset

Parameters
symbolThe symbol of a variable for which we want to obtain its name
nameThe name of the index variable
use_instanceShould the variable be accessed via instance or data array
Returns
The backend code string representing the access to the given variable symbol

Implements nmodl::codegen::CodegenCppVisitor.

Definition at line 904 of file codegen_neuron_cpp_visitor.cpp.

◆ internal_method_arguments()

std::string nmodl::codegen::CodegenNeuronCppVisitor::internal_method_arguments ( )
overrideprotectedvirtual

Arguments for functions that are defined and used internally.

Returns
the method arguments

Implements nmodl::codegen::CodegenCppVisitor.

Definition at line 568 of file codegen_neuron_cpp_visitor.cpp.

◆ internal_method_parameters()

CodegenCppVisitor::ParamVector nmodl::codegen::CodegenNeuronCppVisitor::internal_method_parameters ( )
overrideprotectedvirtual

Parameters for internally defined functions.

Returns
the method parameters

Implements nmodl::codegen::CodegenCppVisitor.

Definition at line 574 of file codegen_neuron_cpp_visitor.cpp.

◆ internalthreadargs_parameters()

CodegenCppVisitor::ParamVector nmodl::codegen::CodegenNeuronCppVisitor::internalthreadargs_parameters ( )
protected

The parameters for the four macros _internalthreadargs*_.

Definition at line 609 of file codegen_neuron_cpp_visitor.cpp.

◆ ldifusfunc1_parameters()

CodegenNeuronCppVisitor::ParamVector nmodl::codegen::CodegenNeuronCppVisitor::ldifusfunc1_parameters ( ) const
protected

Parameters for what NEURON calls ldifusfunc1_t.

Definition at line 477 of file codegen_neuron_cpp_visitor.cpp.

◆ ldifusfunc3_parameters()

CodegenNeuronCppVisitor::ParamVector nmodl::codegen::CodegenNeuronCppVisitor::ldifusfunc3_parameters ( ) const
protected

Parameters for what NEURON calls ldifusfunc3_t.

Definition at line 484 of file codegen_neuron_cpp_visitor.cpp.

◆ namespace_name()

std::string nmodl::codegen::CodegenNeuronCppVisitor::namespace_name ( )
overrideprotectedvirtual

Name of "our" namespace.

Implements nmodl::codegen::CodegenCppVisitor.

Definition at line 857 of file codegen_neuron_cpp_visitor.cpp.

◆ needs_v_unused()

bool nmodl::codegen::CodegenNeuronCppVisitor::needs_v_unused ( ) const
overrideprotectedvirtual

Implements nmodl::codegen::CodegenCppVisitor.

Definition at line 60 of file codegen_neuron_cpp_visitor.cpp.

◆ net_receive_args()

CodegenNeuronCppVisitor::ParamVector nmodl::codegen::CodegenNeuronCppVisitor::net_receive_args ( )
protected

Definition at line 2808 of file codegen_neuron_cpp_visitor.cpp.

◆ nrn_current_arguments()

std::string nmodl::codegen::CodegenNeuronCppVisitor::nrn_current_arguments ( )
protected

Definition at line 2333 of file codegen_neuron_cpp_visitor.cpp.

◆ nrn_current_parameters()

CodegenNeuronCppVisitor::ParamVector nmodl::codegen::CodegenNeuronCppVisitor::nrn_current_parameters ( )
protected

Definition at line 2338 of file codegen_neuron_cpp_visitor.cpp.

◆ nrn_thread_arguments()

std::string nmodl::codegen::CodegenNeuronCppVisitor::nrn_thread_arguments ( ) const
overrideprotectedvirtual

Arguments for "_threadargs_" macro in neuron implementation.

TODO: Edit for NEURON.

Implements nmodl::codegen::CodegenCppVisitor.

Definition at line 625 of file codegen_neuron_cpp_visitor.cpp.

◆ nrn_thread_internal_arguments()

std::string nmodl::codegen::CodegenNeuronCppVisitor::nrn_thread_internal_arguments ( )
overrideprotectedvirtual

Arguments for "_threadargs_" macro in neuron implementation.

TODO: Edit for NEURON.

Implements nmodl::codegen::CodegenCppVisitor.

Definition at line 631 of file codegen_neuron_cpp_visitor.cpp.

◆ optimize_ion_variable_copies()

bool nmodl::codegen::CodegenNeuronCppVisitor::optimize_ion_variable_copies ( ) const
overrideprotectedvirtual

Check if ion variable copies should be avoided.

Implements nmodl::codegen::CodegenCppVisitor.

Definition at line 83 of file codegen_neuron_cpp_visitor.cpp.

◆ position_of_float_var()

int nmodl::codegen::CodegenNeuronCppVisitor::position_of_float_var ( const std::string &  name) const
overrideprotectedvirtual

Determine the position in the data array for a given float variable.

Parameters
nameThe name of a float variable
Returns
The position index in the data array

Implements nmodl::codegen::CodegenCppVisitor.

Definition at line 69 of file codegen_neuron_cpp_visitor.cpp.

◆ position_of_int_var()

int nmodl::codegen::CodegenNeuronCppVisitor::position_of_int_var ( const std::string &  name) const
overrideprotectedvirtual

Determine the position in the data array for a given int variable.

Parameters
nameThe name of an int variable
Returns
The position index in the data array

Implements nmodl::codegen::CodegenCppVisitor.

Definition at line 74 of file codegen_neuron_cpp_visitor.cpp.

◆ print_check_table_entrypoint()

void nmodl::codegen::CodegenNeuronCppVisitor::print_check_table_entrypoint ( )
protected

Print all check_* function declarations.

Definition at line 139 of file codegen_neuron_cpp_visitor.cpp.

◆ print_codegen_routines()

void nmodl::codegen::CodegenNeuronCppVisitor::print_codegen_routines ( )
overrideprotectedvirtual

Print entry point to code generation.

Implements nmodl::codegen::CodegenCppVisitor.

Definition at line 2710 of file codegen_neuron_cpp_visitor.cpp.

◆ print_codegen_routines_nothing()

void nmodl::codegen::CodegenNeuronCppVisitor::print_codegen_routines_nothing ( )
protected

SUFFIX nothing is special.

Definition at line 2698 of file codegen_neuron_cpp_visitor.cpp.

◆ print_codegen_routines_regular()

void nmodl::codegen::CodegenNeuronCppVisitor::print_codegen_routines_regular ( )
protected

Anything not SUFFIX nothing.

Definition at line 2666 of file codegen_neuron_cpp_visitor.cpp.

◆ print_compute_functions()

void nmodl::codegen::CodegenNeuronCppVisitor::print_compute_functions ( )
overrideprotectedvirtual

Print all compute functions for every backend.

Implements nmodl::codegen::CodegenCppVisitor.

Definition at line 2657 of file codegen_neuron_cpp_visitor.cpp.

◆ print_cvode_count()

void nmodl::codegen::CodegenNeuronCppVisitor::print_cvode_count ( )
protected

Print the CVODE function returning the number of ODEs to solve.

Definition at line 2857 of file codegen_neuron_cpp_visitor.cpp.

◆ print_cvode_definitions()

void nmodl::codegen::CodegenNeuronCppVisitor::print_cvode_definitions ( )
protected

Print all callbacks for CVODE.

Definition at line 2937 of file codegen_neuron_cpp_visitor.cpp.

◆ print_cvode_setup()

void nmodl::codegen::CodegenNeuronCppVisitor::print_cvode_setup ( const std::string &  setup_name,
const std::string &  update_name 
)
protected

Print the CVODE setup function setup_name that calls the CVODE update function update_name.

Definition at line 2917 of file codegen_neuron_cpp_visitor.cpp.

◆ print_cvode_tolerances()

void nmodl::codegen::CodegenNeuronCppVisitor::print_cvode_tolerances ( )
protected

Print the CVODE function for setup of tolerances.

Definition at line 2865 of file codegen_neuron_cpp_visitor.cpp.

◆ print_cvode_update()

void nmodl::codegen::CodegenNeuronCppVisitor::print_cvode_update ( const std::string &  name,
const ast::StatementBlock block 
)
protected

Print the CVODE update function name contained in block.

Definition at line 2901 of file codegen_neuron_cpp_visitor.cpp.

◆ print_data_structures()

void nmodl::codegen::CodegenNeuronCppVisitor::print_data_structures ( bool  print_initializers)
overrideprotectedvirtual

Print all classes.

Parameters
print_initializersWhether to include default values.

Implements nmodl::codegen::CodegenCppVisitor.

Definition at line 2614 of file codegen_neuron_cpp_visitor.cpp.

◆ print_entrypoint_setup_code_from_memb_list()

void nmodl::codegen::CodegenNeuronCppVisitor::print_entrypoint_setup_code_from_memb_list ( )
protected

Prints setup code for entrypoints from NEURON.

The entrypoints typically receive a sorted_token and a bunch of other things, which then need to be converted into the default arguments for functions called (recursively) from the entrypoint.

This variation prints the fast entrypoint, where NEURON is fully initialized and setup.

Definition at line 1977 of file codegen_neuron_cpp_visitor.cpp.

◆ print_entrypoint_setup_code_from_prop()

void nmodl::codegen::CodegenNeuronCppVisitor::print_entrypoint_setup_code_from_prop ( )
protected

Prints setup code for entrypoints NEURON.

See print_entrypoint_setup_code_from_memb_list. This variation should be used when one only has access to a Prop, but not the full Memb_list.

Definition at line 1997 of file codegen_neuron_cpp_visitor.cpp.

◆ print_fast_imem_calculation()

void nmodl::codegen::CodegenNeuronCppVisitor::print_fast_imem_calculation ( )
overrideprotectedvirtual

Print fast membrane current calculation code.

TODO: Edit for NEURON.

Implements nmodl::codegen::CodegenCppVisitor.

Definition at line 2484 of file codegen_neuron_cpp_visitor.cpp.

◆ print_function_definitions()

void nmodl::codegen::CodegenNeuronCppVisitor::print_function_definitions ( )
protected

Print function and procedures prototype definitions.

This includes the HOC/Python wrappers.

Definition at line 2644 of file codegen_neuron_cpp_visitor.cpp.

◆ print_function_or_procedure()

void nmodl::codegen::CodegenNeuronCppVisitor::print_function_or_procedure ( const ast::Block node,
const std::string &  name,
const std::unordered_set< CppObjectSpecifier > &  specifiers = CppObjectSpecifier::Inline} 
)
overrideprotectedvirtual

Print nmodl function or procedure (common code)

Parameters
nodethe AST node representing the function or procedure in NMODL
namethe name of the function or procedure
specifiersthe set of C++ specifiers to apply to the function signature

Implements nmodl::codegen::CodegenCppVisitor.

Definition at line 244 of file codegen_neuron_cpp_visitor.cpp.

◆ print_function_procedure_helper()

void nmodl::codegen::CodegenNeuronCppVisitor::print_function_procedure_helper ( const ast::Block node)
overrideprotectedvirtual

Common helper function to help printing function or procedure blocks.

Parameters
nodethe AST node representing the function or procedure in NMODL

Implements nmodl::codegen::CodegenCppVisitor.

Definition at line 273 of file codegen_neuron_cpp_visitor.cpp.

◆ print_function_prototypes()

void nmodl::codegen::CodegenNeuronCppVisitor::print_function_prototypes ( )
overrideprotectedvirtual

Print function and procedures prototype declaration.

Implements nmodl::codegen::CodegenCppVisitor.

Definition at line 217 of file codegen_neuron_cpp_visitor.cpp.

◆ print_function_table_call()

void nmodl::codegen::CodegenNeuronCppVisitor::print_function_table_call ( const ast::FunctionCall node)
overrideprotectedvirtual

Print special code when calling FUNCTION_TABLEs.

Implements nmodl::codegen::CodegenCppVisitor.

Definition at line 2767 of file codegen_neuron_cpp_visitor.cpp.

◆ print_g_unused()

void nmodl::codegen::CodegenNeuronCppVisitor::print_g_unused ( ) const
overrideprotectedvirtual

Set g_unused (conductance) for NRN_PRCELLSTATE feature.

Implements nmodl::codegen::CodegenCppVisitor.

Definition at line 2636 of file codegen_neuron_cpp_visitor.cpp.

◆ print_global_function_common_code()

void nmodl::codegen::CodegenNeuronCppVisitor::print_global_function_common_code ( BlockType  type,
const std::string &  function_name = "" 
)
overrideprotectedvirtual

Print common code for global functions like nrn_init, nrn_cur and nrn_state.

Parameters
typeThe target backend code block type

Implements nmodl::codegen::CodegenCppVisitor.

Definition at line 2021 of file codegen_neuron_cpp_visitor.cpp.

◆ print_global_macros()

void nmodl::codegen::CodegenNeuronCppVisitor::print_global_macros ( )
protected

Print NEURON global variable macros.

Definition at line 2554 of file codegen_neuron_cpp_visitor.cpp.

◆ print_global_param_default_values()

void nmodl::codegen::CodegenNeuronCppVisitor::print_global_param_default_values ( )
protected

Print global struct with default value of RANGE PARAMETERs.

Definition at line 1353 of file codegen_neuron_cpp_visitor.cpp.

◆ print_global_var_external_access()

void nmodl::codegen::CodegenNeuronCppVisitor::print_global_var_external_access ( )
protected

Print functions for EXTERNAL use.

Definition at line 1329 of file codegen_neuron_cpp_visitor.cpp.

◆ print_global_variables_for_hoc()

void nmodl::codegen::CodegenNeuronCppVisitor::print_global_variables_for_hoc ( )
overrideprotectedvirtual

Print byte arrays that register scalar and vector variables for hoc interface.

Implements nmodl::codegen::CodegenCppVisitor.

Definition at line 1366 of file codegen_neuron_cpp_visitor.cpp.

◆ print_headers_include()

void nmodl::codegen::CodegenNeuronCppVisitor::print_headers_include ( )
overrideprotectedvirtual

Print all includes.

Implements nmodl::codegen::CodegenCppVisitor.

Definition at line 2536 of file codegen_neuron_cpp_visitor.cpp.

◆ print_hoc_py_wrapper()

void nmodl::codegen::CodegenNeuronCppVisitor::print_hoc_py_wrapper ( const ast::Block function_or_procedure_block,
InterpreterWrapper  wrapper_type 
)
protected

Print the wrapper for calling FUNCION/PROCEDURES from HOC/Py.

Usually the function is made up of the following parts:

  • Print setup code inst, etc.
  • Print code to call the function and return.

Definition at line 417 of file codegen_neuron_cpp_visitor.cpp.

◆ print_hoc_py_wrapper_call_impl()

void nmodl::codegen::CodegenNeuronCppVisitor::print_hoc_py_wrapper_call_impl ( const ast::Block function_or_procedure_block,
InterpreterWrapper  wrapper_type 
)
protected

Print the code that calls the impl from the HOC/Py wrapper.

Definition at line 287 of file codegen_neuron_cpp_visitor.cpp.

◆ print_hoc_py_wrapper_function_definitions()

void nmodl::codegen::CodegenNeuronCppVisitor::print_hoc_py_wrapper_function_definitions ( )
protected

Definition at line 432 of file codegen_neuron_cpp_visitor.cpp.

◆ print_hoc_py_wrapper_setup()

void nmodl::codegen::CodegenNeuronCppVisitor::print_hoc_py_wrapper_setup ( const ast::Block function_or_procedure_block,
InterpreterWrapper  wrapper_type 
)
protected

Print the setup code for HOC/Py wrapper.

Definition at line 324 of file codegen_neuron_cpp_visitor.cpp.

◆ print_initial_block()

void nmodl::codegen::CodegenNeuronCppVisitor::print_initial_block ( const ast::InitialBlock node)
protected

Print the initial block.

Definition at line 1956 of file codegen_neuron_cpp_visitor.cpp.

◆ print_ion_variable()

void nmodl::codegen::CodegenNeuronCppVisitor::print_ion_variable ( )
overrideprotectedvirtual

◆ print_longitudinal_diffusion_callbacks()

void nmodl::codegen::CodegenNeuronCppVisitor::print_longitudinal_diffusion_callbacks ( )
protected

Prints the callbacks required for LONGITUDINAL_DIFFUSION.

Definition at line 496 of file codegen_neuron_cpp_visitor.cpp.

◆ print_macro_definitions()

void nmodl::codegen::CodegenNeuronCppVisitor::print_macro_definitions ( )
protected

Print all NEURON macros.

Definition at line 2546 of file codegen_neuron_cpp_visitor.cpp.

◆ print_make_instance()

void nmodl::codegen::CodegenNeuronCppVisitor::print_make_instance ( ) const
protected

Print make_*_instance.

Definition at line 1807 of file codegen_neuron_cpp_visitor.cpp.

◆ print_make_node_data()

void nmodl::codegen::CodegenNeuronCppVisitor::print_make_node_data ( ) const
protected

Print make_*_node_data.

Definition at line 1880 of file codegen_neuron_cpp_visitor.cpp.

◆ print_mechanism_global_var_structure()

void nmodl::codegen::CodegenNeuronCppVisitor::print_mechanism_global_var_structure ( bool  print_initializers)
overrideprotectedvirtual

Print the structure that wraps all global variables used in the NMODL.

Parameters
print_initializersWhether to include default values in the struct definition (true: int foo{42}; false: int foo;)

TODO: Print only global variables printed in NEURON

Implements nmodl::codegen::CodegenCppVisitor.

Definition at line 1160 of file codegen_neuron_cpp_visitor.cpp.

◆ print_mechanism_range_var_structure()

void nmodl::codegen::CodegenNeuronCppVisitor::print_mechanism_range_var_structure ( bool  print_initializers)
overridevirtual

Print the structure that wraps all range and int variables required for the NMODL.

Parameters
print_initializersWhether or not default values for variables be included in the struct declaration.

Implements nmodl::codegen::CodegenCppVisitor.

Definition at line 1765 of file codegen_neuron_cpp_visitor.cpp.

◆ print_mechanism_register()

void nmodl::codegen::CodegenNeuronCppVisitor::print_mechanism_register ( )
overrideprotectedvirtual

Print the mechanism registration function.

Implements nmodl::codegen::CodegenCppVisitor.

Definition at line 1497 of file codegen_neuron_cpp_visitor.cpp.

◆ print_mechanism_register_nothing()

void nmodl::codegen::CodegenNeuronCppVisitor::print_mechanism_register_nothing ( )
protected

Function body for SUFFIX nothing.

Definition at line 1719 of file codegen_neuron_cpp_visitor.cpp.

◆ print_mechanism_register_regular()

void nmodl::codegen::CodegenNeuronCppVisitor::print_mechanism_register_regular ( )
protected

Function body for anything not SUFFIX nothing.

type related information

Definition at line 1508 of file codegen_neuron_cpp_visitor.cpp.

◆ print_mechanism_variables_macros()

void nmodl::codegen::CodegenNeuronCppVisitor::print_mechanism_variables_macros ( )
protected

Print mechanism variables' related macros.

Definition at line 2571 of file codegen_neuron_cpp_visitor.cpp.

◆ print_net_event_call()

void nmodl::codegen::CodegenNeuronCppVisitor::print_net_event_call ( const ast::FunctionCall node)
overrideprotectedvirtual

Print call to net_event.

Parameters
nodeThe AST node representing the function call

Implements nmodl::codegen::CodegenCppVisitor.

Definition at line 2761 of file codegen_neuron_cpp_visitor.cpp.

◆ print_net_init()

void nmodl::codegen::CodegenNeuronCppVisitor::print_net_init ( )
protected

Print NET_RECEIVE{ INITIAL{ ...

}} block.

Definition at line 2975 of file codegen_neuron_cpp_visitor.cpp.

◆ print_net_move_call()

void nmodl::codegen::CodegenNeuronCppVisitor::print_net_move_call ( const ast::FunctionCall node)
overrideprotectedvirtual

Print call to net_move.

Parameters
nodeThe AST node representing the function call

Implements nmodl::codegen::CodegenCppVisitor.

Definition at line 2748 of file codegen_neuron_cpp_visitor.cpp.

◆ print_net_receive()

void nmodl::codegen::CodegenNeuronCppVisitor::print_net_receive ( )
protected

Print net_receive call-back.

Definition at line 2953 of file codegen_neuron_cpp_visitor.cpp.

◆ print_net_receive_common_code()

void nmodl::codegen::CodegenNeuronCppVisitor::print_net_receive_common_code ( )
protected

Definition at line 2815 of file codegen_neuron_cpp_visitor.cpp.

◆ print_net_receive_registration()

void nmodl::codegen::CodegenNeuronCppVisitor::print_net_receive_registration ( )
protected

Print code to register the call-back for the NET_RECEIVE block.

◆ print_net_send_call()

void nmodl::codegen::CodegenNeuronCppVisitor::print_net_send_call ( const ast::FunctionCall node)
overrideprotectedvirtual

Print call to net_send.

Parameters
nodeThe AST node representing the function call

Implements nmodl::codegen::CodegenCppVisitor.

Definition at line 2723 of file codegen_neuron_cpp_visitor.cpp.

◆ print_neuron_global_variable_declarations()

void nmodl::codegen::CodegenNeuronCppVisitor::print_neuron_global_variable_declarations ( )
protected

Print extern declarations for neuron global variables.

Examples include celsius.

Definition at line 1758 of file codegen_neuron_cpp_visitor.cpp.

◆ print_neuron_includes()

void nmodl::codegen::CodegenNeuronCppVisitor::print_neuron_includes ( )
protected

Print includes from NEURON.

Definition at line 1101 of file codegen_neuron_cpp_visitor.cpp.

◆ print_node_data_structure()

void nmodl::codegen::CodegenNeuronCppVisitor::print_node_data_structure ( bool  print_initializers)

Print the structure that wraps all node variables required for the NMODL.

Parameters
print_initializersWhether or not default values for variables be included in the struct declaration.

Definition at line 1866 of file codegen_neuron_cpp_visitor.cpp.

◆ print_nrn_alloc()

void nmodl::codegen::CodegenNeuronCppVisitor::print_nrn_alloc ( )
overrideprotectedvirtual

Print nrn_alloc function definition.

Implements nmodl::codegen::CodegenCppVisitor.

Definition at line 2143 of file codegen_neuron_cpp_visitor.cpp.

◆ print_nrn_constructor()

void nmodl::codegen::CodegenNeuronCppVisitor::print_nrn_constructor ( )
overrideprotectedvirtual

Print nrn_constructor function definition.

Implements nmodl::codegen::CodegenCppVisitor.

Definition at line 2104 of file codegen_neuron_cpp_visitor.cpp.

◆ print_nrn_constructor_declaration()

void nmodl::codegen::CodegenNeuronCppVisitor::print_nrn_constructor_declaration ( )
protected

Definition at line 2097 of file codegen_neuron_cpp_visitor.cpp.

◆ print_nrn_cur()

void nmodl::codegen::CodegenNeuronCppVisitor::print_nrn_cur ( )
overrideprotectedvirtual

Print nrn_cur / current update function definition.

TODO: Edit for NEURON.

Implements nmodl::codegen::CodegenCppVisitor.

Definition at line 2490 of file codegen_neuron_cpp_visitor.cpp.

◆ print_nrn_cur_conductance_kernel()

void nmodl::codegen::CodegenNeuronCppVisitor::print_nrn_cur_conductance_kernel ( const ast::BreakpointBlock node)
overrideprotectedvirtual

Print the nrn_cur kernel with NMODL conductance keyword provisions.

If the NMODL conductance keyword is used in the breakpoint block, then CodegenCoreneuronCppVisitor::print_nrn_cur_kernel will use this printer

Parameters
nodethe AST node representing the NMODL breakpoint block

Implements nmodl::codegen::CodegenCppVisitor.

Definition at line 2379 of file codegen_neuron_cpp_visitor.cpp.

◆ print_nrn_cur_kernel()

void nmodl::codegen::CodegenNeuronCppVisitor::print_nrn_cur_kernel ( const ast::BreakpointBlock node)
overrideprotectedvirtual

Print main body of nrn_cur function.

Parameters
nodethe AST node representing the NMODL breakpoint block

Implements nmodl::codegen::CodegenCppVisitor.

Definition at line 2451 of file codegen_neuron_cpp_visitor.cpp.

◆ print_nrn_cur_non_conductance_kernel()

void nmodl::codegen::CodegenNeuronCppVisitor::print_nrn_cur_non_conductance_kernel ( )
overrideprotectedvirtual

Print the nrn_cur kernel without NMODL conductance keyword provisions.

If the NMODL conductance keyword is not used in the breakpoint block, then CodegenCoreneuronCppVisitor::print_nrn_cur_kernel will use this printer

Implements nmodl::codegen::CodegenCppVisitor.

Definition at line 2417 of file codegen_neuron_cpp_visitor.cpp.

◆ print_nrn_current()

void nmodl::codegen::CodegenNeuronCppVisitor::print_nrn_current ( const ast::BreakpointBlock node)
overrideprotectedvirtual

Print the nrn_current kernel.

Note
nrn_cur_kernel will have two calls to nrn_current if no conductance keywords specified
Parameters
nodethe AST node representing the NMODL breakpoint block

Implements nmodl::codegen::CodegenCppVisitor.

Definition at line 2360 of file codegen_neuron_cpp_visitor.cpp.

◆ print_nrn_destructor()

void nmodl::codegen::CodegenNeuronCppVisitor::print_nrn_destructor ( )
overrideprotectedvirtual

Print nrn_destructor function definition.

Implements nmodl::codegen::CodegenCppVisitor.

Definition at line 2123 of file codegen_neuron_cpp_visitor.cpp.

◆ print_nrn_destructor_declaration()

void nmodl::codegen::CodegenNeuronCppVisitor::print_nrn_destructor_declaration ( )
protected

Definition at line 2119 of file codegen_neuron_cpp_visitor.cpp.

◆ print_nrn_init()

void nmodl::codegen::CodegenNeuronCppVisitor::print_nrn_init ( bool  skip_init_check = true)
protected

Print the nrn_init function definition.

Parameters
skip_init_checktrue to generate code executing the initialization conditionally

Definition at line 2034 of file codegen_neuron_cpp_visitor.cpp.

◆ print_nrn_jacob()

void nmodl::codegen::CodegenNeuronCppVisitor::print_nrn_jacob ( )
protected

Print nrn_jacob function definition.

Definition at line 2067 of file codegen_neuron_cpp_visitor.cpp.

◆ print_nrn_state()

void nmodl::codegen::CodegenNeuronCppVisitor::print_nrn_state ( )
overrideprotectedvirtual

Print nrn_state / state update function definition.

Todo:
Eigen solver node also emits IonCurVar variable in the functor but that shouldn't update ions in derivative block

Implements nmodl::codegen::CodegenCppVisitor.

Definition at line 2281 of file codegen_neuron_cpp_visitor.cpp.

◆ print_point_process_function_definitions()

void nmodl::codegen::CodegenNeuronCppVisitor::print_point_process_function_definitions ( )
protected

Print POINT_PROCESS related functions Wrap external NEURON functions related to POINT_PROCESS mechanisms.

Definition at line 96 of file codegen_neuron_cpp_visitor.cpp.

◆ print_sdlists_init()

void nmodl::codegen::CodegenNeuronCppVisitor::print_sdlists_init ( bool  print_initializers)
overrideprotectedvirtual

_initlists() should only be called once by the mechanism registration function (_<mod_file>_reg())

TODO: Something similar needs to happen for slist/dlist2 but I don't know their usage at

TODO: We have to do checks and add errors similar to nocmodl in the

TODO: Needs a for loop here. Look at

TODO: Also needs a test

Implements nmodl::codegen::CodegenCppVisitor.

Definition at line 1113 of file codegen_neuron_cpp_visitor.cpp.

◆ print_setdata_functions()

void nmodl::codegen::CodegenNeuronCppVisitor::print_setdata_functions ( )
protected

Print NEURON functions related to setting global variables of the mechanism.

Definition at line 186 of file codegen_neuron_cpp_visitor.cpp.

◆ print_standard_includes()

void nmodl::codegen::CodegenNeuronCppVisitor::print_standard_includes ( )
overrideprotectedvirtual

Print standard C/C++ includes.

Implements nmodl::codegen::CodegenCppVisitor.

Definition at line 1085 of file codegen_neuron_cpp_visitor.cpp.

◆ print_thread_memory_callbacks()

void nmodl::codegen::CodegenNeuronCppVisitor::print_thread_memory_callbacks ( )
protected

Print thread variable (de-)initialization functions.

Definition at line 1724 of file codegen_neuron_cpp_visitor.cpp.

◆ print_thread_variables_structure()

void nmodl::codegen::CodegenNeuronCppVisitor::print_thread_variables_structure ( bool  print_initializers)

Print the data structure used to access thread variables.

Definition at line 1924 of file codegen_neuron_cpp_visitor.cpp.

◆ print_v_unused()

void nmodl::codegen::CodegenNeuronCppVisitor::print_v_unused ( ) const
overrideprotectedvirtual

Set v_unused (voltage) for NRN_PRCELLSTATE feature.

Implements nmodl::codegen::CodegenCppVisitor.

Definition at line 2624 of file codegen_neuron_cpp_visitor.cpp.

◆ print_verbatim_cleanup()

void nmodl::codegen::CodegenNeuronCppVisitor::print_verbatim_cleanup ( const std::vector< std::string > &  macros_defined)
protected

Print #undefs to erase all compatibility macros.

Definition at line 766 of file codegen_neuron_cpp_visitor.cpp.

◆ print_verbatim_setup()

std::vector< std::string > nmodl::codegen::CodegenNeuronCppVisitor::print_verbatim_setup ( const ast::Verbatim node,
const std::string &  verbatim 
)
protected

Print compatibility macros required for VERBATIM blocks.

Returns the names of all macros introduced.

Definition at line 686 of file codegen_neuron_cpp_visitor.cpp.

◆ process_verbatim_text()

std::string nmodl::codegen::CodegenNeuronCppVisitor::process_verbatim_text ( const std::string &  verbatim)
protected

Definition at line 775 of file codegen_neuron_cpp_visitor.cpp.

◆ py_function_name()

std::string nmodl::codegen::CodegenNeuronCppVisitor::py_function_name ( const std::string &  function_or_procedure_name) const
protected

In non POINT_PROCESS mechanisms all functions and procedures need a py <func_or_proc_name> to be available to the HOC interpreter.

Definition at line 840 of file codegen_neuron_cpp_visitor.cpp.

◆ py_function_signature()

std::string nmodl::codegen::CodegenNeuronCppVisitor::py_function_signature ( const std::string &  function_or_procedure_name) const
protected

Get the signature of the npy <func_or_proc_name> function.

Definition at line 846 of file codegen_neuron_cpp_visitor.cpp.

◆ register_mechanism_arguments()

std::string nmodl::codegen::CodegenNeuronCppVisitor::register_mechanism_arguments ( ) const
overrideprotectedvirtual

Arguments for register_mech or point_register_mech function.

TODO: Write for NEURON.

Implements nmodl::codegen::CodegenCppVisitor.

Definition at line 820 of file codegen_neuron_cpp_visitor.cpp.

◆ simulator_name()

std::string nmodl::codegen::CodegenNeuronCppVisitor::simulator_name ( )
overrideprotectedvirtual

Name of the simulator the code was generated for.

Implements nmodl::codegen::CodegenCppVisitor.

Definition at line 46 of file codegen_neuron_cpp_visitor.cpp.

◆ table_thread_function_name()

std::string nmodl::codegen::CodegenNeuronCppVisitor::table_thread_function_name ( ) const
protected

Name of the threaded table checking function.

Definition at line 56 of file codegen_neuron_cpp_visitor.cpp.

◆ thread_variable_name()

std::string nmodl::codegen::CodegenNeuronCppVisitor::thread_variable_name ( const ThreadVariableInfo var_info,
bool  use_instance = true 
) const
protected

Determine the C++ string to print for thread variables.

Parameters
var_infoIdentifies the thread variable, typically an instance of codegen_thread_variables.
use_instanceShould the variable be accessed via instance or data array

Definition at line 944 of file codegen_neuron_cpp_visitor.cpp.

◆ threadargs_parameters()

CodegenCppVisitor::ParamVector nmodl::codegen::CodegenNeuronCppVisitor::threadargs_parameters ( )
protected

The parameters for the four macros _threadargs*_.

Definition at line 614 of file codegen_neuron_cpp_visitor.cpp.

◆ visit_for_netcon()

void nmodl::codegen::CodegenNeuronCppVisitor::visit_for_netcon ( const ast::ForNetcon node)
overrideprotectedvirtual

visit node of type ast::ForNetcon

Implements nmodl::visitor::ConstVisitor.

Definition at line 3016 of file codegen_neuron_cpp_visitor.cpp.

◆ visit_lon_diffuse()

void nmodl::codegen::CodegenNeuronCppVisitor::visit_lon_diffuse ( const ast::LonDiffuse node)
overrideprotectedvirtual

visit node of type ast::LonDiffuse

Implements nmodl::visitor::ConstVisitor.

Definition at line 3012 of file codegen_neuron_cpp_visitor.cpp.

◆ visit_longitudinal_diffusion_block()

void nmodl::codegen::CodegenNeuronCppVisitor::visit_longitudinal_diffusion_block ( const ast::LongitudinalDiffusionBlock node)
overrideprotectedvirtual

visit node of type ast::LongitudinalDiffusionBlock

Implements nmodl::visitor::ConstVisitor.

Definition at line 3007 of file codegen_neuron_cpp_visitor.cpp.

◆ visit_protect_statement()

void nmodl::codegen::CodegenNeuronCppVisitor::visit_protect_statement ( const ast::ProtectStatement node)
overrideprotectedvirtual

visit node of type ast::ProtectStatement

Implements nmodl::visitor::ConstVisitor.

Definition at line 3067 of file codegen_neuron_cpp_visitor.cpp.

◆ visit_verbatim()

void nmodl::codegen::CodegenNeuronCppVisitor::visit_verbatim ( const ast::Verbatim node)
overrideprotectedvirtual

visit node of type ast::Verbatim

Implements nmodl::visitor::ConstVisitor.

Definition at line 804 of file codegen_neuron_cpp_visitor.cpp.

◆ visit_watch_statement()

void nmodl::codegen::CodegenNeuronCppVisitor::visit_watch_statement ( const ast::WatchStatement node)
overrideprotectedvirtual

TODO: Edit for NEURON.

Implements nmodl::visitor::ConstVisitor.

Definition at line 3003 of file codegen_neuron_cpp_visitor.cpp.

Member Data Documentation

◆ codegen_thread_variables

std::vector<ThreadVariableInfo> nmodl::codegen::CodegenNeuronCppVisitor::codegen_thread_variables
protected

GLOBAL variables in THREADSAFE MOD files that are not read-only are converted to thread variables.

This is the list of all such variables.

Definition at line 105 of file codegen_neuron_cpp_visitor.hpp.


The documentation for this class was generated from the following files: