Template Numerical Library: TNL::Solvers::SolverMonitor Class Reference

Template Numerical Library version\ main:be7e16d88

Loading...
Searching...
No Matches
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:
[legend]
Collaboration diagram for TNL::Solvers::SolverMonitor:
[legend]

## 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.
void | unsetTimer ()
| Unsets the timer object for the solver monitor.

## 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

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

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

This abstract method is responsible for printing or visualizing the status of the solver.

Implemented in TNL::Solvers::IterativeSolverMonitor< Real >, TNL::Solvers::IterativeSolverMonitor< double >, TNL::Solvers::IterativeSolverMonitor< gko::default_precision >, and TNL::Solvers::IterativeSolverMonitor< typename Vector::RealType >.

## ◆ setRefreshRate()

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

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

Parameters

  refreshRate | refresh rate in milliseconds.

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

  timer | is an instance of TNL::Timer.

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

- src/TNL/Solvers/SolverMonitor.h