16 #ifndef GEOS_LINEARALGEBRA_SOLVERS_KRYLOVSOLVER_HPP_
17 #define GEOS_LINEARALGEBRA_SOLVERS_KRYLOVSOLVER_HPP_
32 template<
typename VECTOR >
108 virtual MPI_Comm
comm() const override final
148 template<
typename VEC >
149 struct VectorStorageHelper
153 static VEC createFrom( VEC
const & src )
156 v.create( src.localSize(), src.comm() );
161 template<
typename VEC >
171 v.block( i ).create( src.
block( i ).localSize(), src.
block( i ).comm() );
182 using VectorTemp =
typename VectorStorageHelper< VECTOR >::type;
193 return VectorStorageHelper< VECTOR >::createFrom( src );
Concrete representation of a block vector.
Abstract view of a block vector.
VECTOR const & block(localIndex const blockIndex) const
Get a reference to the vector corresponding to block blockRowIndex.
localIndex blockSize() const
Get block size.
Base class for Krylov solvers.
LinearSolverResult m_result
results of a solve
virtual void solve(Vector const &b, Vector &x) const =0
Solve preconditioned system.
virtual globalIndex numGlobalCols() const override final
Get the number of global columns.
virtual localIndex numLocalRows() const override final
Get the number of local rows.
LinearOperator< Vector > const & m_operator
reference to the operator to be solved
virtual localIndex numLocalCols() const override final
Get the number of local columns.
static VectorTemp createTempVector(Vector const &src)
Helper function to create temporary vectors based on a source vector.
void logResult() const
Output convergence result (called by implementations).
typename Base::Vector Vector
Alias for template parameter.
LinearSolverParameters const & parameters() const
typename VectorStorageHelper< VECTOR >::type VectorTemp
Alias for vector type that can be used for temporaries.
LinearOperator< Vector > const & m_precond
reference to the preconditioning operator
virtual ~KrylovSolver() override=default
Virtual destructor.
virtual void apply(Vector const &src, Vector &dst) const override final
Apply operator to a vector.
void logProgress() const
Output iteration progress (called by implementations).
virtual string methodName() const =0
Get name of the Krylov subspace method.
static std::unique_ptr< KrylovSolver< VECTOR > > create(LinearSolverParameters const ¶meters, LinearOperator< VECTOR > const &matrix, LinearOperator< VECTOR > const &precond)
Factory method for instantiating Krylov solver objects.
LinearSolverResult const & result() const
virtual MPI_Comm comm() const override final
Get the MPI communicator the matrix was created with.
arrayView1d< real64 const > history() const
Get convergence history of a linear solve.
virtual globalIndex numGlobalRows() const override final
Get the number of global rows.
KrylovSolver(LinearSolverParameters params, LinearOperator< Vector > const &matrix, LinearOperator< Vector > const &precond)
Constructor.
array1d< real64 > m_residualNorms
Absolute residual norms at each iteration (if available)
LinearSolverParameters m_params
parameters of the solver
Abstract base class for linear operators.
virtual globalIndex numGlobalCols() const =0
Get the number of global columns.
VECTOR Vector
Alias for template parameter.
virtual globalIndex numGlobalRows() const =0
Get the number of global rows.
virtual localIndex numLocalRows() const =0
Get the number of local rows.
virtual localIndex numLocalCols() const =0
Get the number of local columns.
virtual MPI_Comm comm() const =0
Get the MPI communicator the matrix was created with.
ArrayView< T, 1 > arrayView1d
Alias for 1D array view.
GEOS_GLOBALINDEX_TYPE globalIndex
Global index type (for indexing objects across MPI partitions).
GEOS_LOCALINDEX_TYPE localIndex
Local index type (for indexing objects within an MPI partition).
Array< T, 1 > array1d
Alias for 1D array.
Set of parameters for a linear solver or preconditioner.
Results/stats of a linear solve.