Manager to handle everything related to input and output. More...
#include <io_manager.h>
Public Member Functions | |
| IOManager () | |
| ~IOManager () override | |
| void | initialize (const bool) override |
| Prepare manager for operation. | |
| void | finalize (const bool) override |
| Take down manager after operation. | |
| void | set_status (const Dictionary &) override |
| Set the status of the manager. | |
| void | get_status (Dictionary &) override |
| Retrieve the status of the manager. | |
| void | set_recording_backend_status (std::string, const Dictionary &) |
| Dictionary | get_recording_backend_status (std::string) |
| const std::string & | get_data_prefix () const |
| The prefix for files written by devices. | |
| const std::string & | get_data_path () const |
| The path for files written by devices. | |
| bool | overwrite_files () const |
| Indicate if existing data files should be overwritten. | |
| void | post_run_hook () |
| Clean up in all registered recording backends after a single call to run by calling the backends' post_run_hook() functions. | |
| void | pre_run_hook () |
| void | post_step_hook () |
| Clean up in all registered recording backends after a single simulation step by calling the backends' post_step_hook() functions. | |
| void | cleanup () override |
| Finalize all registered recording backends after a call to SimulationManager::simulate() or SimulationManager::cleanup() by calling the backends' finalize() functions. | |
| void | prepare () override |
| template<class RecordingBackendT > | |
| void | register_recording_backend (const std::string &) |
| template<class StimulationBackendT > | |
| void | register_stimulation_backend (const std::string &) |
| bool | is_valid_recording_backend (const std::string &) const |
| bool | is_valid_stimulation_backend (const std::string &) const |
| void | write (const std::string &, const RecordingDevice &, const Event &, const std::vector< double > &, const std::vector< long > &) |
| Send device data to a given recording backend. | |
| void | enroll_recorder (const std::string &, const RecordingDevice &, const Dictionary &) |
| void | enroll_stimulator (const std::string &, StimulationDevice &, const Dictionary &) |
| void | set_recording_value_names (const std::string &backend_name, const RecordingDevice &device, const std::vector< std::string > &double_value_names, const std::vector< std::string > &long_value_names) |
| void | check_recording_backend_device_status (const std::string &, const Dictionary &) |
| void | get_recording_backend_device_defaults (const std::string &, Dictionary &) |
| void | get_recording_backend_device_status (const std::string &, const RecordingDevice &, Dictionary &) |
Public Member Functions inherited from nest::ManagerInterface | |
| ManagerInterface (ManagerInterface const &)=delete | |
| void | operator= (ManagerInterface const &)=delete |
| ManagerInterface () | |
| virtual | ~ManagerInterface () |
Private Member Functions | |
| void | set_data_path_prefix_ (const Dictionary &) |
Private Attributes | |
| std::string | data_path_ |
| Path for all files written by devices. | |
| std::string | data_prefix_ |
| Prefix for all files written by devices. | |
| bool | overwrite_files_ |
| If true, overwrite existing data files. | |
| std::map< std::string, RecordingBackend * > | recording_backends_ |
| A mapping from names to registered recording backends. | |
| std::map< std::string, StimulationBackend * > | stimulation_backends_ |
| A mapping from names to registered stimulation backends. | |
Manager to handle everything related to input and output.
IOManager handles the data path and prefix variables of the NEST kernel and manages the recording and stimulation backends and the routing of data from and to devices to and from the backends.
This manager is not responsible for logging and messaging to the user. See LoggingManager if you are looging for that.
| nest::IOManager::IOManager | ( | ) |
|
override |
| void nest::IOManager::check_recording_backend_device_status | ( | const std::string & | backend_name, |
| const Dictionary & | params | ||
| ) |
References recording_backends_.
Referenced by nest::RecordingDevice::set_status().
|
overridevirtual |
Finalize all registered recording backends after a call to SimulationManager::simulate() or SimulationManager::cleanup() by calling the backends' finalize() functions.
Reimplemented from nest::ManagerInterface.
References recording_backends_, and stimulation_backends_.
| void nest::IOManager::enroll_recorder | ( | const std::string & | backend_name, |
| const RecordingDevice & | device, | ||
| const Dictionary & | params | ||
| ) |
References recording_backends_.
Referenced by nest::RecordingDevice::set_initialized_(), and nest::RecordingDevice::set_status().
| void nest::IOManager::enroll_stimulator | ( | const std::string & | backend_name, |
| StimulationDevice & | device, | ||
| const Dictionary & | params | ||
| ) |
References is_valid_stimulation_backend(), and stimulation_backends_.
Referenced by nest::StimulationDevice::set_initialized_(), and nest::StimulationDevice::set_status().
|
overridevirtual |
Take down manager after operation.
After this method has completed, all dynamic data structures created by the manager shall be deallocated and containers emptied. Plain variables need not be reset.
| adjust_number_of_threads_or_rng_only | Pass true if calling from kernel_manager::change_number_of_threads() to limit operations to those necessary for thread adjustment. |
Implements nest::ManagerInterface.
References recording_backends_, and stimulation_backends_.
|
inline |
The path for files written by devices.
It may be the empty string (use current directory).
References data_path_.
Referenced by nest::RecordingBackendSIONlib::build_filename_(), nest::RecordingBackendASCII::DeviceData::compute_filename_(), nest::RecordingBackendMPI::get_port(), and nest::StimulationBackendMPI::get_port().
|
inline |
The prefix for files written by devices.
The prefix must not contain any part of a path.
References data_prefix_.
Referenced by nest::RecordingBackendSIONlib::build_filename_(), nest::RecordingBackendASCII::DeviceData::compute_filename_(), nest::RecordingBackendMPI::get_port(), and nest::StimulationBackendMPI::get_port().
| void nest::IOManager::get_recording_backend_device_defaults | ( | const std::string & | backend_name, |
| Dictionary & | params | ||
| ) |
References recording_backends_.
Referenced by nest::RecordingDevice::get_status().
| void nest::IOManager::get_recording_backend_device_status | ( | const std::string & | backend_name, |
| const RecordingDevice & | device, | ||
| Dictionary & | d | ||
| ) |
References recording_backends_.
Referenced by nest::RecordingDevice::get_status().
| Dictionary nest::IOManager::get_recording_backend_status | ( | std::string | recording_backend | ) |
References nest::names::element_type(), and recording_backends_.
Referenced by nest::get_model_defaults().
|
overridevirtual |
Retrieve the status of the manager.
Implements nest::ManagerInterface.
References nest::names::data_path(), data_path_, nest::names::data_prefix(), data_prefix_, nest::names::overwrite_files(), overwrite_files_, nest::names::recording_backends(), recording_backends_, nest::names::stimulation_backends(), and stimulation_backends_.
|
overridevirtual |
Prepare manager for operation.
After this method has completed, the manager should be completely initialized and "ready for action".
| adjust_number_of_threads_or_rng_only | Pass true if calling from kernel_manager::change_number_of_threads() or RandomManager::get_status() to limit operations to those necessary for thread adjustment or switch or re-seeding of RNG. |
Implements nest::ManagerInterface.
References nest::names::data_path(), nest::names::data_prefix(), overwrite_files_, recording_backends_, set_data_path_prefix_(), and stimulation_backends_.
| bool nest::IOManager::is_valid_recording_backend | ( | const std::string & | backend_name | ) | const |
References recording_backends_.
| bool nest::IOManager::is_valid_stimulation_backend | ( | const std::string & | backend_name | ) | const |
References stimulation_backends_.
Referenced by enroll_stimulator().
|
inline |
Indicate if existing data files should be overwritten.
References overwrite_files_.
| void nest::IOManager::post_run_hook | ( | ) |
Clean up in all registered recording backends after a single call to run by calling the backends' post_run_hook() functions.
References recording_backends_, and stimulation_backends_.
Referenced by nest::SimulationManager::run().
| void nest::IOManager::post_step_hook | ( | ) |
Clean up in all registered recording backends after a single simulation step by calling the backends' post_step_hook() functions.
References recording_backends_.
Referenced by nest::SimulationManager::update_().
| void nest::IOManager::pre_run_hook | ( | ) |
References recording_backends_, and stimulation_backends_.
Referenced by nest::SimulationManager::run().
|
overridevirtual |
Reimplemented from nest::ManagerInterface.
References recording_backends_, and stimulation_backends_.
| void nest::IOManager::register_recording_backend | ( | const std::string & | name | ) |
References recording_backends_.
| void nest::IOManager::register_stimulation_backend | ( | const std::string & | name | ) |
References stimulation_backends_.
|
private |
References nest::names::data_path(), data_path_, nest::names::data_prefix(), data_prefix_, nest::ERROR, LOG, and Dictionary::update_value().
Referenced by initialize(), and set_status().
| void nest::IOManager::set_recording_backend_status | ( | std::string | recording_backend, |
| const Dictionary & | d | ||
| ) |
References recording_backends_.
Referenced by nest::set_model_defaults().
| void nest::IOManager::set_recording_value_names | ( | const std::string & | backend_name, |
| const RecordingDevice & | device, | ||
| const std::vector< std::string > & | double_value_names, | ||
| const std::vector< std::string > & | long_value_names | ||
| ) |
References recording_backends_.
Referenced by nest::RecordingDevice::pre_run_hook().
|
overridevirtual |
Set the status of the manager.
Implements nest::ManagerInterface.
References nest::names::overwrite_files(), overwrite_files_, and set_data_path_prefix_().
| void nest::IOManager::write | ( | const std::string & | backend_name, |
| const RecordingDevice & | device, | ||
| const Event & | event, | ||
| const std::vector< double > & | double_values, | ||
| const std::vector< long > & | long_values | ||
| ) |
Send device data to a given recording backend.
This function is called from a RecordingDevice device when it wants to write data to a given recording backend, identified by its backend_name. The function takes an Event event from which some fundamental data is taken and additionally vectors of double_values and long_values that have to be written. The data vectors may be empty, if no additional data has to be written.
| backend_name | the name of the RecordingBackend to write to |
| device | a reference to the RecordingDevice that wants to write |
| event | the Event to be written |
| double_values | a vector of doubles to be written |
| long_values | a vector of longs to be written |
References recording_backends_.
Referenced by nest::RecordingDevice::write().
|
private |
Path for all files written by devices.
Referenced by get_data_path(), get_status(), and set_data_path_prefix_().
|
private |
Prefix for all files written by devices.
Referenced by get_data_prefix(), get_status(), and set_data_path_prefix_().
|
private |
If true, overwrite existing data files.
Referenced by get_status(), initialize(), overwrite_files(), and set_status().
|
private |
A mapping from names to registered recording backends.
Referenced by check_recording_backend_device_status(), cleanup(), enroll_recorder(), finalize(), get_recording_backend_device_defaults(), get_recording_backend_device_status(), get_recording_backend_status(), get_status(), initialize(), is_valid_recording_backend(), post_run_hook(), post_step_hook(), pre_run_hook(), prepare(), register_recording_backend(), set_recording_backend_status(), set_recording_value_names(), and write().
|
private |
A mapping from names to registered stimulation backends.
Referenced by cleanup(), enroll_stimulator(), finalize(), get_status(), initialize(), is_valid_stimulation_backend(), post_run_hook(), pre_run_hook(), prepare(), and register_stimulation_backend().