Template Numerical Library version\ main:0c33d623
Loading...
Searching...
No Matches
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.
 
void setIterations (const IndexType &iterations)
 Set number of the current iteration.
 
void setNodesPerIteration (const IndexType &nodes)
 Set the number of nodes of the numerical mesh or lattice.
 
void setResidue (const RealType &residue)
 Set residue of the current approximation of the solution.
 
void setStage (const std::string &stage)
 This method can be used for naming a stage of the monitored solver.
 
void setTime (const RealType &time)
 Set the time of the simulated evolution if it is time dependent.
 
void setTimeStep (const RealType &timeStep)
 Set the time step for time dependent iterative solvers.
 
void setVerbose (const IndexType &verbose)
 Set up the verbosity of the monitor.
 
- 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.
 
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

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/Matrices/SparseMatrix.h>
6#include <TNL/Devices/Sequential.h>
7#include <TNL/Devices/Cuda.h>
8#include <TNL/Solvers/Linear/Jacobi.h>
9
10template< typename Device >
11void iterativeLinearSolverExample()
12{
13 /***
14 * Set the following matrix (dots represent zero matrix elements):
15 *
16 * / 2.5 -1 . . . \
17 * | -1 2.5 -1 . . |
18 * | . -1 2.5 -1. . |
19 * | . . -1 2.5 -1 |
20 * \ . . . -1 2.5 /
21 */
24 const int size( 5 );
25 auto matrix_ptr = std::make_shared< MatrixType >();
26 matrix_ptr->setDimensions( size, size );
27 matrix_ptr->setRowCapacities( Vector( { 2, 3, 3, 3, 2 } ) );
28
29 auto f = [=] __cuda_callable__ ( typename MatrixType::RowView& row ) mutable {
30 const int rowIdx = row.getRowIndex();
31 if( rowIdx == 0 )
32 {
33 row.setElement( 0, rowIdx, 2.5 ); // diagonal element
34 row.setElement( 1, rowIdx+1, -1 ); // element above the diagonal
35 }
36 else if( rowIdx == size - 1 )
37 {
38 row.setElement( 0, rowIdx-1, -1.0 ); // element below the diagonal
39 row.setElement( 1, rowIdx, 2.5 ); // diagonal element
40 }
41 else
42 {
43 row.setElement( 0, rowIdx-1, -1.0 ); // element below the diagonal
44 row.setElement( 1, rowIdx, 2.5 ); // diagonal element
45 row.setElement( 2, rowIdx+1, -1.0 ); // element above the diagonal
46 }
47 };
48
49 /***
50 * Set the matrix elements.
51 */
52 matrix_ptr->forAllRows( f );
53 std::cout << *matrix_ptr << std::endl;
54
55 /***
56 * Set the right-hand side vector.
57 */
58 Vector x( size, 1.0 );
59 Vector b( size );
60 matrix_ptr->vectorProduct( x, b );
61 x = 0.0;
62 std::cout << "Vector b = " << b << std::endl;
63
64 /***
65 * Setup solver of the linear system.
66 */
68 LinearSolver solver;
69 solver.setMatrix( matrix_ptr );
70 solver.setOmega( 0.0005 );
71
72 /***
73 * Setup monitor of the iterative solver.
74 */
75 using IterativeSolverMonitorType = TNL::Solvers::IterativeSolverMonitor< double, int >;
76 IterativeSolverMonitorType monitor;
77 TNL::Solvers::SolverMonitorThread monitorThread(monitor);
78 monitor.setRefreshRate(10); // refresh rate in milliseconds
79 monitor.setVerbose(1);
80 monitor.setStage( "Jacobi stage:" );
81 solver.setSolverMonitor(monitor);
82 solver.setConvergenceResidue( 1.0e-6 );
83 solver.solve( b, x );
84 monitor.stopMainLoop();
85 std::cout << "Vector x = " << x << std::endl;
86}
87
88int main( int argc, char* argv[] )
89{
90 std::cout << "Solving linear system on host: " << std::endl;
91 iterativeLinearSolverExample< TNL::Devices::Sequential >();
92
93#ifdef __CUDACC__
94 std::cout << "Solving linear system on CUDA device: " << std::endl;
95 iterativeLinearSolverExample< TNL::Devices::Cuda >();
96#endif
97}
#define __cuda_callable__
Definition Macros.h:52
Vector extends Array with algebraic operations.
Definition Vector.h:39
Implementation of sparse matrix, i.e. matrix storing only non-zero elements.
Definition SparseMatrix.h:60
Iterative solver of linear systems based on the Jacobi method.
Definition Jacobi.h:24
void setMatrix(const MatrixPointer &matrix)
Set the matrix of the linear system.
Definition LinearSolver.h:123
A RAII wrapper for launching the SolverMonitor's main loop in a separate thread.
Definition SolverMonitor.h:136
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: 16779 RES: 0.054896
Jacobi stage: ITER: 34955 RES: 0.0033634
Jacobi stage: ITER: 52197 RES: 0.00023808
Jacobi stage: ITER: 69553 RES: 1.6555e-05
Jacobi stage: ITER: 86681 RES: 1.1922e-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: 5793 RES: 0.2987
Jacobi stage: ITER: 10651 RES: 0.14074
Jacobi stage: ITER: 15567 RES: 0.066129
Jacobi stage: ITER: 20319 RES: 0.031871
Jacobi stage: ITER: 23377 RES: 0.019919
Jacobi stage: ITER: 23835 RES: 0.018571
Jacobi stage: ITER: 24307 RES: 0.017273
Jacobi stage: ITER: 24801 RES: 0.016006
Jacobi stage: ITER: 25315 RES: 0.014795
Jacobi stage: ITER: 25809 RES: 0.01371
Jacobi stage: ITER: 26303 RES: 0.012712
Jacobi stage: ITER: 26797 RES: 0.011779
Jacobi stage: ITER: 27291 RES: 0.010922
Jacobi stage: ITER: 27807 RES: 0.01009
Jacobi stage: ITER: 28311 RES: 0.0093381
Jacobi stage: ITER: 28823 RES: 0.0086319
Jacobi stage: ITER: 29339 RES: 0.0079741
Jacobi stage: ITER: 29853 RES: 0.0073665
Jacobi stage: ITER: 30405 RES: 0.0067677
Jacobi stage: ITER: 30917 RES: 0.0062558
Jacobi stage: ITER: 31427 RES: 0.0057862
Jacobi stage: ITER: 31935 RES: 0.0053519
Jacobi stage: ITER: 32451 RES: 0.0049441
Jacobi stage: ITER: 32947 RES: 0.0045814
Jacobi stage: ITER: 33443 RES: 0.0042453
Jacobi stage: ITER: 33937 RES: 0.0039339
Jacobi stage: ITER: 34431 RES: 0.0036476
Jacobi stage: ITER: 34931 RES: 0.0033779
Jacobi stage: ITER: 35425 RES: 0.0031301
Jacobi stage: ITER: 35919 RES: 0.0029023
Jacobi stage: ITER: 36413 RES: 0.0026894
Jacobi stage: ITER: 36907 RES: 0.0024936
Jacobi stage: ITER: 37415 RES: 0.0023065
Jacobi stage: ITER: 37909 RES: 0.0021373
Jacobi stage: ITER: 38403 RES: 0.0019817
Jacobi stage: ITER: 38897 RES: 0.0018363
Jacobi stage: ITER: 39391 RES: 0.0017027
Jacobi stage: ITER: 39903 RES: 0.0015739
Jacobi stage: ITER: 40397 RES: 0.0014584
Jacobi stage: ITER: 40895 RES: 0.0013515
Jacobi stage: ITER: 41391 RES: 0.0012523
Jacobi stage: ITER: 41883 RES: 0.0011612
Jacobi stage: ITER: 42399 RES: 0.0010727
Jacobi stage: ITER: 42893 RES: 0.000994
Jacobi stage: ITER: 43387 RES: 0.00092165
Jacobi stage: ITER: 43883 RES: 0.00085404
Jacobi stage: ITER: 44375 RES: 0.00079188
Jacobi stage: ITER: 44891 RES: 0.00073154
Jacobi stage: ITER: 45383 RES: 0.00067829
Jacobi stage: ITER: 45879 RES: 0.00062853
Jacobi stage: ITER: 46371 RES: 0.00058278
Jacobi stage: ITER: 46867 RES: 0.00054003
Jacobi stage: ITER: 47379 RES: 0.00049919
Jacobi stage: ITER: 47871 RES: 0.00046285
Jacobi stage: ITER: 48369 RES: 0.00042864
Jacobi stage: ITER: 48863 RES: 0.00039744
Jacobi stage: ITER: 49355 RES: 0.00036851
Jacobi stage: ITER: 49879 RES: 0.00033897
Jacobi stage: ITER: 50407 RES: 0.00031353
Jacobi stage: ITER: 51211 RES: 0.0002771
Jacobi stage: ITER: 51705 RES: 0.00025677
Jacobi stage: ITER: 52199 RES: 0.00023808
Jacobi stage: ITER: 52695 RES: 0.00022062
Jacobi stage: ITER: 53187 RES: 0.00020456
Jacobi stage: ITER: 53681 RES: 0.00018956
Jacobi stage: ITER: 54175 RES: 0.00017576
Jacobi stage: ITER: 54671 RES: 0.00016287
Jacobi stage: ITER: 55163 RES: 0.00015101
Jacobi stage: ITER: 55657 RES: 0.00013993
Jacobi stage: ITER: 56151 RES: 0.00012975
Jacobi stage: ITER: 56647 RES: 0.00012023
Jacobi stage: ITER: 57141 RES: 0.00011141
Jacobi stage: ITER: 57635 RES: 0.0001033
Jacobi stage: ITER: 58127 RES: 9.5782e-05
Jacobi stage: ITER: 58621 RES: 8.8756e-05
Jacobi stage: ITER: 59115 RES: 8.2296e-05
Jacobi stage: ITER: 59579 RES: 7.6634e-05
Jacobi stage: ITER: 60073 RES: 7.1013e-05
Jacobi stage: ITER: 60567 RES: 6.5844e-05
Jacobi stage: ITER: 61053 RES: 6.1089e-05
Jacobi stage: ITER: 61547 RES: 5.6642e-05
Jacobi stage: ITER: 62041 RES: 5.2487e-05
Jacobi stage: ITER: 62535 RES: 4.8667e-05
Jacobi stage: ITER: 63029 RES: 4.5097e-05
Jacobi stage: ITER: 63523 RES: 4.1814e-05
Jacobi stage: ITER: 64021 RES: 3.8723e-05
Jacobi stage: ITER: 64515 RES: 3.5905e-05
Jacobi stage: ITER: 65007 RES: 3.3291e-05
Jacobi stage: ITER: 65503 RES: 3.0849e-05
Jacobi stage: ITER: 65997 RES: 2.8586e-05
Jacobi stage: ITER: 66489 RES: 2.6505e-05
Jacobi stage: ITER: 66983 RES: 2.4576e-05
Jacobi stage: ITER: 67477 RES: 2.2773e-05
Jacobi stage: ITER: 67977 RES: 2.109e-05
Jacobi stage: ITER: 68471 RES: 1.9555e-05
Jacobi stage: ITER: 68967 RES: 1.812e-05
Jacobi stage: ITER: 69459 RES: 1.6801e-05
Jacobi stage: ITER: 69951 RES: 1.5578e-05
Jacobi stage: ITER: 70445 RES: 1.4436e-05
Jacobi stage: ITER: 70939 RES: 1.3385e-05
Jacobi stage: ITER: 71433 RES: 1.2403e-05
Jacobi stage: ITER: 71927 RES: 1.15e-05
Jacobi stage: ITER: 72419 RES: 1.0663e-05
Jacobi stage: ITER: 72911 RES: 9.8871e-06
Jacobi stage: ITER: 73347 RES: 9.2466e-06
Jacobi stage: ITER: 73843 RES: 8.5683e-06
Jacobi stage: ITER: 74353 RES: 7.9203e-06
Jacobi stage: ITER: 74859 RES: 7.3303e-06
Jacobi stage: ITER: 75347 RES: 6.8009e-06
Jacobi stage: ITER: 75831 RES: 6.3136e-06
Jacobi stage: ITER: 76301 RES: 5.8721e-06
Jacobi stage: ITER: 76779 RES: 5.4581e-06
Jacobi stage: ITER: 77249 RES: 5.0764e-06
Jacobi stage: ITER: 77723 RES: 4.7214e-06
Jacobi stage: ITER: 78201 RES: 4.3858e-06
Jacobi stage: ITER: 78681 RES: 4.0741e-06
Jacobi stage: ITER: 79153 RES: 3.7891e-06
Jacobi stage: ITER: 79625 RES: 3.5242e-06
Jacobi stage: ITER: 80069 RES: 3.2918e-06
Jacobi stage: ITER: 80573 RES: 3.0466e-06
Jacobi stage: ITER: 81075 RES: 2.8214e-06
Jacobi stage: ITER: 81967 RES: 2.4601e-06
Jacobi stage: ITER: 82503 RES: 2.2657e-06
Jacobi stage: ITER: 83047 RES: 2.0841e-06
Jacobi stage: ITER: 83559 RES: 1.9264e-06
Jacobi stage: ITER: 84069 RES: 1.7807e-06
Jacobi stage: ITER: 84581 RES: 1.6461e-06
Jacobi stage: ITER: 85673 RES: 1.3919e-06
Jacobi stage: ITER: 86185 RES: 1.2866e-06
Jacobi stage: ITER: 86699 RES: 1.1893e-06
Jacobi stage: ITER: 87213 RES: 1.0987e-06
Jacobi stage: ITER: 87725 RES: 1.0156e-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/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 mmonitorThread(monitor);
79 monitor.setRefreshRate(10); // refresh rate in milliseconds
80 monitor.setVerbose(1);
81 monitor.setStage( "Jacobi stage:" );
82 TNL::Timer timer;
83 monitor.setTimer( timer );
84 timer.start();
85 solver.setSolverMonitor(monitor);
86 solver.setConvergenceResidue( 1.0e-6 );
87 solver.solve( b, x );
88 monitor.stopMainLoop();
89 std::cout << "Vector x = " << x << std::endl;
90}
91
92int main( int argc, char* argv[] )
93{
94 std::cout << "Solving linear system on host: " << std::endl;
95 iterativeLinearSolverExample< TNL::Devices::Sequential >();
96
97#ifdef __CUDACC__
98 std::cout << "Solving linear system on CUDA device: " << std::endl;
99 iterativeLinearSolverExample< TNL::Devices::Cuda >();
100#endif
101}
Class for real time, CPU time and CPU cycles measuring.
Definition Timer.h:28
void start()
Starts timer.
Definition Timer.hpp:48

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.007991
ELA: 0.10813 Jacobi stage: ITER: 20333 RES: 0.031793
ELA: 0.20825 Jacobi stage: ITER: 38959 RES: 0.0018195
ELA: 0.30837 Jacobi stage: ITER: 59781 RES: 7.427e-05
ELA: 0.4085 Jacobi stage: ITER: 79415 RES: 3.6408e-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:0.012548
ELA: 0.11266 Jacobi stage: ITER: 511 RES: 0.8482
ELA: 0.21278 Jacobi stage: ITER: 973 RES: 0.74346
ELA: 0.31289 Jacobi stage: ITER: 1471 RES: 0.65605
ELA: 0.41301 Jacobi stage: ITER: 1971 RES: 0.58588
ELA: 0.51313 Jacobi stage: ITER: 2465 RES: 0.52882
ELA: 0.61325 Jacobi stage: ITER: 2963 RES: 0.48079
ELA: 0.71336 Jacobi stage: ITER: 3455 RES: 0.43977
ELA: 0.81348 Jacobi stage: ITER: 3951 RES: 0.40352
ELA: 0.9136 Jacobi stage: ITER: 4441 RES: 0.37154
ELA: 1.0137 Jacobi stage: ITER: 4935 RES: 0.34278
ELA: 1.1139 Jacobi stage: ITER: 5429 RES: 0.3165
ELA: 1.2141 Jacobi stage: ITER: 5923 RES: 0.29272
ELA: 1.3142 Jacobi stage: ITER: 6417 RES: 0.27075
ELA: 1.4143 Jacobi stage: ITER: 6909 RES: 0.25072
ELA: 1.5144 Jacobi stage: ITER: 7403 RES: 0.23226
ELA: 1.6146 Jacobi stage: ITER: 7895 RES: 0.21522
ELA: 1.7147 Jacobi stage: ITER: 8391 RES: 0.19933
ELA: 1.8148 Jacobi stage: ITER: 8885 RES: 0.18465
ELA: 1.9149 Jacobi stage: ITER: 9375 RES: 0.17128
ELA: 2.015 Jacobi stage: ITER: 9871 RES: 0.15869
ELA: 2.1152 Jacobi stage: ITER: 10365 RES: 0.14703
ELA: 2.2153 Jacobi stage: ITER: 10859 RES: 0.13631
ELA: 2.3154 Jacobi stage: ITER: 11351 RES: 0.12639
ELA: 2.4155 Jacobi stage: ITER: 11847 RES: 0.11711
ELA: 2.5156 Jacobi stage: ITER: 12339 RES: 0.10858
ELA: 2.6158 Jacobi stage: ITER: 12835 RES: 0.10061
ELA: 2.7159 Jacobi stage: ITER: 13327 RES: 0.09329
ELA: 2.816 Jacobi stage: ITER: 13821 RES: 0.086445
ELA: 2.9161 Jacobi stage: ITER: 14313 RES: 0.080153
ELA: 3.0162 Jacobi stage: ITER: 14807 RES: 0.074318
ELA: 3.1163 Jacobi stage: ITER: 15301 RES: 0.068866
ELA: 3.2164 Jacobi stage: ITER: 15795 RES: 0.063853
ELA: 3.3165 Jacobi stage: ITER: 16287 RES: 0.059206
ELA: 3.4167 Jacobi stage: ITER: 16779 RES: 0.054896
ELA: 3.5168 Jacobi stage: ITER: 17271 RES: 0.0509
ELA: 3.6169 Jacobi stage: ITER: 17765 RES: 0.047166
ELA: 3.717 Jacobi stage: ITER: 18259 RES: 0.043733
ELA: 3.8171 Jacobi stage: ITER: 18751 RES: 0.04055
ELA: 3.9173 Jacobi stage: ITER: 19243 RES: 0.037599
ELA: 4.0174 Jacobi stage: ITER: 19737 RES: 0.03484
ELA: 4.1175 Jacobi stage: ITER: 20231 RES: 0.032305
ELA: 4.2176 Jacobi stage: ITER: 20723 RES: 0.029953
ELA: 4.3177 Jacobi stage: ITER: 21217 RES: 0.027756
ELA: 4.4178 Jacobi stage: ITER: 21711 RES: 0.025736
ELA: 4.518 Jacobi stage: ITER: 22203 RES: 0.023862
ELA: 4.6181 Jacobi stage: ITER: 22699 RES: 0.022112
ELA: 4.7182 Jacobi stage: ITER: 23193 RES: 0.02049
ELA: 4.8183 Jacobi stage: ITER: 23687 RES: 0.018999
ELA: 4.9184 Jacobi stage: ITER: 24179 RES: 0.017616
ELA: 5.0185 Jacobi stage: ITER: 24671 RES: 0.016333
ELA: 5.1186 Jacobi stage: ITER: 25165 RES: 0.015135
ELA: 5.2188 Jacobi stage: ITER: 25659 RES: 0.014034
ELA: 5.3189 Jacobi stage: ITER: 26153 RES: 0.013004
ELA: 5.419 Jacobi stage: ITER: 26645 RES: 0.012058
ELA: 5.5385 Jacobi stage: ITER: 27411 RES: 0.010723
ELA: 5.6394 Jacobi stage: ITER: 28031 RES: 0.0097485
ELA: 5.7395 Jacobi stage: ITER: 28527 RES: 0.0090334
ELA: 5.8396 Jacobi stage: ITER: 29019 RES: 0.0083759
ELA: 5.9397 Jacobi stage: ITER: 29513 RES: 0.0077615
ELA: 6.0398 Jacobi stage: ITER: 30007 RES: 0.0071965
ELA: 6.1399 Jacobi stage: ITER: 30499 RES: 0.0066727
ELA: 6.2401 Jacobi stage: ITER: 30995 RES: 0.0061832
ELA: 6.3402 Jacobi stage: ITER: 31487 RES: 0.0057332
ELA: 6.4403 Jacobi stage: ITER: 31981 RES: 0.0053126
ELA: 6.5404 Jacobi stage: ITER: 32475 RES: 0.0049259
ELA: 6.6405 Jacobi stage: ITER: 32967 RES: 0.0045674
ELA: 6.7406 Jacobi stage: ITER: 33461 RES: 0.0042323
ELA: 6.8408 Jacobi stage: ITER: 33955 RES: 0.0039243
ELA: 6.9409 Jacobi stage: ITER: 34451 RES: 0.0036364
ELA: 7.041 Jacobi stage: ITER: 34945 RES: 0.0033696
ELA: 7.1411 Jacobi stage: ITER: 35441 RES: 0.0031225
ELA: 7.2412 Jacobi stage: ITER: 35939 RES: 0.0028934
ELA: 7.3414 Jacobi stage: ITER: 36685 RES: 0.0025794
ELA: 7.4415 Jacobi stage: ITER: 37179 RES: 0.0023916
ELA: 7.5416 Jacobi stage: ITER: 37725 RES: 0.0021985
ELA: 7.6417 Jacobi stage: ITER: 38219 RES: 0.0020385
ELA: 7.7418 Jacobi stage: ITER: 38715 RES: 0.001889
ELA: 7.8419 Jacobi stage: ITER: 39207 RES: 0.0017515
ELA: 7.9421 Jacobi stage: ITER: 39701 RES: 0.001623
ELA: 8.0422 Jacobi stage: ITER: 40195 RES: 0.0015049
ELA: 8.1423 Jacobi stage: ITER: 40693 RES: 0.0013936
ELA: 8.2424 Jacobi stage: ITER: 41189 RES: 0.0012914
ELA: 8.3425 Jacobi stage: ITER: 41683 RES: 0.0011974
ELA: 8.4427 Jacobi stage: ITER: 42175 RES: 0.0011102
ELA: 8.5428 Jacobi stage: ITER: 42671 RES: 0.0010288
ELA: 8.6429 Jacobi stage: ITER: 43171 RES: 0.00095274
ELA: 8.743 Jacobi stage: ITER: 43663 RES: 0.00088339
ELA: 8.8431 Jacobi stage: ITER: 44157 RES: 0.00081859
ELA: 8.9432 Jacobi stage: ITER: 44651 RES: 0.00075901
ELA: 9.0434 Jacobi stage: ITER: 45143 RES: 0.00070376
ELA: 9.1435 Jacobi stage: ITER: 45639 RES: 0.00065214
ELA: 9.2436 Jacobi stage: ITER: 46135 RES: 0.0006043
ELA: 9.3437 Jacobi stage: ITER: 46633 RES: 0.00055962
ELA: 9.4438 Jacobi stage: ITER: 47127 RES: 0.00051889
ELA: 9.5439 Jacobi stage: ITER: 47621 RES: 0.00048083
ELA: 9.644 Jacobi stage: ITER: 48117 RES: 0.00044555
ELA: 9.7442 Jacobi stage: ITER: 48615 RES: 0.00041287
ELA: 9.8443 Jacobi stage: ITER: 49107 RES: 0.00038282
ELA: 9.9444 Jacobi stage: ITER: 49607 RES: 0.00035452
ELA: 10.044 Jacobi stage: ITER: 50959 RES: 0.00028804
ELA: 10.146 Jacobi stage: ITER: 51519 RES: 0.0002643
ELA: 10.249 Jacobi stage: ITER: 52039 RES: 0.00024401
ELA: 10.356 Jacobi stage: ITER: 52591 RES: 0.00022417
ELA: 10.456 Jacobi stage: ITER: 53091 RES: 0.0002076
ELA: 10.556 Jacobi stage: ITER: 53565 RES: 0.00019296
ELA: 10.656 Jacobi stage: ITER: 54035 RES: 0.00017958
ELA: 10.756 Jacobi stage: ITER: 54521 RES: 0.00016661
ELA: 10.856 Jacobi stage: ITER: 55003 RES: 0.00015477
ELA: 10.957 Jacobi stage: ITER: 55475 RES: 0.00014394
ELA: 11.057 Jacobi stage: ITER: 55951 RES: 0.0001338
ELA: 11.157 Jacobi stage: ITER: 56415 RES: 0.00012459
ELA: 11.257 Jacobi stage: ITER: 56887 RES: 0.00011588
ELA: 11.357 Jacobi stage: ITER: 57387 RES: 0.00010731
ELA: 11.457 Jacobi stage: ITER: 58157 RES: 9.5312e-05
ELA: 11.557 Jacobi stage: ITER: 58631 RES: 8.8647e-05
ELA: 11.657 Jacobi stage: ITER: 59113 RES: 8.2296e-05
ELA: 11.758 Jacobi stage: ITER: 59591 RES: 7.6493e-05
ELA: 11.858 Jacobi stage: ITER: 60029 RES: 7.1494e-05
ELA: 11.958 Jacobi stage: ITER: 60507 RES: 6.6454e-05
ELA: 12.058 Jacobi stage: ITER: 60999 RES: 6.1617e-05
ELA: 12.158 Jacobi stage: ITER: 61495 RES: 5.7097e-05
ELA: 12.258 Jacobi stage: ITER: 61993 RES: 5.2876e-05
ELA: 12.358 Jacobi stage: ITER: 62507 RES: 4.8877e-05
ELA: 12.458 Jacobi stage: ITER: 62933 RES: 4.5767e-05
ELA: 12.559 Jacobi stage: ITER: 63429 RES: 4.2409e-05
ELA: 12.659 Jacobi stage: ITER: 63923 RES: 3.9323e-05
ELA: 12.759 Jacobi stage: ITER: 64419 RES: 3.6438e-05
ELA: 12.859 Jacobi stage: ITER: 64935 RES: 3.3662e-05
ELA: 12.959 Jacobi stage: ITER: 69107 RES: 1.7735e-05
ELA: 13.059 Jacobi stage: ITER: 73617 RES: 8.8683e-06
ELA: 13.159 Jacobi stage: ITER: 78193 RES: 4.3912e-06
ELA: 13.259 Jacobi stage: ITER: 82763 RES: 2.177e-06
ELA: 13.36 Jacobi stage: ITER: 86239 RES: 1.2764e-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: