source: project/release/4/nemo/trunk/templates/NEST-ida-event.tmpl @ 31587

Last change on this file since 31587 was 31587, checked in by Ivan Raikov, 6 years ago

nemo: bug fixes in NEST templates

File size: 854 bytes
Line 
1   
2extern "C" int {{modelName}}_event (double t, N_Vector y, N_Vector yp, double *g, void* pnode)
3{
4  double v, vt; v = -1.0; vt = 0.0;
5
6  // S is shorthand for the type that describes the model state
7  typedef {{modelName}}::State_ S;
8           
9  // cast the node ptr to an object of the proper type
10  assert(pnode);
11  const {{modelName}} & node =  *(reinterpret_cast<{{modelName}}*>(pnode));
12     
13  // params is a reference to the model parameters
14  const struct {{modelName}}::Parameters_ *params;
15  params = &(node.P_);
16     
17  // state is a reference to the model state
18  const struct {{modelName}}::State_ *state;
19  state = &(node.S_);
20
21{% if (haskey(stateIndexMap,"v") and ("V_t" in defaultDefs)) %}     
22  v = Ith (y, {{attr(stateIndexMap,"v")}});
23  vt = params->V_t;
24  g[0] = v - vt;
25{% else %}
26  g[0] = -1.0;
27{% endif %}
28
29  return 0;
30}
Note: See TracBrowser for help on using the repository browser.