Template Numerical Library version\ main:4e58ea6
Loading...
Searching...
No Matches
TNL::Solvers::SolverMonitor Class Referenceabstract

Base class for solver monitors. More...

#include <TNL/Solvers/SolverMonitor.h>

Inheritance diagram for TNL::Solvers::SolverMonitor:
Collaboration diagram for TNL::Solvers::SolverMonitor:

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 }
 
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
inlinenodiscard

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

◆ 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: