Template Numerical Library version main:e6bb26f
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
TNL::Solvers::IterativeSolverMonitor< Real, Index > Class Template Reference

Object for monitoring convergence of iterative solvers. More...

#include <TNL/Solvers/IterativeSolverMonitor.h>

Inheritance diagram for TNL::Solvers::IterativeSolverMonitor< Real, Index >:
Inheritance graph
[legend]
Collaboration diagram for TNL::Solvers::IterativeSolverMonitor< Real, Index >:
Collaboration graph
[legend]

Public Types

using IndexType = Index
 A type for indexing.
 
using RealType = Real
 A type of the floating-point arithmetics.
 

Public Member Functions

 IterativeSolverMonitor ()=default
 Construct with no parameters.
 
void refresh () override
 Causes that the monitor prints out the status of the solver. More...
 
void setIterations (const IndexType &iterations)
 Set number of the current iteration. More...
 
void setNodesPerIteration (const IndexType &nodes)
 Set the number of nodes of the numerical mesh or lattice. More...
 
void setResidue (const RealType &residue)
 Set residue of the current approximation of the solution. More...
 
void setStage (const std::string &stage)
 This method can be used for naming a stage of the monitored solver. More...
 
void setTime (const RealType &time)
 Set the time of the simulated evolution if it is time dependent. More...
 
void setTimeStep (const RealType &timeStep)
 Set the time step for time dependent iterative solvers. More...
 
void setVerbose (const IndexType &verbose)
 Set up the verbosity of the monitor. More...
 
- Public Member Functions inherited from TNL::Solvers::SolverMonitor
 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

int getLineWidth ()
 
- Protected Member Functions inherited from TNL::Solvers::SolverMonitor
double getElapsedTime ()
 

Protected Attributes

std::atomic_bool attributes_changed { false }
 
RealType elapsed_time_before_refresh = 0
 
IndexType iterations = 0
 
IndexType iterations_before_refresh = 0
 
RealType last_mlups = 0
 
IndexType nodesPerIteration = 0
 
RealType residue = 0
 
std::atomic_bool saved { false }
 
IndexType saved_iterations = 0
 
RealType saved_residue = 0
 
std::string saved_stage
 
RealType saved_time = 0
 
RealType saved_timeStep = 0
 
std::string stage
 
RealType time = 0
 
RealType timeStep = 0
 
IndexType verbose = 2
 
- Protected Attributes inherited from TNL::Solvers::SolverMonitor
std::atomic_bool started { false }
 
std::atomic_bool stopped { false }
 
std::atomic_int timeout_milliseconds { 500 }
 
Timertimer = nullptr
 

Detailed Description

template<typename Real = double, typename Index = int>
class TNL::Solvers::IterativeSolverMonitor< Real, Index >

Object for monitoring convergence of iterative solvers.

Template Parameters
Realis a type of the floating-point arithmetics.
Indexis an indexing type.

The following example shows how to use the iterative solver monitor for monitoring convergence of linear iterative solver:

1#include <iostream>
2#include <memory>
3#include <chrono>
4#include <thread>
5#include <TNL/Algorithms/ParallelFor.h>
6#include <TNL/Matrices/SparseMatrix.h>
7#include <TNL/Devices/Sequential.h>
8#include <TNL/Devices/Cuda.h>
9#include <TNL/Solvers/Linear/Jacobi.h>
10
11template< typename Device >
12void iterativeLinearSolverExample()
13{
14 /***
15 * Set the following matrix (dots represent zero matrix elements):
16 *
17 * / 2.5 -1 . . . \
18 * | -1 2.5 -1 . . |
19 * | . -1 2.5 -1. . |
20 * | . . -1 2.5 -1 |
21 * \ . . . -1 2.5 /
22 */
25 const int size( 5 );
26 auto matrix_ptr = std::make_shared< MatrixType >();
27 matrix_ptr->setDimensions( size, size );
28 matrix_ptr->setRowCapacities( Vector( { 2, 3, 3, 3, 2 } ) );
29
30 auto f = [=] __cuda_callable__ ( typename MatrixType::RowView& row ) mutable {
31 const int rowIdx = row.getRowIndex();
32 if( rowIdx == 0 )
33 {
34 row.setElement( 0, rowIdx, 2.5 ); // diagonal element
35 row.setElement( 1, rowIdx+1, -1 ); // element above the diagonal
36 }
37 else if( rowIdx == size - 1 )
38 {
39 row.setElement( 0, rowIdx-1, -1.0 ); // element below the diagonal
40 row.setElement( 1, rowIdx, 2.5 ); // diagonal element
41 }
42 else
43 {
44 row.setElement( 0, rowIdx-1, -1.0 ); // element below the diagonal
45 row.setElement( 1, rowIdx, 2.5 ); // diagonal element
46 row.setElement( 2, rowIdx+1, -1.0 ); // element above the diagonal
47 }
48 };
49
50 /***
51 * Set the matrix elements.
52 */
53 matrix_ptr->forAllRows( f );
54 std::cout << *matrix_ptr << std::endl;
55
56 /***
57 * Set the right-hand side vector.
58 */
59 Vector x( size, 1.0 );
60 Vector b( size );
61 matrix_ptr->vectorProduct( x, b );
62 x = 0.0;
63 std::cout << "Vector b = " << b << std::endl;
64
65 /***
66 * Setup solver of the linear system.
67 */
69 LinearSolver solver;
70 solver.setMatrix( matrix_ptr );
71 solver.setOmega( 0.0005 );
72
73 /***
74 * Setup monitor of the iterative solver.
75 */
76 using IterativeSolverMonitorType = TNL::Solvers::IterativeSolverMonitor< double, int >;
77 IterativeSolverMonitorType monitor;
78 TNL::Solvers::SolverMonitorThread monitorThread(monitor);
79 monitor.setRefreshRate(10); // refresh rate in milliseconds
80 monitor.setVerbose(1);
81 monitor.setStage( "Jacobi stage:" );
82 solver.setSolverMonitor(monitor);
83 solver.setConvergenceResidue( 1.0e-6 );
84 solver.solve( b, x );
85 monitor.stopMainLoop();
86 std::cout << "Vector x = " << x << std::endl;
87}
88
89int main( int argc, char* argv[] )
90{
91 std::cout << "Solving linear system on host: " << std::endl;
92 iterativeLinearSolverExample< TNL::Devices::Sequential >();
93
94#ifdef HAVE_CUDA
95 std::cout << "Solving linear system on CUDA device: " << std::endl;
96 iterativeLinearSolverExample< TNL::Devices::Cuda >();
97#endif
98}
#define __cuda_callable__
Definition: CudaCallable.h:22
Vector extends Array with algebraic operations.
Definition: Vector.h:40
Implementation of sparse matrix, i.e. matrix storing only non-zero elements.
Definition: SparseMatrix.h:57
Iterative solver of linear systems based on the Jacobi method.
Definition: Jacobi.h:26
void setMatrix(const MatrixPointer &matrix)
Set the matrix of the linear system.
Definition: LinearSolver.h:127
A RAII wrapper for launching the SolverMonitor's main loop in a separate thread.
Definition: SolverMonitor.h:137
T endl(T... args)

The result looks as follows:

Solving linear system on host:
Row: 0 -> 0:2.5 1:-1
Row: 1 -> 0:-1 1:2.5 2:-1
Row: 2 -> 1:-1 2:2.5 3:-1
Row: 3 -> 2:-1 3:2.5 4:-1
Row: 4 -> 3:-1 4:2.5
Vector b = [ 1.5, 0.5, 0.5, 0.5, 1.5 ]
Jacobi stage: ITER: 14903 RES: 0.07323
Jacobi stage: ITER: 28437 RES: 0.0091563
Jacobi stage: ITER: 42819 RES: 0.0010057
Jacobi stage: ITER: 56973 RES: 0.00011432
Jacobi stage: ITER: 70841 RES: 1.3584e-05
Jacobi stage: ITER: 85527 RES: 1.4239e-06
Vector x = [ 0.999999, 0.999999, 0.999998, 0.999999, 0.999999 ]
Solving linear system on CUDA device:
Row: 0 -> 0:2.5 1:-1
Row: 1 -> 0:-1 1:2.5 2:-1
Row: 2 -> 1:-1 2:2.5 3:-1
Row: 3 -> 2:-1 3:2.5 4:-1
Row: 4 -> 3:-1 4:2.5
Vector b = [ 1.5, 0.5, 0.5, 0.5, 1.5 ]
Jacobi stage: ITER: 3339 RES: 0.44894
Jacobi stage: ITER: 6693 RES: 0.25931
Jacobi stage: ITER: 8605 RES: 0.1928
Jacobi stage: ITER: 9399 RES: 0.17065
Jacobi stage: ITER: 10199 RES: 0.15088
Jacobi stage: ITER: 10997 RES: 0.13341
Jacobi stage: ITER: 13927 RES: 0.085075
Jacobi stage: ITER: 14731 RES: 0.075191
Jacobi stage: ITER: 15535 RES: 0.066455
Jacobi stage: ITER: 16339 RES: 0.058735
Jacobi stage: ITER: 17143 RES: 0.051911
Jacobi stage: ITER: 17951 RES: 0.045852
Jacobi stage: ITER: 18755 RES: 0.040525
Jacobi stage: ITER: 19563 RES: 0.035795
Jacobi stage: ITER: 20367 RES: 0.031637
Jacobi stage: ITER: 21175 RES: 0.027944
Jacobi stage: ITER: 21979 RES: 0.024698
Jacobi stage: ITER: 22787 RES: 0.021815
Jacobi stage: ITER: 23593 RES: 0.019269
Jacobi stage: ITER: 24399 RES: 0.01703
Jacobi stage: ITER: 25207 RES: 0.015043
Jacobi stage: ITER: 26013 RES: 0.013287
Jacobi stage: ITER: 26819 RES: 0.011743
Jacobi stage: ITER: 27627 RES: 0.010373
Jacobi stage: ITER: 28433 RES: 0.009162
Jacobi stage: ITER: 29239 RES: 0.0080976
Jacobi stage: ITER: 30047 RES: 0.0071524
Jacobi stage: ITER: 30853 RES: 0.0063176
Jacobi stage: ITER: 31659 RES: 0.0055837
Jacobi stage: ITER: 32467 RES: 0.004932
Jacobi stage: ITER: 33273 RES: 0.0043563
Jacobi stage: ITER: 34079 RES: 0.0038502
Jacobi stage: ITER: 34885 RES: 0.0034008
Jacobi stage: ITER: 35691 RES: 0.0030057
Jacobi stage: ITER: 36497 RES: 0.0026549
Jacobi stage: ITER: 37303 RES: 0.0023465
Jacobi stage: ITER: 38111 RES: 0.0020726
Jacobi stage: ITER: 38915 RES: 0.0018318
Jacobi stage: ITER: 39723 RES: 0.001618
Jacobi stage: ITER: 40529 RES: 0.0014292
Jacobi stage: ITER: 41335 RES: 0.0012631
Jacobi stage: ITER: 42143 RES: 0.0011157
Jacobi stage: ITER: 42949 RES: 0.00098548
Jacobi stage: ITER: 43755 RES: 0.000871
Jacobi stage: ITER: 44561 RES: 0.00076934
Jacobi stage: ITER: 45367 RES: 0.00067996
Jacobi stage: ITER: 46171 RES: 0.00060096
Jacobi stage: ITER: 46977 RES: 0.00053082
Jacobi stage: ITER: 47783 RES: 0.00046915
Jacobi stage: ITER: 48589 RES: 0.0004144
Jacobi stage: ITER: 49395 RES: 0.00036625
Jacobi stage: ITER: 50199 RES: 0.0003237
Jacobi stage: ITER: 51005 RES: 0.00028592
Jacobi stage: ITER: 51811 RES: 0.00025271
Jacobi stage: ITER: 52617 RES: 0.00022321
Jacobi stage: ITER: 53423 RES: 0.00019728
Jacobi stage: ITER: 54229 RES: 0.00017425
Jacobi stage: ITER: 55035 RES: 0.00015401
Jacobi stage: ITER: 55843 RES: 0.00013603
Jacobi stage: ITER: 56647 RES: 0.00012023
Jacobi stage: ITER: 57455 RES: 0.0001062
Jacobi stage: ITER: 58261 RES: 9.3802e-05
Jacobi stage: ITER: 59067 RES: 8.2905e-05
Jacobi stage: ITER: 59875 RES: 7.3228e-05
Jacobi stage: ITER: 60681 RES: 6.4681e-05
Jacobi stage: ITER: 61489 RES: 5.7132e-05
Jacobi stage: ITER: 62295 RES: 5.0494e-05
Jacobi stage: ITER: 63103 RES: 4.4601e-05
Jacobi stage: ITER: 63907 RES: 3.9419e-05
Jacobi stage: ITER: 64713 RES: 3.4818e-05
Jacobi stage: ITER: 65519 RES: 3.0773e-05
Jacobi stage: ITER: 66325 RES: 2.7182e-05
Jacobi stage: ITER: 67131 RES: 2.4024e-05
Jacobi stage: ITER: 67937 RES: 2.122e-05
Jacobi stage: ITER: 68743 RES: 1.8755e-05
Jacobi stage: ITER: 69547 RES: 1.6576e-05
Jacobi stage: ITER: 70351 RES: 1.465e-05
Jacobi stage: ITER: 71157 RES: 1.294e-05
Jacobi stage: ITER: 71961 RES: 1.1437e-05
Jacobi stage: ITER: 72767 RES: 1.0108e-05
Jacobi stage: ITER: 73571 RES: 8.9339e-06
Jacobi stage: ITER: 74379 RES: 7.8911e-06
Jacobi stage: ITER: 75185 RES: 6.9701e-06
Jacobi stage: ITER: 75991 RES: 6.1604e-06
Jacobi stage: ITER: 76799 RES: 5.4413e-06
Jacobi stage: ITER: 77605 RES: 4.8062e-06
Jacobi stage: ITER: 78411 RES: 4.2479e-06
Jacobi stage: ITER: 79219 RES: 3.7521e-06
Jacobi stage: ITER: 80025 RES: 3.3141e-06
Jacobi stage: ITER: 80833 RES: 2.9273e-06
Jacobi stage: ITER: 81639 RES: 2.5872e-06
Jacobi stage: ITER: 82447 RES: 2.2853e-06
Jacobi stage: ITER: 83255 RES: 2.0185e-06
Jacobi stage: ITER: 84061 RES: 1.7829e-06
Jacobi stage: ITER: 84867 RES: 1.5758e-06
Jacobi stage: ITER: 85675 RES: 1.3919e-06
Jacobi stage: ITER: 86483 RES: 1.2294e-06
Jacobi stage: ITER: 87289 RES: 1.0859e-06
Vector x = [ 0.999999, 0.999999, 0.999998, 0.999999, 0.999999 ]

The following example shows how to employ timer (TNL::Timer) to the monitor of iterative solvers:

1#include <iostream>
2#include <memory>
3#include <chrono>
4#include <thread>
5#include <TNL/Timer.h>
6#include <TNL/Algorithms/ParallelFor.h>
7#include <TNL/Matrices/SparseMatrix.h>
8#include <TNL/Devices/Sequential.h>
9#include <TNL/Devices/Cuda.h>
10#include <TNL/Solvers/Linear/Jacobi.h>
11
12template< typename Device >
13void iterativeLinearSolverExample()
14{
15 /***
16 * Set the following matrix (dots represent zero matrix elements):
17 *
18 * / 2.5 -1 . . . \
19 * | -1 2.5 -1 . . |
20 * | . -1 2.5 -1. . |
21 * | . . -1 2.5 -1 |
22 * \ . . . -1 2.5 /
23 */
26 const int size( 5 );
27 auto matrix_ptr = std::make_shared< MatrixType >();
28 matrix_ptr->setDimensions( size, size );
29 matrix_ptr->setRowCapacities( Vector( { 2, 3, 3, 3, 2 } ) );
30
31 auto f = [=] __cuda_callable__ ( typename MatrixType::RowView& row ) mutable {
32 const int rowIdx = row.getRowIndex();
33 if( rowIdx == 0 )
34 {
35 row.setElement( 0, rowIdx, 2.5 ); // diagonal element
36 row.setElement( 1, rowIdx+1, -1 ); // element above the diagonal
37 }
38 else if( rowIdx == size - 1 )
39 {
40 row.setElement( 0, rowIdx-1, -1.0 ); // element below the diagonal
41 row.setElement( 1, rowIdx, 2.5 ); // diagonal element
42 }
43 else
44 {
45 row.setElement( 0, rowIdx-1, -1.0 ); // element below the diagonal
46 row.setElement( 1, rowIdx, 2.5 ); // diagonal element
47 row.setElement( 2, rowIdx+1, -1.0 ); // element above the diagonal
48 }
49 };
50
51 /***
52 * Set the matrix elements.
53 */
54 matrix_ptr->forAllRows( f );
55 std::cout << *matrix_ptr << std::endl;
56
57 /***
58 * Set the right-hand side vector.
59 */
60 Vector x( size, 1.0 );
61 Vector b( size );
62 matrix_ptr->vectorProduct( x, b );
63 x = 0.0;
64 std::cout << "Vector b = " << b << std::endl;
65
66 /***
67 * Setup solver of the linear system.
68 */
70 LinearSolver solver;
71 solver.setMatrix( matrix_ptr );
72 solver.setOmega( 0.0005 );
73
74 /***
75 * Setup monitor of the iterative solver.
76 */
77 using IterativeSolverMonitorType = TNL::Solvers::IterativeSolverMonitor< double, int >;
78 IterativeSolverMonitorType monitor;
79 TNL::Solvers::SolverMonitorThread mmonitorThread(monitor);
80 monitor.setRefreshRate(10); // refresh rate in milliseconds
81 monitor.setVerbose(1);
82 monitor.setStage( "Jacobi stage:" );
83 TNL::Timer timer;
84 monitor.setTimer( timer );
85 timer.start();
86 solver.setSolverMonitor(monitor);
87 solver.setConvergenceResidue( 1.0e-6 );
88 solver.solve( b, x );
89 monitor.stopMainLoop();
90 std::cout << "Vector x = " << x << std::endl;
91}
92
93int main( int argc, char* argv[] )
94{
95 std::cout << "Solving linear system on host: " << std::endl;
96 iterativeLinearSolverExample< TNL::Devices::Sequential >();
97
98#ifdef HAVE_CUDA
99 std::cout << "Solving linear system on CUDA device: " << std::endl;
100 iterativeLinearSolverExample< TNL::Devices::Cuda >();
101#endif
102}
Class for real time, CPU time and CPU cycles measuring.
Definition: Timer.h:28
void start()
Starts timer.
Definition: Timer.hpp:49

The result looks as follows:

Solving linear system on host:
Row: 0 -> 0:2.5 1:-1
Row: 1 -> 0:-1 1:2.5 2:-1
Row: 2 -> 1:-1 2:2.5 3:-1
Row: 3 -> 2:-1 3:2.5 4:-1
Row: 4 -> 3:-1 4:2.5
Vector b = [ 1.5, 0.5, 0.5, 0.5, 1.5 ]
ELA: 0
ELA: 0.10011 Jacobi stage: ITER: 12885 RES: 0.099814
ELA: 0.20024 Jacobi stage: ITER: 25849 RES: 0.013626
ELA: 0.30035 Jacobi stage: ITER: 38875 RES: 0.0018431
ELA: 0.40046 Jacobi stage: ITER: 51959 RES: 0.00024703
ELA: 0.50057 Jacobi stage: ITER: 64965 RES: 3.3496e-05
ELA: 0.60068 Jacobi stage: ITER: 77893 RES: 4.5983e-06
Vector x = [ 0.999999, 0.999999, 0.999998, 0.999999, 0.999999 ]
Solving linear system on CUDA device:
Row: 0 -> 0:2.5 1:-1
Row: 1 -> 0:-1 1:2.5 2:-1
Row: 2 -> 1:-1 2:2.5 3:-1
Row: 3 -> 2:-1 3:2.5 4:-1
Row: 4 -> 3:-1 4:2.5
Vector b = [ 1.5, 0.5, 0.5, 0.5, 1.5 ]
ELA:1.5091e-
ELA: 0.10012 Jacobi stage: ITER: 789 RES: 0.78187
ELA: 0.20023 Jacobi stage: ITER: 1587 RES: 0.6384
ELA: 0.30033 Jacobi stage: ITER: 2385 RES: 0.53734
ELA: 0.40046 Jacobi stage: ITER: 3187 RES: 0.46141
ELA: 0.78017 Jacobi stage: ITER: 3987 RES: 0.40106
ELA: 0.88028 Jacobi stage: ITER: 4791 RES: 0.3509
ELA: 0.98039 Jacobi stage: ITER: 5597 RES: 0.30814
ELA: 1.0805 Jacobi stage: ITER: 6403 RES: 0.27143
ELA: 1.1806 Jacobi stage: ITER: 7207 RES: 0.23944
ELA: 1.2807 Jacobi stage: ITER: 8015 RES: 0.21126
ELA: 1.3808 Jacobi stage: ITER: 8819 RES: 0.1866
ELA: 1.4809 Jacobi stage: ITER: 9627 RES: 0.16476
ELA: 1.581 Jacobi stage: ITER: 10431 RES: 0.14559
ELA: 1.6811 Jacobi stage: ITER: 11239 RES: 0.12858
ELA: 1.7812 Jacobi stage: ITER: 12045 RES: 0.11356
ELA: 1.8813 Jacobi stage: ITER: 12851 RES: 0.10037
ELA: 1.9814 Jacobi stage: ITER: 13659 RES: 0.088651
ELA: 2.0815 Jacobi stage: ITER: 14465 RES: 0.078303
ELA: 2.1816 Jacobi stage: ITER: 15273 RES: 0.069163
ELA: 2.2817 Jacobi stage: ITER: 16079 RES: 0.061128
ELA: 2.3818 Jacobi stage: ITER: 16885 RES: 0.053993
ELA: 2.4819 Jacobi stage: ITER: 17691 RES: 0.04772
ELA: 2.582 Jacobi stage: ITER: 18499 RES: 0.04215
ELA: 2.6821 Jacobi stage: ITER: 19305 RES: 0.037231
ELA: 2.7822 Jacobi stage: ITER: 20111 RES: 0.032906
ELA: 2.8823 Jacobi stage: ITER: 20919 RES: 0.029065
ELA: 2.9824 Jacobi stage: ITER: 21725 RES: 0.025672
ELA: 3.0825 Jacobi stage: ITER: 22531 RES: 0.02269
ELA: 3.1826 Jacobi stage: ITER: 23339 RES: 0.020042
ELA: 3.2827 Jacobi stage: ITER: 24143 RES: 0.017713
ELA: 3.3828 Jacobi stage: ITER: 24951 RES: 0.015646
ELA: 3.4829 Jacobi stage: ITER: 25757 RES: 0.01382
ELA: 3.583 Jacobi stage: ITER: 26563 RES: 0.012214
ELA: 3.6831 Jacobi stage: ITER: 27369 RES: 0.010789
ELA: 3.7832 Jacobi stage: ITER: 28175 RES: 0.0095353
ELA: 3.8834 Jacobi stage: ITER: 28983 RES: 0.0084223
ELA: 3.9835 Jacobi stage: ITER: 29789 RES: 0.0074393
ELA: 4.0836 Jacobi stage: ITER: 30595 RES: 0.006575
ELA: 4.1836 Jacobi stage: ITER: 31403 RES: 0.0058076
ELA: 4.2837 Jacobi stage: ITER: 32209 RES: 0.0051298
ELA: 4.3838 Jacobi stage: ITER: 33015 RES: 0.0045338
ELA: 4.4839 Jacobi stage: ITER: 33821 RES: 0.0040046
ELA: 4.584 Jacobi stage: ITER: 34627 RES: 0.0035394
ELA: 4.6841 Jacobi stage: ITER: 35431 RES: 0.0031282
ELA: 4.7842 Jacobi stage: ITER: 36237 RES: 0.0027631
ELA: 4.8843 Jacobi stage: ITER: 37043 RES: 0.0024421
ELA: 4.9844 Jacobi stage: ITER: 37849 RES: 0.0021571
ELA: 5.0845 Jacobi stage: ITER: 38655 RES: 0.0019065
ELA: 5.1846 Jacobi stage: ITER: 39459 RES: 0.001685
ELA: 5.2847 Jacobi stage: ITER: 40265 RES: 0.0014883
ELA: 5.3848 Jacobi stage: ITER: 41071 RES: 0.0013154
ELA: 5.4849 Jacobi stage: ITER: 41877 RES: 0.0011619
ELA: 5.585 Jacobi stage: ITER: 42683 RES: 0.0010269
ELA: 5.6852 Jacobi stage: ITER: 43489 RES: 0.00090704
ELA: 5.7853 Jacobi stage: ITER: 44295 RES: 0.00080167
ELA: 5.8854 Jacobi stage: ITER: 45101 RES: 0.0007081
ELA: 5.9855 Jacobi stage: ITER: 45907 RES: 0.00062584
ELA: 6.0856 Jacobi stage: ITER: 46713 RES: 0.00055279
ELA: 6.1857 Jacobi stage: ITER: 47519 RES: 0.00048857
ELA: 6.2858 Jacobi stage: ITER: 48327 RES: 0.00043154
ELA: 6.3859 Jacobi stage: ITER: 49135 RES: 0.00038118
ELA: 6.486 Jacobi stage: ITER: 49939 RES: 0.00033689
ELA: 6.5861 Jacobi stage: ITER: 50747 RES: 0.00029757
ELA: 6.6862 Jacobi stage: ITER: 51553 RES: 0.00026284
ELA: 6.7863 Jacobi stage: ITER: 52359 RES: 0.0002323
ELA: 6.8864 Jacobi stage: ITER: 53163 RES: 0.00020532
ELA: 6.9865 Jacobi stage: ITER: 53971 RES: 0.00018135
ELA: 7.0866 Jacobi stage: ITER: 54775 RES: 0.00016028
ELA: 7.1867 Jacobi stage: ITER: 55583 RES: 0.00014158
ELA: 7.2868 Jacobi stage: ITER: 56387 RES: 0.00012513
ELA: 7.3869 Jacobi stage: ITER: 57195 RES: 0.00011052
ELA: 7.487 Jacobi stage: ITER: 57999 RES: 9.7684e-05
ELA: 7.5871 Jacobi stage: ITER: 58803 RES: 8.6335e-05
ELA: 7.6872 Jacobi stage: ITER: 59609 RES: 7.6259e-05
ELA: 7.7873 Jacobi stage: ITER: 60413 RES: 6.7399e-05
ELA: 7.8874 Jacobi stage: ITER: 61217 RES: 5.9569e-05
ELA: 7.9875 Jacobi stage: ITER: 62023 RES: 5.2649e-05
ELA: 8.0876 Jacobi stage: ITER: 62827 RES: 4.6532e-05
ELA: 8.1877 Jacobi stage: ITER: 63635 RES: 4.1101e-05
ELA: 8.2878 Jacobi stage: ITER: 64441 RES: 3.6304e-05
ELA: 8.3879 Jacobi stage: ITER: 65247 RES: 3.2086e-05
ELA: 8.488 Jacobi stage: ITER: 66055 RES: 2.8341e-05
ELA: 8.5881 Jacobi stage: ITER: 66861 RES: 2.5033e-05
ELA: 8.6882 Jacobi stage: ITER: 67667 RES: 2.2125e-05
ELA: 8.7883 Jacobi stage: ITER: 68473 RES: 1.9543e-05
ELA: 8.8884 Jacobi stage: ITER: 69279 RES: 1.7272e-05
ELA: 8.9885 Jacobi stage: ITER: 70087 RES: 1.5256e-05
ELA: 9.0886 Jacobi stage: ITER: 70893 RES: 1.3476e-05
ELA: 9.1887 Jacobi stage: ITER: 71701 RES: 1.1903e-05
ELA: 9.2888 Jacobi stage: ITER: 72507 RES: 1.052e-05
ELA: 9.3889 Jacobi stage: ITER: 73315 RES: 9.2922e-06
ELA: 9.489 Jacobi stage: ITER: 74121 RES: 8.2076e-06
ELA: 9.5892 Jacobi stage: ITER: 74929 RES: 7.2497e-06
ELA: 9.6893 Jacobi stage: ITER: 75735 RES: 6.4074e-06
ELA: 9.7894 Jacobi stage: ITER: 76543 RES: 5.6596e-06
ELA: 9.8895 Jacobi stage: ITER: 78207 RES: 4.3831e-06
ELA: 9.9896 Jacobi stage: ITER: 81691 RES: 2.5667e-06
ELA: 10.09 Jacobi stage: ITER: 85283 RES: 1.4783e-06
Vector x = [ 0.999999, 0.999999, 0.999998, 0.999999, 0.999999 ]

Member Function Documentation

◆ refresh()

template<typename Real , typename Index >
void TNL::Solvers::IterativeSolverMonitor< Real, Index >::refresh
overridevirtual

Causes that the monitor prints out the status of the solver.

Implements TNL::Solvers::SolverMonitor.

◆ setIterations()

template<typename Real , typename Index >
void TNL::Solvers::IterativeSolverMonitor< Real, Index >::setIterations ( const IndexType iterations)

Set number of the current iteration.

Parameters
iterationsis number of the current iteration.

◆ setNodesPerIteration()

template<typename Real , typename Index >
void TNL::Solvers::IterativeSolverMonitor< Real, Index >::setNodesPerIteration ( const IndexType nodes)

Set the number of nodes of the numerical mesh or lattice.

This can be used to compute the number of nodes processed per one second.

Parameters
nodesis number of nodes of the numerical mesh or lattice.

◆ setResidue()

template<typename Real = double, typename Index = int>
void TNL::Solvers::IterativeSolverMonitor< Real, Index >::setResidue ( const RealType residue)

Set residue of the current approximation of the solution.

Parameters
residueis a residue of the current approximation of the solution.

◆ setStage()

template<typename Real , typename Index >
void TNL::Solvers::IterativeSolverMonitor< Real, Index >::setStage ( const std::string stage)

This method can be used for naming a stage of the monitored solver.

The stage name can be used to differ between various stages of iterative solvers.

Parameters
stageis name of the solver stage.

◆ setTime()

template<typename Real , typename Index >
void TNL::Solvers::IterativeSolverMonitor< Real, Index >::setTime ( const RealType time)

Set the time of the simulated evolution if it is time dependent.

This can be used for example when solving parabolic or hyperbolic PDEs.

Parameters
timetime of the simulated evolution.

◆ setTimeStep()

template<typename Real , typename Index >
void TNL::Solvers::IterativeSolverMonitor< Real, Index >::setTimeStep ( const RealType timeStep)

Set the time step for time dependent iterative solvers.

Parameters
timeSteptime step of the time dependent iterative solver.

◆ setVerbose()

template<typename Real , typename Index >
void TNL::Solvers::IterativeSolverMonitor< Real, Index >::setVerbose ( const IndexType verbose)

Set up the verbosity of the monitor.

Parameters
verboseis the new value of the verbosity of the monitor.

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