Skip to content
Snippets Groups Projects
Commit fd1386cb authored by Tomáš Oberhuber's avatar Tomáš Oberhuber
Browse files

Fixes in tutorial and example on linear preconditioners.

parent 8b1748bd
No related branches found
No related tags found
1 merge request!116Documentation for linear solvers and preconditioners
......@@ -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 );
......
......@@ -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:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment