Debian Codegraph @

brian2/devices/cpp_standalone/templates/synapses_push_spikes.cpp

raw
1 {# USES_VARIABLES { _n_sources, _n_targets, delay, _source_dt} #}
2
3 {% extends 'common_group.cpp' %}
4
5 {% block before_code %}
6 {% set scalar = c_data_type(variables['delay'].dtype) %}
7 std::vector<{{scalar}}> &real_delays = {{get_array_name(variables['delay'], access_data=False)}};
8 {{scalar}}* real_delays_data = real_delays.empty() ? 0 : &(real_delays[0]);
9 int32_t* sources = {{owner.name}}.sources.empty() ? 0 : &({{owner.name}}.sources[0]);
10 const size_t n_delays = real_delays.size();
11 const size_t n_synapses = {{owner.name}}.sources.size();
12 {{owner.name}}.prepare({{constant_or_scalar('_n_sources', variables['_n_sources'])}},
13 {{constant_or_scalar('_n_targets', variables['_n_targets'])}},
14 real_delays_data, n_delays, sources,
15 n_synapses,
16 {{_source_dt}});
17 {% endblock %}
18
19 {% block maincode %}
20 // we do advance at the beginning rather than at the end because it saves us making
21 // a copy of the current spiking synapses
22 {# Get the name of the array that stores these events (e.g. the spikespace array) #}
23 {% set _eventspace = get_array_name(eventspace_variable) %}
24 {{openmp_pragma('parallel')}}
25 {
26 {{owner.name}}.advance();
27 {{owner.name}}.push({{_eventspace}}, {{_eventspace}}[_num{{eventspace_variable.name}}-1]);
28 }
29 {% endblock %}