File: group_variable_set_conditional.pyx

package info (click to toggle)
brian 2.9.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,872 kB
  • sloc: python: 51,820; cpp: 2,033; makefile: 108; sh: 72
file content (22 lines) | stat: -rw-r--r-- 650 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
{# USES_VARIABLES { N } #}
{# ALLOWS_SCALAR_WRITE #}
{% extends 'common_group.pyx' %}

{% block maincode %}
    cdef size_t _N = {{constant_or_scalar('N', variables['N'])}}
    _vectorisation_idx = 1
    
    {{scalar_code['condition']|autoindent}}
    {{scalar_code['statement']|autoindent}}

    for _idx in range(_N):
        _vectorisation_idx = _idx
        
        {{vector_code['condition']|autoindent}}
        if _cond:
            # this looks silly but is necessary to avoid an error if there is
            # no vector code (setting a scalar variable)
            pass
            {{vector_code['statement']|autoindent}}

{% endblock %}