Skip to content
Snippets Groups Projects
Commit a34a1e9f authored by Timo Koch's avatar Timo Koch
Browse files

[istlsolvers] Improve parameter handling and allow setting a matrix operator for reuse

* The solver accepts now either a parameter group or a Dune::ParameterTree. In the case of the latter,
the parameter tree is forwarded without modificaiton to the dune-istl solvers.

* Introduce a new function to set the maximum number of itertions

* Introduce two new interfaces "setMatrix(A)" and "solve(x, b)". The first one constructs a solver
based on the matrix A. If the new solve interface without matrix is called, this pre-constructed
solver is used in the solver. solve(A, x, b) still exists and construct a solver based on A and
ignores any stored solver. This allows to contruct a solver and then reuse it for many right hand sides.
This can be practical, for example, in parallel for linear problems
where constructing the solver involves the modificaiton
of the matrix and communication and is therefore an expensive step.

* Return solver result that is convertible to bool but contains Dune::InverseOperatorResults

* Simplify parallel code branches

* Make solver copyable by using shared_ptr for parallel helper
parent 02e599a7
No related branches found
No related tags found
1 merge request!3465[linear][istlsolvers] Improve parameter handling and allow setting a matrix operator for reuse
This diff is collapsed.
......@@ -83,9 +83,12 @@ int main(int argc, char* argv[])
LinearSolver solver(testSolverName);
std::cout << "Solving Laplace problem with " << solver.name() << "\n";
solver.solve(A, x, b);
if (!solver.result().converged)
auto result = solver.solve(A, x, b);
if (!result.converged)
DUNE_THROW(Dune::Exception, testSolverName << " did not converge!");
if (!result)
DUNE_THROW(Dune::Exception, "Solver result cannot be implicitly converted to bool");
}
// IstlSolverFactoryBackend
......
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