GEOSX
Public Types | Public Member Functions | List of all members
geos::PetscSolver Class Referencefinal

This class creates and provides basic support for PETSc solvers. More...

#include <PetscSolver.hpp>

Inheritance diagram for geos::PetscSolver:
Inheritance graph
[legend]

Public Types

using Base = LinearSolverBase< PetscInterface >
 Alias for base type.
 
- Public Types inherited from geos::LinearSolverBase< PetscInterface >
using Base = PreconditionerBase< PetscInterface >
 Alias for base type.
 
using Vector = typename Base::Vector
 Alias for vector type.
 
using Matrix = typename Base::Matrix
 Alias for matrix type.
 
- Public Types inherited from geos::PreconditionerBase< PetscInterface >
using Base = LinearOperator< typename PetscInterface ::ParallelVector >
 Alias for base type.
 
using Vector = typename Base::Vector
 Alias for vector type.
 
using Matrix = typename PetscInterface ::ParallelMatrix
 Alias for matrix type.
 
- Public Types inherited from geos::LinearOperator< PetscInterface ::ParallelVector >
using Vector = PetscInterface ::ParallelVector
 Alias for template parameter.
 

Public Member Functions

 PetscSolver (LinearSolverParameters parameters)
 Solver constructor, with parameter list reference. More...
 
virtual ~PetscSolver ()
 Destructor.
 
virtual void setup (PetscMatrix const &mat) override
 Compute the preconditioner from a matrix. More...
 
virtual void apply (PetscVector const &src, PetscVector &dst) const override
 Apply operator to a vector, dst = this(src). More...
 
virtual void solve (PetscVector const &rhs, PetscVector &sol) const override
 Solve preconditioned system. More...
 
virtual void clear () override
 Clean up the preconditioner setup. More...
 
- Public Member Functions inherited from geos::LinearSolverBase< PetscInterface >
 LinearSolverBase (LinearSolverParameters params)
 Constructor. More...
 
virtual void solve (Vector const &rhs, Vector &sol) const=0
 Solve preconditioned system. More...
 
const LinearSolverParametersparameters () const
 
const LinearSolverResultresult () const
 
- Public Member Functions inherited from geos::PreconditionerBase< PetscInterface >
virtual void setup (Matrix const &mat)
 Compute the preconditioner from a matrix. More...
 
virtual globalIndex numGlobalRows () const override
 Get the number of global rows. More...
 
virtual globalIndex numGlobalCols () const override
 Get the number of global columns. More...
 
virtual localIndex numLocalRows () const override
 Get the number of local rows. More...
 
virtual localIndex numLocalCols () const override
 Get the number of local columns. More...
 
virtual MPI_Comm comm () const override
 Get the MPI communicator the matrix was created with. More...
 
bool ready () const
 Chech if preconditioner is ready to use. More...
 
const Matrixmatrix () const
 Access the matrix the preconditioner was computed from. More...
 
virtual bool hasPreconditionerMatrix () const
 Check whether the preconditioner is available in matrix (explicit) form. More...
 
virtual const MatrixpreconditionerMatrix () const
 Access the preconditioner in matrix form (whenever available). It must be overridden by the specific preconditioner. More...
 
- Public Member Functions inherited from geos::LinearOperator< PetscInterface ::ParallelVector >
 LinearOperator ()=default
 Constructor.
 
virtual ~LinearOperator ()=default
 Destructor.
 
virtual void apply (Vector const &src, Vector &dst) const=0
 Apply operator to a vector, dst = this(src). More...
 
virtual void residual (Vector const &x, Vector const &b, Vector &r) const
 Compute residual r = b - this(x). More...
 

Additional Inherited Members

- Protected Attributes inherited from geos::LinearSolverBase< PetscInterface >
LinearSolverParameters m_params
 Parameters for the solver.
 
LinearSolverResult m_result
 Result of most recent solve (status, timings)
 

Detailed Description

This class creates and provides basic support for PETSc solvers.

Definition at line 35 of file PetscSolver.hpp.

Constructor & Destructor Documentation

◆ PetscSolver()

geos::PetscSolver::PetscSolver ( LinearSolverParameters  parameters)
explicit

Solver constructor, with parameter list reference.

Parameters
[in]parametersstructure containing linear solver parameters

Member Function Documentation

◆ apply()

virtual void geos::PetscSolver::apply ( PetscVector const &  src,
PetscVector dst 
) const
overridevirtual

Apply operator to a vector, dst = this(src).

Parameters
srcinput vector
dstoutput vector
Warning
src and dst cannot alias the same vector (some implementations may allow this).

◆ clear()

virtual void geos::PetscSolver::clear ( )
overridevirtual

Clean up the preconditioner setup.

Releases memory used and allows the matrix to be deleted cleanly. This method should be called before the matrix used to compute the preconditioner goes out of scope or is re-created. Some implementations require the matrix to outlive the preconditioner (for example, Trilinos/ML may crash the program if deleted after the matrix).

Note
Should be properly overridden in derived classes, which may call this method.

Reimplemented from geos::PreconditionerBase< PetscInterface >.

◆ setup()

virtual void geos::PetscSolver::setup ( PetscMatrix const &  mat)
overridevirtual

Compute the preconditioner from a matrix.

Parameters
matthe matrix to precondition.

◆ solve()

virtual void geos::PetscSolver::solve ( PetscVector const &  rhs,
PetscVector sol 
) const
overridevirtual

Solve preconditioned system.

Parameters
[in]rhssystem right hand side.
[in,out]solsystem solution (input = initial guess, output = solution).

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