Skip to content

Commit

Permalink
Partially revert unnecessarily complex fix introduced with eef7253
Browse files Browse the repository at this point in the history
It broke devices relying on the distinction between global and local array name.
Fixes #796
  • Loading branch information
mstimberg committed Jan 9, 2017
1 parent 3242e04 commit a3e15a9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions brian2/core/variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -981,14 +981,12 @@ def set_with_expression(self, item, code, run_namespace, check_units=True):
# TODO: Have an additional argument to avoid going through the index
# array for situations where iterate_all could be used
from brian2.codegen.codeobject import create_runner_codeobj
from brian2.devices.device import get_default_codeobject_class, get_device
from brian2.devices.device import get_default_codeobject_class

group_index_var = get_device().get_array_name(variables['_group_idx'])
codeobj = create_runner_codeobj(self.group,
abstract_code,
'group_variable_set',
additional_variables=variables,
template_kwds={'_group_index_var': group_index_var},
check_units=check_units,
run_namespace=run_namespace,
codeobj_class=get_default_codeobject_class('codegen.string_expression_target'))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
for(int _idx_group_idx=0; _idx_group_idx<_num_group_idx; _idx_group_idx++)
{
// vector code
const int _idx = {{_group_index_var}}[_idx_group_idx];
const int _idx = {{_group_idx}}[_idx_group_idx];
const int _vectorisation_idx = _idx;
{{vector_code|autoindent}}
}
Expand Down

0 comments on commit a3e15a9

Please sign in to comment.