GSLContainer class

(Shortest import: from brian2.stateupdaters.GSL import GSLContainer)

class brian2.stateupdaters.GSL.GSLContainer(method_options, integrator, abstract_code=None, needed_variables=[], variable_flags=[])[source]

Bases: object

Class that contains information (equation- or integrator-related) required for later code generation

Methods

__call__(obj) Transfer the code object class saved in self to the object sent as an argument.
get_codeobj_class() Return codeobject class based on target language and device.

Details

__call__(obj)[source]

Transfer the code object class saved in self to the object sent as an argument.

This method is returned when calling GSLStateUpdater. This class inherits from StateUpdateMethod which orignally only returns abstract code. However, with GSL this returns a method because more is needed than just the abstract code: the state updater requires its own CodeObject that is different from the other NeuronGroup objects. This method adds this CodeObject to the StateUpdater object (and also adds the variables ‘t’, ‘dt’, and other variables that are needed in the GSLCodeGenerator.

Parameters:

obj : GSLStateUpdater

the object that the codeobj_class and other variables need to be transferred to

Returns:

abstract_code : str

The abstract code (translated equations), that is returned conventionally by brian and used for later code generation in the CodeGenerator.translate() method.

get_codeobj_class()[source]

Return codeobject class based on target language and device.

Choose which version of the GSL CodeObject to use. If `isinstance(device, CPPStandaloneDevice)`, then we want the GSLCPPStandaloneCodeObject. Otherwise the return value is based on prefs.codegen.target.

Returns:

code_object : class

The respective CodeObject class (i.e. either GSLWeaveCodeObject, GSLCythonCodeObject, or GSLCPPStandaloneCodeObject).