DOLFINx 0.9.0
DOLFINx C++ interface
Loading...
Searching...
No Matches
KrylovSolver Class Reference

#include <petsc.h>

Public Member Functions

 KrylovSolver (MPI_Comm comm)
 
 KrylovSolver (KSP ksp, bool inc_ref_count)
 
 KrylovSolver (const KrylovSolver &solver)=delete
 
 KrylovSolver (KrylovSolver &&solver)
 Move constructor.
 
 ~KrylovSolver ()
 Destructor.
 
KrylovSolveroperator= (const KrylovSolver &)=delete
 
KrylovSolveroperator= (KrylovSolver &&solver)
 Move assignment.
 
void set_operator (const Mat A)
 Set operator (Mat)
 
void set_operators (const Mat A, const Mat P)
 Set operator and preconditioner matrix (Mat)
 
int solve (Vec x, const Vec b, bool transpose=false) const
 
void set_options_prefix (std::string options_prefix)
 
std::string get_options_prefix () const
 
void set_from_options () const
 Set options from PETSc options database.
 
KSP ksp () const
 Return PETSc KSP pointer.
 

Detailed Description

This class implements Krylov methods for linear systems of the form Ax = b. It is a wrapper for the Krylov solvers of PETSc.

Constructor & Destructor Documentation

◆ KrylovSolver() [1/2]

KrylovSolver ( MPI_Comm comm)
explicit

Create Krylov solver for a particular method and named preconditioner

◆ KrylovSolver() [2/2]

KrylovSolver ( KSP ksp,
bool inc_ref_count )

Create solver wrapper of a PETSc KSP object

Parameters
[in]kspThe PETSc KSP object. It should already have been created
[in]inc_ref_countIncrement the reference count on ksp if true

Member Function Documentation

◆ get_options_prefix()

std::string get_options_prefix ( ) const

Returns the prefix used by PETSc when searching the PETSc options database

◆ set_options_prefix()

void set_options_prefix ( std::string options_prefix)

Sets the prefix used by PETSc when searching the PETSc options database

◆ solve()

int solve ( Vec x,
const Vec b,
bool transpose = false ) const

Solve linear system Ax = b and return number of iterations (A^t x = b if transpose is true)


The documentation for this class was generated from the following files: