1#ifndef included_AMP_PetscKrylovSolver
2#define included_AMP_PetscKrylovSolver
4#include "AMP/solvers/SolverStrategy.h"
5#include "AMP/solvers/petsc/PetscMonitor.h"
6#include "AMP/utils/AMP_MPI.h"
7#include "AMP/vectors/petsc/PetscHelpers.h"
12typedef struct _p_SNES *
SNES;
13typedef struct _p_KSP *
KSP;
14typedef struct _p_PC *
PC;
88 std::string
type()
const override {
return "PetscKrylovSolver"; }
91 static std::unique_ptr<SolverStrategy>
102 void apply( std::shared_ptr<const AMP::LinearAlgebra::Vector> f,
103 std::shared_ptr<AMP::LinearAlgebra::Vector>
u )
override;
105 void reset( std::shared_ptr<AMP::Solver::SolverStrategyParameters> )
override;
122 void initialize( std::shared_ptr<const SolverStrategyParameters> parameters )
override;
135 resetOperator( std::shared_ptr<const AMP::Operator::OperatorParameters> parameters )
override;
Provides C++ wrapper around MPI routines.
void getFromInput(std::shared_ptr< AMP::Database > db)
static PetscErrorCode matVec(Mat mat, Vec x, Vec y)
double d_dDivergenceTolerance
KSP getKrylovSolver(void)
PetscKrylovSolver(std::shared_ptr< SolverStrategyParameters > parameters)
bool usesPreconditioner(void)
std::shared_ptr< PetscMonitor > d_PetscMonitor
void registerOperator(std::shared_ptr< AMP::Operator::Operator > op) override
void initializePreconditioner(std::shared_ptr< const SolverStrategyParameters > parameters)
std::string d_sGmresOrthogonalizationAlgorithm
static PetscErrorCode setupPreconditioner(PC pc)
void resetOperator(std::shared_ptr< const AMP::Operator::OperatorParameters > parameters) override
void setKrylovSolver(KSP *ksp)
void initialize(std::shared_ptr< const SolverStrategyParameters > parameters) override
bool d_bKSPCreatedInternally
bool d_bUsesPreconditioner
void setZeroInitialGuess(bool use_zero_guess) override
void setupPetscMatInterface(std::shared_ptr< AMP::Operator::Operator > op, Mat &mat)
static PetscErrorCode applyPreconditioner(PC pc, Vec r, Vec z)
int d_iMaxKrylovDimension
static std::unique_ptr< SolverStrategy > createSolver(std::shared_ptr< SolverStrategyParameters > solverStrategyParameters)
static create routine that is used by SolverFactory
void apply(std::shared_ptr< const AMP::LinearAlgebra::Vector > f, std::shared_ptr< AMP::LinearAlgebra::Vector > u) override
void reset(std::shared_ptr< AMP::Solver::SolverStrategyParameters >) override
std::string type() const override
Return the name of the solver.
virtual ~PetscKrylovSolver()
std::shared_ptr< AMP::Operator::Operator > createPCOperator()
std::string d_KSPAppendOptionsPrefix
std::shared_ptr< AMP::Solver::SolverStrategy > shared_ptr