Template Numerical Library version\ main:bb09b17
|
Base class for solver monitors. More...
#include <TNL/Solvers/SolverMonitor.h>
Public Member Functions | |
SolverMonitor ()=default | |
Basic construct with no arguments. | |
bool | isStopped () const |
Checks whether the main loop was stopped. | |
virtual void | refresh ()=0 |
This abstract method is responsible for printing or visualizing the status of the solver. | |
void | runMainLoop () |
Starts the main loop from which the method SolverMonitor::refresh is called in given time periods. | |
void | setRefreshRate (const int &refreshRate) |
Set the time interval between two consecutive calls of SolverMonitor::refresh. | |
void | setTimer (Timer &timer) |
Set a timer object for the solver monitor. | |
void | stopMainLoop () |
Stops the main loop of the monitor. See runMainLoop. | |
Protected Member Functions | |
double | getElapsedTime () |
Protected Attributes | |
std::atomic_bool | started { false } |
std::atomic_bool | stopped { false } |
std::atomic_int | timeout_milliseconds { 500 } |
Timer * | timer = nullptr |
Base class for solver monitors.
The solver monitors serve for monitoring a convergence and status of various solvers. The solver monitor uses separate thread for monitoring the solver status in preset time period.
|
inlinenodiscard |
Checks whether the main loop was stopped.
|
pure virtual |
This abstract method is responsible for printing or visualizing the status of the solver.
Implemented in TNL::Solvers::IterativeSolverMonitor< Real, Index >, TNL::Solvers::IterativeSolverMonitor< double, int >, TNL::Solvers::IterativeSolverMonitor< gko::default_precision, int >, TNL::Solvers::IterativeSolverMonitor< Matrix::RealType, Matrix::IndexType >, TNL::Solvers::IterativeSolverMonitor< Real, Index >, and TNL::Solvers::IterativeSolverMonitor< typename Vector::RealType, typename Vector::IndexType >.
|
inline |
Set the time interval between two consecutive calls of SolverMonitor::refresh.
refreshRate | refresh rate in miliseconds. |
|
inline |
Set a timer object for the solver monitor.
If a timer is set, the monitor can measure real elapsed time since the start of the solver.
timer | is an instance of TNL::Timer. |