10 #ifdef ENABLE_BIN_REPORTS
11 #include "reportinglib/Records.h"
12 #endif // ENABLE_BIN_REPORTS
20 #ifdef ENABLE_BIN_REPORTS
21 records_set_atomic_step(
dt);
22 #endif // ENABLE_BIN_REPORTS
26 #ifdef ENABLE_BIN_REPORTS
27 static void create_soma_extra(
const CellMapping& mapping, std::array<int, 5>& extra) {
28 extra = {1, 0, 0, 0, 0};
33 static void create_compartment_extra(
const CellMapping& mapping, std::array<int, 5>& extra) {
34 extra[1] = mapping.get_seclist_section_count(
"soma");
35 extra[2] = mapping.get_seclist_section_count(
"axon");
36 extra[3] = mapping.get_seclist_section_count(
"dend");
37 extra[4] = mapping.get_seclist_section_count(
"apic");
38 extra[0] = std::accumulate(extra.begin() + 1, extra.end(), 0);
41 static void create_custom_extra(
const CellMapping& mapping, std::array<int, 5>& extra) {
42 extra = {1, 0, 0, 0, 1};
43 extra[1] = mapping.get_seclist_section_count(
"soma");
45 extra[4] = mapping.get_seclist_section_count(
"apic");
46 extra[0] = std::accumulate(extra.begin() + 1, extra.end(), 0);
49 void BinaryReportHandler::register_section_report(
const NrnThread& nt,
50 const ReportConfiguration& config,
51 const VarsToReport& vars_to_report,
52 bool is_soma_target) {
53 create_extra_func create_extra = is_soma_target ? create_soma_extra : create_compartment_extra;
54 register_report(nt, config, vars_to_report, create_extra);
57 void BinaryReportHandler::register_custom_report(
const NrnThread& nt,
58 const ReportConfiguration& config,
59 const VarsToReport& vars_to_report) {
60 create_extra_func create_extra = create_custom_extra;
61 register_report(nt, config, vars_to_report, create_extra);
64 void BinaryReportHandler::register_report(
const NrnThread& nt,
65 const ReportConfiguration& config,
66 const VarsToReport& vars_to_report,
67 create_extra_func& create_extra) {
70 std::array<int, 1> mapping = {0};
71 std::array<int, 5> extra;
72 for (
const auto& var: vars_to_report) {
74 auto& vars = var.second;
78 const auto* mapinfo =
static_cast<NrnThreadMappingInfo*
>(nt.mapping);
79 const CellMapping* m = mapinfo->get_cell_mapping(gid);
80 extra[0] = vars.size();
81 create_extra(*m, extra);
82 records_add_report(config.output_path.data(),
90 config.type_str.data(),
94 records_set_report_max_buffer_size_hint(config.output_path.data(), config.buffer_size);
95 records_extra_mapping(config.output_path.data(), gid, 5, extra.data());
96 for (
const auto& var: vars) {
98 records_add_var_with_mapping(
99 config.output_path.data(), gid, var.var_value, sizemapping, mapping.data());
103 #endif // ENABLE_BIN_REPORTS