![]() |
Sapphire++
v1.3.0-121-g2682132 |
LogStream for Sapphire++ More...
#include <sapphirepp-logstream.h>
Public Member Functions | |
| SapphireppLogStream () | |
| Constructor. | |
| ~SapphireppLogStream () | |
| Destructor. | |
| void | init (const unsigned int depth_console=2, const bool enable_mpi_output=false) |
| Initialize the log stream. | |
| void | init (const int argc, const char *const argv[]) |
| Initialize the log stream with command line options. | |
| void | init_parse (const int argc, const char *const argv[], std::string ¶meter_filename, bool &resume) |
| Initialize the log stream and parse command line options. | |
| void | attach_file (const std::string &filepath, const unsigned int depth_file, const bool enable_mpi_output=false) |
| Attach a logfile to the stream. | |
| void | print_error (const std::exception &exc) |
| Prints an error message to std:err and this LogStream. | |
| void | print_warning (const std::string &warning) |
| Prints a warning to std:err and this LogStream. | |
| unsigned int | get_verbosity_console () |
| Get the verbosity of the console output. | |
| unsigned int | get_verbosity_file () |
| Get the verbosity of the file output. | |
| std::ostream & | to_ostream (const unsigned int verbosity=3) |
| Conversion to std::ostream. | |
| dealii::ConditionalOStream | to_condition_ostream (const unsigned int verbosity=3) |
| Conversion to ConditionalOStream. | |
| operator std::ostream & () | |
| Conversion operator to std::ostream. | |
| operator dealii::ConditionalOStream () | |
| Conversion operator to ConditionalOStream. | |
LogStream for Sapphire++
The Stream is prefixed with sapphirepp. In case of parallel execution, all but the first process are prefixed with mpi<rank>.
For more details see LogStream documentation
| void sapphirepp::Utils::SapphireppLogStream::attach_file | ( | const std::string & | filepath, |
| const unsigned int | depth_file, | ||
| const bool | enable_mpi_output = false ) |
Attach a logfile to the stream.
| filepath | Path to the logfile |
| depth_file | The verbosity of the file output |
| enable_mpi_output | Enable output of all mpi processes |
| unsigned int sapphirepp::Utils::SapphireppLogStream::get_verbosity_console | ( | ) |
Get the verbosity of the console output.
| unsigned int sapphirepp::Utils::SapphireppLogStream::get_verbosity_file | ( | ) |
Get the verbosity of the file output.
| void sapphirepp::Utils::SapphireppLogStream::init | ( | const int | argc, |
| const char *const | argv[] ) |
Initialize the log stream with command line options.
This function must only be called after MPI initialization. To show all options use the --help/-h flag.
| argc | Number of commandline arguments |
| argv | Commandline arguments |
| void sapphirepp::Utils::SapphireppLogStream::init | ( | const unsigned int | depth_console = 2, |
| const bool | enable_mpi_output = false ) |
Initialize the log stream.
This function must only be called after MPI initialization. It prefixes the log stream with MPI<rank> for all but the first rank. In addition, it shows a start-up message.
| depth_console | The verbosity of the console output
|
| enable_mpi_output | If true, all mpi processes will output to the console, otherwise only the first process will show messages |
| void sapphirepp::Utils::SapphireppLogStream::init_parse | ( | const int | argc, |
| const char *const | argv[], | ||
| std::string & | parameter_filename, | ||
| bool & | resume ) |
Initialize the log stream and parse command line options.
This function must only be called after MPI initialization. To show all options use the --help/-h flag.
| argc | Number of commandline arguments |
| argv | Commandline arguments |
| parameter_filename | Parameter file name |
| resume | Resume simulation from checkpoint? |
| void sapphirepp::Utils::SapphireppLogStream::print_error | ( | const std::exception & | exc | ) |
Prints an error message to std:err and this LogStream.
This has the advantage, that error messages are also saved in the logfile.
| exc | Exception |
| void sapphirepp::Utils::SapphireppLogStream::print_warning | ( | const std::string & | warning | ) |
Prints a warning to std:err and this LogStream.
The warning is shown for verbosity > 0.
| warning | Warning message |
| dealii::ConditionalOStream sapphirepp::Utils::SapphireppLogStream::to_condition_ostream | ( | const unsigned int | verbosity = 3 | ) |
Conversion to ConditionalOStream.
Returns either file or console output stream dependent on verbosity. If the target verbosity is larger then the logstream verbosity, the result will be silenced.
| verbosity | Target verbosity of the output |
| std::ostream & sapphirepp::Utils::SapphireppLogStream::to_ostream | ( | const unsigned int | verbosity = 3 | ) |
Conversion to std::ostream.
Returns either file or console output stream dependent on verbosity. If the target verbosity is larger then the logstream verbosity, return an empty stream.
| verbosity | Target verbosity of the output |