1 #include <../../nrnconf.h>
17 "%s<%d>(_slist%d, neuron::scopmath::row_view{_ml, _iml}, %s_wrapper_returning_int, "
35 " error = %s(%d, _coef%d, neuron::scopmath::row_view{_ml, _iml}, _slist%d);\n",
68 "static void %s();\nstatic int %s_wrapper_returning_int() { %s(); return 42; }",
78 diag(
"NONLINEAR merging not implemented", (
char*) 0);
102 "for(_i=0;_i<%d;_i++){\n _slist%d[%d+_i] = {%s_columnindex, _i};}\n",
118 char* eqtype =
SYM(
ITM(lq))->name;
119 if (strcmp(eqtype,
"~+") == 0) {
121 diag(
"no previous equation for adding terms", (
char*) 0);
124 }
else if (eqtype[0] ==
'D') {
126 int count_deriv =
SYM(
ITM(lq))->araydim;
128 counte += count_deriv;
136 if (counte != counts) {
137 Sprintf(
buf,
"Number of equations, %d, does not equal number, %d", counte, counts);
143 "if(_counte != %d) printf( \"Number of equations, %%d,\
144 does not equal number of states, %d\", _counte + 1);\n",
151 diag(
"NONLINEAR contains no equations", (
char*) 0);
155 "static neuron::container::field_index _slist%d[%d]; static double _dlist%d[%d];\n",
161 Sprintf(
buf,
"static neuron::container::field_index _slist%d[%d];\n",
numlist, counts);
180 q =
insertstr(q3,
"{ static int _recurse = 0;\n int _counte = -1;\n");
183 " auto* _savstate%d =_thread[_dith%d].get<double*>();\n"
184 " auto* _dlist%d = _thread[_dith%d].get<double*>() + %d;\n"
185 " int _counte = -1;\n",
192 Insertstr(q3,
"if (!_recurse) {\n _recurse = 1;\n");
195 "error = newton<%d>(_slist%d, neuron::scopmath::row_view{_ml, _iml}, %s, _dlist%d);\n",
202 "error = nrn_newton_thread(_newtonspace%d, %d, _slist%d, "
203 "neuron::scopmath::row_view{_ml, _iml}, %s, _dlist%d, _ml,"
204 " _iml, _ppvar, _thread, _globals, _nt);\n",
211 Insertstr(q3,
"_recurse = 0; if(error) {abort_run(error);}}\n");
241 if (strcmp(
SYM(q1)->
name,
"~+") == 0) {
268 "for(_i=0;_i<%d;_i++){_slist%d[%d+_i] = {%s_columnindex, _i};}\n",
303 }
else if (pstate == 0) {
307 diag(
"more than one state in preceding term", (
char*) 0);
333 if ((
s->subtype &
STAT) &&
s->used) {
345 "if(_counte != %d) printf( \"Number of equations, %%d,\
346 does not equal number of states, %d\", _counte + 1);\n",
354 "static neuron::container::field_index _slist%d[%d];static double **_coef%d;\n",
char * qconcat(Item *q1, Item *q2)
#define ITERATE(itm, lst)
void movelist(Item *q1, Item *q2, List *s)
Item * linsertstr(List *list, const char *str)
void replacstr(Item *q, const char *s)
void deltokens(Item *q1, Item *q2)
Item * insertstr(Item *item, const char *str)
Item * lappendsym(List *list, Symbol *sym)
void freelist(List *list)
List * newlist()
The following routines support the concept of a list.
int Sprintf(char(&buf)[N], const char *fmt, Args &&... args)
Redirect sprintf to snprintf if the buffer size can be deduced.
void slist_data(Symbol *s, int indx, int findx)
void vectorize_substitute(Item *q, const char *str)
NMODL parser global flags / functions.
void init_linblk(Item *q)
int in_solvefor(Symbol *s)
void lin_state_term(Item *q1, Item *q2)
void massage_linblk(Item *q1, Item *q2, Item *q3, Item *q4)
int nonlin_common(Item *)
Item * mixed_eqns(Item *q2, Item *q3, Item *q4)
static void freeqnqueue()
void massagenonlin(Item *q1, Item *q2, Item *q3, Item *q4)
void init_lineq(Item *q1)
void solv_lineq(Item *qsol, Symbol *fun, Symbol *method, int numeqn, int listnum)
void solv_nonlin(Item *qsol, Symbol *fun, Symbol *method, int numeqn, int listnum)
void linterm(Item *q1, Item *q2, int pstate, int sign)