source: project/release/4/nemo/trunk/templates/NEST-accessors_modifiers.tmpl @ 31520

Last change on this file since 31520 was 31520, checked in by Ivan Raikov, 5 years ago

nemo: completed refactoring of nest backend to template form

File size: 1.8 KB
Line 
1
2void {{modelName}}::Parameters_::get (DictionaryDatum &d) const
3{
4
5{% for parameterDef in parameters.parameterDefs %}
6   def<double_t>(d, "{{parameterDef.name}}", {{parameterDef.name}});
7{% endfor %}   
8
9{% for defaultDef in parameters.defaultDefs %}
10   def<double_t>(d, "{{defaultDef.name}}", {{defaultDef.name}});
11{% endfor %}   
12   
13}
14
15
16void {{modelName}}::Parameters_::set (const DictionaryDatum &d)
17{
18
19{% for parameterDef in parameters.parameterDefs %}
20   updateValue<double_t>(d, "{{parameterDef.name}}", {{parameterDef.name}});
21
22{% if parameterDef.scale %}
23   {{parameterDef.name}} = {{parameterDef.scale}} * {{parameterDef.name}};
24
25{% endif %}   
26{% endfor %}   
27
28
29{% for defaultDef in parameters.defaultDefs %}
30   updateValue<double_t>(d, "{{defaultDef.name}}", {{defaultDef.name}});
31
32{% if defaultDef.scale %}
33   {{defaultDef.name}} = {{defaultDef.scale}} * {{defaultDef.name}};
34
35{% endif %}   
36{% endfor %}   
37
38
39{% for eq in defaultEqDefs %}
40   {{eq}}
41
42{% endfor %}   
43
44}
45
46
47void {{modelName}}::State_::get (DictionaryDatum &d) const
48{
49
50{% for stateDef in stateDefs %}
51   def<double_t>(d, "{{stateDef.name}}", y_[{{attr(stateIndexMap,stateDef.name)}}]);
52
53{% endfor %}   
54   
55{% if hasattr(stateIndexMap,"v") %}
56   def<double_t>(d, names::V_m, y_[{{attr(stateIndexMap,name)}}]);
57
58{% endfor %}   
59   
60}
61
62   
63void {{modelName}}::State_::set (const DictionaryDatum &d, const Parameters_&)
64{
65
66{% for stateDef in stateDefs %}
67   updateValue<double_t>(d, "{{stateDef.name}}", y_[{{attr(stateIndexMap,stateDef.name)}}]);
68
69{% if stateDef.scale %}
70   {{stateDef.name}} = {{stateDef.scale}} * {{stateDef.name}};
71
72{% endif %}   
73{% endfor %}   
74
75{% if hasattr(stateIndexMap,"v") %}
76   updateValue<double_t>(d, names::V_m, y_[{{attr(stateIndexMap,name)}}]);
77
78{% endfor %}   
79   
80}
81
Note: See TracBrowser for help on using the repository browser.