13 #ifdef ENABLE_BIN_REPORTS
14 #include "reportinglib/Records.h"
15 #endif // ENABLE_BIN_REPORTS
16 #ifdef ENABLE_SONATA_REPORTS
17 #include "bbp/sonata/reports.h"
18 #endif // ENABLE_SONATA_REPORTS
22 #if defined(ENABLE_BIN_REPORTS) || defined(ENABLE_SONATA_REPORTS)
23 ReportEvent::ReportEvent(
double dt,
25 const VarsToReport& filtered_gids,
31 , report_dt(report_dt)
32 , vars_to_report(filtered_gids) {
35 reporting_period =
static_cast<int>(report_dt /
dt);
36 gids_to_report.reserve(filtered_gids.size());
37 for (
const auto& gid: filtered_gids) {
38 gids_to_report.push_back(gid.first);
40 std::sort(gids_to_report.begin(), gids_to_report.end());
43 void ReportEvent::summation_alu(NrnThread* nt) {
45 if (step > 0 && (
static_cast<int>(step) % reporting_period) == 0) {
46 auto& summation_report = nt->summation_report_handler_->summation_reports_[report_path];
49 for (
const auto& kv: summation_report.currents_) {
50 int segment_id = kv.first;
51 for (
const auto& value: kv.second) {
52 double current_value = *value.first;
53 int scale = value.second;
54 sum += current_value * scale;
56 summation_report.summation_[segment_id] = sum;
61 if (!summation_report.gid_segments_.empty()) {
62 double sum_soma = 0.0;
63 for (
const auto& kv: summation_report.gid_segments_) {
65 for (
const auto& segment_id: kv.second) {
66 sum_soma += summation_report.summation_[segment_id];
68 *(vars_to_report[gid].front().var_value) = sum_soma;
76 void ReportEvent::deliver(
double t, NetCvode* nc, NrnThread* nt) {
82 #ifdef ENABLE_BIN_REPORTS
83 records_nrec(step, gids_to_report.size(), gids_to_report.data(), report_path.data());
85 #ifdef ENABLE_SONATA_REPORTS
86 sonata_record_node_data(step,
87 gids_to_report.size(),
88 gids_to_report.data(),
96 bool ReportEvent::require_checkpoint() {
99 #endif // defined(ENABLE_BIN_REPORTS) || defined(ENABLE_SONATA_REPORTS)