GSLCythonCodeGenerator class

(Shortest import: from brian2.codegen.generators import GSLCythonCodeGenerator)

class brian2.codegen.generators.GSL_generator.GSLCythonCodeGenerator(variables, variable_indices, owner, iterate_all, codeobj_class, name, template_name, override_conditional_write=None, allows_scalar_write=False)[source]

Bases: GSLCodeGenerator

Methods

c_data_type(dtype)

Get string version of object dtype that is attached to Brian variables.

get_array_name(var[, access_data])

initialize_array(varname, values)

Initialize a static array with given floating point values.

unpack_namespace_single(var_obj, in_vector, ...)

Writes the code necessary to pull single variable out of the Brian namespace into the generated code.

var_init_lhs(var, type)

Get string version of the left hand side of an initializing expression

var_replace_diff_var_lhs(var, ind)

Details

c_data_type(dtype)[source]

Get string version of object dtype that is attached to Brian variables. c pp_generator already has this function, but the Cython generator does not, but we need it for GSL code generation.

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

Initialize a static array with given floating point values. E.g. in C++, when called with arguments array and [1.0, 3.0, 2.0], this method should return double array[] = {1.0, 3.0, 2.0}.

unpack_namespace_single(var_obj, in_vector, in_scalar)[source]

Writes the code necessary to pull single variable out of the Brian namespace into the generated code.

The code created is significantly different between cpp and cython, so I decided to not make this function general over all target languages (i.e. in contrast to most other functions that only have syntactical differences)

var_init_lhs(var, type)[source]

Get string version of the left hand side of an initializing expression

var_replace_diff_var_lhs(var, ind)[source]