NEURON
init.cpp File Reference
#include <../../nrnconf.h>
#include <nrnmpiuse.h>
#include "nrn_ansi.h"
#include "nrncore_write/io/nrncore_io.h"
#include "oc_ansi.h"
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <stdlib.h>
#include "section.h"
#include "seclist.h"
#include "parse.hpp"
#include "nrniv_mf.h"
#include "cabvars.h"
#include "neuron.h"
#include "neuron/container/data_handle.hpp"
#include "membdef.h"
#include "multicore.h"
#include "nrnmpi.h"
#include <vector>
#include <unordered_map>
#include <filesystem>
#include "nrnwrap_dlfcn.h"

Go to the source code of this file.

Namespaces

 neuron
 In mechanism libraries, cannot use auto const token = nrn_ensure_model_data_are_sorted(); because the return type is incomplete (from include/neuron/model_data.hpp).
 
 neuron::mechanism
 
 neuron::mechanism::detail
 

Macros

#define CHECK(name)
 

Functions

int nrn_load_dll_recover_error ()
 
void nrn_load_name_check (const char *name)
 
void hoc_reg_watch_allocate (int type, NrnWatchAllocateFunc_t waf)
 
void hoc_reg_bbcore_write (int mechtype, bbcore_write_t f)
 
void hoc_reg_bbcore_read (int mechtype, bbcore_write_t f)
 
void hoc_reg_nmodl_text (int mechtype, const char *txt)
 
void hoc_reg_nmodl_filename (int mechtype, const char *filename)
 
void add_nrn_has_net_event (int mechtype)
 
void add_nrn_fornetcons (int type, int indx)
 
void add_nrn_artcell (int mechtype, int qi)
 
int nrn_is_artificial (int pnttype)
 
int nrn_is_cable (void)
 
void * nrn_realpath_dlopen (const char *relpath, int flags)
 
int mswin_load_dll (const char *cp1)
 
void hoc_nrn_load_dll (void)
 
void hoc_last_init (void)
 
void initnrn (void)
 
void reallocate_mech_data (int mechtype)
 
void initialize_memb_func (int mechtype, nrn_cur_t cur, nrn_jacob_t jacob, Pvmp alloc, nrn_state_t stat, nrn_init_t initialize, int vectorized)
 
void check_mech_version (const char **m)
 
int count_variables_in_mechanism (const char **m2, int modltypemax)
 
void register_mech_vars (const char **var_buffers, int modltypemax, Symbol *mech_symbol, int mechtype, int nrnpointerindex)
 
void nrn_register_mech_common (const char **m, Pvmp alloc, nrn_cur_t cur, nrn_jacob_t jacob, nrn_state_t stat, nrn_init_t initialize, int nrnpointerindex, int vectorized)
 
void register_mech (const char **m, Pvmp alloc, nrn_cur_t cur, nrn_jacob_t jacob, nrn_state_t stat, nrn_init_t initialize, int nrnpointerindex, int vectorized)
 
void hoc_register_parm_default (int mechtype, const std::vector< double > *pd)
 
void nrn_writes_conc (int mechtype, int unused)
 
void neuron::mechanism::detail::register_data_fields (int mechtype, std::vector< std::pair< std::string, int >> const &param_info, std::vector< std::pair< std::string, std::string >> const &dparam_info)
 
static int neuron::mechanism::detail::count_prop_param_size (const std::vector< std::pair< const char *, int >> &param_info)
 
void neuron::mechanism::detail::register_data_fields (int mechtype, std::vector< std::pair< const char *, int >> const &param_info, std::vector< std::pair< const char *, const char * >> const &dparam_info)
 
template<>
int const * neuron::mechanism::get_array_dims< double > (int mech_type)
 
template<>
double *const * neuron::mechanism::get_data_ptrs< double > (int mech_type)
 
template<>
int neuron::mechanism::get_field_count< double > (int mech_type)
 
void hoc_register_npy_direct (int mechtype, NPyDirectMechFunc *f)
 Support mechanism FUNCTION/PROCEDURE python syntax seg.mech.f() More...
 
void hoc_register_prop_size (int mechtype, int psize, int dpsize)
 Legacy way of registering mechanism data/pdata size. More...
 
void hoc_register_dparam_semantics (int mechtype, int ix, const char *name)
 Legacy way of registering pdata semantics. More...
 
int nrn_dparam_semantics_to_int (const char *name)
 
std::vector< int > & nrn_mech_random_indices (int type)
 dparam indices with random semantics for mechtype More...
 
void hoc_register_cvode (int i, nrn_ode_count_t cnt, nrn_ode_map_t map, nrn_ode_spec_t spec, nrn_ode_matsol_t matsol)
 
void hoc_register_synonym (int i, nrn_ode_synonym_t syn)
 
void register_destructor (Pvmp d)
 
int point_reg_helper (Symbol *s2)
 
void class2oc_base (const char *, ctor_f *cons, dtor_f *destruct, Member_func *, Member_ret_obj_func *, Member_ret_str_func *)
 
int point_register_mech (const char **m, Pvmp alloc, nrn_cur_t cur, nrn_jacob_t jacob, nrn_state_t stat, nrn_init_t initialize, int nrnpointerindex, int vectorized, void *(*constructor)(Object *), void(*destructor)(void *), Member_func *fmember)
 
void _modl_set_dt (double newdt)
 
void _modl_set_dt_thread (double newdt, NrnThread *nt)
 
double _modl_get_dt_thread (NrnThread *nt)
 
void state_discontinuity (int i, double *pd, double d)
 
void hoc_register_limits (int mechtype, HocParmLimits *limits)
 
void hoc_register_units (int mechtype, HocParmUnits *units)
 
void hoc_reg_ba (int mt, nrn_bamech_t f, int type)
 
void _cvode_abstol (Symbol **s, double *tol, int i)
 
void hoc_register_tolerance (int mechtype, HocStateTolerance *tol, Symbol ***stol)
 
void _nrn_thread_reg (int i, int cons, void(*f)(Datum *))
 
void _nrn_thread_table_reg (int i, nrn_thread_table_check_t f)
 
void _nrn_setdata_reg (int i, void(*call)(Prop *))
 
double nrn_call_mech_func (Symbol *s, int narg, Prop *p, int mechtype)
 
void nrnunit_use_legacy ()
 

Variables

static char nmodl_version_ [] = "7.7.0"
 
static char banner []
 
static char CHKmes [] = "The user defined name, %s, already exists\n"
 
void(* nrnpy_reg_mech_p_ )(int)
 
int secondorder = 0
 
int state_discon_allowed_
 
int nrn_nobanner_
 
double t
 
double dt
 
double clamp_resist
 
double celsius
 
double htablemin
 
double htablemax
 
int nrn_netrec_state_adjust = 0
 
int nrn_sparse_partrans = 0
 
hoc_Listsection_list
 
int nrn_global_ncell = 0
 
double hoc_default_dll_loaded_
 
int nrn_istty_
 
static std::vector< double > morph_parm_default {DEF_diam}
 
static HocParmLimits _hoc_parm_limits []
 
static HocParmUnits _hoc_parm_units []
 
Symlistnrn_load_dll_called_
 
static int memb_func_size_
 
std::vector< Memb_funcmemb_func
 
std::vector< Memb_listmemb_list
 
short * memb_order_
 
Symbol ** pointsym
 
Point_process ** point_process
 
char * pnt_map
 
BAMech ** bamech_
 
cTemplate ** nrn_pnt_template_
 
pnt_receive_tpnt_receive
 
pnt_receive_init_tpnt_receive_init
 
short * pnt_receive_size
 
int nrn_has_net_event_cnt_
 
int * nrn_has_net_event_
 
int * nrn_prop_param_size_
 
int * nrn_prop_dparam_size_
 
int * nrn_dparam_ptr_start_
 
int * nrn_dparam_ptr_end_
 
NrnWatchAllocateFunc_tnrn_watch_allocate_
 
std::unordered_map< int, void(*)(Prop *)> nrn_mech_inst_destruct
 
bbcore_write_tnrn_bbcore_write_
 
bbcore_write_tnrn_bbcore_read_
 
const char ** nrn_nmodl_text_
 
const char ** nrn_nmodl_filename_
 
int nrn_fornetcon_cnt_
 
int * nrn_fornetcon_type_
 
int * nrn_fornetcon_index_
 
short * nrn_is_artificial_
 
short * nrn_artcell_qindex_
 
static DoubScal scdoub [] = {{"t", &t}, {"dt", &dt}, {nullptr, nullptr}}
 
static int pointtype = 1
 
int n_memb_func
 
std::unordered_map< int, NPyDirectMechFuncsnrn_mech2funcs_map
 
int _ninits
 
int state_discon_flag_ = 0
 

Macro Definition Documentation

◆ CHECK

#define CHECK (   name)
Value:
if (hoc_lookup(name) != (Symbol*) 0) { \
IGNORE(fprintf(stderr, CHKmes, name)); \
nrn_exit(1); \
}
Symbol * hoc_lookup(const char *)
Definition: symbol.cpp:59
const char * name
Definition: init.cpp:16
static char CHKmes[]
Definition: init.cpp:103
Definition: model.h:47

Definition at line 97 of file init.cpp.

Function Documentation

◆ _cvode_abstol()

void _cvode_abstol ( Symbol **  s,
double *  tol,
int  i 
)

Definition at line 1165 of file init.cpp.

◆ _modl_get_dt_thread()

double _modl_get_dt_thread ( NrnThread nt)

Definition at line 1080 of file init.cpp.

◆ _modl_set_dt()

void _modl_set_dt ( double  newdt)

Definition at line 1073 of file init.cpp.

◆ _modl_set_dt_thread()

void _modl_set_dt_thread ( double  newdt,
NrnThread nt 
)

Definition at line 1077 of file init.cpp.

◆ _nrn_setdata_reg()

void _nrn_setdata_reg ( int  i,
void(*)(Prop *)  call 
)

Definition at line 1255 of file init.cpp.

◆ _nrn_thread_reg()

void _nrn_thread_reg ( int  i,
int  cons,
void(*)(Datum *)  f 
)

Definition at line 1243 of file init.cpp.

◆ _nrn_thread_table_reg()

void _nrn_thread_table_reg ( int  i,
nrn_thread_table_check_t  f 
)

Definition at line 1251 of file init.cpp.

◆ add_nrn_artcell()

void add_nrn_artcell ( int  mechtype,
int  qi 
)

Definition at line 217 of file init.cpp.

◆ add_nrn_fornetcons()

void add_nrn_fornetcons ( int  type,
int  indx 
)

Definition at line 205 of file init.cpp.

◆ add_nrn_has_net_event()

void add_nrn_has_net_event ( int  mechtype)

Definition at line 194 of file init.cpp.

◆ check_mech_version()

void check_mech_version ( const char **  m)

Definition at line 692 of file init.cpp.

◆ class2oc_base()

void class2oc_base ( const char *  name,
ctor_f cons,
dtor_f destruct,
Member_func m,
Member_ret_obj_func mobjret,
Member_ret_str_func strret 
)

Definition at line 1583 of file hoc_oop.cpp.

◆ count_variables_in_mechanism()

int count_variables_in_mechanism ( const char **  m2,
int  modltypemax 
)

Definition at line 583 of file init.cpp.

◆ hoc_nrn_load_dll()

void hoc_nrn_load_dll ( void  )

Definition at line 284 of file init.cpp.

◆ hoc_reg_ba()

void hoc_reg_ba ( int  mt,
nrn_bamech_t  f,
int  type 
)

Definition at line 1126 of file init.cpp.

◆ hoc_reg_bbcore_read()

void hoc_reg_bbcore_read ( int  mechtype,
bbcore_write_t  f 
)

Definition at line 180 of file init.cpp.

◆ hoc_reg_bbcore_write()

void hoc_reg_bbcore_write ( int  mechtype,
bbcore_write_t  f 
)

Definition at line 176 of file init.cpp.

◆ hoc_reg_watch_allocate()

void hoc_reg_watch_allocate ( int  type,
NrnWatchAllocateFunc_t  waf 
)

Definition at line 169 of file init.cpp.

◆ hoc_register_cvode()

void hoc_register_cvode ( int  i,
nrn_ode_count_t  cnt,
nrn_ode_map_t  map,
nrn_ode_spec_t  spec,
nrn_ode_matsol_t  matsol 
)

Definition at line 995 of file init.cpp.

◆ hoc_register_dparam_semantics()

void hoc_register_dparam_semantics ( int  mechtype,
int  ix,
const char *  name 
)

Legacy way of registering pdata semantics.

Superseded by neuron::mechanism::register_data_fields.

Definition at line 980 of file init.cpp.

◆ hoc_register_limits()

void hoc_register_limits ( int  mechtype,
HocParmLimits limits 
)

Definition at line 1092 of file init.cpp.

◆ hoc_register_npy_direct()

void hoc_register_npy_direct ( int  mechtype,
NPyDirectMechFunc f 
)

Support mechanism FUNCTION/PROCEDURE python syntax seg.mech.f()

Python (density) mechanism registration uses nrn_mechs2func_map to create a per mechanism map of f members that can be called directly without prior call to setmech.

Definition at line 957 of file init.cpp.

◆ hoc_register_parm_default()

void hoc_register_parm_default ( int  mechtype,
const std::vector< double > *  pd 
)

Definition at line 741 of file init.cpp.

◆ hoc_register_prop_size()

void hoc_register_prop_size ( int  mechtype,
int  psize,
int  dpsize 
)

Legacy way of registering mechanism data/pdata size.

Superseded by neuron::mechanism::register_data_fields.

Definition at line 970 of file init.cpp.

◆ hoc_register_synonym()

void hoc_register_synonym ( int  i,
nrn_ode_synonym_t  syn 
)

Definition at line 1005 of file init.cpp.

◆ hoc_register_tolerance()

void hoc_register_tolerance ( int  mechtype,
HocStateTolerance tol,
Symbol ***  stol 
)

Definition at line 1175 of file init.cpp.

◆ hoc_register_units()

void hoc_register_units ( int  mechtype,
HocParmUnits units 
)

Definition at line 1109 of file init.cpp.

◆ initialize_memb_func()

void initialize_memb_func ( int  mechtype,
nrn_cur_t  cur,
nrn_jacob_t  jacob,
Pvmp  alloc,
nrn_state_t  stat,
nrn_init_t  initialize,
int  vectorized 
)

Definition at line 654 of file init.cpp.

◆ initnrn()

void initnrn ( void  )

Definition at line 437 of file init.cpp.

◆ mswin_load_dll()

int mswin_load_dll ( const char *  cp1)

Definition at line 257 of file init.cpp.

◆ nrn_call_mech_func()

double nrn_call_mech_func ( Symbol s,
int  narg,
Prop p,
int  mechtype 
)

Definition at line 1259 of file init.cpp.

◆ nrn_dparam_semantics_to_int()

int nrn_dparam_semantics_to_int ( const char *  name)

Definition at line 984 of file init.cpp.

◆ nrn_is_artificial()

int nrn_is_artificial ( int  pnttype)

Definition at line 222 of file init.cpp.

◆ nrn_load_dll_recover_error()

int nrn_load_dll_recover_error ( )

Definition at line 22 of file hocusr.cpp.

◆ nrn_load_name_check()

void nrn_load_name_check ( const char *  name)

Definition at line 33 of file hocusr.cpp.

◆ nrn_mech_random_indices()

std::vector<int>& nrn_mech_random_indices ( int  type)

dparam indices with random semantics for mechtype

Definition at line 991 of file init.cpp.

◆ nrn_realpath_dlopen()

void* nrn_realpath_dlopen ( const char *  relpath,
int  flags 
)

Definition at line 230 of file init.cpp.

◆ nrn_register_mech_common()

void nrn_register_mech_common ( const char **  m,
Pvmp  alloc,
nrn_cur_t  cur,
nrn_jacob_t  jacob,
nrn_state_t  stat,
nrn_init_t  initialize,
int  nrnpointerindex,
int  vectorized 
)

Definition at line 468 of file init.cpp.

◆ nrn_writes_conc()

void nrn_writes_conc ( int  mechtype,
int  unused 
)

Definition at line 745 of file init.cpp.

◆ nrnunit_use_legacy()

void nrnunit_use_legacy ( )

Definition at line 1267 of file init.cpp.

◆ point_reg_helper()

int point_reg_helper ( Symbol s2)

Definition at line 1013 of file init.cpp.

◆ point_register_mech()

int point_register_mech ( const char **  m,
Pvmp  alloc,
nrn_cur_t  cur,
nrn_jacob_t  jacob,
nrn_state_t  stat,
nrn_init_t  initialize,
int  nrnpointerindex,
int  vectorized,
void *(*)(Object *)  constructor,
void(*)(void *)  destructor,
Member_func fmember 
)

Definition at line 1032 of file init.cpp.

◆ reallocate_mech_data()

void reallocate_mech_data ( int  mechtype)

Definition at line 597 of file init.cpp.

◆ register_destructor()

void register_destructor ( Pvmp  d)

Definition at line 1009 of file init.cpp.

◆ register_mech()

void register_mech ( const char **  m,
Pvmp  alloc,
nrn_cur_t  cur,
nrn_jacob_t  jacob,
nrn_state_t  stat,
nrn_init_t  initialize,
int  nrnpointerindex,
int  vectorized 
)

Definition at line 726 of file init.cpp.

◆ register_mech_vars()

void register_mech_vars ( const char **  var_buffers,
int  modltypemax,
Symbol mech_symbol,
int  mechtype,
int  nrnpointerindex 
)

Definition at line 511 of file init.cpp.

Variable Documentation

◆ _hoc_parm_limits

HocParmLimits _hoc_parm_limits[]
static
Initial value:
= {{"Ra", {1e-6, 1e9}},
{"L", {1e-4, 1e20}},
{"diam", {1e-9, 1e9}},
{"cm", {0., 1e9}},
{"rallbranch", {1., 1e9}},
{"nseg", {1., 1e9}},
{"celsius", {-273., 1e6}},
{"dt", {1e-9, 1e15}},
{nullptr, {0., 0.}}}

Definition at line 120 of file init.cpp.

◆ _hoc_parm_units

HocParmUnits _hoc_parm_units[]
static
Initial value:
= {{"Ra", "ohm-cm"},
{"L", "um"},
{"diam", "um"},
{"cm", "uF/cm2"},
{"celsius", "degC"},
{"dt", "ms"},
{"t", "ms"},
{"v", "mV"},
{"i_cap", "mA/cm2"},
{nullptr, nullptr}}

Definition at line 130 of file init.cpp.

◆ _ninits

int _ninits

Definition at line 1071 of file init.cpp.

◆ bamech_

BAMech** bamech_

Definition at line 151 of file init.cpp.

◆ banner

char banner[]
static
Initial value:
=
"Duke, Yale, and the BlueBrain Project -- Copyright 1984-2022\n\
See http://neuron.yale.edu/neuron/credits\n"

Definition at line 32 of file init.cpp.

◆ celsius

double celsius

Definition at line 110 of file init.cpp.

◆ CHKmes

char CHKmes[] = "The user defined name, %s, already exists\n"
static

Definition at line 103 of file init.cpp.

◆ clamp_resist

double clamp_resist

Definition at line 110 of file init.cpp.

◆ dt

double dt

Definition at line 110 of file init.cpp.

◆ hoc_default_dll_loaded_

double hoc_default_dll_loaded_
extern

Definition at line 225 of file hoc_init.cpp.

◆ htablemax

double htablemax

Definition at line 110 of file init.cpp.

◆ htablemin

double htablemin

Definition at line 110 of file init.cpp.

◆ memb_func

std::vector<Memb_func> memb_func

Definition at line 145 of file init.cpp.

◆ memb_func_size_

int memb_func_size_
static

Definition at line 144 of file init.cpp.

◆ memb_list

std::vector<Memb_list> memb_list

Definition at line 146 of file init.cpp.

◆ memb_order_

short* memb_order_

Definition at line 147 of file init.cpp.

◆ morph_parm_default

std::vector<double> morph_parm_default {DEF_diam}
static

Definition at line 118 of file init.cpp.

◆ n_memb_func

int n_memb_func

Definition at line 448 of file init.cpp.

◆ nmodl_version_

char nmodl_version_[] = "7.7.0"
static

Definition at line 30 of file init.cpp.

◆ nrn_artcell_qindex_

short* nrn_artcell_qindex_

Definition at line 215 of file init.cpp.

◆ nrn_bbcore_read_

bbcore_write_t* nrn_bbcore_read_

Definition at line 174 of file init.cpp.

◆ nrn_bbcore_write_

bbcore_write_t* nrn_bbcore_write_

Definition at line 173 of file init.cpp.

◆ nrn_dparam_ptr_end_

int* nrn_dparam_ptr_end_

Definition at line 165 of file init.cpp.

◆ nrn_dparam_ptr_start_

int* nrn_dparam_ptr_start_

Definition at line 164 of file init.cpp.

◆ nrn_fornetcon_cnt_

int nrn_fornetcon_cnt_

Definition at line 201 of file init.cpp.

◆ nrn_fornetcon_index_

int* nrn_fornetcon_index_

Definition at line 203 of file init.cpp.

◆ nrn_fornetcon_type_

int* nrn_fornetcon_type_

Definition at line 202 of file init.cpp.

◆ nrn_global_ncell

int nrn_global_ncell = 0

Definition at line 114 of file init.cpp.

◆ nrn_has_net_event_

int* nrn_has_net_event_

Definition at line 161 of file init.cpp.

◆ nrn_has_net_event_cnt_

int nrn_has_net_event_cnt_

Definition at line 160 of file init.cpp.

◆ nrn_is_artificial_

short* nrn_is_artificial_

Definition at line 214 of file init.cpp.

◆ nrn_istty_

int nrn_istty_
extern

Definition at line 778 of file hoc.cpp.

◆ nrn_load_dll_called_

Symlist* nrn_load_dll_called_
extern

Definition at line 17 of file hocusr.cpp.

◆ nrn_mech2funcs_map

std::unordered_map<int, NPyDirectMechFuncs> nrn_mech2funcs_map

Definition at line 963 of file init.cpp.

◆ nrn_mech_inst_destruct

std::unordered_map<int, void (*)(Prop*)> nrn_mech_inst_destruct

Definition at line 167 of file init.cpp.

◆ nrn_netrec_state_adjust

int nrn_netrec_state_adjust = 0

Definition at line 111 of file init.cpp.

◆ nrn_nmodl_filename_

const char** nrn_nmodl_filename_

Definition at line 189 of file init.cpp.

◆ nrn_nmodl_text_

const char** nrn_nmodl_text_

Definition at line 184 of file init.cpp.

◆ nrn_nobanner_

int nrn_nobanner_
extern

Definition at line 117 of file init.cpp.

◆ nrn_pnt_template_

cTemplate** nrn_pnt_template_

Definition at line 153 of file init.cpp.

◆ nrn_prop_dparam_size_

int* nrn_prop_dparam_size_

Definition at line 163 of file init.cpp.

◆ nrn_prop_param_size_

int* nrn_prop_param_size_

Definition at line 162 of file init.cpp.

◆ nrn_sparse_partrans

int nrn_sparse_partrans = 0

Definition at line 112 of file init.cpp.

◆ nrn_watch_allocate_

NrnWatchAllocateFunc_t* nrn_watch_allocate_

Definition at line 166 of file init.cpp.

◆ nrnpy_reg_mech_p_

void(* nrnpy_reg_mech_p_) (int) ( int  )

Definition at line 105 of file init.cpp.

◆ pnt_map

char* pnt_map

Definition at line 150 of file init.cpp.

◆ pnt_receive

pnt_receive_t* pnt_receive

Definition at line 155 of file init.cpp.

◆ pnt_receive_init

pnt_receive_init_t* pnt_receive_init

Definition at line 156 of file init.cpp.

◆ pnt_receive_size

short* pnt_receive_size

Definition at line 157 of file init.cpp.

◆ point_process

Point_process** point_process

Definition at line 149 of file init.cpp.

◆ pointsym

Symbol** pointsym

Definition at line 148 of file init.cpp.

◆ pointtype

int pointtype = 1
static

Definition at line 447 of file init.cpp.

◆ scdoub

DoubScal scdoub[] = {{"t", &t}, {"dt", &dt}, {nullptr, nullptr}}
static

Definition at line 306 of file init.cpp.

◆ secondorder

int secondorder = 0

Definition at line 107 of file init.cpp.

◆ section_list

hoc_List* section_list

Definition at line 113 of file init.cpp.

◆ state_discon_allowed_

int state_discon_allowed_

Definition at line 108 of file init.cpp.

◆ state_discon_flag_

int state_discon_flag_ = 0

Definition at line 1084 of file init.cpp.

◆ t

double t

Definition at line 110 of file init.cpp.