Debian Codegraph @

brian2/devices/cpp_standalone/templates/summed_variable.cpp

raw
1 {# USES_VARIABLES { N } #}
2 {% extends 'common_group.cpp' %}
3
4 {% block maincode %}
5 {% set _target_var_array = get_array_name(_target_var) %}
6 {% set _index_array = get_array_name(_index_var) %}
7 //// MAIN CODE ////////////
8 {# This enables summed variables for connections to a synapse #}
9 const int _target_size = {{constant_or_scalar(_target_size_name, variables[_target_size_name])}};
10
11 // Set all the target variable values to zero
12 {{ openmp_pragma('parallel-static') }}
13 for (int _target_idx=0; _target_idx<_target_size; _target_idx++)
14 {
15 {{_target_var_array}}[_target_idx + {{_target_start}}] = 0;
16 }
17
18 // scalar code
19 const size_t _vectorisation_idx = -1;
20 {{scalar_code|autoindent}}
21
22 for(int _idx=0; _idx<{{N}}; _idx++)
23 {
24 // vector code
25 const size_t _vectorisation_idx = _idx;
26 {{vector_code|autoindent}}
27 {{_target_var_array}}[{{_index_array}}[_idx]] += _synaptic_var;
28 }
29 {% endblock %}