#include <colvarproxy_io.h>
Inheritance diagram for colvarproxy_io:
Public Methods | |||||||
colvarproxy_io () | |||||||
Constructor. More... | |||||||
virtual | ~colvarproxy_io () | ||||||
Destructor. More... | |||||||
virtual bool | io_available () | ||||||
Ensure that we're on the main thread (derived class will do actual check). More... | |||||||
virtual int | get_frame (long int &) | ||||||
\brief Save the current frame number in the argument given. More... | |||||||
virtual int | set_frame (long int) | ||||||
\brief Set the current frame number (as well as colvarmodule::it). More... | |||||||
virtual int | backup_file (char const *filename) | ||||||
\brief Rename the given file, before overwriting it. More... | |||||||
int | backup_file (std::string const &filename) | ||||||
\brief Rename the given file, before overwriting it. More... | |||||||
virtual int | remove_file (char const *filename) | ||||||
Remove the given file (on Windows only, rename to filename.old). More... | |||||||
int | remove_file (std::string const &filename) | ||||||
Remove the given file (on Windows only, rename to filename.old). More... | |||||||
virtual int | rename_file (char const *filename, char const *newfilename) | ||||||
Rename the given file. More... | |||||||
int | rename_file (std::string const &filename, std::string const &newfilename) | ||||||
Rename the given file. More... | |||||||
std::string & | input_prefix () | ||||||
Prefix of the input state file to be read next. More... | |||||||
std::string & | output_prefix () | ||||||
Default prefix to be used for all output files (final configuration). More... | |||||||
std::string & | restart_output_prefix () | ||||||
Prefix of the restart (checkpoint) file to be written next. More... | |||||||
int | default_restart_frequency () const | ||||||
Default restart frequency (as set by the simulation engine). More... | |||||||
char const *& | input_buffer () | ||||||
Buffer from which the input state information may be read. More... | |||||||
virtual std::istream & | input_stream (std::string const &input_name, std::string const description="file/channel", bool error_on_fail=true) | ||||||
Returns a reference to given input stream, creating it if needed
| |||||||
virtual bool | input_stream_exists (std::string const &input_name) | ||||||
Check if the file/channel is open (without opening it if not). More... | |||||||
virtual int | close_input_stream (std::string const &input_name) | ||||||
Closes the given input stream. More... | |||||||
virtual int | close_input_streams () | ||||||
Closes all input streams. More... | |||||||
virtual std::ostream & | output_stream (std::string const &output_name, std::string const description="file/channel") | ||||||
Returns a reference to the named output file/channel (open it if needed)
| |||||||
virtual bool | output_stream_exists (std::string const &output_name) | ||||||
Check if the file/channel is open (without opening it if not). More... | |||||||
virtual int | flush_output_stream (std::string const &output_name) | ||||||
Flushes the given output file/channel. More... | |||||||
virtual int | flush_output_streams () | ||||||
Flushes all output files/channels. More... | |||||||
virtual int | close_output_stream (std::string const &output_name) | ||||||
Closes the given output file/channel. More... | |||||||
virtual int | close_output_streams () | ||||||
Close all open files/channels to prevent data loss. More... | |||||||
Protected Attributes | |||||||
std::string | input_prefix_str | ||||||
Prefix of the input state file to be read next. More... | |||||||
std::string | output_prefix_str | ||||||
Default prefix to be used for all output files (final configuration). More... | |||||||
std::string | restart_output_prefix_str | ||||||
Prefix of the restart (checkpoint) file to be written next. More... | |||||||
int | restart_frequency_engine | ||||||
How often the simulation engine will write its own restart. More... | |||||||
std::map< std::string, std::istream * > | input_streams_ | ||||||
Container of input files/channels indexed by path name. More... | |||||||
std::istream * | input_stream_error_ | ||||||
Object whose reference is returned when read errors occur. More... | |||||||
std::map< std::string, std::ostream * > | output_streams_ | ||||||
Currently open output files/channels. More... | |||||||
std::ostream * | output_stream_error_ | ||||||
Object whose reference is returned when write errors occur. More... | |||||||
char const * | input_buffer_ | ||||||
Buffer from which the input state information may be read. More... |
Definition at line 19 of file colvarproxy_io.h.
|
Constructor.
Definition at line 30 of file colvarproxy_io.C. References input_buffer_, input_stream_error_, NULL, output_stream_error_, and restart_frequency_engine. |
|
Destructor.
Definition at line 41 of file colvarproxy_io.C. References close_input_streams, close_output_streams, input_stream_error_, and output_stream_error_. |
|
\brief Rename the given file, before overwriting it.
Definition at line 44 of file colvarproxy_io.h. References backup_file. |
|
\brief Rename the given file, before overwriting it.
Definition at line 68 of file colvarproxy_io.C. References COLVARS_ERROR, colvarmodule::error, rename_file, and string. Referenced by backup_file, colvarmodule::backup_file, and output_stream. |
|
Closes the given input stream.
Definition at line 188 of file colvarproxy_io.C. References COLVARS_FILE_ERROR, colvarmodule::error, input_stream_exists, and input_streams_. Referenced by colvar_grid_gradient::colvar_grid_gradient, colvarbias_restraint_histogram::init, colvarmodule::read_config_file, UIestimator::UIestimator::read_inputfiles, colvar_grid::read_multicol, colvarbias::read_state_prefix, colvarmodule::setup_input, and simple_scalar_dist_functions. |
|
Closes all input streams.
Definition at line 200 of file colvarproxy_io.C. References input_streams_. Referenced by ~colvarproxy_io. |
|
Closes the given output file/channel.
Definition at line 279 of file colvarproxy_io.C. References COLVARS_BUG_ERROR, colvarmodule::error, io_available, output_stream_exists, and output_streams_. Referenced by colvarbias_meta::reopen_replica_buffer_file, colvar_grid::write_multicol, colvar_grid::write_opendx, colvarbias_restraint_histogram::write_output_files, colvarbias_meta::write_replica_state_file, colvarmodule::write_restart_file, and colvarbias_meta::~colvarbias_meta. |
|
Close all open files/channels to prevent data loss.
Definition at line 296 of file colvarproxy_io.C. References io_available, and output_streams_. Referenced by colvarproxy::~colvarproxy, and ~colvarproxy_io. |
|
Default restart frequency (as set by the simulation engine).
Definition at line 87 of file colvarproxy_io.h. References restart_frequency_engine. Referenced by colvarmodule::colvarmodule. |
|
Flushes the given output file/channel.
Definition at line 247 of file colvarproxy_io.C. References io_available, output_stream_exists, and output_streams_. Referenced by colvarbias_meta::replica_share, colvar::write_state, and colvarmodule::write_traj_files. |
|
Flushes all output files/channels.
Definition at line 263 of file colvarproxy_io.C. References io_available, and output_streams_. Referenced by colvarproxy::post_run, and colvarmodule::reset. |
|
\brief Save the current frame number in the argument given.
Reimplemented in colvarproxy_vmd. Definition at line 56 of file colvarproxy_io.C. References COLVARS_NOT_IMPLEMENTED. |
|
Buffer from which the input state information may be read.
Definition at line 93 of file colvarproxy_io.h. References input_buffer_. Referenced by colvarmodule::setup_input. |
|
Prefix of the input state file to be read next.
Definition at line 69 of file colvarproxy_io.h. References input_prefix_str. Referenced by colvarmodule::print_total_forces_errning, and colvarmodule::setup_input. |
|
Returns a reference to given input stream, creating it if needed
Definition at line 154 of file colvarproxy_io.C. References COLVARS_BUG_ERROR, COLVARS_FILE_ERROR, colvarmodule::error, input_stream_error_, input_stream_exists, input_streams_, and io_available. Referenced by colvar_grid_gradient::colvar_grid_gradient, colvarbias_restraint_histogram::init, colvarmodule::read_config_file, UIestimator::UIestimator::read_inputfiles, colvar_grid::read_multicol, colvarbias::read_state_prefix, colvarmodule::setup_input, and simple_scalar_dist_functions. |
|
Check if the file/channel is open (without opening it if not).
Definition at line 182 of file colvarproxy_io.C. References input_streams_. Referenced by close_input_stream, and input_stream. |
|
Ensure that we're on the main thread (derived class will do actual check).
Reimplemented in colvarproxy. Definition at line 50 of file colvarproxy_io.C. Referenced by close_output_stream, close_output_streams, flush_output_stream, flush_output_streams, input_stream, and output_stream. |
|
Default prefix to be used for all output files (final configuration).
Definition at line 75 of file colvarproxy_io.h. References output_prefix_str. Referenced by colvarmodule::setup_output. |
|
Returns a reference to the named output file/channel (open it if needed)
Definition at line 212 of file colvarproxy_io.C. References backup_file, COLVARS_BUG_ERROR, COLVARS_FILE_ERROR, colvarmodule::debug, colvarmodule::error, io_available, colvarmodule::log, output_stream_error_, output_stream_exists, and output_streams_. Referenced by colvar::calc_runave, colvarbias_meta::reopen_replica_buffer_file, colvar_grid::write_multicol, colvar_grid::write_opendx, colvarbias_restraint_histogram::write_output_files, colvarbias_meta::write_replica_state_file, colvarmodule::write_restart_file, and colvarmodule::write_traj_files. |
|
Check if the file/channel is open (without opening it if not).
Definition at line 241 of file colvarproxy_io.C. References output_streams_. Referenced by colvar::calc_runave, close_output_stream, flush_output_stream, and output_stream. |
|
Remove the given file (on Windows only, rename to filename.old).
Definition at line 53 of file colvarproxy_io.h. References remove_file. |
|
Remove the given file (on Windows only, rename to filename.old).
Definition at line 100 of file colvarproxy_io.C. References COLVARS_FILE_ERROR, and colvarmodule::error. Referenced by remove_file, rename_file, colvarbias_meta::reopen_replica_buffer_file, and colvarbias_meta::write_replica_state_file. |
|
Rename the given file.
Definition at line 62 of file colvarproxy_io.h. References rename_file. |
|
Rename the given file.
Definition at line 133 of file colvarproxy_io.C. References COLVARS_FILE_ERROR, colvarmodule::log, and remove_file. Referenced by backup_file, rename_file, and colvarbias_meta::write_replica_state_file. |
|
Prefix of the restart (checkpoint) file to be written next.
Definition at line 81 of file colvarproxy_io.h. References restart_output_prefix_str. Referenced by colvarmodule::setup_output. |
|
\brief Set the current frame number (as well as colvarmodule::it).
Reimplemented in colvarproxy_vmd. Definition at line 62 of file colvarproxy_io.C. References COLVARS_NOT_IMPLEMENTED. |
|
Buffer from which the input state information may be read.
Definition at line 163 of file colvarproxy_io.h. Referenced by colvarproxy_io, and input_buffer. |
|
Prefix of the input state file to be read next.
Definition at line 139 of file colvarproxy_io.h. Referenced by input_prefix. |
|
Object whose reference is returned when read errors occur.
Definition at line 154 of file colvarproxy_io.h. Referenced by colvarproxy_io, input_stream, and ~colvarproxy_io. |
|
Container of input files/channels indexed by path name.
Definition at line 151 of file colvarproxy_io.h. Referenced by close_input_stream, close_input_streams, input_stream, and input_stream_exists. |
|
Default prefix to be used for all output files (final configuration).
Definition at line 142 of file colvarproxy_io.h. Referenced by output_prefix. |
|
Object whose reference is returned when write errors occur.
Definition at line 160 of file colvarproxy_io.h. Referenced by colvarproxy_io, output_stream, and ~colvarproxy_io. |
|
Currently open output files/channels.
Definition at line 157 of file colvarproxy_io.h. Referenced by close_output_stream, close_output_streams, flush_output_stream, flush_output_streams, output_stream, and output_stream_exists. |
|
How often the simulation engine will write its own restart.
Definition at line 148 of file colvarproxy_io.h. Referenced by colvarproxy_io, and default_restart_frequency. |
|
Prefix of the restart (checkpoint) file to be written next.
Definition at line 145 of file colvarproxy_io.h. Referenced by restart_output_prefix. |