19 #ifndef GEOSX_LINEARALGEBRA_SOLVERS_KRYLOVSOLVER_HPP_ 20 #define GEOSX_LINEARALGEBRA_SOLVERS_KRYLOVSOLVER_HPP_ 31 template<
typename Vector >
class LinearOperator;
38 template<
typename VECTOR >
145 template<
typename VEC >
146 struct VectorStorageHelper
150 static VEC createFrom( VEC
const & src )
153 v.createWithLocalSize( src.localSize(), src.getComm() );
158 template<
typename VEC >
159 struct VectorStorageHelper< BlockVectorView< VEC > >
168 v.
block( i ).createWithLocalSize( src.
block( i ).localSize(), src.
block( i ).getComm() );
179 using VectorTemp =
typename VectorStorageHelper< VECTOR >::type;
190 return VectorStorageHelper< VECTOR >::createFrom( src );
239 #endif //GEOSX_LINEARALGEBRA_SOLVERS_KRYLOVSOLVER_HPP_ virtual void apply(Vector const &src, Vector &dst) const override final
Apply operator to a vector.
Concrete representation of a block vector.
typename VectorStorageHelper< VECTOR >::type VectorTemp
Alias for vector type that can be used for temporaries.
virtual globalIndex numGlobalRows() const override final
Get the number of global rows.
long long int globalIndex
Global index type (for indexing objects across MPI partitions).
#define GEOSX_LOG_LEVEL_RANK_0(minLevel, msg)
Output messages (only on rank 0) based on current Group's log level.
virtual globalIndex numGlobalCols() const =0
Get the number of global columns.
virtual string methodName() const =0
Get name of the Krylov subspace method.
integer m_logLevel
solver verbosity level
LinearOperator< Vector > const & m_operator
reference to the operator to be solved
LinearOperator< Vector > const & m_precond
reference to the preconditioning operator
void logProgress(localIndex const iter, real64 const rnorm) const
Output iteration progress (called by implementations).
integer numIterations
Number of solver iterations performed.
virtual globalIndex numGlobalCols() const override final
Get the number of global columns.
Set of parameters for a linear solver or preconditioner.
virtual ~KrylovSolver() override=default
Virtual destructor.
Results/stats of a linear solve.
real64 solveTime
Solve time (in seconds) exclusive of setup costs.
static VectorTemp createTempVector(Vector const &src)
Helper function to create temporary vectors based on a source vector.
This class serves to provide a "view" of a multidimensional array.
KrylovSolver(LinearOperator< Vector > const &matrix, LinearOperator< Vector > const &precond, real64 const tolerance, localIndex const maxIterations, integer const verbosity)
Constructor.
double real64
64-bit floating point type.
localIndex blockSize() const
Get block size.
array1d< real64 > m_residualNorms
Absolute residual norms at each iteration (if available)
typename Base::Vector Vector
Alias for template parameter.
virtual globalIndex numGlobalRows() const =0
Get the number of global rows.
real64 m_tolerance
relative residual norm reduction tolerance
std::int32_t integer
Signed integer type.
arrayView1d< real64 const > history() const
Get convergence history of a linear solve.
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.
localIndex m_maxIterations
maximum number of Krylov iterations
std::ptrdiff_t localIndex
Local index type (for indexing objects within an MPI partition).
LinearSolverResult const & result() const
Get result of a linear solve.
VECTOR const & block(localIndex const blockIndex) const
Get a reference to the vector corresponding to block blockRowIndex.
integer getLogLevel() const
Get log level.
Abstract view of a block vector.
void logResult() const
Output convergence result (called by implementations).
Abstract base class for linear operators.
VECTOR Vector
Alias for template parameter.
LinearSolverResult m_result
results of a solve
Base class for Krylov solvers.
bool success() const
Check whether the last solve was successful.
This class provides a fixed dimensional resizeable array interface in addition to an interface simila...
virtual void solve(Vector const &b, Vector &x) const =0
Solve preconditioned system.