Skip to content

Commit

Permalink
Changes for '1uc/improve-usecase-func'. (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
1uc authored Feb 28, 2024
1 parent 86ea3be commit 01cd8b6
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 33 deletions.
10 changes: 5 additions & 5 deletions func_proc/coreneuron/func_proc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}


Expand Down
31 changes: 17 additions & 14 deletions func_proc/neuron/func_proc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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 */
Expand All @@ -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{};
Expand Down Expand Up @@ -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;
Expand All @@ -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);
}

Expand Down Expand Up @@ -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;
}


Expand Down
10 changes: 5 additions & 5 deletions func_proc_pnt/coreneuron/func_proc_pnt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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;
}


Expand Down
18 changes: 9 additions & 9 deletions func_proc_pnt/neuron/func_proc_pnt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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 */
Expand All @@ -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) {
Expand Down Expand Up @@ -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;
Expand All @@ -235,7 +235,7 @@ namespace neuron {
_ppvar = _nrn_mechanism_access_dparam(_p);
_thread = _extcall_thread.data();
_nt = static_cast<NrnThread*>(_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);
}

Expand All @@ -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;
}


Expand Down

0 comments on commit 01cd8b6

Please sign in to comment.