{# NEST steady state template This template defines a C++ function of the form: int modelName_steadystate (N_Vector u, N_Vector f, void* pnode) if using the KINSOL solver, or int modelName_steadystate (const gsl_vector *u, void *pnode, gsl_vector *f) if using the GSL steady state solver. The function computes the derivatives of all states defined in the system. Template variables are: - ODEmethod: the current used solver method; can be "cvode" "ida" or "gsl" - modelName: the name of the current system - vars: list of strings with the name of all local variables appearing in the system - SSgetStateDefs - equations of the form "n = u[i]" where "n" is the name of a state, and "i" is the index corresponding to that state in the steady state vector. - initOrder - topologically sorted list of strings with external, assignment, initial, pool equations in C++ syntax - SScurrentEqDefs - equations of the form "i_{{name}} = 0.0" that set all ionic currents to 0 - SSsetStateDefsLbs - list of objects of with the following fields: - lbs - local variables used in steady state expressions - defs - list of equations of the form "f[i] = rhs" where "i" is the index of a state, and "rhs" is the corresponding derivative expr for that state #} {% if (SSmethod == "kinsol") %} extern "C" int {{modelName}}_steadystate (N_Vector u, N_Vector f, void* pnode) {% else %} extern "C" int {{modelName}}_steadystate (const gsl_vector *u, void *pnode, gsl_vector *f) {% endif %} { {% if (not (steadystate.localVars == [])) %} double {{steadystate.localVars | join(", ")}}; {% endif %} // params is a reference to the model parameters const struct {{modelName}}::Parameters_ *params = (struct {{modelName}}::Parameters_ *)pnode; {% for parameterDef in steadystate.parameterDefs %} {{parameterDef}} {% endfor %} {% for eq in steadystate.SSgetStateDefs %} {{eq}} {% endfor %} {% for eq in steadystate.SScurrentEqDefs %} {{eq}} {% endfor %} {% for eq in init.initOrder %} {{eq}} {% endfor %} {% for x in steadystate.SSsetStateDefsLbs %} {% if (not (x.lbs == [])) %} double {{x.lbs | join(", ")}}; {% endif %} {% for eq in x.defs %} {{eq}} {% endfor %} {% endfor %} return 0; }