This repository was archived by the owner on Mar 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 42
Expand file tree
/
Copy pathnrnreport.hpp
More file actions
118 lines (101 loc) · 4.11 KB
/
nrnreport.hpp
File metadata and controls
118 lines (101 loc) · 4.11 KB
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
/*
# =============================================================================
# Copyright (c) 2016 - 2021 Blue Brain Project/EPFL
#
# See top-level LICENSE file for details.
# =============================================================================
*/
/**
* @file nrnreport.h
* @brief interface with reportinglib for soma reports
*/
#ifndef _H_NRN_REPORT_
#define _H_NRN_REPORT_
#include <string>
#include <vector>
#include <set>
#include <unordered_map>
#include <cstdint>
#define REPORT_MAX_NAME_LEN 256
#define REPORT_MAX_FILEPATH_LEN 4096
namespace coreneuron {
struct SummationReport {
// Contains the values of the summation with index == segment_id
std::vector<double> summation_ = {};
// Map containing the pointers of the currents and its scaling factor for every segment_id
std::unordered_map<size_t, std::vector<std::pair<double*, int>>> currents_;
// Map containing the list of segment_ids per gid
std::unordered_map<int, std::vector<size_t>> gid_segments_;
};
struct SummationReportMapping {
// Map containing a SummationReport object per report
std::unordered_map<std::string, SummationReport> summation_reports_;
};
struct SpikesInfo {
std::string file_name = "out";
std::vector<std::pair<std::string, int>> population_info;
};
// name of the variable in mod file that is used to indicate which synapse
// is enabled or disable for reporting
#define SELECTED_VAR_MOD_NAME "selected_for_report"
/// name of the variable in mod file used for setting synapse id
#define SYNAPSE_ID_MOD_NAME "synapseID"
/*
* Defines the type of target, as per the following syntax:
* 0=Compartment, 1=Cell/Soma, Section { 2=Axon, 3=Dendrite, 4=Apical }
* The "Comp" variations are compartment-based (all segments, not middle only)
*/
enum class TargetType {
Compartment = 0,
Cell = 1,
SectionSoma = 2,
SectionAxon = 3,
SectionDendrite = 4,
SectionApical = 5,
SectionSomaAll = 6,
SectionAxonAll = 7,
SectionDendriteAll = 8,
SectionApicalAll = 9,
};
// enumerate that defines the type of target report requested
enum ReportType {
SomaReport,
CompartmentReport,
SynapseReport,
IMembraneReport,
SectionReport,
SummationReport,
LFPReport
};
// enumerate that defines the section type for a Section report
enum SectionType { Cell, Soma, Axon, Dendrite, Apical, All };
struct ReportConfiguration {
std::string name; // name of the report
std::string output_path; // full path of the report
std::string target_name; // target of the report
std::vector<std::string> mech_names; // mechanism names
std::vector<std::string> var_names; // variable names
std::vector<int> mech_ids; // mechanisms
std::string unit; // unit of the report
std::string format; // format of the report (Bin, hdf5, SONATA)
std::string type_str; // type of report string
TargetType target_type; // type of the target
ReportType type; // type of the report
SectionType section_type; // type of section report
bool section_all_compartments; // flag for section report (all values)
double report_dt; // reporting timestep
double start; // start time of report
double stop; // stop time of report
int num_gids; // total number of gids
int buffer_size; // hint on buffer size used for this report
std::set<int> target; // list of gids for this report
};
void setup_report_engine(double dt_report, double mindelay);
std::vector<ReportConfiguration> create_report_configurations(const std::string& filename,
const std::string& output_dir,
SpikesInfo& spikes_info);
void finalize_report();
void nrn_flush_reports(double t);
void set_report_buffer_size(int n);
} // namespace coreneuron
#endif //_H_NRN_REPORT_