User Guide
nmodl::codegen Namespace Reference

Namespaces

 naming
 different variable names used in code generation
 
 utils
 

Classes

class  CodegenAccVisitor
 Visitor for printing C++ code with OpenACC backend More...
 
class  CodegenCompatibilityVisitor
 Visitor for printing compatibility issues of the mod file More...
 
class  CodegenCoreneuronCppVisitor
 Visitor for printing C++ code compatible with legacy api of CoreNEURON More...
 
class  CodegenCppVisitor
 Visitor for printing C++ code compatible with legacy api of CoreNEURON More...
 
class  CodegenHelperVisitor
 Helper visitor to gather AST information to help code generation. More...
 
class  CodegenInfo
 Represent information collected from AST for code generation. More...
 
class  CodegenNeuronCppVisitor
 Visitor for printing C++ code compatible with legacy api of NEURON More...
 
class  Conductance
 Represent conductance statements used in mod file. More...
 
class  IndexSemantics
 Represent semantic information for index variable. More...
 
class  IndexVariableInfo
 Helper to represent information about index/int variables. More...
 
class  Ion
 Represent ions used in mod file. More...
 
class  ShadowUseStatement
 Represents ion write statement during code generation. More...
 

Enumerations

enum  BlockType {
  BlockType::Initial, BlockType::Constructor, BlockType::Destructor, BlockType::Equation,
  BlockType::State, BlockType::Watch, BlockType::NetReceive, BlockType::BeforeAfter,
  BlockType::BlockTypeEnd
}
 Helper to represent various block types. More...
 
enum  MemberType { MemberType::index, MemberType::range, MemberType::global, MemberType::thread }
 Helper to represent various variables types. More...
 
enum  InterpreterWrapper { HOC, Python }
 Enum to switch between HOC and Python wrappers for functions and procedures defined in mechanisms. More...
 

Functions

static const TableStatementget_table_statement (const ast::Block &node)
 
static std::string get_register_type_for_ba_block (const ast::Block *block)
 Return registration type for a given BEFORE/AFTER block /param block A BEFORE/AFTER block being registered. More...
 
static void rename_net_receive_arguments (const ast::NetReceiveBlock &net_receive_node, const ast::Node &node)
 Rename arguments to NET_RECEIVE block with corresponding pointer variable. More...
 

Variables

const std::regex regex_special_chars {R"([-[\]{}()*+?.,\^$|#\s])"}
 

Enumeration Type Documentation

◆ InterpreterWrapper

Enum to switch between HOC and Python wrappers for functions and procedures defined in mechanisms.

Enumerator
HOC 
Python 

Definition at line 50 of file codegen_neuron_cpp_visitor.hpp.

Function Documentation

◆ get_register_type_for_ba_block()

static std::string nmodl::codegen::get_register_type_for_ba_block ( const ast::Block block)
static

Return registration type for a given BEFORE/AFTER block /param block A BEFORE/AFTER block being registered.

Depending on a block type i.e. BEFORE or AFTER and also type of it's associated block i.e. BREAKPOINT, INITIAL, SOLVE and STEP, the registration type (as an integer) is calculated. These values are then interpreted by CoreNEURON internally.

before block have value 10 and after block 20

associated blocks have different values (1 to 4) based on type. These values are based on neuron/coreneuron implementation details.

Definition at line 1682 of file codegen_coreneuron_cpp_visitor.cpp.

◆ get_table_statement()

static const TableStatement* nmodl::codegen::get_table_statement ( const ast::Block node)
static

Definition at line 409 of file codegen_coreneuron_cpp_visitor.cpp.

◆ rename_net_receive_arguments()

static void nmodl::codegen::rename_net_receive_arguments ( const ast::NetReceiveBlock net_receive_node,
const ast::Node node 
)
static

Rename arguments to NET_RECEIVE block with corresponding pointer variable.

Arguments to NET_RECEIVE block are packed and passed via weight vector. These variables need to be replaced with corresponding pointer variable. For example, if mod file is like

NET_RECEIVE (weight, R){
INITIAL {
R=1
}
}

then generated code for initial block should be:

double* R = weights + weight_index + 0;
(*R) = 1.0;

So, the R in AST needs to be renamed with (*R).

Definition at line 2750 of file codegen_coreneuron_cpp_visitor.cpp.

Variable Documentation

◆ regex_special_chars

const std::regex nmodl::codegen::regex_special_chars {R"([-[\]{}()*+?.,\^$|#\s])"}

Definition at line 610 of file codegen_cpp_visitor.cpp.