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 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156
|
{% macro before_run_cpp_file() %}
#include "code_objects/before_run_{{codeobj_name}}.h"
#include "objects.h"
#include "brianlib/common_math.h"
#include "brianlib/stdint_compat.h"
#include<cmath>
#include<ctime>
#include<iostream>
#include<fstream>
#include<climits>
{% for name in user_headers | sort %}
#include {{name}}
{% endfor %}
////// SUPPORT CODE ///////
namespace {
{{support_code_lines|autoindent}}
}
void _before_run_{{codeobj_name}}()
{
using namespace brian;
///// CONSTANTS ///////////
%CONSTANTS%
///// POINTERS ////////////
{{pointers_lines|autoindent}}
{% block before_code %}
// EMPTY_CODE_BLOCK -- will be overwritten in child templates
{% endblock %}
}
{% endmacro %}
{% macro before_run_h_file() %}
#ifndef _INCLUDED_{{codeobj_name}}_before
#define _INCLUDED_{{codeobj_name}}_before
void _before_run_{{codeobj_name}}();
#endif
{% endmacro %}
{% macro cpp_file() %}
#include "code_objects/{{codeobj_name}}.h"
#include "objects.h"
#include "brianlib/common_math.h"
#include "brianlib/stdint_compat.h"
#include<cmath>
#include<ctime>
#include<iostream>
#include<fstream>
#include<climits>
{% block extra_headers %}
{% endblock %}
{% for name in user_headers | sort %}
#include {{name}}
{% endfor %}
////// SUPPORT CODE ///////
namespace {
{{support_code_lines|autoindent}}
}
////// HASH DEFINES ///////
{{hashdefine_lines|autoindent}}
void _run_{{codeobj_name}}()
{
using namespace brian;
{% if profiled %}
{% if openmp_pragma('with_openmp') %}
const double _start_time = omp_get_wtime();
{% else %}
const std::clock_t _start_time = std::clock();
{% endif %}
{% endif %}
///// CONSTANTS ///////////
%CONSTANTS%
///// POINTERS ////////////
{{pointers_lines|autoindent}}
{% block maincode %}
{# Will be overwritten in child templates #}
{% endblock %}
{% if profiled %}
{% if openmp_pragma('with_openmp') %}
const double _run_time = omp_get_wtime() -_start_time;
{% else %}
const double _run_time = (double)(std::clock() -_start_time)/CLOCKS_PER_SEC;
{% endif %}
{{codeobj_name}}_profiling_info += _run_time;
{% endif %}
}
{% block extra_functions_cpp %}
{% endblock %}
{% endmacro %}
{% macro h_file() %}
#ifndef _INCLUDED_{{codeobj_name}}
#define _INCLUDED_{{codeobj_name}}
void _run_{{codeobj_name}}();
{% block extra_functions_h %}
{% endblock %}
#endif
{% endmacro %}
{% macro after_run_cpp_file() %}
#include "objects.h"
#include "code_objects/after_run_{{codeobj_name}}.h"
#include "brianlib/common_math.h"
#include "brianlib/stdint_compat.h"
#include<cmath>
#include<ctime>
#include<iostream>
#include<fstream>
#include<climits>
{% for name in user_headers | sort %}
#include {{name}}
{% endfor %}
////// SUPPORT CODE ///////
namespace {
{{support_code_lines|autoindent}}
}
void _after_run_{{codeobj_name}}()
{
using namespace brian;
///// CONSTANTS ///////////
%CONSTANTS%
///// POINTERS ////////////
{{pointers_lines|autoindent}}
{% block after_code %}
// EMPTY_CODE_BLOCK -- will be overwritten in child templates
{% endblock %}
}
{% endmacro %}
{% macro after_run_h_file() %}
#ifndef _INCLUDED_{{codeobj_name}}_after
#define _INCLUDED_{{codeobj_name}}_after
void _after_run_{{codeobj_name}}();
#endif
{% endmacro %}
|