1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
{% macro cpp_file() %}
#include<stdlib.h>
#include "objects.h"
#include<ctime>
#include<random>
{% for codeobj in code_objects | sort(attribute='name') %}
#include "code_objects/{{codeobj.name}}.h"
{% endfor %}
{% for name in user_headers | sort %}
#include {{name}}
{% endfor %}
void brian_start()
{
_init_arrays();
_load_arrays();
// Initialize clocks (link timestep and dt to the respective arrays)
{% for clock in clocks | sort(attribute='name') %}
brian::{{clock.name}}.timestep = brian::{{array_specs[clock.variables['timestep']]}};
brian::{{clock.name}}.dt = brian::{{array_specs[clock.variables['dt']]}};
brian::{{clock.name}}.t = brian::{{array_specs[clock.variables['t']]}};
{% endfor %}
}
void brian_end()
{
_write_arrays();
_dealloc_arrays();
}
{% for name, lines in run_funcs.items() | sort(attribute='name') %}
void {{name}}()
{
using namespace brian;
{{lines|autoindent}}
}
{% endfor %}
{% endmacro %}
/////////////////////////////////////////////////////////////////////////////////////////////////////
{% macro h_file() %}
void brian_start();
void brian_end();
{% for name, lines in run_funcs.items() | sort(attribute='name') %}
void {{name}}();
{% endfor %}
{% endmacro %}
|