From fd1386cbf5d7b26998faf6fa8d3bccec5936b1e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Oberhuber?= <oberhuber.tomas@gmail.com> Date: Wed, 29 Dec 2021 21:24:54 +0100 Subject: [PATCH] Fixes in tutorial and example on linear preconditioners. --- .../Linear/IterativeLinearSolverWithPreconditionerExample.cpp | 2 +- .../Tutorials/Solvers/Linear/tutorial_Linear_solvers.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/Examples/Solvers/Linear/IterativeLinearSolverWithPreconditionerExample.cpp b/Documentation/Examples/Solvers/Linear/IterativeLinearSolverWithPreconditionerExample.cpp index 3a21410744..035dbb6ce2 100644 --- a/Documentation/Examples/Solvers/Linear/IterativeLinearSolverWithPreconditionerExample.cpp +++ b/Documentation/Examples/Solvers/Linear/IterativeLinearSolverWithPreconditionerExample.cpp @@ -66,7 +66,7 @@ void iterativeLinearSolverExample() */ using LinearSolver = TNL::Solvers::Linear::TFQMR< MatrixType >; using Preconditioner = TNL::Solvers::Linear::Preconditioners::Diagonal< MatrixType >; - auto preconditioner_ptr = std::make_shared< Preconditioner >; + auto preconditioner_ptr = std::make_shared< Preconditioner >(); preconditioner_ptr->update( matrix_ptr ); LinearSolver solver; solver.setMatrix( matrix_ptr ); diff --git a/Documentation/Tutorials/Solvers/Linear/tutorial_Linear_solvers.md b/Documentation/Tutorials/Solvers/Linear/tutorial_Linear_solvers.md index 25e709ae66..4832f4f12e 100644 --- a/Documentation/Tutorials/Solvers/Linear/tutorial_Linear_solvers.md +++ b/Documentation/Tutorials/Solvers/Linear/tutorial_Linear_solvers.md @@ -85,7 +85,7 @@ Preconditioners of iterative solvers can significantly improve the performance o \includelineno Solvers/Linear/IterativeLinearSolverWithPreconditionerExample.cpp -In this example, we solve the same problem as in all other examples in this section. The only differences concerning the preconditioner happen on the lines (68-72). Similar to the matrix of the linear system, the preconditioner is passed to the solver by the means of smart shared pointer (\ref std::shared_ptr). The instance is created on the lines 68 and 69. Next we just need to connect the solver with the preconditioner (line 72, \ref TNL::Solvers::Linear::LinearSolver). +In this example, we solve the same problem as in all other examples in this section. The only differences concerning the preconditioner happen on the lines (68-72). Similar to the matrix of the linear system, the preconditioner is passed to the solver by the means of smart shared pointer (\ref std::shared_ptr). The instance is created on the lines 68 and 69. Next we have to initialize the preconditioner (line 70, \ref TNL::Solvers::Linear::Preconditioners::Preconditioner::update). The method `update` has to be called everytime the matrix of the linear system changes. This is important for example when solving time dependent PDEs but it does not happen in this example. Finally, we need to connect the solver with the preconditioner (line 73, \ref TNL::Solvers::Linear::LinearSolver). The result looks as follows: -- GitLab