Template Numerical Library version\ main:161afe73
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. 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 __CUDACC__
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: 26601 RES: 0.012139
Jacobi stage: ITER: 51475 RES: 0.00026609
Jacobi stage: ITER: 75975 RES: 6.1755e-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: 723 RES: 0.79705
Jacobi stage: ITER: 1519 RES: 0.64863
Jacobi stage: ITER: 2355 RES: 0.54081
Jacobi stage: ITER: 3359 RES: 0.44734
Jacobi stage: ITER: 4297 RES: 0.38054
Jacobi stage: ITER: 5235 RES: 0.32659
Jacobi stage: ITER: 6023 RES: 0.28814
Jacobi stage: ITER: 6911 RES: 0.25072
Jacobi stage: ITER: 7823 RES: 0.21763
Jacobi stage: ITER: 8731 RES: 0.18915
Jacobi stage: ITER: 9643 RES: 0.16435
Jacobi stage: ITER: 10551 RES: 0.14293
Jacobi stage: ITER: 11463 RES: 0.12423
Jacobi stage: ITER: 12373 RES: 0.10798
Jacobi stage: ITER: 13283 RES: 0.093922
Jacobi stage: ITER: 14193 RES: 0.081644
Jacobi stage: ITER: 15103 RES: 0.071015
Jacobi stage: ITER: 16015 RES: 0.061732
Jacobi stage: ITER: 16927 RES: 0.053662
Jacobi stage: ITER: 17837 RES: 0.046648
Jacobi stage: ITER: 18747 RES: 0.040575
Jacobi stage: ITER: 19657 RES: 0.035271
Jacobi stage: ITER: 20565 RES: 0.03068
Jacobi stage: ITER: 21475 RES: 0.026686
Jacobi stage: ITER: 22385 RES: 0.023197
Jacobi stage: ITER: 23287 RES: 0.020202
Jacobi stage: ITER: 24199 RES: 0.017562
Jacobi stage: ITER: 25109 RES: 0.015266
Jacobi stage: ITER: 26019 RES: 0.013279
Jacobi stage: ITER: 26929 RES: 0.011543
Jacobi stage: ITER: 27839 RES: 0.01004
Jacobi stage: ITER: 28747 RES: 0.0087332
Jacobi stage: ITER: 29659 RES: 0.0075917
Jacobi stage: ITER: 30569 RES: 0.0065993
Jacobi stage: ITER: 31479 RES: 0.0057402
Jacobi stage: ITER: 32391 RES: 0.0049899
Jacobi stage: ITER: 33303 RES: 0.0043376
Jacobi stage: ITER: 34215 RES: 0.0037706
Jacobi stage: ITER: 35125 RES: 0.0032778
Jacobi stage: ITER: 36031 RES: 0.0028528
Jacobi stage: ITER: 36931 RES: 0.0024845
Jacobi stage: ITER: 37885 RES: 0.0021452
Jacobi stage: ITER: 38827 RES: 0.0018568
Jacobi stage: ITER: 39727 RES: 0.001617
Jacobi stage: ITER: 40627 RES: 0.0014083
Jacobi stage: ITER: 41527 RES: 0.0012264
Jacobi stage: ITER: 42455 RES: 0.0010635
Jacobi stage: ITER: 43359 RES: 0.00092562
Jacobi stage: ITER: 44259 RES: 0.00080611
Jacobi stage: ITER: 45159 RES: 0.00070203
Jacobi stage: ITER: 46059 RES: 0.00061139
Jacobi stage: ITER: 46961 RES: 0.00053213
Jacobi stage: ITER: 47861 RES: 0.00046342
Jacobi stage: ITER: 48761 RES: 0.00040359
Jacobi stage: ITER: 49659 RES: 0.0003517
Jacobi stage: ITER: 50559 RES: 0.00030629
Jacobi stage: ITER: 51459 RES: 0.00026674
Jacobi stage: ITER: 52359 RES: 0.0002323
Jacobi stage: ITER: 53259 RES: 0.00020231
Jacobi stage: ITER: 54159 RES: 0.00017619
Jacobi stage: ITER: 55059 RES: 0.00015344
Jacobi stage: ITER: 55959 RES: 0.00013363
Jacobi stage: ITER: 56859 RES: 0.00011638
Jacobi stage: ITER: 57761 RES: 0.00010129
Jacobi stage: ITER: 58661 RES: 8.8212e-05
Jacobi stage: ITER: 59559 RES: 7.687e-05
Jacobi stage: ITER: 60461 RES: 6.6904e-05
Jacobi stage: ITER: 61361 RES: 5.8266e-05
Jacobi stage: ITER: 62261 RES: 5.0743e-05
Jacobi stage: ITER: 63159 RES: 4.4219e-05
Jacobi stage: ITER: 64083 RES: 3.8368e-05
Jacobi stage: ITER: 65091 RES: 3.2865e-05
Jacobi stage: ITER: 66003 RES: 2.8569e-05
Jacobi stage: ITER: 66903 RES: 2.488e-05
Jacobi stage: ITER: 67803 RES: 2.1668e-05
Jacobi stage: ITER: 68703 RES: 1.887e-05
Jacobi stage: ITER: 69603 RES: 1.6434e-05
Jacobi stage: ITER: 70501 RES: 1.4312e-05
Jacobi stage: ITER: 71401 RES: 1.2464e-05
Jacobi stage: ITER: 72301 RES: 1.0855e-05
Jacobi stage: ITER: 73201 RES: 9.4534e-06
Jacobi stage: ITER: 74099 RES: 8.2379e-06
Jacobi stage: ITER: 74999 RES: 7.1743e-06
Jacobi stage: ITER: 75877 RES: 6.2673e-06
Jacobi stage: ITER: 76775 RES: 5.4614e-06
Jacobi stage: ITER: 77675 RES: 4.7563e-06
Jacobi stage: ITER: 78575 RES: 4.1422e-06
Jacobi stage: ITER: 79475 RES: 3.6074e-06
Jacobi stage: ITER: 80375 RES: 3.1416e-06
Jacobi stage: ITER: 81275 RES: 2.736e-06
Jacobi stage: ITER: 82175 RES: 2.3828e-06
Jacobi stage: ITER: 83075 RES: 2.0751e-06
Jacobi stage: ITER: 83975 RES: 1.8072e-06
Jacobi stage: ITER: 84875 RES: 1.5739e-06
Jacobi stage: ITER: 85771 RES: 1.3715e-06
Jacobi stage: ITER: 86671 RES: 1.1944e-06
Jacobi stage: ITER: 87569 RES: 1.0402e-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 __CUDACC__
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:3.09e-06
ELA: 0.1001 Jacobi stage: ITER: 23897 RES: 0.01839
ELA: 0.20023 Jacobi stage: ITER: 47571 RES: 0.00048468
ELA: 0.30034 Jacobi stage: ITER: 71167 RES: 1.2924e-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:1.273e-0
ELA: 0.10035 Jacobi stage: ITER: 727 RES: 0.79614
ELA: 0.20049 Jacobi stage: ITER: 1533 RES: 0.6462
ELA: 0.30061 Jacobi stage: ITER: 2371 RES: 0.53907
ELA: 0.4081 Jacobi stage: ITER: 3299 RES: 0.45217
ELA: 0.50826 Jacobi stage: ITER: 4197 RES: 0.38696
ELA: 0.61164 Jacobi stage: ITER: 5117 RES: 0.33274
ELA: 0.71178 Jacobi stage: ITER: 5899 RES: 0.29383
ELA: 0.81191 Jacobi stage: ITER: 6795 RES: 0.2553
ELA: 0.91204 Jacobi stage: ITER: 7707 RES: 0.22157
ELA: 1.0122 Jacobi stage: ITER: 8623 RES: 0.19232
ELA: 1.1123 Jacobi stage: ITER: 9533 RES: 0.16711
ELA: 1.2124 Jacobi stage: ITER: 10443 RES: 0.14532
ELA: 1.3126 Jacobi stage: ITER: 11355 RES: 0.12631
ELA: 1.4128 Jacobi stage: ITER: 12265 RES: 0.10979
ELA: 1.5129 Jacobi stage: ITER: 13175 RES: 0.095494
ELA: 1.613 Jacobi stage: ITER: 14085 RES: 0.08301
ELA: 1.7131 Jacobi stage: ITER: 14995 RES: 0.072203
ELA: 1.8133 Jacobi stage: ITER: 15907 RES: 0.062764
ELA: 1.9134 Jacobi stage: ITER: 16819 RES: 0.05456
ELA: 2.0135 Jacobi stage: ITER: 17727 RES: 0.047457
ELA: 2.1136 Jacobi stage: ITER: 18639 RES: 0.041254
ELA: 2.2138 Jacobi stage: ITER: 19555 RES: 0.035839
ELA: 2.3139 Jacobi stage: ITER: 20479 RES: 0.031097
ELA: 2.414 Jacobi stage: ITER: 21389 RES: 0.027032
ELA: 2.5141 Jacobi stage: ITER: 22299 RES: 0.023513
ELA: 2.6143 Jacobi stage: ITER: 23223 RES: 0.020402
ELA: 2.7144 Jacobi stage: ITER: 24135 RES: 0.017735
ELA: 2.8146 Jacobi stage: ITER: 25043 RES: 0.015426
ELA: 2.9147 Jacobi stage: ITER: 25955 RES: 0.01341
ELA: 3.0148 Jacobi stage: ITER: 26863 RES: 0.011664
ELA: 3.1149 Jacobi stage: ITER: 27773 RES: 0.010139
ELA: 3.215 Jacobi stage: ITER: 28683 RES: 0.0088195
ELA: 3.3152 Jacobi stage: ITER: 29593 RES: 0.0076667
ELA: 3.4153 Jacobi stage: ITER: 30503 RES: 0.0066686
ELA: 3.5154 Jacobi stage: ITER: 31415 RES: 0.0057969
ELA: 3.6155 Jacobi stage: ITER: 32327 RES: 0.0050392
ELA: 3.7156 Jacobi stage: ITER: 33239 RES: 0.0043805
ELA: 3.8157 Jacobi stage: ITER: 34151 RES: 0.0038079
ELA: 3.9159 Jacobi stage: ITER: 35061 RES: 0.0033101
ELA: 4.016 Jacobi stage: ITER: 35967 RES: 0.002881
ELA: 4.1161 Jacobi stage: ITER: 36867 RES: 0.002509
ELA: 4.2162 Jacobi stage: ITER: 37749 RES: 0.0021904
ELA: 4.3163 Jacobi stage: ITER: 38643 RES: 0.00191
ELA: 4.4164 Jacobi stage: ITER: 39543 RES: 0.0016634
ELA: 4.5166 Jacobi stage: ITER: 40443 RES: 0.0014486
ELA: 4.6167 Jacobi stage: ITER: 41343 RES: 0.0012616
ELA: 4.7168 Jacobi stage: ITER: 42235 RES: 0.0011001
ELA: 4.8169 Jacobi stage: ITER: 43135 RES: 0.00095802
ELA: 4.917 Jacobi stage: ITER: 44035 RES: 0.00083433
ELA: 5.0171 Jacobi stage: ITER: 44937 RES: 0.00072616
ELA: 5.1172 Jacobi stage: ITER: 45837 RES: 0.00063241
ELA: 5.2173 Jacobi stage: ITER: 46739 RES: 0.00055076
ELA: 5.3175 Jacobi stage: ITER: 47639 RES: 0.00047965
ELA: 5.4176 Jacobi stage: ITER: 48539 RES: 0.00041772
ELA: 5.5177 Jacobi stage: ITER: 49439 RES: 0.00036379
ELA: 5.6178 Jacobi stage: ITER: 50339 RES: 0.00031682
ELA: 5.7179 Jacobi stage: ITER: 51239 RES: 0.00027591
ELA: 5.818 Jacobi stage: ITER: 52139 RES: 0.00024029
ELA: 5.9182 Jacobi stage: ITER: 53039 RES: 0.00020926
ELA: 6.0183 Jacobi stage: ITER: 53941 RES: 0.00018213
ELA: 6.1184 Jacobi stage: ITER: 54843 RES: 0.00015862
ELA: 6.2185 Jacobi stage: ITER: 55743 RES: 0.00013814
ELA: 6.3186 Jacobi stage: ITER: 56643 RES: 0.0001203
ELA: 6.4187 Jacobi stage: ITER: 57543 RES: 0.00010477
ELA: 6.5188 Jacobi stage: ITER: 58443 RES: 9.1244e-05
ELA: 6.619 Jacobi stage: ITER: 59343 RES: 7.9463e-05
ELA: 6.7191 Jacobi stage: ITER: 60245 RES: 6.9161e-05
ELA: 6.8192 Jacobi stage: ITER: 61145 RES: 6.0232e-05
ELA: 6.9193 Jacobi stage: ITER: 62045 RES: 5.2455e-05
ELA: 7.0194 Jacobi stage: ITER: 62945 RES: 4.5682e-05
ELA: 7.1195 Jacobi stage: ITER: 63835 RES: 3.9858e-05
ELA: 7.2197 Jacobi stage: ITER: 64699 RES: 3.4904e-05
ELA: 7.3198 Jacobi stage: ITER: 65595 RES: 3.0416e-05
ELA: 9.2586 Jacobi stage: ITER: 66493 RES: 2.6489e-05
ELA: 9.3587 Jacobi stage: ITER: 67393 RES: 2.3069e-05
ELA: 9.4588 Jacobi stage: ITER: 68293 RES: 2.0091e-05
ELA: 9.5589 Jacobi stage: ITER: 69193 RES: 1.7497e-05
ELA: 9.659 Jacobi stage: ITER: 70091 RES: 1.5247e-05
ELA: 9.7591 Jacobi stage: ITER: 70991 RES: 1.3278e-05
ELA: 9.8592 Jacobi stage: ITER: 71891 RES: 1.1564e-05
ELA: 9.9593 Jacobi stage: ITER: 72791 RES: 1.0071e-05
ELA: 10.059 Jacobi stage: ITER: 73691 RES: 8.7707e-06
ELA: 10.16 Jacobi stage: ITER: 74591 RES: 7.6383e-06
ELA: 10.26 Jacobi stage: ITER: 75463 RES: 6.6808e-06
ELA: 10.36 Jacobi stage: ITER: 76361 RES: 5.8182e-06
ELA: 10.46 Jacobi stage: ITER: 77261 RES: 5.067e-06
ELA: 10.56 Jacobi stage: ITER: 78161 RES: 4.4128e-06
ELA: 10.66 Jacobi stage: ITER: 79059 RES: 3.8454e-06
ELA: 10.76 Jacobi stage: ITER: 79959 RES: 3.3489e-06
ELA: 10.86 Jacobi stage: ITER: 80859 RES: 2.9166e-06
ELA: 10.96 Jacobi stage: ITER: 81759 RES: 2.54e-06
ELA: 11.06 Jacobi stage: ITER: 82659 RES: 2.2121e-06
ELA: 11.161 Jacobi stage: ITER: 83559 RES: 1.9264e-06
ELA: 11.261 Jacobi stage: ITER: 84459 RES: 1.6777e-06
ELA: 11.361 Jacobi stage: ITER: 85359 RES: 1.4611e-06
ELA: 11.461 Jacobi stage: ITER: 86259 RES: 1.2725e-06
ELA: 11.561 Jacobi stage: ITER: 87159 RES: 1.1082e-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: