preCICE
Loading...
Searching...
No Matches
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 236 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 261 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.

Here is the call graph for this function:

◆ KSPSolver() [2/3]

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

Definition at line 614 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.

Here is the call graph for this function:

◆ ~KSPSolver()

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

Definition at line 622 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 736 of file Petsc.cpp.

◆ getRealtiveTolerance()

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

Returns the relavtive tolerance of the KSP.

Definition at line 754 of file Petsc.cpp.

◆ getResidualNorm()

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

Returns the last residual norm of the KSP.

Definition at line 745 of file Petsc.cpp.

◆ getSolverResult()

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

Returns the current convergence reason as a SolverRestult.

Definition at line 644 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 632 of file Petsc.cpp.

◆ operator=()

KSPSolver & precice::utils::petsc::KSPSolver::operator= ( const KSPSolver & )
delete
Here is the call graph for this function:

◆ reset()

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

Destroys and recreates the ksp on the same communicator.

Definition at line 637 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 662 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 668 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 674 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 238 of file Petsc.hpp.


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