/* Created by Language version: 7.7.0 */ /* NOT VECTORIZED */ #define NRN_VECTORIZED 0 #include #include #include #include "mech_api.h" #undef PI #define nil 0 #define _pval pval // clang-format off #include "md1redef.h" #include "section_fwd.hpp" #include "nrniv_mf.h" #include "md2redef.h" #include "nrnconf.h" // clang-format on #include "neuron/cache/mechanism_range.hpp" #include using std::size_t; static auto& std_cerr_stream = std::cerr; static constexpr auto number_of_datum_variables = 2; static constexpr auto number_of_floating_point_variables = 6; namespace { template using _nrn_mechanism_std_vector = std::vector; using _nrn_model_sorted_token = neuron::model_sorted_token; using _nrn_mechanism_cache_range = neuron::cache::MechanismRange; using _nrn_mechanism_cache_instance = neuron::cache::MechanismInstance; using _nrn_non_owning_id_without_container = neuron::container::non_owning_identifier_without_container; template using _nrn_mechanism_field = neuron::mechanism::field; template void _nrn_mechanism_register_data_fields(Args&&... args) { neuron::mechanism::register_data_fields(std::forward(args)...); } } #if !NRNGPU #undef exp #define exp hoc_Exp #if NRN_ENABLE_ARCH_INDEP_EXP_POW #undef pow #define pow hoc_pow #endif #endif #define nrn_init _nrn_init__xtra #define _nrn_initial _nrn_initial__xtra #define nrn_cur _nrn_cur__xtra #define _nrn_current _nrn_current__xtra #define nrn_jacob _nrn_jacob__xtra #define nrn_state _nrn_state__xtra #define _net_receive _net_receive__xtra #define _threadargscomma_ /**/ #define _threadargsprotocomma_ /**/ #define _internalthreadargsprotocomma_ /**/ #define _threadargs_ /**/ #define _threadargsproto_ /**/ #define _internalthreadargsproto_ /**/ /*SUPPRESS 761*/ /*SUPPRESS 762*/ /*SUPPRESS 763*/ /*SUPPRESS 765*/ extern double *hoc_getarg(int); #define t nrn_threads->_t #define dt nrn_threads->_dt #define es _ml->template fpfield<0>(_iml) #define es_columnindex 0 #define x _ml->template fpfield<1>(_iml) #define x_columnindex 1 #define y _ml->template fpfield<2>(_iml) #define y_columnindex 2 #define z _ml->template fpfield<3>(_iml) #define z_columnindex 3 #define type _ml->template fpfield<4>(_iml) #define type_columnindex 4 #define order _ml->template fpfield<5>(_iml) #define order_columnindex 5 #define ex *_ppvar[0].get() #define _p_ex _ppvar[0].literal_value() #define area (*(_ml->dptr_field<1>(_iml))) static _nrn_mechanism_cache_instance _ml_real{nullptr}; static _nrn_mechanism_cache_range *_ml{&_ml_real}; static size_t _iml{0}; static Datum *_ppvar; static int hoc_nrnpointerindex = 0; static Prop* _extcall_prop; /* _prop_id kind of shadows _extcall_prop to allow validity checking. */ static _nrn_non_owning_id_without_container _prop_id{}; /* external NEURON variables */ /* declaration of user functions */ static int _mechtype; extern void _nrn_cacheloop_reg(int, int); extern void hoc_register_limits(int, HocParmLimits*); extern void hoc_register_units(int, HocParmUnits*); extern void nrn_promote(Prop*, int, int); #define NMODL_TEXT 1 #if NMODL_TEXT static void register_nmodl_text_and_filename(int mechtype); #endif static void _hoc_setdata(); /* connect user functions to hoc names */ static VoidFunc hoc_intfunc[] = { {"setdata_xtra", _hoc_setdata}, {0, 0} }; /* Direct Python call wrappers to density mechanism functions.*/ static NPyDirectMechFunc npy_direct_func_proc[] = { {0, 0} }; /* declare global and static user variables */ #define gind 0 #define _gth 0 #define stim stim_xtra double stim = 0; /* some parameters have upper and lower limits */ static HocParmLimits _hoc_parm_limits[] = { {0, 0, 0} }; static HocParmUnits _hoc_parm_units[] = { {"stim_xtra", "unitless"}, {"es_xtra", "mV"}, {"x_xtra", "1"}, {"y_xtra", "1"}, {"z_xtra", "1"}, {"type_xtra", "1"}, {"order_xtra", "1"}, {"ex_xtra", "millivolts"}, {0, 0} }; static double v = 0; /* connect global user variables to hoc */ static DoubScal hoc_scdoub[] = { {"stim_xtra", &stim_xtra}, {0, 0} }; static DoubVec hoc_vdoub[] = { {0, 0, 0} }; static double _sav_indep; static void _ba1(Node*_nd, Datum* _ppd, Datum* _thread, NrnThread* _nt, Memb_list* _ml, size_t _iml, _nrn_model_sorted_token const&); extern void _nrn_setdata_reg(int, void(*)(Prop*)); static void _setdata(Prop* _prop) { _extcall_prop = _prop; _prop_id = _nrn_get_prop_id(_prop); neuron::legacy::set_globals_from_prop(_prop, _ml_real, _ml, _iml); _ppvar = _nrn_mechanism_access_dparam(_prop); Node * _node = _nrn_mechanism_access_node(_prop); v = _nrn_mechanism_access_voltage(_node); } static void _hoc_setdata() { Prop *_prop, *hoc_getdata_range(int); _prop = hoc_getdata_range(_mechtype); _setdata(_prop); hoc_retpushx(1.); } static void nrn_alloc(Prop*); static void nrn_init(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int); static void nrn_state(_nrn_model_sorted_token const&, NrnThread*, Memb_list*, int); /* connect range variables in _p that hoc is supposed to know about */ static const char *_mechanism[] = { "7.7.0", "xtra", "es_xtra", "x_xtra", "y_xtra", "z_xtra", "type_xtra", "order_xtra", 0, 0, 0, "ex_xtra", 0}; extern Node* nrn_alloc_node_; /* Used by NrnProperty */ static _nrn_mechanism_std_vector _parm_default{ 0, /* es */ 0, /* x */ 0, /* y */ 0, /* z */ 0, /* type */ 0, /* order */ }; extern Prop* need_memb(Symbol*); static void nrn_alloc(Prop* _prop) { Prop *prop_ion{}; Datum *_ppvar{}; _ppvar = nrn_prop_datum_alloc(_mechtype, 2, _prop); _nrn_mechanism_access_dparam(_prop) = _ppvar; _nrn_mechanism_cache_instance _ml_real{_prop}; auto* const _ml = &_ml_real; size_t const _iml{}; assert(_nrn_mechanism_get_num_vars(_prop) == 6); /*initialize range parameters*/ es = _parm_default[0]; /* 0 */ x = _parm_default[1]; /* 0 */ y = _parm_default[2]; /* 0 */ z = _parm_default[3]; /* 0 */ type = _parm_default[4]; /* 0 */ order = _parm_default[5]; /* 0 */ assert(_nrn_mechanism_get_num_vars(_prop) == 6); _nrn_mechanism_access_dparam(_prop) = _ppvar; /*connect ionic variables to this model*/ _ppvar[1] = _nrn_mechanism_get_area_handle(nrn_alloc_node_); } static void _initlists(); extern Symbol* hoc_lookup(const char*); extern void _nrn_thread_reg(int, int, void(*)(Datum*)); void _nrn_thread_table_reg(int, nrn_thread_table_check_t); extern void hoc_register_tolerance(int, HocStateTolerance*, Symbol***); extern void _cvode_abstol( Symbol**, double*, int); extern "C" void _xtra_reg() { int _vectorized = 0; _initlists(); register_mech(_mechanism, nrn_alloc,nullptr, nullptr, nullptr, nrn_init, hoc_nrnpointerindex, 0); _mechtype = nrn_get_mechtype(_mechanism[1]); hoc_register_parm_default(_mechtype, &_parm_default); hoc_register_npy_direct(_mechtype, npy_direct_func_proc); _nrn_setdata_reg(_mechtype, _setdata); #if NMODL_TEXT register_nmodl_text_and_filename(_mechtype); #endif _nrn_mechanism_register_data_fields(_mechtype, _nrn_mechanism_field{"es"} /* 0 */, _nrn_mechanism_field{"x"} /* 1 */, _nrn_mechanism_field{"y"} /* 2 */, _nrn_mechanism_field{"z"} /* 3 */, _nrn_mechanism_field{"type"} /* 4 */, _nrn_mechanism_field{"order"} /* 5 */, _nrn_mechanism_field{"ex", "pointer"} /* 0 */, _nrn_mechanism_field{"area", "area"} /* 1 */); hoc_register_prop_size(_mechtype, 6, 2); hoc_register_dparam_semantics(_mechtype, 0, "pointer"); hoc_register_dparam_semantics(_mechtype, 1, "area"); hoc_reg_ba(_mechtype, _ba1, 11); hoc_register_var(hoc_scdoub, hoc_vdoub, hoc_intfunc); ivoc_help("help ?1 xtra /home/qh4os/neurenv/mech/xtra.mod\n"); hoc_register_limits(_mechtype, _hoc_parm_limits); hoc_register_units(_mechtype, _hoc_parm_units); } static int _reset; static const char *modelname = ""; static int error; static int _ninits = 0; static int _match_recurse=1; static void _modl_cleanup(){ _match_recurse=1;} /* BEFORE BREAKPOINT */ static void _ba1(Node*_nd, Datum* _ppd, Datum* _thread, NrnThread* _nt, Memb_list* _ml_arg, size_t _iml, _nrn_model_sorted_token const& _sorted_token) { _nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _ml_arg->_type()}; auto* const _ml = &_lmr; double* _globals = nullptr; if (gind != 0 && _thread != nullptr) { _globals = _thread[_gth].get(); } _ppvar = _ppd; v = NODEV(_nd); ex = stim * es ; } static void initmodel() { int _i; double _save;_ninits++; { { ex = stim * es ; } } } static void nrn_init(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type){ Node *_nd; double _v; int* _ni; int _cntml; _nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type}; auto* const _vec_v = _nt->node_voltage_storage(); _ml = &_lmr; _ni = _ml_arg->_nodeindices; _cntml = _ml_arg->_nodecount; for (_iml = 0; _iml < _cntml; ++_iml) { _ppvar = _ml_arg->_pdata[_iml]; _v = _vec_v[_ni[_iml]]; v = _v; initmodel(); }} static double _nrn_current(double _v){double _current=0.;v=_v;{ } return _current; } static void nrn_state(_nrn_model_sorted_token const& _sorted_token, NrnThread* _nt, Memb_list* _ml_arg, int _type){ Node *_nd; double _v = 0.0; int* _ni; int _cntml; _nrn_mechanism_cache_range _lmr{_sorted_token, *_nt, *_ml_arg, _type}; auto* const _vec_v = _nt->node_voltage_storage(); _ml = &_lmr; _ni = _ml_arg->_nodeindices; _cntml = _ml_arg->_nodecount; for (_iml = 0; _iml < _cntml; ++_iml) { _ppvar = _ml_arg->_pdata[_iml]; _nd = _ml_arg->_nodelist[_iml]; _v = _vec_v[_ni[_iml]]; v=_v; { }} } static void terminal(){} static void _initlists() { int _i; static int _first = 1; if (!_first) return; _first = 0; } #if NMODL_TEXT static void register_nmodl_text_and_filename(int mech_type) { const char* nmodl_filename = "/home/qh4os/neurenv/mech/xtra.mod"; const char* nmodl_file_text = ": $Id: xtra.mod,v 1.4 2014/08/18 23:15:25 ted Exp ted $\n" ": 2018/05/20 Modified by Aman Aberra \n" "\n" "NEURON {\n" " SUFFIX xtra\n" " RANGE es : (es = max amplitude of the potential) \n" " RANGE x, y, z, type, order\n" " GLOBAL stim : (stim = normalized waveform)\n" " POINTER ex \n" "}\n" "\n" "PARAMETER { \n" " es = 0 (mV)\n" " x = 0 (1) : spatial coords\n" " y = 0 (1)\n" " z = 0 (1) \n" " type = 0 (1) : numbering system for morphological category of section - unassigned is 0\n" " order = 0 (1) : order of branch/collateral. \n" "}\n" "\n" "ASSIGNED {\n" " v (millivolts)\n" " ex (millivolts)\n" " stim (unitless) \n" " area (micron2)\n" "}\n" "\n" "INITIAL {\n" " ex = stim*es \n" "}\n" "\n" "\n" "BEFORE BREAKPOINT { : before each cy' = f(y,t) setup\n" " ex = stim*es\n" "}\n" "\n" ; hoc_reg_nmodl_filename(mech_type, nmodl_filename); hoc_reg_nmodl_text(mech_type, nmodl_file_text); } #endif