NEURON
nrnreport.hpp
Go to the documentation of this file.
1 /*
2 # =============================================================================
3 # Copyright (c) 2016 - 2021 Blue Brain Project/EPFL
4 #
5 # See top-level LICENSE file for details.
6 # =============================================================================
7 */
8 
9 /**
10  * @file nrnreport.h
11  * @brief interface with libsonata for soma reports
12  */
13 
14 #ifndef _H_NRN_REPORT_
15 #define _H_NRN_REPORT_
16 
17 #include <string>
18 #include <vector>
19 #include <set>
20 #include <unordered_map>
21 #include <cstdint>
22 
23 #define REPORT_MAX_NAME_LEN 256
24 #define REPORT_MAX_FILEPATH_LEN 4096
25 
26 namespace coreneuron {
27 
29  // Contains the values of the summation with index == segment_id
30  std::vector<double> summation_ = {};
31  // Map containing the pointers of the currents and its scaling factor for every segment_id
32  std::unordered_map<size_t, std::vector<std::pair<double*, int>>> currents_;
33  // Map containing the list of segment_ids per gid
34  std::unordered_map<int, std::vector<size_t>> gid_segments_;
35 };
36 
38  // Map containing a SummationReport object per report
39  std::unordered_map<std::string, SummationReport> summation_reports_;
40 };
41 
42 struct SpikesInfo {
43  std::string file_name = "out";
44  std::vector<std::pair<std::string, int>> population_info;
45 };
46 
47 // name of the variable in mod file that is used to indicate which synapse
48 // is enabled or disable for reporting
49 #define SELECTED_VAR_MOD_NAME "selected_for_report"
50 
51 /// name of the variable in mod file used for setting synapse id
52 #define SYNAPSE_ID_MOD_NAME "synapseID"
53 
54 /*
55  * Defines the type of target, as per the following syntax:
56  * 0=Compartment, 1=Cell/Soma, Section { 2=Axon, 3=Dendrite, 4=Apical }
57  * The "Comp" variations are compartment-based (all segments, not middle only)
58  */
59 enum class TargetType {
60  Compartment = 0,
61  Cell = 1,
62  SectionSoma = 2,
63  SectionAxon = 3,
64  SectionDendrite = 4,
65  SectionApical = 5,
66  SectionSomaAll = 6,
67  SectionAxonAll = 7,
69  SectionApicalAll = 9,
70 };
71 
72 // enumerate that defines the type of target report requested
73 enum ReportType {
80  LFPReport
81 };
82 
83 // enumerate that defines the section type for a Section report
85 
87  std::string name; // name of the report
88  std::string output_path; // full path of the report
89  std::string target_name; // target of the report
90  std::vector<std::string> mech_names; // mechanism names
91  std::vector<std::string> var_names; // variable names
92  std::vector<int> mech_ids; // mechanisms
93  std::string unit; // unit of the report
94  std::string format; // format of the report (SONATA)
95  std::string type_str; // type of report string
96  TargetType target_type; // type of the target
97  ReportType type; // type of the report
98  SectionType section_type; // type of section report
99  bool section_all_compartments; // flag for section report (all values)
100  double report_dt; // reporting timestep
101  double start; // start time of report
102  double stop; // stop time of report
103  int num_gids; // total number of gids
104  int buffer_size; // hint on buffer size used for this report
105  std::vector<int> target; // list of gids for this report
106 };
107 
108 void setup_report_engine(double dt_report, double mindelay);
109 std::vector<ReportConfiguration> create_report_configurations(const std::string& filename,
110  const std::string& output_dir,
111  SpikesInfo& spikes_info);
112 void finalize_report();
113 void nrn_flush_reports(double t);
114 void set_report_buffer_size(int n);
115 
116 } // namespace coreneuron
117 
118 #endif //_H_NRN_REPORT_
THIS FILE IS AUTO GENERATED DONT MODIFY IT.
@ IMembraneReport
Definition: nrnreport.hpp:77
@ CompartmentReport
Definition: nrnreport.hpp:75
@ SummationReport
Definition: nrnreport.hpp:79
void nrn_flush_reports(double t)
Definition: nrnreport.cpp:33
void set_report_buffer_size(int n)
Definition: nrnreport.cpp:58
std::vector< ReportConfiguration > create_report_configurations(const std::string &filename, const std::string &output_dir, SpikesInfo &spikes_info)
void finalize_report()
Definition: nrnreport.cpp:65
void setup_report_engine(double dt_report, double mindelay)
in the current implementation, we call flush during every spike exchange interval.
Definition: nrnreport.cpp:47
int const size_t const size_t n
Definition: nrngsl.h:10
std::vector< std::string > var_names
Definition: nrnreport.hpp:91
std::vector< std::string > mech_names
Definition: nrnreport.hpp:90
std::vector< int > mech_ids
Definition: nrnreport.hpp:92
std::string file_name
Definition: nrnreport.hpp:43
std::vector< std::pair< std::string, int > > population_info
Definition: nrnreport.hpp:44
std::unordered_map< size_t, std::vector< std::pair< double *, int > > > currents_
Definition: nrnreport.hpp:32
std::vector< double > summation_
Definition: nrnreport.hpp:30
std::unordered_map< int, std::vector< size_t > > gid_segments_
Definition: nrnreport.hpp:34
std::unordered_map< std::string, SummationReport > summation_reports_
Definition: nrnreport.hpp:39