![]() |
User Guide
|
Visitor for printing C++ code compatible with legacy api of CoreNEURON More...
Visitor for printing C++ code compatible with legacy api of CoreNEURON
Definition at line 241 of file codegen_cpp_visitor.hpp.
#include <codegen_cpp_visitor.hpp>
Protected Types | |
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... | |
Protected Member Functions | |
std::string | nmodl_version () const noexcept |
Return Nmodl language version. More... | |
virtual std::string | simulator_name ()=0 |
Name of the simulator the code was generated for. 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... | |
virtual std::string | backend_name () const =0 |
Name of the code generation backend. 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 |
virtual int | position_of_float_var (const std::string &name) const =0 |
Determine the position in the data array for a given float variable. More... | |
virtual int | position_of_int_var (const std::string &name) const =0 |
Determine the position in the data array for a given int variable. More... | |
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< SymbolType > | get_float_variables () const |
Determine all float variables required during code generation. More... | |
virtual bool | needs_v_unused () const =0 |
std::vector< IndexVariableInfo > | get_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< ShadowUseStatement > | ion_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... | |
virtual bool | optimize_ion_variable_copies () const =0 |
Check if ion variable copies should be avoided. 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_net_send_call (const ast::FunctionCall &node)=0 |
Print call to net_send . More... | |
virtual void | print_nrn_pointing (const ast::FunctionCall &node) |
Print nrn_pointing . More... | |
virtual void | print_net_move_call (const ast::FunctionCall &node)=0 |
Print call to net_move. More... | |
virtual void | print_net_event_call (const ast::FunctionCall &node)=0 |
Print call to net_event. More... | |
virtual void | print_function_table_call (const ast::FunctionCall &node)=0 |
Print special code when calling FUNCTION_TABLEs. More... | |
virtual void | print_function_prototypes ()=0 |
Print function and procedures prototype declaration. More... | |
virtual void | print_function_or_procedure (const ast::Block &node, const std::string &name, const std::unordered_set< CppObjectSpecifier > &specifiers)=0 |
Print nmodl function or procedure (common code) More... | |
virtual void | print_function_procedure_helper (const ast::Block &node)=0 |
Common helper function to help printing function or procedure blocks. 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... | |
virtual std::pair< ParamVector, ParamVector > | function_table_parameters (const ast::FunctionTableBlock &node)=0 |
Parameters of the function itself "{}" and "table_{}" . 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... | |
virtual ParamVector | functor_params ()=0 |
The parameters of the Newton solver "functor". 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... | |
virtual void | print_ion_variable ()=0 |
virtual void | add_variable_tqitem (std::vector< IndexVariableInfo > &variables)=0 |
Add the variable tqitem during get_int_variables . More... | |
virtual void | add_variable_point_process (std::vector< IndexVariableInfo > &variables)=0 |
Add the variable point_process during get_int_variables . More... | |
virtual std::string | internal_method_arguments ()=0 |
Arguments for functions that are defined and used internally. More... | |
virtual ParamVector | internal_method_parameters ()=0 |
Parameters for internally defined functions. More... | |
virtual const std::string | external_method_arguments () noexcept=0 |
Arguments for external functions called from generated code. More... | |
virtual const ParamVector | external_method_parameters (bool table=false) noexcept=0 |
Parameters for functions in generated code that are called back from external code. More... | |
virtual std::string | nrn_thread_arguments () const =0 |
Arguments for "_threadargs_" macro in neuron implementation. More... | |
virtual std::string | nrn_thread_internal_arguments ()=0 |
Arguments for "_threadargs_" macro in neuron implementation. More... | |
virtual std::string | register_mechanism_arguments () const =0 |
Arguments for register_mech or point_register_mech function. 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... | |
virtual void | append_conc_write_statements (std::vector< ShadowUseStatement > &statements, const Ion &ion, const std::string &concentration)=0 |
Generate Function call statement for nrn_wrote_conc. More... | |
virtual std::string | namespace_name ()=0 |
Name of "our" namespace. 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... | |
virtual std::string | float_variable_name (const SymbolType &symbol, bool use_instance) const =0 |
Determine the name of a float variable given its symbol. More... | |
virtual std::string | int_variable_name (const IndexVariableInfo &symbol, const std::string &name, bool use_instance) const =0 |
Determine the name of an int variable given its symbol. More... | |
virtual std::string | global_variable_name (const SymbolType &symbol, bool use_instance=true) const =0 |
Determine the variable name for a global variable given its symbol. More... | |
virtual std::string | get_variable_name (const std::string &name, bool use_instance=true) const =0 |
Determine variable name in the structure of mechanism properties. 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_standard_includes ()=0 |
Print standard C/C++ includes. More... | |
virtual void | print_sdlists_init (bool print_initializers)=0 |
virtual void | print_mechanism_global_var_structure (bool print_initializers)=0 |
Print the structure that wraps all global variables used in the NMODL. 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... | |
virtual void | print_global_variables_for_hoc ()=0 |
Print byte arrays that register scalar and vector variables for hoc interface. More... | |
virtual void | print_mechanism_register ()=0 |
Print the mechanism registration function. More... | |
virtual void | print_global_function_common_code (BlockType type, const std::string &function_name="")=0 |
Print common code for global functions like nrn_init, nrn_cur and nrn_state. More... | |
virtual void | print_nrn_constructor ()=0 |
Print nrn_constructor function definition. More... | |
virtual void | print_nrn_destructor ()=0 |
Print nrn_destructor function definition. More... | |
virtual void | print_nrn_alloc ()=0 |
Print nrn_alloc function definition. More... | |
virtual void | print_nrn_state ()=0 |
Print nrn_state / state update function definition. More... | |
virtual void | print_nrn_current (const ast::BreakpointBlock &node)=0 |
Print the nrn_current kernel. More... | |
virtual void | print_nrn_cur_conductance_kernel (const ast::BreakpointBlock &node)=0 |
Print the nrn_cur kernel with NMODL conductance keyword provisions. More... | |
virtual void | print_nrn_cur_non_conductance_kernel ()=0 |
Print the nrn_cur kernel without NMODL conductance keyword provisions. More... | |
virtual void | print_nrn_cur_kernel (const ast::BreakpointBlock &node)=0 |
Print main body of nrn_cur function. More... | |
virtual void | print_fast_imem_calculation ()=0 |
Print fast membrane current calculation code. More... | |
virtual void | print_nrn_cur ()=0 |
Print nrn_cur / current update function definition. More... | |
virtual void | print_headers_include ()=0 |
Print all includes. More... | |
virtual void | print_data_structures (bool print_initializers)=0 |
Print all classes. More... | |
virtual void | print_v_unused () const =0 |
Set v_unused (voltage) for NRN_PRCELLSTATE feature. More... | |
virtual void | print_g_unused () const =0 |
Set g_unused (conductance) for NRN_PRCELLSTATE feature. More... | |
virtual void | print_compute_functions ()=0 |
Print all compute functions for every backend. More... | |
virtual void | print_codegen_routines ()=0 |
Print entry point to code generation. 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) |
virtual void | print_mechanism_range_var_structure (bool print_initializers)=0 |
Print the structure that wraps all range and int variables required for the NMODL. More... | |
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::TableStatement * | get_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 |
Static Protected Member Functions | |
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 ¶ms) |
Generate the string representing the procedure parameter declaration. More... | |
static std::string | get_arg_str (const ParamVector ¶ms) |
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... | |
Protected Attributes | |
std::unique_ptr< CodePrinter > | printer |
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::SymbolTable * | program_symtab = nullptr |
Symbol table for the program. More... | |
std::vector< SymbolType > | codegen_float_variables |
All float variables for the model. More... | |
std::vector< IndexVariableInfo > | codegen_int_variables |
All int variables for the model. More... | |
std::vector< SymbolType > | codegen_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 |
Private Attributes | |
bool | enable_cvode = false |
|
protected |
A vector of parameters represented by a 4-tuple of strings:
const
)double
)__restrict__
)data
) Definition at line 297 of file codegen_cpp_visitor.hpp.
|
protected |
Definition at line 285 of file codegen_cpp_visitor.hpp.
|
inline |
Constructs the C++ code generator visitor.
This constructor instantiates an NMODL C++ code generator and allows writing generated code into an output stream.
AstVisitor
the AST must be visited using e.g. visit_program
in order to generate the C++ code corresponding to the AST.mod_filename | The name of the model for which code should be generated. It is used for constructing an output filename. |
stream | The output stream onto which to write the generated code |
float_type | The 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.
|
inline |
Definition at line 269 of file codegen_cpp_visitor.hpp.
|
inlineprotected |
Add quotes to string to be output.
text | The string to be quoted |
Definition at line 1048 of file codegen_cpp_visitor.hpp.
|
protectedpure virtual |
Add the variable point_process during get_int_variables
.
Implemented in nmodl::codegen::CodegenCoreneuronCppVisitor, and nmodl::codegen::CodegenNeuronCppVisitor.
|
protectedpure virtual |
Add the variable tqitem during get_int_variables
.
Implemented in nmodl::codegen::CodegenCoreneuronCppVisitor, and nmodl::codegen::CodegenNeuronCppVisitor.
|
protectedpure virtual |
Generate Function call statement for nrn_wrote_conc.
statements | Statements are appended to this vector. |
ion | The ion variable. |
concentration | The name of the concentration variable |
Implemented in nmodl::codegen::CodegenCoreneuronCppVisitor, and nmodl::codegen::CodegenNeuronCppVisitor.
|
protectedpure virtual |
Name of the code generation backend.
Implemented in nmodl::codegen::CodegenNeuronCppVisitor, nmodl::codegen::CodegenCoreneuronCppVisitor, and nmodl::codegen::CodegenAccVisitor.
|
protected |
Determine the variable name for the "current" used in breakpoint block taking into account intermediate code transformations.
current | The variable name for the current used in the model |
Current variable used in breakpoint block could be local variable. In this case, neuron has already renamed the variable name by prepending "_l". In our implementation, the variable could have been renamed by one of the pass. And hence, we search all local variables and check if the variable is renamed. Note that we have to look into the symbol table of statement block and not breakpoint.
Definition at line 363 of file codegen_cpp_visitor.cpp.
|
protectednoexcept |
Check if breakpoint node exist.
Definition at line 144 of file codegen_cpp_visitor.cpp.
|
protected |
Check if the given name exist in the symbol.
return
a tuple <true, array_length> if variable is an array otherwise <false, 0> Definition at line 1745 of file codegen_cpp_visitor.cpp.
|
protected |
Definition at line 1485 of file codegen_cpp_visitor.cpp.
|
inlineprotectednoexcept |
Default data type for floating point elements.
Definition at line 474 of file codegen_cpp_visitor.hpp.
|
inlineprotectednoexcept |
Default data type for integer (offset) elements.
Definition at line 490 of file codegen_cpp_visitor.hpp.
|
protected |
Check if given method is defined in this model.
name | The name of the method to check |
true
if the method is defined Definition at line 164 of file codegen_cpp_visitor.cpp.
|
protectedpure virtualnoexcept |
Arguments for external functions called from generated code.
Implemented in nmodl::codegen::CodegenCoreneuronCppVisitor, and nmodl::codegen::CodegenNeuronCppVisitor.
|
protectedpure virtualnoexcept |
Parameters for functions in generated code that are called back from external code.
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.
table |
Implemented in nmodl::codegen::CodegenCoreneuronCppVisitor, and nmodl::codegen::CodegenNeuronCppVisitor.
|
inlineprotectednoexcept |
Data type for floating point elements specified on command line.
Definition at line 482 of file codegen_cpp_visitor.hpp.
|
protectedpure virtual |
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
symbol | The symbol of a variable for which we want to obtain its name |
use_instance | Should the variable be accessed via instance or data array |
Implemented in nmodl::codegen::CodegenCoreneuronCppVisitor, and nmodl::codegen::CodegenNeuronCppVisitor.
|
protected |
Number of float variables in the model.
Definition at line 177 of file codegen_cpp_visitor.cpp.
|
protected |
Convert a given double
value to its string representation.
value | The number to convert given as string as it is parsed by the modfile |
We can directly print value but if user specify value as integer then then it gets printed as an integer. To avoid this, we use below wrapper. If user has provided integer then it gets printed as 1.0 (similar to mod2c and neuron where ".0" is appended). Otherwise we print double variables as they are represented in the mod file by user. If the value is in scientific representation (1e+20, 1E-15) then keep it as it is.
Definition at line 201 of file codegen_cpp_visitor.cpp.
|
protected |
Convert a given float
value to its string representation.
value | The number to convert given as string as it is parsed by the modfile |
Definition at line 206 of file codegen_cpp_visitor.cpp.
|
protectedpure virtual |
Parameters of the function itself "{}"
and "table_{}"
.
Implemented in nmodl::codegen::CodegenCoreneuronCppVisitor, and nmodl::codegen::CodegenNeuronCppVisitor.
|
protectedpure virtual |
The parameters of the Newton solver "functor".
Implemented in nmodl::codegen::CodegenCoreneuronCppVisitor, and nmodl::codegen::CodegenNeuronCppVisitor.
|
staticprotected |
Generate the string representing the parameters in a function call.
The procedure parameters are stored in a vector of 4-tuples each representing a parameter.
params | The parameters that should be concatenated into the function parameter declaration |
Definition at line 43 of file codegen_cpp_visitor.cpp.
|
inlineprotectednoexcept |
Name of channel info variable.
Definition at line 514 of file codegen_cpp_visitor.hpp.
|
protected |
Determine all float
variables required during code generation.
vector
of float
variables Definition at line 1267 of file codegen_cpp_visitor.cpp.
|
protected |
Definition at line 449 of file codegen_cpp_visitor.cpp.
|
protected |
Determine all int
variables required during code generation.
IndexVariableInfo has following constructor arguments:
vector
of int
variablesWhich variables are constant qualified?
symbol for di_ion_dv var
insert after read/write variables but before style ion variable
Definition at line 1343 of file codegen_cpp_visitor.cpp.
|
protected |
Definition at line 1719 of file codegen_cpp_visitor.cpp.
|
staticprotected |
Generate the string representing the procedure parameter declaration.
The procedure parameters are stored in a vector of 4-tuples each representing a parameter.
params | The parameters that should be concatenated into the function parameter declaration |
Definition at line 52 of file codegen_cpp_visitor.cpp.
|
protected |
Definition at line 1732 of file codegen_cpp_visitor.cpp.
|
protectedpure virtual |
Determine variable name in the structure of mechanism properties.
name | Variable name that is being printed |
use_instance | Should the variable be accessed via instance or data array |
Implemented in nmodl::codegen::CodegenCoreneuronCppVisitor, and nmodl::codegen::CodegenNeuronCppVisitor.
|
inlineprotected |
Name of structure that wraps global variables.
Definition at line 436 of file codegen_cpp_visitor.hpp.
|
inlineprotected |
Name of the (host-only) global instance of global_struct
Definition at line 444 of file codegen_cpp_visitor.hpp.
|
protectedpure virtual |
Determine the variable name for a global variable given its symbol.
symbol | The symbol of a variable for which we want to obtain its name |
use_instance | Should the variable be accessed via the (host-only) global variable or the instance-specific copy (also available on GPU). |
Implemented in nmodl::codegen::CodegenCoreneuronCppVisitor, and nmodl::codegen::CodegenNeuronCppVisitor.
|
protected |
Check if function or procedure node has parameter with given name.
T | Node type (either procedure or function) |
node | AST node (either procedure or function) |
name | Name of parameter |
Definition at line 66 of file codegen_cpp_visitor.cpp.
|
inlineprotected |
Name of structure that wraps range variables.
Definition at line 417 of file codegen_cpp_visitor.hpp.
|
protectedpure virtual |
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
symbol | The symbol of a variable for which we want to obtain its name |
name | The name of the index variable |
use_instance | Should the variable be accessed via instance or data array |
Implemented in nmodl::codegen::CodegenCoreneuronCppVisitor, and nmodl::codegen::CodegenNeuronCppVisitor.
|
protected |
Number of integer variables in the model.
Definition at line 187 of file codegen_cpp_visitor.cpp.
|
protectedpure virtual |
Arguments for functions that are defined and used internally.
Implemented in nmodl::codegen::CodegenCoreneuronCppVisitor, and nmodl::codegen::CodegenNeuronCppVisitor.
|
protectedpure virtual |
Parameters for internally defined functions.
Implemented in nmodl::codegen::CodegenCoreneuronCppVisitor, and nmodl::codegen::CodegenNeuronCppVisitor.
|
protected |
For a given output block type, return statements for all read ion variables.
type | The type of code block being generated |
vector
of strings representing the reading of ion variablesDepending upon the block type, we have to print read/write ion variables during code generation. Depending on block/procedure being printed, this method return statements as vector. As different code backends could have different variable names, we rely on backend-specific read_ion_variable_name and write_ion_variable_name method which will be overloaded.
Definition at line 252 of file codegen_cpp_visitor.cpp.
|
protected |
For a given output block type, return minimal statements for all read ion variables.
type | The type of code block being generated |
vector
of strings representing the reading of ion variables Definition at line 282 of file codegen_cpp_visitor.cpp.
|
protected |
Check if a structure for ion variables is required.
true
if a structure fot ion variables must be generated Definition at line 39 of file codegen_cpp_visitor.cpp.
|
protected |
For a given output block type, return statements for writing back ion variables.
type | The type of code block being generated |
vector
of strings representing the write-back of ion variables Definition at line 298 of file codegen_cpp_visitor.cpp.
|
protected |
Definition at line 170 of file codegen_cpp_visitor.cpp.
|
protected |
Checks whether the functor_block generated by sympy solver modifies any variable outside its scope.
If it does then return false, so that the operator() of the struct functor of the Eigen Newton solver doesn't have const qualifier.
variable_block | Statement Block of the variables declarations used in the functor struct of the solver |
functor_block | Actual code being printed in the operator() of the functor struct of the solver |
Definition at line 732 of file codegen_cpp_visitor.cpp.
|
inlineprotectednoexcept |
Checks if given function name is net_event
.
name | The function name to check |
true
if the function is net_event Definition at line 660 of file codegen_cpp_visitor.hpp.
|
inlineprotectednoexcept |
Checks if given function name is net_move
.
name | The function name to check |
true
if the function is net_move Definition at line 650 of file codegen_cpp_visitor.hpp.
|
inlineprotectednoexcept |
Checks if given function name is net_send
.
name | The function name to check |
true
if the function is net_send Definition at line 636 of file codegen_cpp_visitor.hpp.
|
inlineprotectednoexcept |
Definition at line 640 of file codegen_cpp_visitor.hpp.
|
inlineprotectednoexcept |
Data type for the local variables.
Definition at line 458 of file codegen_cpp_visitor.hpp.
|
inlineprotected |
Creates a temporary symbol.
name | The name of the symbol |
Definition at line 1075 of file codegen_cpp_visitor.hpp.
|
inlineprotected |
Constructs the name of a function or procedure.
name | The name of the function or procedure |
Definition at line 1058 of file codegen_cpp_visitor.hpp.
|
protectedpure virtual |
Name of "our" namespace.
Implemented in nmodl::codegen::CodegenCoreneuronCppVisitor, and nmodl::codegen::CodegenNeuronCppVisitor.
|
staticprotected |
Check if a semicolon is required at the end of given statement.
node | The AST Statement node to check |
true
if this Statement requires a semicolonStatements like if, else etc. don't need semicolon at the end. (Note that it's valid to have "extraneous" semicolon). Also, statement block can appear as statement using expression statement which need to be inspected.
Definition at line 217 of file codegen_cpp_visitor.cpp.
|
protectedpure virtual |
Implemented in nmodl::codegen::CodegenNeuronCppVisitor, and nmodl::codegen::CodegenCoreneuronCppVisitor.
|
protectednoexcept |
Check if net receive/send buffering kernels required.
Definition at line 121 of file codegen_cpp_visitor.cpp.
|
protectednoexcept |
Check if net_receive node exist.
Definition at line 139 of file codegen_cpp_visitor.cpp.
|
protectednoexcept |
Check if net_receive function is required.
Definition at line 149 of file codegen_cpp_visitor.cpp.
|
protectednoexcept |
Check if net_send_buffer is required.
Definition at line 111 of file codegen_cpp_visitor.cpp.
|
inlineprotectednoexcept |
Return Nmodl language version.
Definition at line 403 of file codegen_cpp_visitor.hpp.
|
inlineprotected |
Name of structure that wraps node variables.
Definition at line 424 of file codegen_cpp_visitor.hpp.
|
protectednoexcept |
Check if nrn_cur function is required.
Definition at line 134 of file codegen_cpp_visitor.cpp.
|
protectednoexcept |
Check if nrn_state function is required.
Definition at line 126 of file codegen_cpp_visitor.cpp.
|
protectedpure virtual |
Arguments for "_threadargs_" macro in neuron implementation.
Implemented in nmodl::codegen::CodegenCoreneuronCppVisitor, and nmodl::codegen::CodegenNeuronCppVisitor.
|
protectedpure virtual |
Arguments for "_threadargs_" macro in neuron implementation.
Implemented in nmodl::codegen::CodegenCoreneuronCppVisitor, and nmodl::codegen::CodegenNeuronCppVisitor.
|
inlineprotectednoexcept |
Operator for diagonal vector update (matrix update)
Definition at line 506 of file codegen_cpp_visitor.hpp.
|
inlineprotectednoexcept |
Operator for rhs vector update (matrix update)
Definition at line 498 of file codegen_cpp_visitor.hpp.
|
protectedpure virtual |
Check if ion variable copies should be avoided.
Implemented in nmodl::codegen::CodegenCoreneuronCppVisitor, and nmodl::codegen::CodegenNeuronCppVisitor.
|
protectedpure virtual |
Determine the position in the data array for a given float variable.
name | The name of a float variable |
Implemented in nmodl::codegen::CodegenNeuronCppVisitor, and nmodl::codegen::CodegenCoreneuronCppVisitor.
|
protectedpure virtual |
Determine the position in the data array for a given int variable.
name | The name of an int variable |
Implemented in nmodl::codegen::CodegenNeuronCppVisitor, and nmodl::codegen::CodegenCoreneuronCppVisitor.
|
protected |
Print top file header printed in generated code.
Definition at line 459 of file codegen_cpp_visitor.cpp.
|
protectedpure virtual |
Print entry point to code generation.
Implemented in nmodl::codegen::CodegenCoreneuronCppVisitor, and nmodl::codegen::CodegenNeuronCppVisitor.
|
protectedpure virtual |
Print all compute functions for every backend.
Implemented in nmodl::codegen::CodegenCoreneuronCppVisitor, and nmodl::codegen::CodegenNeuronCppVisitor.
|
protectedpure virtual |
Print all classes.
print_initializers | Whether to include default values. |
Implemented in nmodl::codegen::CodegenCoreneuronCppVisitor, and nmodl::codegen::CodegenNeuronCppVisitor.
|
protected |
Print linear solver using Eigen.
Definition at line 849 of file codegen_cpp_visitor.cpp.
|
protectedpure virtual |
Print fast membrane current calculation code.
Implemented in nmodl::codegen::CodegenCoreneuronCppVisitor, nmodl::codegen::CodegenNeuronCppVisitor, and nmodl::codegen::CodegenAccVisitor.
|
protected |
Print NMODL function in target backend code.
node |
Definition at line 574 of file codegen_cpp_visitor.cpp.
|
protectedvirtual |
Print call to internal or external function.
node | The AST node representing a function call |
Definition at line 505 of file codegen_cpp_visitor.cpp.
|
protectedpure virtual |
Print nmodl function or procedure (common code)
node | the AST node representing the function or procedure in NMODL |
name | the name of the function or procedure |
specifiers | the set of C++ specifiers to apply to the function signature |
Implemented in nmodl::codegen::CodegenCoreneuronCppVisitor, and nmodl::codegen::CodegenNeuronCppVisitor.
|
protectedpure virtual |
Common helper function to help printing function or procedure blocks.
node | the AST node representing the function or procedure in NMODL |
Implemented in nmodl::codegen::CodegenCoreneuronCppVisitor, and nmodl::codegen::CodegenNeuronCppVisitor.
|
protectedpure virtual |
Print function and procedures prototype declaration.
Implemented in nmodl::codegen::CodegenCoreneuronCppVisitor, and nmodl::codegen::CodegenNeuronCppVisitor.
|
protectedpure virtual |
Print special code when calling FUNCTION_TABLEs.
Implemented in nmodl::codegen::CodegenCoreneuronCppVisitor, and nmodl::codegen::CodegenNeuronCppVisitor.
|
protected |
Print the internal function for FUNCTION_TABLES.
Here internal refers to the function called from BREAKPOINT, INITIAL and other FUNCTIONs. Therefore this function doesn't print the functions required to call function tables from HOC/Python.
Definition at line 594 of file codegen_cpp_visitor.cpp.
|
protected |
Based on the EigenNewtonSolverBlock
passed print the definition needed for its functor.
node | EigenNewtonSolverBlock for which to print the functor |
Definition at line 775 of file codegen_cpp_visitor.cpp.
|
protected |
Print all Newton functor structs.
Definition at line 768 of file codegen_cpp_visitor.cpp.
|
protectedpure virtual |
Set g_unused (conductance) for NRN_PRCELLSTATE feature.
Implemented in nmodl::codegen::CodegenCoreneuronCppVisitor, and nmodl::codegen::CodegenNeuronCppVisitor.
|
protectedpure virtual |
Print common code for global functions like nrn_init, nrn_cur and nrn_state.
type | The target backend code block type |
Implemented in nmodl::codegen::CodegenCoreneuronCppVisitor, and nmodl::codegen::CodegenNeuronCppVisitor.
|
protectedvirtual |
Print the entries of for FUNCTION_TABLEs in the global struct.
And creates the required GLOBAL variables.
Definition at line 479 of file codegen_cpp_visitor.cpp.
|
protectedvirtual |
Print static assertions about the global variable struct.
Definition at line 487 of file codegen_cpp_visitor.cpp.
|
protectedvirtual |
Instantiate global var instance.
For C++ code generation this is empty
Definition at line 500 of file codegen_cpp_visitor.cpp.
|
protectedpure virtual |
Print byte arrays that register scalar and vector variables for hoc interface.
Implemented in nmodl::codegen::CodegenCoreneuronCppVisitor, and nmodl::codegen::CodegenNeuronCppVisitor.
|
protectedpure virtual |
Print all includes.
Implemented in nmodl::codegen::CodegenCoreneuronCppVisitor, and nmodl::codegen::CodegenNeuronCppVisitor.
|
protectedpure virtual |
Implemented in nmodl::codegen::CodegenNeuronCppVisitor, and nmodl::codegen::CodegenCoreneuronCppVisitor.
|
protectedpure virtual |
Print the structure that wraps all global variables used in the NMODL.
print_initializers | Whether to include default values in the struct definition (true: int foo{42}; false: int foo;) |
Implemented in nmodl::codegen::CodegenCoreneuronCppVisitor, and nmodl::codegen::CodegenNeuronCppVisitor.
|
protected |
Print backend code for byte array that has mechanism information (to be registered with NEURON/CoreNEURON)
Definition at line 626 of file codegen_cpp_visitor.cpp.
|
protectedpure virtual |
Print the structure that wraps all range and int variables required for the NMODL.
print_initializers | Whether or not default values for variables be included in the struct declaration. |
Implemented in nmodl::codegen::CodegenCoreneuronCppVisitor, and nmodl::codegen::CodegenNeuronCppVisitor.
|
protectedpure virtual |
Print the mechanism registration function.
Implemented in nmodl::codegen::CodegenCoreneuronCppVisitor, and nmodl::codegen::CodegenNeuronCppVisitor.
|
protected |
Prints the start of the simulator namespace.
Definition at line 662 of file codegen_cpp_visitor.cpp.
|
protected |
Prints the end of the simulator namespace.
Definition at line 668 of file codegen_cpp_visitor.cpp.
|
protectedpure virtual |
Print call to net_event.
node | The AST node representing the function call |
Implemented in nmodl::codegen::CodegenCoreneuronCppVisitor, and nmodl::codegen::CodegenNeuronCppVisitor.
|
protectedpure virtual |
Print call to net_move.
node | The AST node representing the function call |
Implemented in nmodl::codegen::CodegenCoreneuronCppVisitor, and nmodl::codegen::CodegenNeuronCppVisitor.
|
protectedpure virtual |
Print call to net_send
.
node | The AST node representing the function call |
Implemented in nmodl::codegen::CodegenCoreneuronCppVisitor, and nmodl::codegen::CodegenNeuronCppVisitor.
|
protected |
Print the nmodl constants used in backend code.
NMODL constants from unit database.
Currently we define three basic constants, which are assumed to be present in NMODL, directly in the backend code:
Definition at line 895 of file codegen_cpp_visitor.cpp.
|
protectedpure virtual |
Print nrn_alloc function definition.
Implemented in nmodl::codegen::CodegenCoreneuronCppVisitor, and nmodl::codegen::CodegenNeuronCppVisitor.
|
protectedpure virtual |
Print nrn_constructor function definition.
Implemented in nmodl::codegen::CodegenCoreneuronCppVisitor, and nmodl::codegen::CodegenNeuronCppVisitor.
|
protectedpure virtual |
Print nrn_cur / current update function definition.
Implemented in nmodl::codegen::CodegenCoreneuronCppVisitor, and nmodl::codegen::CodegenNeuronCppVisitor.
|
protectedpure virtual |
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
node | the AST node representing the NMODL breakpoint block |
Implemented in nmodl::codegen::CodegenCoreneuronCppVisitor, and nmodl::codegen::CodegenNeuronCppVisitor.
|
protectedpure virtual |
Print main body of nrn_cur function.
node | the AST node representing the NMODL breakpoint block |
Implemented in nmodl::codegen::CodegenCoreneuronCppVisitor, and nmodl::codegen::CodegenNeuronCppVisitor.
|
protectedpure virtual |
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
Implemented in nmodl::codegen::CodegenCoreneuronCppVisitor, and nmodl::codegen::CodegenNeuronCppVisitor.
|
protectedpure virtual |
Print the nrn_current
kernel.
node | the AST node representing the NMODL breakpoint block |
Implemented in nmodl::codegen::CodegenCoreneuronCppVisitor, and nmodl::codegen::CodegenNeuronCppVisitor.
|
protectedpure virtual |
Print nrn_destructor function definition.
Implemented in nmodl::codegen::CodegenCoreneuronCppVisitor, and nmodl::codegen::CodegenNeuronCppVisitor.
|
protectedvirtual |
Print nrn_pointing
.
Definition at line 563 of file codegen_cpp_visitor.cpp.
|
protectedpure virtual |
Print nrn_state / state update function definition.
Implemented in nmodl::codegen::CodegenCoreneuronCppVisitor, and nmodl::codegen::CodegenNeuronCppVisitor.
|
protectedvirtual |
Print pragma annotations for channel iterations.
This can be overriden by backends to provide additonal annotations or pragmas to enable for example SIMD code generation (e.g. through ivdep
) The default implementation prints
type | The block type |
Depending programming model and compiler, we print compiler hint for parallelization. For example:
Reimplemented in nmodl::codegen::CodegenAccVisitor.
Definition at line 394 of file codegen_cpp_visitor.cpp.
|
protected |
Print declaration of macro NRN_PRCELLSTATE for debugging.
Definition at line 619 of file codegen_cpp_visitor.cpp.
|
protected |
Print NMODL procedure in target backend code.
node |
Definition at line 569 of file codegen_cpp_visitor.cpp.
|
protected |
Definition at line 1759 of file codegen_cpp_visitor.cpp.
|
protectedpure virtual |
Implemented in nmodl::codegen::CodegenCoreneuronCppVisitor, and nmodl::codegen::CodegenNeuronCppVisitor.
|
protectedpure virtual |
Print standard C/C++ includes.
Implemented in nmodl::codegen::CodegenCoreneuronCppVisitor, and nmodl::codegen::CodegenNeuronCppVisitor.
|
protected |
Print any statement block in nmodl with option to (not) print braces.
The individual statements (of type nmodl::ast::Statement) in the StatementBlock are printed by accepting this
visistor.
node | A (possibly empty) statement block AST node |
open_brace | Print an opening brace if false |
close_brace | Print a closing brace if true |
not necessary to add indent for verbatim block (pretty-printing)
Definition at line 700 of file codegen_cpp_visitor.cpp.
|
protected |
Print check_function()
for functions or procedure using table.
node | The AST node representing a function or procedure block |
Definition at line 1623 of file codegen_cpp_visitor.cpp.
|
protected |
Print replacement function for function or procedure using table.
node | The AST node representing a function or procedure block |
Definition at line 1514 of file codegen_cpp_visitor.cpp.
|
protected |
Print top level (global scope) verbatim blocks.
Definition at line 673 of file codegen_cpp_visitor.cpp.
|
protected |
Prints f"using namespace {namespace_name()}".
Definition at line 658 of file codegen_cpp_visitor.cpp.
|
protectedpure virtual |
Set v_unused (voltage) for NRN_PRCELLSTATE feature.
Implemented in nmodl::codegen::CodegenCoreneuronCppVisitor, and nmodl::codegen::CodegenNeuronCppVisitor.
|
protected |
Process shadow update statement.
If mechanisms dependency level execution is enabled then certain updates like ionic current contributions needs to be atomically updated.
If the statement requires reduction then add it to vector of reduction statement and return statement using shadow update
statement | The statement that might require shadow updates |
type | The target backend code block type |
In this case we first update current mechanism's shadow vector and then add statement to queue that will be used in reduction queue.
Definition at line 340 of file codegen_cpp_visitor.cpp.
|
protectednoexcept |
Check if setup_range_variable function is required.
When floating point data type is not default (i.e. double) then we have to copy old array to new type (for range variables).
Definition at line 158 of file codegen_cpp_visitor.cpp.
|
staticprotected |
Return ion variable name and corresponding ion read variable name.
Example: {"ena", "ion_ena"} = read_ion_variable_name("ena");
name | The ion variable name |
Definition at line 437 of file codegen_cpp_visitor.cpp.
|
protectedpure virtual |
Arguments for register_mech or point_register_mech function.
Implemented in nmodl::codegen::CodegenCoreneuronCppVisitor, and nmodl::codegen::CodegenNeuronCppVisitor.
|
protectedvirtual |
Definition at line 1457 of file codegen_cpp_visitor.cpp.
|
protectedpure virtual |
Name of the simulator the code was generated for.
Implemented in nmodl::codegen::CodegenNeuronCppVisitor, and nmodl::codegen::CodegenCoreneuronCppVisitor.
|
staticprotected |
Check if given statement should be skipped during code generation.
node | The AST Statement node to check |
true
if this Statement is to be skippedCertain statements like unit, comment, solve can/need to be skipped during code generation. Note that solve block is wrapped in expression statement and hence we have to check inner expression. It's also true for the initial block defined inside net receive block.
Definition at line 87 of file codegen_cpp_visitor.cpp.
|
protected |
The name of the function that updates the table value if the parameters changed.
block_name | The name of the block that contains the TABLE. |
Definition at line 76 of file codegen_cpp_visitor.cpp.
|
inlineprotected |
Definition at line 428 of file codegen_cpp_visitor.hpp.
|
protected |
Determine the updated name if the ion variable has been optimized.
name | The ion variable name |
ena
--> ion_ena
) Definition at line 420 of file codegen_cpp_visitor.cpp.
|
protected |
populate all index semantics needed for registration with coreneuron
Once variables are populated, update index semantics to register with coreneuron
add if variable is not present in the read list
Definition at line 1191 of file codegen_cpp_visitor.cpp.
|
overrideprotectedvirtual |
visit node of type ast::BinaryExpression
Implements nmodl::visitor::ConstVisitor.
Definition at line 1061 of file codegen_cpp_visitor.cpp.
|
overrideprotectedvirtual |
visit node of type ast::BinaryOperator
Implements nmodl::visitor::ConstVisitor.
Definition at line 1079 of file codegen_cpp_visitor.cpp.
|
overrideprotectedvirtual |
visit node of type ast::Boolean
Implements nmodl::visitor::ConstVisitor.
Definition at line 940 of file codegen_cpp_visitor.cpp.
|
overrideprotectedvirtual |
visit node of type ast::Double
Implements nmodl::visitor::ConstVisitor.
Definition at line 935 of file codegen_cpp_visitor.cpp.
|
overrideprotectedvirtual |
visit node of type ast::EigenLinearSolverBlock
Implements nmodl::visitor::ConstVisitor.
Definition at line 1161 of file codegen_cpp_visitor.cpp.
|
overrideprotectedvirtual |
visit node of type ast::EigenNewtonSolverBlock
Implements nmodl::visitor::ConstVisitor.
Definition at line 1132 of file codegen_cpp_visitor.cpp.
|
overrideprotectedvirtual |
visit node of type ast::ElseIfStatement
Implements nmodl::visitor::ConstVisitor.
Definition at line 1011 of file codegen_cpp_visitor.cpp.
|
overrideprotectedvirtual |
visit node of type ast::ElseStatement
Implements nmodl::visitor::ConstVisitor.
Definition at line 1019 of file codegen_cpp_visitor.cpp.
|
overrideprotectedvirtual |
visit node of type ast::Float
Implements nmodl::visitor::ConstVisitor.
Definition at line 930 of file codegen_cpp_visitor.cpp.
|
overrideprotectedvirtual |
visit node of type ast::FromStatement
Implements nmodl::visitor::ConstVisitor.
Definition at line 1033 of file codegen_cpp_visitor.cpp.
|
overrideprotectedvirtual |
visit node of type ast::FunctionCall
Implements nmodl::visitor::ConstVisitor.
Definition at line 1099 of file codegen_cpp_visitor.cpp.
|
overrideprotectedvirtual |
visit node of type ast::IfStatement
Implements nmodl::visitor::ConstVisitor.
Definition at line 998 of file codegen_cpp_visitor.cpp.
|
overrideprotectedvirtual |
visit node of type ast::IndexedName
Implements nmodl::visitor::ConstVisitor.
Definition at line 982 of file codegen_cpp_visitor.cpp.
|
overrideprotectedvirtual |
visit node of type ast::Integer
Implements nmodl::visitor::ConstVisitor.
Definition at line 924 of file codegen_cpp_visitor.cpp.
|
overrideprotectedvirtual |
visit node of type ast::LocalListStatement
Implements nmodl::visitor::ConstVisitor.
Definition at line 992 of file codegen_cpp_visitor.cpp.
|
overrideprotectedvirtual |
visit node of type ast::MutexLock
Implements nmodl::visitor::ConstVisitor.
Definition at line 1109 of file codegen_cpp_visitor.cpp.
|
overrideprotectedvirtual |
visit node of type ast::MutexUnlock
Implements nmodl::visitor::ConstVisitor.
Definition at line 1116 of file codegen_cpp_visitor.cpp.
|
overrideprotectedvirtual |
visit node of type ast::Name
Implements nmodl::visitor::ConstVisitor.
Definition at line 945 of file codegen_cpp_visitor.cpp.
|
overrideprotectedvirtual |
visit node of type ast::ParenExpression
Implements nmodl::visitor::ConstVisitor.
Definition at line 1054 of file codegen_cpp_visitor.cpp.
|
overrideprotectedvirtual |
visit node of type ast::PrimeName
Implements nmodl::visitor::ConstVisitor.
Definition at line 955 of file codegen_cpp_visitor.cpp.
|
overridevirtual |
Main and only member function to call after creating an instance of this class.
program | the AST to translate to C++ code |
Implements nmodl::visitor::ConstVisitor.
Definition at line 1508 of file codegen_cpp_visitor.cpp.
|
overrideprotectedvirtual |
visit node of type ast::SolutionExpression
Implements nmodl::visitor::ConstVisitor.
Definition at line 1121 of file codegen_cpp_visitor.cpp.
|
overrideprotectedvirtual |
Statement block is top level construct (for every nmodl block). Sometime we want to analyse ast nodes even if code generation is false. Hence we visit children even if code generation is false.
Implements nmodl::visitor::ConstVisitor.
Definition at line 1094 of file codegen_cpp_visitor.cpp.
|
overrideprotectedvirtual |
visit node of type ast::String
Implements nmodl::visitor::ConstVisitor.
Definition at line 915 of file codegen_cpp_visitor.cpp.
|
overrideprotectedvirtual |
visit node of type ast::UnaryOperator
Implements nmodl::visitor::ConstVisitor.
Definition at line 1084 of file codegen_cpp_visitor.cpp.
|
overrideprotectedvirtual |
visit node of type ast::Unit
Implements nmodl::visitor::ConstVisitor.
Definition at line 950 of file codegen_cpp_visitor.cpp.
|
overrideprotectedvirtual |
visit node of type ast::UpdateDt
Implements nmodl::visitor::ConstVisitor.
Definition at line 1104 of file codegen_cpp_visitor.cpp.
|
overrideprotectedvirtual |
Implements nmodl::visitor::ConstVisitor.
Definition at line 963 of file codegen_cpp_visitor.cpp.
|
overrideprotectedvirtual |
visit node of type ast::WhileStatement
Implements nmodl::visitor::ConstVisitor.
Definition at line 1025 of file codegen_cpp_visitor.cpp.
|
staticprotected |
Return ion variable name and corresponding ion write variable name.
Example: {"ion_ena", "ena"} = write_ion_variable_name("ena");
name | The ion variable name |
Definition at line 443 of file codegen_cpp_visitor.cpp.
|
protected |
All float variables for the model.
Definition at line 343 of file codegen_cpp_visitor.hpp.
|
protected |
All global variables for the model.
Definition at line 356 of file codegen_cpp_visitor.hpp.
|
protected |
All int variables for the model.
Definition at line 349 of file codegen_cpp_visitor.hpp.
|
protected |
Index of watch statement being printed.
Definition at line 392 of file codegen_cpp_visitor.hpp.
|
private |
Definition at line 282 of file codegen_cpp_visitor.hpp.
|
protected |
Variable name should be converted to instance name (but not for function arguments)
Definition at line 362 of file codegen_cpp_visitor.hpp.
|
protected |
Data type of floating point variables.
Definition at line 319 of file codegen_cpp_visitor.hpp.
|
protected |
All ast information for code generation.
Definition at line 331 of file codegen_cpp_visitor.hpp.
|
protected |
true
if internal method call was encountered while processing verbatim block
Definition at line 386 of file codegen_cpp_visitor.hpp.
|
protected |
Name of mod file (without .mod suffix)
Definition at line 313 of file codegen_cpp_visitor.hpp.
|
protected |
Definition at line 1422 of file codegen_cpp_visitor.hpp.
|
protected |
Flag to indicate if visitor should avoid ion variable copies.
Definition at line 325 of file codegen_cpp_visitor.hpp.
|
protected |
Code printer object for target (C++)
Definition at line 307 of file codegen_cpp_visitor.hpp.
|
protected |
true
if currently initial block of net_receive being printed
Definition at line 374 of file codegen_cpp_visitor.hpp.
|
protected |
true
if currently net_receive block being printed
Definition at line 368 of file codegen_cpp_visitor.hpp.
|
protected |
true
if currently printing top level verbatim blocks
Definition at line 380 of file codegen_cpp_visitor.hpp.
|
protected |
Symbol table for the program.
Definition at line 337 of file codegen_cpp_visitor.hpp.