NEST main@caf0ae8
 
Loading...
Searching...
No Matches
recording_backend_screen.h
Go to the documentation of this file.
1/*
2 * recording_backend_screen.h
3 *
4 * This file is part of NEST.
5 *
6 * Copyright (C) 2004 The NEST Initiative
7 *
8 * NEST is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * NEST is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with NEST. If not, see <http://www.gnu.org/licenses/>.
20 *
21 */
22
23#ifndef RECORDING_BACKEND_SCREEN_H
24#define RECORDING_BACKEND_SCREEN_H
25
26#include "recording_backend.h"
27#include <set>
28
29/* BeginUserDocs: NOINDEX
30
31Short description
32+++++++++++++++++
33
34Recording backend `screen` - Write data to the terminal
35
36Description
37~~~~~~~~~~~
38
39When initially conceiving and debugging simulations, it can be useful
40to check recordings in a more ad hoc fashion. The recording backend
41`screen` can be used to dump all recorded data onto the console for
42quick inspection.
43
44The first field of each record written is the node ID of the neuron
45the event originated from, i.e., the *source* of the event. This is
46followed by the time of the measurement, the recorded floating point
47values, and the recorded integer values.
48
49The format of the time field depends on the value of the property
50``time_in_steps``. If set to *false* (which is the default), time is
51written as one floating point number representing the simulation time
52in ms. If ``time_in_steps`` is *true*, the time of the event is written
53as a value pair consisting of the integer simulation time step and the
54floating point offset in ms from the next grid point.
55
56.. note::
57
58 Using this backend for production runs is not recommended, as it
59 may produce *huge* amounts of console output and *considerably* slow
60 down the simulation.
61
62Parameter summary
63~~~~~~~~~~~~~~~~~
64
65precision
66 controls the number of decimal places used to write decimal numbers
67 to the terminal.
68
69time_in_steps
70 A boolean (default: false) specifying whether to print time in
71 steps, i.e., in integer multiples of the resolution and an offset,
72 rather than just in ms.
73
74EndUserDocs */
75
76namespace nest
77{
78
84{
85public:
89
90 ~RecordingBackendScreen() throw() override
91 {
92 }
93
94 void initialize() override;
95
96 void finalize() override;
97
98 void enroll( const RecordingDevice& device, const Dictionary& params ) override;
99
100 void disenroll( const RecordingDevice& device ) override;
101
102 void set_value_names( const RecordingDevice& device,
103 const std::vector< std::string >& double_value_names,
104 const std::vector< std::string >& long_value_names ) override;
105
106 void prepare() override;
107
108 void cleanup() override;
109
110 void write( const RecordingDevice&, const Event&, const std::vector< double >&, const std::vector< long >& ) override;
111
112 void pre_run_hook() override;
113
114 void post_run_hook() override;
115
116 void post_step_hook() override;
117
118 void set_status( const Dictionary& ) override;
119
120 void get_status( Dictionary& ) const override;
121
122 void check_device_status( const Dictionary& ) const override;
123 void get_device_defaults( Dictionary& ) const override;
124 void get_device_status( const RecordingDevice& device, Dictionary& ) const override;
125
126private:
128 {
129 DeviceData();
130 void get_status( Dictionary& ) const;
131 void set_status( const Dictionary& );
132 void write( const Event&, const std::vector< double >&, const std::vector< long >& );
133
134 private:
135 void prepare_cout_();
136 void restore_cout_();
137 std::ios::fmtflags old_fmtflags_;
141 };
142
143 typedef std::vector< std::map< size_t, DeviceData > > device_data_map;
145};
146
147} // namespace
148
149#endif /* #ifndef RECORDING_BACKEND_SCREEN_H */
Dictionary class for interface to Python and C++ API.
Definition dictionary.h:213
Encapsulate information sent between nodes.
Definition event.h:103
A simple recording backend implementation that prints all recorded data to screen.
Definition recording_backend_screen.h:84
void post_run_hook() override
Clean up the backend at the end of a Run.
Definition recording_backend_screen.cpp:147
RecordingBackendScreen()
Definition recording_backend_screen.h:86
void get_status(Dictionary &) const override
Return the status of the recording backend by writing it to the given params dictionary.
Definition recording_backend_screen.cpp:165
void set_status(const Dictionary &) override
Set the status of the recording backend using the key-value pairs contained in the params dictionary.
Definition recording_backend_screen.cpp:159
void get_device_defaults(Dictionary &) const override
Return the per-device defaults by writing it to the given params dictionary.
Definition recording_backend_screen.cpp:120
void initialize() override
Definition recording_backend_screen.cpp:35
void finalize() override
Definition recording_backend_screen.cpp:42
void prepare() override
Prepare the backend at begin of the NEST Simulate function.
Definition recording_backend_screen.cpp:141
void check_device_status(const Dictionary &) const override
Check if the given per-device properties are valid and usable by the backend.
Definition recording_backend_screen.cpp:113
void set_value_names(const RecordingDevice &device, const std::vector< std::string > &double_value_names, const std::vector< std::string > &long_value_names) override
To make the names of recorded quantities known to the RecordingBackend, the vectors double_value_name...
Definition recording_backend_screen.cpp:76
void cleanup() override
Clean up the backend at the end of a user level call to the NEST Simulate function.
Definition recording_backend_screen.cpp:90
std::vector< std::map< size_t, DeviceData > > device_data_map
Definition recording_backend_screen.h:143
void get_device_status(const RecordingDevice &device, Dictionary &) const override
Return the per-device status of the given recording device by writing it to the given params dictiona...
Definition recording_backend_screen.cpp:127
device_data_map device_data_
Definition recording_backend_screen.h:144
void pre_run_hook() override
Initialize global backend-specific data structures.
Definition recording_backend_screen.cpp:84
void write(const RecordingDevice &, const Event &, const std::vector< double > &, const std::vector< long > &) override
Write the data from the event to the backend specific channel together with the values given.
Definition recording_backend_screen.cpp:96
void disenroll(const RecordingDevice &device) override
Disenroll a RecordingDevice from the RecordingBackend.
Definition recording_backend_screen.cpp:63
void enroll(const RecordingDevice &device, const Dictionary &params) override
Enroll a RecordingDevice with the RecordingBackend.
Definition recording_backend_screen.cpp:47
void post_step_hook() override
Do work required at the end of each simulation step.
Definition recording_backend_screen.cpp:153
~RecordingBackendScreen() override
Definition recording_backend_screen.h:90
Abstract base class for all NESTio recording backends.
Definition recording_backend.h:67
Base class for all recording devices.
Definition recording_device.h:157
Namespace for the NEST simulation kernel.
Definition beta_normalization_factor.h:33
Definition recording_backend_screen.h:128
std::ios::fmtflags old_fmtflags_
Definition recording_backend_screen.h:137
long old_precision_
Definition recording_backend_screen.h:138
void get_status(Dictionary &) const
Definition recording_backend_screen.cpp:179
void write(const Event &, const std::vector< double > &, const std::vector< long > &)
Definition recording_backend_screen.cpp:193
void set_status(const Dictionary &)
Definition recording_backend_screen.cpp:186
bool time_in_steps_
Should time be recorded in steps (ms if false)
Definition recording_backend_screen.h:140
long precision_
Number of decimal places used when writing decimal values.
Definition recording_backend_screen.h:139
void prepare_cout_()
Definition recording_backend_screen.cpp:227
DeviceData()
Definition recording_backend_screen.cpp:172
void restore_cout_()
Definition recording_backend_screen.cpp:234