diff --git a/func_proc/coreneuron/func_proc.cpp b/func_proc/coreneuron/func_proc.cpp index 9b019fb..4c87abc 100644 --- a/func_proc/coreneuron/func_proc.cpp +++ b/func_proc/coreneuron/func_proc.cpp @@ -205,7 +205,7 @@ namespace coreneuron { } - inline double get_a_42_test_func_proc(int id, int pnodecount, test_func_proc_Instance* inst, double* data, const Datum* indexes, ThreadDatum* thread, NrnThread* nt, double v, double a); + inline double x_plus_a_test_func_proc(int id, int pnodecount, test_func_proc_Instance* inst, double* data, const Datum* indexes, ThreadDatum* thread, NrnThread* nt, double v, double a); inline int set_x_42_test_func_proc(int id, int pnodecount, test_func_proc_Instance* inst, double* data, const Datum* indexes, ThreadDatum* thread, NrnThread* nt, double v); inline int set_x_a_test_func_proc(int id, int pnodecount, test_func_proc_Instance* inst, double* data, const Datum* indexes, ThreadDatum* thread, NrnThread* nt, double v, double a); inline int set_a_x_test_func_proc(int id, int pnodecount, test_func_proc_Instance* inst, double* data, const Datum* indexes, ThreadDatum* thread, NrnThread* nt, double v); @@ -233,10 +233,10 @@ namespace coreneuron { } - inline double get_a_42_test_func_proc(int id, int pnodecount, test_func_proc_Instance* inst, double* data, const Datum* indexes, ThreadDatum* thread, NrnThread* nt, double v, double a) { - double ret_get_a_42 = 0.0; - ret_get_a_42 = a + 42.0; - return ret_get_a_42; + inline double x_plus_a_test_func_proc(int id, int pnodecount, test_func_proc_Instance* inst, double* data, const Datum* indexes, ThreadDatum* thread, NrnThread* nt, double v, double a) { + double ret_x_plus_a = 0.0; + ret_x_plus_a = inst->x[id] + a; + return ret_x_plus_a; } diff --git a/func_proc/neuron/func_proc.cpp b/func_proc/neuron/func_proc.cpp index 6168482..07af4cd 100644 --- a/func_proc/neuron/func_proc.cpp +++ b/func_proc/neuron/func_proc.cpp @@ -121,7 +121,7 @@ namespace neuron { hoc_retpushx(1.); } /* Mechanism procedures and functions */ - inline double get_a_42_test_func_proc(_nrn_mechanism_cache_range* _ml, size_t id, Datum* _ppvar, Datum* _thread, NrnThread* _nt, double a); + inline double x_plus_a_test_func_proc(_nrn_mechanism_cache_range* _ml, size_t id, Datum* _ppvar, Datum* _thread, NrnThread* _nt, double a); inline int set_x_42_test_func_proc(_nrn_mechanism_cache_range* _ml, size_t id, Datum* _ppvar, Datum* _thread, NrnThread* _nt); inline int set_x_a_test_func_proc(_nrn_mechanism_cache_range* _ml, size_t id, Datum* _ppvar, Datum* _thread, NrnThread* _nt, double a); inline int set_a_x_test_func_proc(_nrn_mechanism_cache_range* _ml, size_t id, Datum* _ppvar, Datum* _thread, NrnThread* _nt); @@ -143,11 +143,11 @@ namespace neuron { static void _hoc_set_x_42(void); static void _hoc_set_x_a(void); static void _hoc_set_a_x(void); - static void _hoc_get_a_42(void); + static void _hoc_x_plus_a(void); static double _npy_set_x_42(Prop*); static double _npy_set_x_a(Prop*); static double _npy_set_a_x(Prop*); - static double _npy_get_a_42(Prop*); + static double _npy_x_plus_a(Prop*); /* connect user functions to hoc names */ @@ -156,14 +156,14 @@ namespace neuron { {"set_x_42_test_func_proc", _hoc_set_x_42}, {"set_x_a_test_func_proc", _hoc_set_x_a}, {"set_a_x_test_func_proc", _hoc_set_a_x}, - {"get_a_42_test_func_proc", _hoc_get_a_42}, + {"x_plus_a_test_func_proc", _hoc_x_plus_a}, {0, 0} }; static NPyDirectMechFunc npy_direct_func_proc[] = { {"set_x_42", _npy_set_x_42}, {"set_x_a", _npy_set_x_a}, {"set_a_x", _npy_set_a_x}, - {"get_a_42", _npy_get_a_42}, + {"x_plus_a", _npy_x_plus_a}, }; static void _hoc_set_x_42(void) { double _r{}; @@ -267,22 +267,25 @@ namespace neuron { set_a_x_test_func_proc(_ml, id, _ppvar, _thread, _nt); return(_r); } - static void _hoc_get_a_42(void) { + static void _hoc_x_plus_a(void) { double _r{}; Datum* _ppvar; Datum* _thread; NrnThread* _nt; - Prop* _local_prop = _prop_id ? _extcall_prop : nullptr; + if (!_prop_id) { + hoc_execerror("No data for x_plus_a_test_func_proc. Requires prior call to setdata_test_func_proc and that the specified mechanism instance still be in existence.", NULL); + } + Prop* _local_prop = _extcall_prop; _nrn_mechanism_cache_instance _ml_real{_local_prop}; auto* const _ml = &_ml_real; size_t const id{}; _ppvar = _local_prop ? _nrn_mechanism_access_dparam(_local_prop) : nullptr; _thread = _extcall_thread.data(); _nt = nrn_threads; - _r = get_a_42_test_func_proc(_ml, id, _ppvar, _thread, _nt, *getarg(1)); + _r = x_plus_a_test_func_proc(_ml, id, _ppvar, _thread, _nt, *getarg(1)); hoc_retpushx(_r); } - static double _npy_get_a_42(Prop* _prop) { + static double _npy_x_plus_a(Prop* _prop) { double _r{}; Datum* _ppvar; Datum* _thread; @@ -293,7 +296,7 @@ namespace neuron { _ppvar = _nrn_mechanism_access_dparam(_prop); _thread = _extcall_thread.data(); _nt = nrn_threads; - _r = get_a_42_test_func_proc(_ml, id, _ppvar, _thread, _nt, *getarg(1)); + _r = x_plus_a_test_func_proc(_ml, id, _ppvar, _thread, _nt, *getarg(1)); return(_r); } @@ -323,11 +326,11 @@ namespace neuron { } - inline double get_a_42_test_func_proc(_nrn_mechanism_cache_range* _ml, size_t id, Datum* _ppvar, Datum* _thread, NrnThread* _nt, double a) { + inline double x_plus_a_test_func_proc(_nrn_mechanism_cache_range* _ml, size_t id, Datum* _ppvar, Datum* _thread, NrnThread* _nt, double a) { auto inst = make_instance_test_func_proc(*_ml); - double ret_get_a_42 = 0.0; - ret_get_a_42 = a + 42.0; - return ret_get_a_42; + double ret_x_plus_a = 0.0; + ret_x_plus_a = inst.x[id] + a; + return ret_x_plus_a; } diff --git a/func_proc_pnt/coreneuron/func_proc_pnt.cpp b/func_proc_pnt/coreneuron/func_proc_pnt.cpp index 9644888..4ebe283 100644 --- a/func_proc_pnt/coreneuron/func_proc_pnt.cpp +++ b/func_proc_pnt/coreneuron/func_proc_pnt.cpp @@ -210,7 +210,7 @@ namespace coreneuron { } - inline double get_a_42_test_func_proc_pnt(int id, int pnodecount, test_func_proc_pnt_Instance* inst, double* data, const Datum* indexes, ThreadDatum* thread, NrnThread* nt, double v, double a); + inline double x_plus_a_test_func_proc_pnt(int id, int pnodecount, test_func_proc_pnt_Instance* inst, double* data, const Datum* indexes, ThreadDatum* thread, NrnThread* nt, double v, double a); inline int set_x_42_test_func_proc_pnt(int id, int pnodecount, test_func_proc_pnt_Instance* inst, double* data, const Datum* indexes, ThreadDatum* thread, NrnThread* nt, double v); inline int set_x_a_test_func_proc_pnt(int id, int pnodecount, test_func_proc_pnt_Instance* inst, double* data, const Datum* indexes, ThreadDatum* thread, NrnThread* nt, double v, double a); @@ -229,10 +229,10 @@ namespace coreneuron { } - inline double get_a_42_test_func_proc_pnt(int id, int pnodecount, test_func_proc_pnt_Instance* inst, double* data, const Datum* indexes, ThreadDatum* thread, NrnThread* nt, double v, double a) { - double ret_get_a_42 = 0.0; - ret_get_a_42 = a + 42.0; - return ret_get_a_42; + inline double x_plus_a_test_func_proc_pnt(int id, int pnodecount, test_func_proc_pnt_Instance* inst, double* data, const Datum* indexes, ThreadDatum* thread, NrnThread* nt, double v, double a) { + double ret_x_plus_a = 0.0; + ret_x_plus_a = inst->x[id] + a; + return ret_x_plus_a; } diff --git a/func_proc_pnt/neuron/func_proc_pnt.cpp b/func_proc_pnt/neuron/func_proc_pnt.cpp index 9ba13ea..694c4f8 100644 --- a/func_proc_pnt/neuron/func_proc_pnt.cpp +++ b/func_proc_pnt/neuron/func_proc_pnt.cpp @@ -143,7 +143,7 @@ namespace neuron { _setdata(_prop); } /* Mechanism procedures and functions */ - inline double get_a_42_test_func_proc_pnt(_nrn_mechanism_cache_range* _ml, size_t id, Datum* _ppvar, Datum* _thread, NrnThread* _nt, double a); + inline double x_plus_a_test_func_proc_pnt(_nrn_mechanism_cache_range* _ml, size_t id, Datum* _ppvar, Datum* _thread, NrnThread* _nt, double a); inline int set_x_42_test_func_proc_pnt(_nrn_mechanism_cache_range* _ml, size_t id, Datum* _ppvar, Datum* _thread, NrnThread* _nt); inline int set_x_a_test_func_proc_pnt(_nrn_mechanism_cache_range* _ml, size_t id, Datum* _ppvar, Datum* _thread, NrnThread* _nt, double a); @@ -163,7 +163,7 @@ namespace neuron { /* declaration of user functions */ static double _hoc_set_x_42(void*); static double _hoc_set_x_a(void*); - static double _hoc_get_a_42(void*); + static double _hoc_x_plus_a(void*); /* connect user functions to hoc names */ @@ -176,7 +176,7 @@ namespace neuron { {"get_loc", _hoc_get_loc_pnt}, {"set_x_42", _hoc_set_x_42}, {"set_x_a", _hoc_set_x_a}, - {"get_a_42", _hoc_get_a_42}, + {"x_plus_a", _hoc_x_plus_a}, {0, 0} }; static double _hoc_set_x_42(void* _vptr) { @@ -219,7 +219,7 @@ namespace neuron { set_x_a_test_func_proc_pnt(_ml, id, _ppvar, _thread, _nt, *getarg(1)); return(_r); } - static double _hoc_get_a_42(void* _vptr) { + static double _hoc_x_plus_a(void* _vptr) { double _r{}; Datum* _ppvar; Datum* _thread; @@ -235,7 +235,7 @@ namespace neuron { _ppvar = _nrn_mechanism_access_dparam(_p); _thread = _extcall_thread.data(); _nt = static_cast(_pnt->_vnt); - _r = get_a_42_test_func_proc_pnt(_ml, id, _ppvar, _thread, _nt, *getarg(1)); + _r = x_plus_a_test_func_proc_pnt(_ml, id, _ppvar, _thread, _nt, *getarg(1)); return(_r); } @@ -256,11 +256,11 @@ namespace neuron { } - inline double get_a_42_test_func_proc_pnt(_nrn_mechanism_cache_range* _ml, size_t id, Datum* _ppvar, Datum* _thread, NrnThread* _nt, double a) { + inline double x_plus_a_test_func_proc_pnt(_nrn_mechanism_cache_range* _ml, size_t id, Datum* _ppvar, Datum* _thread, NrnThread* _nt, double a) { auto inst = make_instance_test_func_proc_pnt(*_ml); - double ret_get_a_42 = 0.0; - ret_get_a_42 = a + 42.0; - return ret_get_a_42; + double ret_x_plus_a = 0.0; + ret_x_plus_a = inst.x[id] + a; + return ret_x_plus_a; }