3 #include <dune/common/unused.hh> 4 #include <dune/istl/solver.hh> 6 #include <amdis/CreatorMap.hpp> 7 #include <amdis/Initfile.hpp> 8 #include <amdis/linearalgebra/LinearSolverInterface.hpp> 9 #include <amdis/linearalgebra/SolverInfo.hpp> 10 #include <amdis/linearalgebra/istl/CreatorInterfaces.hpp> 11 #include <amdis/linearalgebra/istl/Traits.hpp> 16 template <
class Mat,
class Vec>
30 return std::make_unique<Self>(prefix);
37 std::string solver =
"default";
42 solverCreator_ = creator->createWithString(prefix);
43 assert(solverCreator_);
50 auto solver_ = solverCreator_->create(A.matrix(), A.comm());
53 Dune::InverseOperatorResult statistics;
56 typename Vec::BaseVector _b = b.vector();
57 solver_->apply(x.vector(), _b, statistics);
60 solverInfo.
setError(statistics.converged ? 0 : 1);
64 std::shared_ptr<ISTLSolverCreatorInterface<Traits>> solverCreator_;
void solveImpl(Mat const &A, Vec &x, Vec const &b, SolverInfo &solverInfo) override
Implements LinearSolverInterface::solveImpl()
Definition: ISTLSolver.hpp:48
A creator to be used instead of the constructor.
Definition: ISTLSolver.hpp:26
std::unique_ptr< Super > createWithString(std::string prefix) override
Must be implemented by sub classes of CreatorInterfaceName. Creates a new instance of the sub class o...
Definition: ISTLSolver.hpp:28
Interface for creators with name.
Definition: CreatorInterface.hpp:42
A CreatorMap is used to construct objects, which types depends on key words determined at run time...
Definition: CreatorMap.hpp:29
Contains all classes needed for solving linear and non linear equation systems.
Definition: AdaptBase.hpp:6
void setRelResidual(double r)
Sets relResidual_.
Definition: SolverInfo.hpp:86
Implementation of RunnerInterface for ISTL solvers.
Definition: ISTLSolver.hpp:17
static std::optional< T > get(std::string const &key)
Get parameter-values from parameter-tree.
Definition: Initfile.hpp:25
CreatorInterfaceName< BaseClass > * named(CreatorInterface< BaseClass > *ptr)
cast a ptr of CreatorInterface to CreatorInterfaceName
Definition: CreatorInterface.hpp:64
Abstract base class for linear solvers.
Definition: LinearSolverInterface.hpp:27
void setError(int e)
Sets error_.
Definition: SolverInfo.hpp:98
static CreatorInterface< BaseClass > * getCreator(std::string key, std::string initFileStr)
Creates a object of the type corresponding to key.
Definition: CreatorMap.hpp:44
Definition: SolverInfo.hpp:11
Definition: Traits.hpp:42