Template Numerical Library version\ main:b780a9f
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.
 
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

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: CudaCallable.h:22
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:56
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:125
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: 32159 RES: 0.0051677
Jacobi stage: ITER: 64107 RES: 3.8203e-05
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: 6459 RES: 0.26906
Jacobi stage: ITER: 12919 RES: 0.099324
Jacobi stage: ITER: 17599 RES: 0.048399
Jacobi stage: ITER: 18061 RES: 0.04507
Jacobi stage: ITER: 18531 RES: 0.041944
Jacobi stage: ITER: 19031 RES: 0.038843
Jacobi stage: ITER: 19533 RES: 0.035949
Jacobi stage: ITER: 20035 RES: 0.033292
Jacobi stage: ITER: 20537 RES: 0.030812
Jacobi stage: ITER: 21039 RES: 0.028534
Jacobi stage: ITER: 21541 RES: 0.026408
Jacobi stage: ITER: 22043 RES: 0.024456
Jacobi stage: ITER: 22543 RES: 0.022648
Jacobi stage: ITER: 23047 RES: 0.020961
Jacobi stage: ITER: 23547 RES: 0.019411
Jacobi stage: ITER: 24051 RES: 0.017965
Jacobi stage: ITER: 24551 RES: 0.016637
Jacobi stage: ITER: 25055 RES: 0.015398
Jacobi stage: ITER: 25555 RES: 0.01426
Jacobi stage: ITER: 26059 RES: 0.013197
Jacobi stage: ITER: 26559 RES: 0.012222
Jacobi stage: ITER: 27061 RES: 0.011311
Jacobi stage: ITER: 27563 RES: 0.010475
Jacobi stage: ITER: 28065 RES: 0.0096948
Jacobi stage: ITER: 28567 RES: 0.0089781
Jacobi stage: ITER: 29069 RES: 0.0083092
Jacobi stage: ITER: 29569 RES: 0.007695
Jacobi stage: ITER: 30067 RES: 0.0071305
Jacobi stage: ITER: 30567 RES: 0.0066034
Jacobi stage: ITER: 31061 RES: 0.006119
Jacobi stage: ITER: 31541 RES: 0.0056841
Jacobi stage: ITER: 32003 RES: 0.0052963
Jacobi stage: ITER: 32475 RES: 0.0049259
Jacobi stage: ITER: 32915 RES: 0.004604
Jacobi stage: ITER: 33383 RES: 0.0042846
Jacobi stage: ITER: 33845 RES: 0.0039899
Jacobi stage: ITER: 34323 RES: 0.0037086
Jacobi stage: ITER: 34823 RES: 0.0034344
Jacobi stage: ITER: 35323 RES: 0.0031805
Jacobi stage: ITER: 35823 RES: 0.0029454
Jacobi stage: ITER: 36323 RES: 0.0027277
Jacobi stage: ITER: 36823 RES: 0.002526
Jacobi stage: ITER: 37323 RES: 0.0023393
Jacobi stage: ITER: 37825 RES: 0.002165
Jacobi stage: ITER: 38325 RES: 0.002005
Jacobi stage: ITER: 38825 RES: 0.0018568
Jacobi stage: ITER: 39325 RES: 0.0017195
Jacobi stage: ITER: 39827 RES: 0.0015924
Jacobi stage: ITER: 40327 RES: 0.0014747
Jacobi stage: ITER: 40827 RES: 0.0013656
Jacobi stage: ITER: 41327 RES: 0.0012647
Jacobi stage: ITER: 41827 RES: 0.0011712
Jacobi stage: ITER: 42327 RES: 0.0010846
Jacobi stage: ITER: 42827 RES: 0.0010044
Jacobi stage: ITER: 43327 RES: 0.00093018
Jacobi stage: ITER: 43829 RES: 0.00086089
Jacobi stage: ITER: 44329 RES: 0.00079725
Jacobi stage: ITER: 44829 RES: 0.00073831
Jacobi stage: ITER: 45329 RES: 0.00068373
Jacobi stage: ITER: 45829 RES: 0.00063318
Jacobi stage: ITER: 46331 RES: 0.00058638
Jacobi stage: ITER: 46831 RES: 0.00054303
Jacobi stage: ITER: 47331 RES: 0.00050288
Jacobi stage: ITER: 47831 RES: 0.00046571
Jacobi stage: ITER: 48331 RES: 0.00043128
Jacobi stage: ITER: 48831 RES: 0.0003994
Jacobi stage: ITER: 49331 RES: 0.00036987
Jacobi stage: ITER: 49831 RES: 0.00034253
Jacobi stage: ITER: 50331 RES: 0.00031721
Jacobi stage: ITER: 50833 RES: 0.00029358
Jacobi stage: ITER: 51333 RES: 0.00027187
Jacobi stage: ITER: 51833 RES: 0.00025178
Jacobi stage: ITER: 52333 RES: 0.00023316
Jacobi stage: ITER: 52835 RES: 0.00021593
Jacobi stage: ITER: 53335 RES: 0.00019996
Jacobi stage: ITER: 53835 RES: 0.00018518
Jacobi stage: ITER: 54335 RES: 0.00017149
Jacobi stage: ITER: 54835 RES: 0.00015881
Jacobi stage: ITER: 55335 RES: 0.00014707
Jacobi stage: ITER: 55835 RES: 0.0001362
Jacobi stage: ITER: 56333 RES: 0.00012613
Jacobi stage: ITER: 56833 RES: 0.00011681
Jacobi stage: ITER: 57333 RES: 0.00010817
Jacobi stage: ITER: 57833 RES: 0.00010018
Jacobi stage: ITER: 58335 RES: 9.277e-05
Jacobi stage: ITER: 58835 RES: 8.5912e-05
Jacobi stage: ITER: 59335 RES: 7.9561e-05
Jacobi stage: ITER: 59835 RES: 7.3679e-05
Jacobi stage: ITER: 60335 RES: 6.8233e-05
Jacobi stage: ITER: 60835 RES: 6.3188e-05
Jacobi stage: ITER: 61335 RES: 5.8517e-05
Jacobi stage: ITER: 61835 RES: 5.4191e-05
Jacobi stage: ITER: 62337 RES: 5.0154e-05
Jacobi stage: ITER: 62837 RES: 4.6447e-05
Jacobi stage: ITER: 63337 RES: 4.3013e-05
Jacobi stage: ITER: 63837 RES: 3.9833e-05
Jacobi stage: ITER: 64339 RES: 3.6889e-05
Jacobi stage: ITER: 64839 RES: 3.4162e-05
Jacobi stage: ITER: 65339 RES: 3.1636e-05
Jacobi stage: ITER: 65839 RES: 2.9297e-05
Jacobi stage: ITER: 66339 RES: 2.7132e-05
Jacobi stage: ITER: 66839 RES: 2.5126e-05
Jacobi stage: ITER: 67339 RES: 2.3268e-05
Jacobi stage: ITER: 67839 RES: 2.1548e-05
Jacobi stage: ITER: 68339 RES: 1.9955e-05
Jacobi stage: ITER: 68839 RES: 1.848e-05
Jacobi stage: ITER: 69341 RES: 1.7103e-05
Jacobi stage: ITER: 69841 RES: 1.5839e-05
Jacobi stage: ITER: 70341 RES: 1.4668e-05
Jacobi stage: ITER: 70841 RES: 1.3584e-05
Jacobi stage: ITER: 71343 RES: 1.258e-05
Jacobi stage: ITER: 71843 RES: 1.165e-05
Jacobi stage: ITER: 72343 RES: 1.0788e-05
Jacobi stage: ITER: 72843 RES: 9.9909e-06
Jacobi stage: ITER: 73343 RES: 9.2523e-06
Jacobi stage: ITER: 73843 RES: 8.5683e-06
Jacobi stage: ITER: 74343 RES: 7.9349e-06
Jacobi stage: ITER: 74845 RES: 7.3438e-06
Jacobi stage: ITER: 75345 RES: 6.8009e-06
Jacobi stage: ITER: 75845 RES: 6.2981e-06
Jacobi stage: ITER: 76345 RES: 5.8325e-06
Jacobi stage: ITER: 76839 RES: 5.408e-06
Jacobi stage: ITER: 77339 RES: 5.0082e-06
Jacobi stage: ITER: 77839 RES: 4.638e-06
Jacobi stage: ITER: 78341 RES: 4.2925e-06
Jacobi stage: ITER: 78841 RES: 3.9752e-06
Jacobi stage: ITER: 79341 RES: 3.6813e-06
Jacobi stage: ITER: 79843 RES: 3.4091e-06
Jacobi stage: ITER: 80343 RES: 3.1571e-06
Jacobi stage: ITER: 80843 RES: 2.9237e-06
Jacobi stage: ITER: 81343 RES: 2.7076e-06
Jacobi stage: ITER: 81807 RES: 2.5213e-06
Jacobi stage: ITER: 82279 RES: 2.345e-06
Jacobi stage: ITER: 82745 RES: 2.1824e-06
Jacobi stage: ITER: 83245 RES: 2.021e-06
Jacobi stage: ITER: 83745 RES: 1.8716e-06
Jacobi stage: ITER: 84245 RES: 1.7333e-06
Jacobi stage: ITER: 84745 RES: 1.6051e-06
Jacobi stage: ITER: 85247 RES: 1.4865e-06
Jacobi stage: ITER: 85747 RES: 1.3766e-06
Jacobi stage: ITER: 86247 RES: 1.2748e-06
Jacobi stage: ITER: 86747 RES: 1.1806e-06
Jacobi stage: ITER: 87247 RES: 1.0933e-06
Jacobi stage: ITER: 87747 RES: 1.0125e-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
ELA: 0.10009 Jacobi stage: ITER: 32115 RES: 0.0052028
ELA: 0.2002 Jacobi stage: ITER: 64491 RES: 3.6037e-05
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:3.4779e-
ELA: 0.10016 Jacobi stage: ITER: 461 RES: 0.86067
ELA: 0.20026 Jacobi stage: ITER: 927 RES: 0.75312
ELA: 0.30035 Jacobi stage: ITER: 1427 RES: 0.66299
ELA: 0.40044 Jacobi stage: ITER: 1929 RES: 0.59097
ELA: 0.50053 Jacobi stage: ITER: 2431 RES: 0.53262
ELA: 0.60063 Jacobi stage: ITER: 2933 RES: 0.48331
ELA: 0.70073 Jacobi stage: ITER: 3435 RES: 0.44133
ELA: 0.80083 Jacobi stage: ITER: 3937 RES: 0.40435
ELA: 0.90094 Jacobi stage: ITER: 4439 RES: 0.37179
ELA: 1.001 Jacobi stage: ITER: 4941 RES: 0.34234
ELA: 1.1012 Jacobi stage: ITER: 5443 RES: 0.31589
ELA: 1.2012 Jacobi stage: ITER: 5945 RES: 0.29161
ELA: 1.3014 Jacobi stage: ITER: 6447 RES: 0.26957
ELA: 1.4015 Jacobi stage: ITER: 6947 RES: 0.24932
ELA: 1.5016 Jacobi stage: ITER: 7451 RES: 0.23054
ELA: 1.6017 Jacobi stage: ITER: 7951 RES: 0.21336
ELA: 1.7018 Jacobi stage: ITER: 8455 RES: 0.19738
ELA: 1.8019 Jacobi stage: ITER: 8955 RES: 0.18273
ELA: 1.902 Jacobi stage: ITER: 9459 RES: 0.16908
ELA: 2.0021 Jacobi stage: ITER: 9959 RES: 0.15655
ELA: 2.1022 Jacobi stage: ITER: 10461 RES: 0.14487
ELA: 2.2023 Jacobi stage: ITER: 10963 RES: 0.13415
ELA: 2.3024 Jacobi stage: ITER: 11465 RES: 0.12415
ELA: 2.4024 Jacobi stage: ITER: 11965 RES: 0.11497
ELA: 2.5025 Jacobi stage: ITER: 12465 RES: 0.10647
ELA: 2.6026 Jacobi stage: ITER: 12965 RES: 0.098595
ELA: 2.7027 Jacobi stage: ITER: 13463 RES: 0.091361
ELA: 2.8028 Jacobi stage: ITER: 13935 RES: 0.084971
ELA: 2.9029 Jacobi stage: ITER: 14387 RES: 0.079271
ELA: 3.003 Jacobi stage: ITER: 14855 RES: 0.073772
ELA: 3.1031 Jacobi stage: ITER: 15307 RES: 0.068824
ELA: 3.2032 Jacobi stage: ITER: 15755 RES: 0.064247
ELA: 3.3033 Jacobi stage: ITER: 16221 RES: 0.059791
ELA: 3.4034 Jacobi stage: ITER: 16687 RES: 0.055677
ELA: 3.5035 Jacobi stage: ITER: 17187 RES: 0.051561
ELA: 3.6036 Jacobi stage: ITER: 17687 RES: 0.04775
ELA: 3.7037 Jacobi stage: ITER: 18187 RES: 0.04422
ELA: 3.8038 Jacobi stage: ITER: 18689 RES: 0.040926
ELA: 3.9039 Jacobi stage: ITER: 19189 RES: 0.0379
ELA: 4.004 Jacobi stage: ITER: 19689 RES: 0.035098
ELA: 4.1041 Jacobi stage: ITER: 20189 RES: 0.032504
ELA: 4.2042 Jacobi stage: ITER: 20691 RES: 0.030101
ELA: 4.3043 Jacobi stage: ITER: 21191 RES: 0.027876
ELA: 4.4044 Jacobi stage: ITER: 21691 RES: 0.025815
ELA: 4.5045 Jacobi stage: ITER: 22191 RES: 0.023906
ELA: 4.6046 Jacobi stage: ITER: 22691 RES: 0.022139
ELA: 4.7047 Jacobi stage: ITER: 23191 RES: 0.020502
ELA: 4.8048 Jacobi stage: ITER: 23691 RES: 0.018987
ELA: 4.9049 Jacobi stage: ITER: 24191 RES: 0.017583
ELA: 5.005 Jacobi stage: ITER: 24693 RES: 0.016273
ELA: 5.1051 Jacobi stage: ITER: 25193 RES: 0.01507
ELA: 5.2052 Jacobi stage: ITER: 25693 RES: 0.013956
ELA: 5.3053 Jacobi stage: ITER: 26193 RES: 0.012925
ELA: 5.4054 Jacobi stage: ITER: 26695 RES: 0.011969
ELA: 5.5056 Jacobi stage: ITER: 27195 RES: 0.011084
ELA: 5.6057 Jacobi stage: ITER: 27695 RES: 0.010265
ELA: 5.7058 Jacobi stage: ITER: 28195 RES: 0.009506
ELA: 5.8059 Jacobi stage: ITER: 28695 RES: 0.0088033
ELA: 5.906 Jacobi stage: ITER: 29195 RES: 0.0081525
ELA: 6.006 Jacobi stage: ITER: 29695 RES: 0.0075498
ELA: 6.1061 Jacobi stage: ITER: 30195 RES: 0.0069917
ELA: 6.2062 Jacobi stage: ITER: 30695 RES: 0.0064748
ELA: 6.3063 Jacobi stage: ITER: 31195 RES: 0.0059962
ELA: 6.4064 Jacobi stage: ITER: 31697 RES: 0.0055495
ELA: 6.5066 Jacobi stage: ITER: 32197 RES: 0.0051392
ELA: 6.6067 Jacobi stage: ITER: 32697 RES: 0.0047593
ELA: 6.7067 Jacobi stage: ITER: 33199 RES: 0.0044075
ELA: 6.8068 Jacobi stage: ITER: 33699 RES: 0.0040816
ELA: 6.9069 Jacobi stage: ITER: 34199 RES: 0.0037799
ELA: 7.007 Jacobi stage: ITER: 34699 RES: 0.0035005
ELA: 7.1071 Jacobi stage: ITER: 35199 RES: 0.0032417
ELA: 7.2072 Jacobi stage: ITER: 35699 RES: 0.0030021
ELA: 7.3073 Jacobi stage: ITER: 36199 RES: 0.0027801
ELA: 7.4074 Jacobi stage: ITER: 36699 RES: 0.0025746
ELA: 7.5075 Jacobi stage: ITER: 37201 RES: 0.0023828
ELA: 7.6076 Jacobi stage: ITER: 37701 RES: 0.0022067
ELA: 7.7077 Jacobi stage: ITER: 38201 RES: 0.0020435
ELA: 7.8078 Jacobi stage: ITER: 38733 RES: 0.0018832
ELA: 7.9079 Jacobi stage: ITER: 39233 RES: 0.001744
ELA: 8.0081 Jacobi stage: ITER: 39735 RES: 0.001615
ELA: 8.1082 Jacobi stage: ITER: 40235 RES: 0.0014956
ELA: 8.2083 Jacobi stage: ITER: 40735 RES: 0.0013851
ELA: 8.3084 Jacobi stage: ITER: 41235 RES: 0.0012827
ELA: 8.4085 Jacobi stage: ITER: 41735 RES: 0.0011879
ELA: 8.5086 Jacobi stage: ITER: 42235 RES: 0.0011001
ELA: 8.6087 Jacobi stage: ITER: 42735 RES: 0.0010187
ELA: 8.7088 Jacobi stage: ITER: 43237 RES: 0.00094284
ELA: 8.8089 Jacobi stage: ITER: 43737 RES: 0.00087314
ELA: 8.909 Jacobi stage: ITER: 44237 RES: 0.00080859
ELA: 9.0091 Jacobi stage: ITER: 44737 RES: 0.00074882
ELA: 9.1092 Jacobi stage: ITER: 45239 RES: 0.00069346
ELA: 9.2093 Jacobi stage: ITER: 45739 RES: 0.0006422
ELA: 9.3094 Jacobi stage: ITER: 46239 RES: 0.00059472
ELA: 9.4095 Jacobi stage: ITER: 46739 RES: 0.00055076
ELA: 9.5096 Jacobi stage: ITER: 47239 RES: 0.00051004
ELA: 9.6097 Jacobi stage: ITER: 47739 RES: 0.00047234
ELA: 9.7098 Jacobi stage: ITER: 48239 RES: 0.00043742
ELA: 9.8099 Jacobi stage: ITER: 48739 RES: 0.00040508
ELA: 9.91 Jacobi stage: ITER: 49241 RES: 0.0003749
ELA: 10.01 Jacobi stage: ITER: 49743 RES: 0.00034719
ELA: 10.11 Jacobi stage: ITER: 50243 RES: 0.00032152
ELA: 10.21 Jacobi stage: ITER: 50743 RES: 0.00029775
ELA: 10.31 Jacobi stage: ITER: 51243 RES: 0.00027574
ELA: 10.41 Jacobi stage: ITER: 51743 RES: 0.0002552
ELA: 10.511 Jacobi stage: ITER: 52245 RES: 0.00023634
ELA: 10.611 Jacobi stage: ITER: 52745 RES: 0.00021886
ELA: 10.711 Jacobi stage: ITER: 53245 RES: 0.00020268
ELA: 10.811 Jacobi stage: ITER: 53747 RES: 0.0001877
ELA: 10.911 Jacobi stage: ITER: 54247 RES: 0.00017383
ELA: 11.011 Jacobi stage: ITER: 54747 RES: 0.00016097
ELA: 11.111 Jacobi stage: ITER: 55247 RES: 0.00014907
ELA: 11.211 Jacobi stage: ITER: 55747 RES: 0.00013805
ELA: 11.311 Jacobi stage: ITER: 56247 RES: 0.00012785
ELA: 11.411 Jacobi stage: ITER: 56747 RES: 0.0001184
ELA: 11.512 Jacobi stage: ITER: 57247 RES: 0.00010964
ELA: 11.612 Jacobi stage: ITER: 57749 RES: 0.00010148
ELA: 11.712 Jacobi stage: ITER: 58249 RES: 9.3975e-05
ELA: 11.812 Jacobi stage: ITER: 58749 RES: 8.7028e-05
ELA: 11.912 Jacobi stage: ITER: 59311 RES: 7.9855e-05
ELA: 12.012 Jacobi stage: ITER: 59811 RES: 7.3952e-05
ELA: 12.112 Jacobi stage: ITER: 60311 RES: 6.8485e-05
ELA: 12.212 Jacobi stage: ITER: 60811 RES: 6.3422e-05
ELA: 12.312 Jacobi stage: ITER: 61311 RES: 5.8733e-05
ELA: 12.412 Jacobi stage: ITER: 61811 RES: 5.4391e-05
ELA: 12.513 Jacobi stage: ITER: 62313 RES: 5.034e-05
ELA: 12.613 Jacobi stage: ITER: 62813 RES: 4.6618e-05
ELA: 12.713 Jacobi stage: ITER: 63313 RES: 4.3172e-05
ELA: 12.813 Jacobi stage: ITER: 63815 RES: 3.998e-05
ELA: 12.913 Jacobi stage: ITER: 64273 RES: 3.7253e-05
ELA: 13.013 Jacobi stage: ITER: 64743 RES: 3.4669e-05
ELA: 13.113 Jacobi stage: ITER: 65211 RES: 3.2264e-05
ELA: 13.213 Jacobi stage: ITER: 65703 RES: 2.9916e-05
ELA: 13.313 Jacobi stage: ITER: 66203 RES: 2.7704e-05
ELA: 13.413 Jacobi stage: ITER: 66703 RES: 2.5656e-05
ELA: 13.513 Jacobi stage: ITER: 67203 RES: 2.376e-05
ELA: 13.614 Jacobi stage: ITER: 67703 RES: 2.2003e-05
ELA: 13.714 Jacobi stage: ITER: 68203 RES: 2.0377e-05
ELA: 13.814 Jacobi stage: ITER: 68705 RES: 1.8859e-05
ELA: 13.914 Jacobi stage: ITER: 69205 RES: 1.7464e-05
ELA: 14.014 Jacobi stage: ITER: 69705 RES: 1.6173e-05
ELA: 14.114 Jacobi stage: ITER: 70205 RES: 1.4978e-05
ELA: 14.214 Jacobi stage: ITER: 75207 RES: 6.9487e-06
ELA: 14.314 Jacobi stage: ITER: 81789 RES: 2.5275e-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: