Template Numerical Library version main:e6bb26f
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
TNL::Solvers::SolverMonitor Class Referenceabstract

Base class for solver monitors. More...

#include <TNL/Solvers/SolverMonitor.h>

Inheritance diagram for TNL::Solvers::SolverMonitor:
Inheritance graph
[legend]
Collaboration diagram for TNL::Solvers::SolverMonitor:
Collaboration graph
[legend]

Public Member Functions

 SolverMonitor ()=default
 Basic construct with no arguments.
 
bool isStopped () const
 Checks whether the main loop was stopped. More...
 
virtual void refresh ()=0
 This abstract method is responsible for printing or visualizing the status of the solver. More...
 
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. More...
 
void setTimer (Timer &timer)
 Set a timer object for the solver monitor. More...
 
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 }
 
Timertimer = nullptr
 

Detailed Description

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.

Member Function Documentation

◆ isStopped()

bool TNL::Solvers::SolverMonitor::isStopped ( ) const
inline

Checks whether the main loop was stopped.

Returns
true if the main loop was stopped.
false if the main loop was not stopped yet.

◆ refresh()

virtual void TNL::Solvers::SolverMonitor::refresh ( )
pure virtual

◆ setRefreshRate()

void TNL::Solvers::SolverMonitor::setRefreshRate ( const int &  refreshRate)
inline

Set the time interval between two consecutive calls of SolverMonitor::refresh.

Parameters
refreshRaterefresh rate in miliseconds.

◆ setTimer()

void TNL::Solvers::SolverMonitor::setTimer ( Timer timer)
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.

Parameters
timeris an instance of TNL::Timer.

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