Reference documentation for deal.II version GIT 79abc2049d 20221201 23:50:02+00:00

#include <deal.II/lac/petsc_solver.h>
Classes  
struct  SolverData 
Public Member Functions  
SolverBase (SolverControl &cn)  
virtual  ~SolverBase ()=default 
void  solve (const MatrixBase &A, VectorBase &x, const VectorBase &b, const PreconditionBase &preconditioner) 
virtual void  reset () 
void  set_prefix (const std::string &prefix) 
SolverControl &  control () const 
void  initialize (const PreconditionBase &preconditioner) 
Protected Member Functions  
virtual void  set_solver_type (KSP &ksp) const =0 
Protected Attributes  
SolverControl &  solver_control 
std::string  prefix_name 
Static Private Member Functions  
static PetscErrorCode  convergence_test (KSP ksp, const PetscInt iteration, const PetscReal residual_norm, KSPConvergedReason *reason, void *solver_control) 
Private Attributes  
std::unique_ptr< SolverData >  solver_data 
Friends  
class  SLEPcWrappers::TransformationBase 
Base class for solver classes using the PETSc solvers. Since solvers in PETSc are selected based on flags passed to a generic solver object, basically all the actual solver calls happen in this class, and derived classes simply set the right flags to select one solver or another, or to set certain parameters for individual solvers.
Optionally, the user can create a solver derived from the SolverBase class and can set the default arguments necessary to solve the linear system of equations with SolverControl. These default options can be overridden by specifying command line arguments of the form ksp_*
. For example, ksp_monitor_true_residual
prints out true residual norm (unpreconditioned) at each iteration and ksp_view
provides information about the linear solver and the preconditioner used in the current context. The type of the solver can also be changed during runtime by specifying ksp_type
{richardson, cg, gmres, fgmres, ..} to dynamically test the optimal solver along with a suitable preconditioner set using pc_type
{jacobi, bjacobi, ilu, lu, ..}. There are several other command line options available to modify the behavior of the PETSc linear solver and can be obtained from the documentation and manual pages.
Definition at line 88 of file petsc_solver.h.
SolverBase< VectorType >::SolverBase  (  SolverControl &  cn  ) 
Constructor.
Definition at line 45 of file petsc_solver.cc.

virtualdefault 
Destructor.
void SolverBase< VectorType >::solve  (  const MatrixBase &  A, 
VectorBase &  x,  
const VectorBase &  b,  
const PreconditionBase &  preconditioner  
) 
Solve the linear system Ax=b
. Depending on the information provided by derived classes and the object passed as a preconditioner, one of the linear solvers and preconditioners of PETSc is chosen. Repeated calls to solve() do not reconstruct the preconditioner for performance reasons. See class Documentation.
Definition at line 52 of file petsc_solver.cc.

virtual 
Resets the contained preconditioner and solver object. See class description for more details.
Definition at line 152 of file petsc_solver.cc.
void SolverBase< VectorType >::set_prefix  (  const std::string &  prefix  ) 
Sets a prefix name for the solver object. Useful when customizing the PETSc KSP object with commandline options.
Definition at line 145 of file petsc_solver.cc.
SolverControl & SolverBase< VectorType >::control  (  )  const 
Access to object that controls convergence.
Definition at line 159 of file petsc_solver.cc.
void SolverBase< VectorType >::initialize  (  const PreconditionBase &  preconditioner  ) 
initialize the solver with the preconditioner. This function is intended for use with SLEPc spectral transformation class.
Definition at line 206 of file petsc_solver.cc.

protectedpure virtual 
Function that takes a Krylov Subspace Solver context object, and sets the type of solver that is requested by the derived class.
Implemented in PETScWrappers::SparseDirectMUMPS, PETScWrappers::SolverPreOnly, PETScWrappers::SolverLSQR, PETScWrappers::SolverCR, PETScWrappers::SolverTCQMR, PETScWrappers::SolverTFQMR, PETScWrappers::SolverCGS, PETScWrappers::SolverBicgstab, PETScWrappers::SolverGMRES, PETScWrappers::SolverBiCG, PETScWrappers::SolverCG, PETScWrappers::SolverChebychev, and PETScWrappers::SolverRichardson.

staticprivate 
A function that is used in PETSc as a callback to check on convergence. It takes the information provided from PETSc and checks it against deal.II's own SolverControl objects to see if convergence has been reached.
Definition at line 166 of file petsc_solver.cc.

friend 
Definition at line 221 of file petsc_solver.h.

protected 
Reference to the object that controls convergence of the iterative solver. In fact, for these PETSc wrappers, PETSc does so itself, but we copy the data from this object before starting the solution process, and copy the data back into it afterwards.
Definition at line 151 of file petsc_solver.h.

protected 
Solver prefix name to qualify options specific to the PETSc KSP object in the current context. Note: A hyphen () must NOT be given at the beginning of the prefix name. The first character of all runtime options is AUTOMATICALLY the hyphen.
Definition at line 166 of file petsc_solver.h.

private 
Pointer to an object that stores the solver context. This is recreated in the main solver routine if necessary.
Definition at line 216 of file petsc_solver.h.