preCICE v3.1.1
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | List of all members
precice::utils::petsc::KSPSolver Class Reference

#include <Petsc.hpp>

Public Types

enum struct  SolverResult { Converged , Stopped , Diverged }
 The state of the KSP after returning from solve() More...
 

Public Member Functions

 KSPSolver (const KSPSolver &)=delete
 Delete copy and assignment constructor.
 
KSPSolveroperator= (const KSPSolver &)=delete
 
 KSPSolver (std::string name="")
 
 KSPSolver (KSPSolver &&other)=default
 Move constructor, use the implicitly declared.
 
 ~KSPSolver ()
 
 operator KSP & ()
 Enables implicit conversion into a reference to a PETSc KSP type.
 
void reset ()
 Destroys and recreates the ksp on the same communicator.
 
SolverResult getSolverResult ()
 Returns the current convergence reason as a SolverRestult.
 
SolverResult solve (Vector &b, Vector &x)
 Solves the linear system, returns false it not converged.
 
SolverResult solveTranspose (Vector &b, Vector &x)
 Solves the transposed linear system, returns false it not converged.
 
std::string summaryFor (Vector &b)
 Returns a summary the KSP solving for b.
 
PetscInt getIterationNumber ()
 Returns the iteration number of solver, either during or after the solve call.
 
PetscReal getRealtiveTolerance ()
 Returns the relavtive tolerance of the KSP.
 
PetscReal getResidualNorm ()
 Returns the last residual norm of the KSP.
 

Public Attributes

KSP ksp
 

Detailed Description

Definition at line 238 of file Petsc.hpp.

Member Enumeration Documentation

◆ SolverResult

The state of the KSP after returning from solve()

Enumerator
Converged 

The solver converged.

Stopped 

The solver reached the maximum iterations.

Diverged 

The solver diverged.

Definition at line 263 of file Petsc.hpp.

Constructor & Destructor Documentation

◆ KSPSolver() [1/3]

precice::utils::petsc::KSPSolver::KSPSolver ( const KSPSolver & )
delete

Delete copy and assignment constructor.

Copying and assignment of this class would involve copying the pointer to the PETSc object and finally cause double destruction of it.

◆ KSPSolver() [2/3]

precice::utils::petsc::KSPSolver::KSPSolver ( std::string name = "")
explicit

Definition at line 653 of file Petsc.cpp.

Here is the call graph for this function:

◆ KSPSolver() [3/3]

precice::utils::petsc::KSPSolver::KSPSolver ( KSPSolver && other)
default

Move constructor, use the implicitly declared.

◆ ~KSPSolver()

precice::utils::petsc::KSPSolver::~KSPSolver ( )

Definition at line 661 of file Petsc.cpp.

Member Function Documentation

◆ getIterationNumber()

PetscInt precice::utils::petsc::KSPSolver::getIterationNumber ( )

Returns the iteration number of solver, either during or after the solve call.

Definition at line 767 of file Petsc.cpp.

◆ getRealtiveTolerance()

PetscReal precice::utils::petsc::KSPSolver::getRealtiveTolerance ( )

Returns the relavtive tolerance of the KSP.

Definition at line 785 of file Petsc.cpp.

◆ getResidualNorm()

PetscReal precice::utils::petsc::KSPSolver::getResidualNorm ( )

Returns the last residual norm of the KSP.

Definition at line 776 of file Petsc.cpp.

◆ getSolverResult()

KSPSolver::SolverResult precice::utils::petsc::KSPSolver::getSolverResult ( )

Returns the current convergence reason as a SolverRestult.

Definition at line 683 of file Petsc.cpp.

◆ operator KSP &()

precice::utils::petsc::KSPSolver::operator KSP & ( )

Enables implicit conversion into a reference to a PETSc KSP type.

Definition at line 671 of file Petsc.cpp.

◆ operator=()

KSPSolver & precice::utils::petsc::KSPSolver::operator= ( const KSPSolver & )
delete

◆ reset()

void precice::utils::petsc::KSPSolver::reset ( )

Destroys and recreates the ksp on the same communicator.

Definition at line 676 of file Petsc.cpp.

◆ solve()

KSPSolver::SolverResult precice::utils::petsc::KSPSolver::solve ( Vector & b,
Vector & x )

Solves the linear system, returns false it not converged.

Definition at line 701 of file Petsc.cpp.

Here is the call graph for this function:

◆ solveTranspose()

KSPSolver::SolverResult precice::utils::petsc::KSPSolver::solveTranspose ( Vector & b,
Vector & x )

Solves the transposed linear system, returns false it not converged.

Definition at line 707 of file Petsc.cpp.

Here is the call graph for this function:

◆ summaryFor()

std::string precice::utils::petsc::KSPSolver::summaryFor ( Vector & b)

Returns a summary the KSP solving for b.

Definition at line 713 of file Petsc.cpp.

Here is the call graph for this function:

Member Data Documentation

◆ ksp

KSP precice::utils::petsc::KSPSolver::ksp

Definition at line 240 of file Petsc.hpp.


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