NEST main@caf0ae8
 
Loading...
Searching...
No Matches
nest::IOManager Class Reference

Manager to handle everything related to input and output. More...

#include <io_manager.h>

Inheritance diagram for nest::IOManager:
[legend]
Collaboration diagram for nest::IOManager:
[legend]

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.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ IOManager()

nest::IOManager::IOManager ( )

◆ ~IOManager()

nest::IOManager::~IOManager ( )
override

Member Function Documentation

◆ check_recording_backend_device_status()

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().

Here is the caller graph for this function:

◆ cleanup()

void nest::IOManager::cleanup ( )
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_.

◆ enroll_recorder()

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().

Here is the caller graph for this function:

◆ enroll_stimulator()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ finalize()

void nest::IOManager::finalize ( const bool  adjust_number_of_threads_or_rng_only)
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.

Note
Finalization of any given manager may depend on other managers not having been finalized yet. KernelManager::finalize() is responsible for calling the initialization routines on the specific managers in correct order, i.e., the opposite order of initialize() calls.
Parameters
adjust_number_of_threads_or_rng_onlyPass true if calling from kernel_manager::change_number_of_threads() to limit operations to those necessary for thread adjustment.
See also
initialize()

Implements nest::ManagerInterface.

References recording_backends_, and stimulation_backends_.

◆ get_data_path()

const std::string & nest::IOManager::get_data_path ( ) const
inline

The path for files written by devices.

It may be the empty string (use current directory).

See also
get_data_prefix(), overwrite_files()

References data_path_.

Referenced by nest::RecordingBackendSIONlib::build_filename_(), nest::RecordingBackendASCII::DeviceData::compute_filename_(), nest::RecordingBackendMPI::get_port(), and nest::StimulationBackendMPI::get_port().

Here is the caller graph for this function:

◆ get_data_prefix()

const std::string & nest::IOManager::get_data_prefix ( ) const
inline

The prefix for files written by devices.

The prefix must not contain any part of a path.

See also
get_data_dir(), overwrite_files()

References data_prefix_.

Referenced by nest::RecordingBackendSIONlib::build_filename_(), nest::RecordingBackendASCII::DeviceData::compute_filename_(), nest::RecordingBackendMPI::get_port(), and nest::StimulationBackendMPI::get_port().

Here is the caller graph for this function:

◆ get_recording_backend_device_defaults()

void nest::IOManager::get_recording_backend_device_defaults ( const std::string &  backend_name,
Dictionary &  params 
)

References recording_backends_.

Referenced by nest::RecordingDevice::get_status().

Here is the caller graph for this function:

◆ get_recording_backend_device_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().

Here is the caller graph for this function:

◆ get_recording_backend_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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_status()

void nest::IOManager::get_status ( Dictionary &  )
overridevirtual

Retrieve the status of the manager.

Note
This would ideally be a const function. However, some managers delay the update of internal variables up to the point where they are needed (e.g., before reporting their values to the user, or before simulate is called). An example for this pattern is the call to update_delay_extrema_() right at the beginning of ConnectionManager::get_status().
See also
set_status()

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_.

Here is the call graph for this function:

◆ initialize()

void nest::IOManager::initialize ( const bool  adjust_number_of_threads_or_rng_only)
overridevirtual

Prepare manager for operation.

After this method has completed, the manager should be completely initialized and "ready for action".

Note
Initialization of any given manager may depend on other managers having been initialized before. KernelManager::initialize() is responsible for calling the initialization routines on the specific managers in correct order.
Parameters
adjust_number_of_threads_or_rng_onlyPass 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.
See also
finalize()

Implements nest::ManagerInterface.

References nest::names::data_path(), nest::names::data_prefix(), overwrite_files_, recording_backends_, set_data_path_prefix_(), and stimulation_backends_.

Here is the call graph for this function:

◆ is_valid_recording_backend()

bool nest::IOManager::is_valid_recording_backend ( const std::string &  backend_name) const

References recording_backends_.

◆ is_valid_stimulation_backend()

bool nest::IOManager::is_valid_stimulation_backend ( const std::string &  backend_name) const

References stimulation_backends_.

Referenced by enroll_stimulator().

Here is the caller graph for this function:

◆ overwrite_files()

bool nest::IOManager::overwrite_files ( ) const
inline

Indicate if existing data files should be overwritten.

Returns
true if existing data files should be overwritten by devices. Default: false.

References overwrite_files_.

◆ post_run_hook()

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().

Here is the caller graph for this function:

◆ post_step_hook()

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_().

Here is the caller graph for this function:

◆ pre_run_hook()

void nest::IOManager::pre_run_hook ( )

References recording_backends_, and stimulation_backends_.

Referenced by nest::SimulationManager::run().

Here is the caller graph for this function:

◆ prepare()

void nest::IOManager::prepare ( )
overridevirtual

◆ register_recording_backend()

template<class RecordingBackendT >
void nest::IOManager::register_recording_backend ( const std::string &  name)

References recording_backends_.

◆ register_stimulation_backend()

template<class StimulationBackendT >
void nest::IOManager::register_stimulation_backend ( const std::string &  name)

References stimulation_backends_.

◆ set_data_path_prefix_()

void nest::IOManager::set_data_path_prefix_ ( const Dictionary &  dict)
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_recording_backend_status()

void nest::IOManager::set_recording_backend_status ( std::string  recording_backend,
const Dictionary &  d 
)

References recording_backends_.

Referenced by nest::set_model_defaults().

Here is the caller graph for this function:

◆ set_recording_value_names()

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().

Here is the caller graph for this function:

◆ set_status()

void nest::IOManager::set_status ( const Dictionary &  )
overridevirtual

Set the status of the manager.

See also
get_status()

Implements nest::ManagerInterface.

References nest::names::overwrite_files(), overwrite_files_, and set_data_path_prefix_().

Here is the call graph for this function:

◆ write()

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.

Parameters
backend_namethe name of the RecordingBackend to write to
devicea reference to the RecordingDevice that wants to write
eventthe Event to be written
double_valuesa vector of doubles to be written
long_valuesa vector of longs to be written

References recording_backends_.

Referenced by nest::RecordingDevice::write().

Here is the caller graph for this function:

Member Data Documentation

◆ data_path_

std::string nest::IOManager::data_path_
private

Path for all files written by devices.

Referenced by get_data_path(), get_status(), and set_data_path_prefix_().

◆ data_prefix_

std::string nest::IOManager::data_prefix_
private

Prefix for all files written by devices.

Referenced by get_data_prefix(), get_status(), and set_data_path_prefix_().

◆ overwrite_files_

bool nest::IOManager::overwrite_files_
private

If true, overwrite existing data files.

Referenced by get_status(), initialize(), overwrite_files(), and set_status().

◆ recording_backends_

◆ stimulation_backends_

std::map< std::string, StimulationBackend* > nest::IOManager::stimulation_backends_
private

The documentation for this class was generated from the following files: