11 #ifndef BOGUS_KRYLOV_HPP
12 #define BOGUS_KRYLOV_HPP
14 #include "BlockSolverBase.hpp"
15 #include "Preconditioners.hpp"
16 #include "KrylovMethods.hpp"
33 template <
typename BlockMatrixType,
34 template<
typename BlockMatrixT >
class PreconditionerType >
39 typedef PreconditionerType< BlockObjectBase< BlockMatrixType > > PreconditionerImplType ;
42 typedef typename GlobalProblemTraits::Scalar Scalar ;
54 #define BOGUS_PROCESS_KRYLOV_METHOD( MethodName )\
55 typedef krylov::solvers::MethodName< \
56 BlockMatrixType, PreconditionerType< BlockObjectBase< BlockMatrixType > >, \
57 GlobalProblemTraits > MethodName##Type ; \
59 MethodName##Type as##MethodName() const { \
60 return MethodName##Type( \
61 Base::m_matrix->derived(), \
62 Base::m_maxIters, Base::m_tol, \
67 template < typename RhsT, typename ResT > \
68 Scalar solve_##MethodName( const RhsT &b, ResT &x ) const \
69 { return as##MethodName().solve( b, x ) ; }
72 #undef BOGUS_PROCESS_KRYLOV_METHOD
75 template <
typename RhsT,
typename ResT >
76 Scalar
solve(
const RhsT &b, ResT &x,
79 const PreconditionerImplType& preconditioner()
const {
return m_preconditioner ; }
80 PreconditionerImplType& preconditioner() {
return m_preconditioner ; }
84 PreconditionerImplType m_preconditioner ;
Scalar solve(const RhsT &b, ResT &x, krylov::Method method=krylov::CG) const
Solve function that takes the method to use as an argument.
Definition: BlockSolvers.fwd.hpp:33
Base class for solvers that operate on BlockMatrixBase matrices.
Definition: BlockSolverBase.hpp:29
Krylov()
Default constructor – you will have to call setMatrix() before using any of the solve() functions...
Conjugate Gradient.
Definition: BlockSolvers.fwd.hpp:22
Method
Definition: BlockSolvers.fwd.hpp:20
Preconditionned Krylov Solvers.
Definition: Krylov.hpp:35
Krylov & setMatrix(const BlockObjectBase< BlockMatrixType > &matrix)
Sets the system matrix and initializes the preconditioner.