Debian Codegraph @

brian2/devices/cpp_standalone/templates/group_variable_set_conditional.cpp

raw
1 {% extends 'common_group.cpp' %}
2 {# USES_VARIABLES { N } #}
3
4 {% block maincode %}
5 //// MAIN CODE ////////////
6 // scalar code
7 const size_t _vectorisation_idx = -1;
8 {# Note that the scalar_code['statement'] will not write to any scalar
9 variables (except if the condition is simply 'True' and no vector code
10 is present), it will only read in scalar variables that are used by the
11 vector code. #}
12 {{scalar_code['condition']|autoindent}}
13 {{scalar_code['statement']|autoindent}}
14
15 {# N is a constant in most cases (NeuronGroup, etc.), but a scalar array for
16 synapses, we therefore have to take care to get its value in the right
17 way. #}
18 const int _N = {{constant_or_scalar('N', variables['N'])}};
19
20 {{ openmp_pragma('parallel-static') }}
21 for(int _idx=0; _idx<_N; _idx++)
22 {
23 // vector code
24 const size_t _vectorisation_idx = _idx;
25 {{vector_code['condition']|autoindent}}
26 if (_cond)
27 {
28 {{vector_code['statement']|autoindent}}
29 }
30 }
31 {% endblock %}