1 #include <../../nmodlconf.h> 14 Sprintf(
buf,
"%s(%d,_slist%d, _p, %s, _dlist%d);\n",
15 method->
name, numeqn, listnum, fun->
name, listnum);
25 Sprintf(
buf,
" 0; %s();\n error = %s(%d, _coef%d, _p, _slist%d);\n",
26 fun->
name, method->
name, numeqn, listnum, listnum);
63 diag(
"NONLINEAR merging not implemented", (
char *)0);
90 Sprintf(
buf,
"for(_i=0;_i<%d;_i++){_slist%d[%d+_i] = (%s + _i) - _p;}\n" 107 char *eqtype =
SYM(
ITM(lq))->name;
108 if (strcmp(eqtype,
"~+") == 0) {
110 diag(
"no previous equation for adding terms", (
char *)0);
113 }
else if (eqtype[0] ==
'D') {
115 int count_deriv =
SYM(
ITM(lq))->araydim;
117 counte += count_deriv;
125 if(counte != counts) {
126 Sprintf(
buf ,
"Number of equations, %d, does not equal number, %d", counte, counts);
131 Sprintf(
buf,
"if(_counte != %d) printf( \"Number of equations, %%d,\ 132 does not equal number of states, %d\", _counte + 1);\n",
138 diag(
"NONLINEAR contains no equations", (
char *)0);
141 Sprintf(
buf,
"static int _slist%d[%d]; static double _dlist%d[%d];\n",
164 q =
insertstr(q3,
"{ static int _recurse = 0;\n int _counte = -1;\n");
165 sprintf(
buf,
"{ double* _savstate%d = _thread[_dith%d]._pval;\n\ 166 double* _dlist%d = _thread[_dith%d]._pval + %d;\n int _counte = -1;\n",
170 Insertstr(q3,
"if (!_recurse) {\n _recurse = 1;\n");
171 Sprintf(
buf,
"error = newton(%d,_slist%d, _p, %s, _dlist%d);\n",
174 Sprintf(
buf,
"error = nrn_newton_thread(_newtonspace%d, %d,_slist%d, _p, %s, _dlist%d, _ppvar, _thread, _nt);\n",
177 Insertstr(q3,
"_recurse = 0; if(error) {abort_run(error);}}\n");
207 if (strcmp(
SYM(q1)->
name,
"~+") == 0) {
228 if (statsym->
used == 1) {
232 Sprintf(
buf,
"for(_i=0;_i<%d;_i++){_slist%d[%d+_i] = (%s + _i) - _p;}\n" 266 }
else if (pstate == 0) {
270 diag(
"more than one state in preceding term", (
char *)0);
285 diag(linblk->
name,
"has no equations");
308 Sprintf(
buf,
"if(_counte != %d) printf( \"Number of equations, %%d,\ 309 does not equal number of states, %d\", _counte + 1);\n",
315 Sprintf(
buf,
"static int _slist%d[%d];static double **_coef%d;\n",
318 Sprintf(
buf,
"\n#define _RHS%d(arg) _coef%d[arg][%d]\n",
321 Sprintf(
buf,
"if (_first) _coef%d = makematrix(%d, %d);\n",
324 Sprintf(
buf,
"zero_matrix(_coef%d, %d, %d);\n{\n",
void deltokens(Item *q1, Item *q2)
Item * mixed_eqns(Item *q2, Item *q3, Item *q4)
int in_solvefor(Symbol *s)
#define ITERATE(itm, lst)
Item * lappendsym(List *list, Symbol *sym)
void init_linblk(Item *q)
void sensmassage(int type, Item *qfun, int fn)
sprintf(buf," if (secondorder) {\ " int _i;\" " for(_i=0;_i< %d;++_i) {\" " _p[_slist%d[_i]]+=dt *_p[_dlist%d[_i]];\" " }}\", numeqn, listnum, listnum)
void init_lineq(Item *q1)
char * qconcat(Item *q1, Item *q2)
int nonlin_common(Item *, int)
void movelist(Item *q1, Item *q2, List *s)
void solv_nonlin(Item *qsol, Symbol *fun, Symbol *method, int numeqn, int listnum)
void vectorize_substitute(Item *q, char *str)
Item * linsertstr(List *list, char *str)
void massagenonlin(Item *q1, Item *q2, Item *q3, Item *q4, int sensused)
NMODL parser global flags / functions.
void solv_lineq(Item *qsol, Symbol *fun, Symbol *method, int numeqn, int listnum)
static void freeqnqueue()
void sens_nonlin_out(Item *q, Symbol *fun)
Item * insertstr(Item *item, char *str)
void freelist(List **plist)
void lin_state_term(Item *q1, Item *q2)
void replacstr(Item *q, char *s)
void massage_linblk(Item *q1, Item *q2, Item *q3, Item *q4, int sensused)
void slist_data(Symbol *s, int indx, int findx)
void add_sens_statelist(Symbol *)
void linterm(Item *q1, Item *q2, int pstate, int sign)