@@ -156,7 +156,7 @@ fun->name, listnum, maxerr_str);
156156 }else{
157157 Sprintf(buf,
158158 " if (!_thread[_spth%d]._pvoid) {\n"
159- " _thread[_spth%d]._pvoid = nrn_cons_sparseobj(_kinetic_ %s%s, %d, _ml, _threadargs_);\n"
159+ " _thread[_spth%d]._pvoid = nrn_cons_sparseobj(%s%s{} , %d, _ml, _threadargs_);\n"
160160 " #ifdef _OPENACC\n"
161161 " if (_nt->compute_gpu) {\n"
162162 " void* _d_so = (void*) acc_deviceptr(_thread[_spth%d]._pvoid);\n"
@@ -177,39 +177,13 @@ dindepname, fun->name, listnum, listnum);
177177 replacstr(qsol, buf);
178178#if VECTORIZE
179179 if (method->subtype & DERF) { /* derivimplicit */
180- Sprintf(buf,
181- "\n"
182- " #if !defined(_%s_%s%s)\n"
183- " #define _%s_%s%s 0\n"
184- " #endif\n"
185- " %s%s_thread(%d, _slist%d, _dlist%d, _%s_%s%s, _threadargs_);\n",
186- method->name, fun->name, suffix, method->name, fun->name,
187- suffix, ssprefix, method->name,
188- numeqn, listnum, listnum, method->name, fun->name, suffix);
180+ Sprintf(buf, "\n %s%s_thread(%d, _slist%d, _dlist%d, %s%s{}, _threadargs_);\n",
181+ ssprefix, method->name, numeqn, listnum, listnum, fun->name, suffix);
189182 vectorize_substitute(qsol, buf);
190-
191- // euler_thread is defined externally and need a callback function
192- // selection of callback is using switch-case implemented in _kinderiv.h
193- if(strcmp(method->name, "euler") == 0) {
194- Sprintf(buf,
195- "\n"
196- "/* _euler_ %s %s */\n"
197- "#ifndef INSIDE_NMODL\n"
198- "#define INSIDE_NMODL\n"
199- "#endif\n"
200- , fun->name, suffix);
201- Linsertstr(procfunc, buf);
202- }
203-
204183 }else{ /* kinetic */
205184 if (vectorize) {
206185Sprintf(buf,
207- "\n"
208- " #if !defined(_kinetic_%s%s)\n"
209- " #define _kinetic_%s%s 0\n"
210- " #endif\n"
211- " %s%s_thread((SparseObj*)_thread[_spth%d]._pvoid, %d, _slist%d, _dlist%d, &%s, %s, _kinetic_%s%s, _linmat%d, _threadargs_);\n",
212- fun->name, suffix, fun->name, suffix,
186+ "\n %s%s_thread(static_cast<SparseObj*>(_thread[_spth%d]._pvoid), %d, _slist%d, _dlist%d, &%s, %s, %s%s{}, _linmat%d, _threadargs_);\n",
213187ssprefix, method->name, listnum, numeqn, listnum, listnum, indepsym->name,
214188dindepname, fun->name, suffix, listnum);
215189 vectorize_substitute(qsol, buf);
@@ -536,15 +510,15 @@ void massagederiv(q1, q2, q3, q4, sensused)
536510 /* all this junk is still in the intoken list */
537511 Sprintf(buf, "static inline int %s(_threadargsproto_);\n", SYM(q2)->name);
538512 if (deriv_implicit_really == 1) {
539- Sprintf(buf, "extern int %s( _threadargsproto_);\n", SYM(q2)->name);
513+ Sprintf(buf, "struct %s%s {\n int operator()( _threadargsproto_) const ;\n};\n ", SYM(q2)->name, suffix );
540514 }
541515 Linsertstr(procfunc, buf);
542516 if (deriv_implicit_really == 1) {
543517 replacstr(q1, "\nint"); q = insertstr(q3, "() {_reset=0;\n");
544518 }else{
545519 replacstr(q1, "\nstatic int"); q = insertstr(q3, "() {_reset=0;\n");
546520 }
547- vectorize_substitute(q, "( _threadargsproto_) { int _reset=0; int error = 0;\n");
521+ vectorize_substitute(q, "::operator()( _threadargsproto_) const {\n int _reset=0;\n int error = 0;\n");
548522
549523 if (derfun->subtype & DERF && derfun->u.i) {
550524 diag("DERIVATIVE merging not implemented", (char *)0);
0 commit comments