GeNNCodeGenerator class

(Shortest import: from brian2genn.genn_generator import GeNNCodeGenerator)

class brian2genn.genn_generator.GeNNCodeGenerator(*args, **kwds)[source]

Bases: brian2.codegen.generators.base.CodeGenerator

“GeNN language”

For user-defined functions, there are two keys to provide:

support_code
The function definition which will be added to the support code.
hashdefine_code
The #define code added to the main loop.

Attributes

flush_denormals
restrict

Methods

denormals_to_zero_code()
determine_keywords() A dictionary of values that is made available to the templated.
get_array_name(var[, access_data]) Get a globally unique name for a ArrayVariable.
translate_expression(expr) Translate the given expression string into a string in the target language, returns a string.
translate_one_statement_sequence(statements)
translate_statement(statement) Translate a single line Statement into the target language, returns a string.
translate_to_declarations(statements)
translate_to_read_arrays(statements)
translate_to_statements(statements)
translate_to_write_arrays(statements)

Details

flush_denormals
restrict
denormals_to_zero_code()[source]
determine_keywords()[source]

A dictionary of values that is made available to the templated. This is used for example by the CPPCodeGenerator to set up all the supporting code

static get_array_name(var, access_data=True)[source]

Get a globally unique name for a ArrayVariable.

Parameters:

var : ArrayVariable

The variable for which a name should be found.

access_data : bool, optional

For DynamicArrayVariable objects, specifying True here means the name for the underlying data is returned. If specifying False, the name of object itself is returned (e.g. to allow resizing).

Returns :

——- :

name : str

A uniqe name for var.

translate_expression(expr)[source]

Translate the given expression string into a string in the target language, returns a string.

translate_one_statement_sequence(statements, scalar=False)[source]
translate_statement(statement)[source]

Translate a single line Statement into the target language, returns a string.

translate_to_declarations(statements)[source]
translate_to_read_arrays(statements)[source]
translate_to_statements(statements)[source]
translate_to_write_arrays(statements)[source]