Skip to content

Commit

Permalink
nope, bad change all round
Browse files Browse the repository at this point in the history
  • Loading branch information
neworderofjamie committed Apr 29, 2022
1 parent db7281c commit a161446
Showing 1 changed file with 16 additions and 23 deletions.
39 changes: 16 additions & 23 deletions pygenn/genn_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,29 +293,22 @@ def _load_egp(self, egp_dict=None, egp_suffix=""):
egp_data.type)
# Copy values
egp_data.view[:] = egp_data.values
else:
if egp_data.values is None:
cname = self.__class__.__name__
mname = self.name
raise Exception(f"Extra global parameter {egp_name} "
f"for {mname} ({cname}) can not be set "
f"to None, it should be {egp_data.type}")
else:
# Allocate memory
self._model._slm.allocate_extra_global_param(
self.name, egp_name + egp_suffix, len(egp_data.values))

# Assign view
egp_data.view = self._assign_ext_ptr_array(egp_name + egp_suffix,
len(egp_data.values),
egp_data.type)

# Copy values
egp_data.view[:] = egp_data.values

# Push egp_data
self._model._slm.push_extra_global_param(
self.name, egp_name + egp_suffix, len(egp_data.values))
elif egp_data.values is not None:
# Allocate memory
self._model._slm.allocate_extra_global_param(
self.name, egp_name + egp_suffix, len(egp_data.values))

# Assign view
egp_data.view = self._assign_ext_ptr_array(egp_name + egp_suffix,
len(egp_data.values),
egp_data.type)

# Copy values
egp_data.view[:] = egp_data.values

# Push egp_data
self._model._slm.push_extra_global_param(
self.name, egp_name + egp_suffix, len(egp_data.values))

def _load_var_init_egps(self, var_dict=None):
# If no variable dictionary is specified, use standard one
Expand Down

0 comments on commit a161446

Please sign in to comment.