File tree Expand file tree Collapse file tree 3 files changed +47
-3
lines changed
pynestml/codegeneration/resources_nest/point_neuron/directives Expand file tree Collapse file tree 3 files changed +47
-3
lines changed Original file line number Diff line number Diff line change @@ -15,15 +15,15 @@ inline double get_state_element(size_t elem)
15
15
else if
16
16
{% - endif %}
17
17
18
- {% - if loop .index != len %}
18
+ {% - if len == 1 or loop .index < len %}
19
19
{% - if variable .has_vector_parameter () %}
20
20
{% - set size = variable .get_vector_parameter () %}
21
21
{% - if size |int == 0 %}
22
22
{% - set size = printer .print_vector_size_parameter (variable ) %}
23
23
{% - endif -%}
24
24
(elem >= State_::{{names.name(variable).upper()}} && elem < State_::{{names.name(variable).upper()}} + {{size}})
25
25
{
26
- return S_.{{names.name(variable)}}[ elem - State_::{{names.name(variable).upper()}}];
26
+ return S_.{{names.name(variable)}}[ elem - State_::{{names.name(variable).upper()}} ];
27
27
}
28
28
{% - else %}
29
29
(elem == State_::{{names.name(variable).upper()}})
@@ -34,7 +34,7 @@ inline double get_state_element(size_t elem)
34
34
{% - else %}
35
35
{% - if variable .has_vector_parameter () %}
36
36
{
37
- return S_.{{names.name(variable)}}[ elem - State_::{{names.name(variable).upper()}}];
37
+ return S_.{{names.name(variable)}}[ elem - State_::{{names.name(variable).upper()}} ];
38
38
}
39
39
{% - else %}
40
40
{
Original file line number Diff line number Diff line change
1
+ """
2
+
3
+ SimpleVectorsModel.nestml
4
+ #########################
5
+
6
+ Copyright statement
7
+ +++++++++++++++++++
8
+
9
+ This file is part of NEST.
10
+
11
+ Copyright (C) 2004 The NEST Initiative
12
+
13
+ NEST is free software: you can redistribute it and/or modify
14
+ it under the terms of the GNU General Public License as published by
15
+ the Free Software Foundation, either version 2 of the License, or
16
+ (at your option) any later version.
17
+
18
+ NEST is distributed in the hope that it will be useful,
19
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
20
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
+ GNU General Public License for more details.
22
+
23
+ You should have received a copy of the GNU General Public License
24
+ along with NEST. If not, see <http://www.gnu.org/licenses/>.
25
+
26
+ """
27
+
28
+ neuron simple_vectors_model:
29
+ state:
30
+ g_ex [20] real = 1.2
31
+ end
32
+
33
+ update:
34
+ g_ex[2] = 10.5
35
+ end
36
+ end
Original file line number Diff line number Diff line change 22
22
import unittest
23
23
24
24
from pynestml .codegeneration .nest_code_generator import NESTCodeGenerator
25
+ from pynestml .frontend .pynestml_frontend import generate_nest_target
25
26
26
27
from pynestml .utils .model_parser import ModelParser
27
28
@@ -72,6 +73,13 @@ def test_vector_code_generation(self):
72
73
nestCodeGenerator = NESTCodeGenerator ()
73
74
nestCodeGenerator .generate_code (compilation_unit .get_neuron_list ())
74
75
76
+ def test_vector_code_generation_and_build (self ):
77
+ input_path = str (os .path .realpath (os .path .join (os .path .dirname (__file__ ), "resources" ,
78
+ "SimpleVectorsModel.nestml" )))
79
+ generate_nest_target (input_path = input_path ,
80
+ target_path = self .target_path ,
81
+ logging_level = "INFO" )
82
+
75
83
def tearDown (self ) -> None :
76
84
import shutil
77
85
shutil .rmtree (self .target_path )
You can’t perform that action at this time.
0 commit comments