PetIBM 0.5.4
Toolbox and applications of the immersed-boundary method for distributed-memory architectures
|
Iterative solver using PETSc KSP. More...
#include <linsolverksp.h>
Public Member Functions | |
LinSolverKSP (const std::string &solverName, const std::string &file) | |
Constructor. More... | |
virtual | ~LinSolverKSP () |
Default destructor. More... | |
virtual PetscErrorCode | destroy () |
Manually destroy the data in the current instance. More... | |
virtual PetscErrorCode | setMatrix (const Mat &A) |
Set the coefficient matrix of the linear system. More... | |
virtual PetscErrorCode | solve (Vec &x, Vec &b) |
Solve the linear system. More... | |
virtual PetscErrorCode | getIters (PetscInt &iters) |
Get the number of iterations of the solver. More... | |
virtual PetscErrorCode | getResidual (PetscReal &res) |
Get the final residual of the solver. More... | |
PetscErrorCode | printInfo () const |
Print information to standard output. More... | |
PetscErrorCode | getType (std::string &_type) const |
Get the type of this instance. More... | |
Protected Member Functions | |
virtual PetscErrorCode | init () |
Private initialization function. More... | |
Protected Attributes | |
KSP | ksp |
the underlying KSP solver More... | |
std::string | name |
Name of the linear solver. More... | |
std::string | config |
Path of the solver configuration file to read. More... | |
std::string | type |
Type of the linear solver. More... | |
Iterative solver using PETSc KSP.
This class holds a KSP object from PETSc. The configuration of this underlying KSP solver will be read from the provided argument file
.
Definition at line 28 of file linsolverksp.h.
petibm::linsolver::LinSolverKSP::LinSolverKSP | ( | const std::string & | solverName, |
const std::string & | file | ||
) |
Constructor.
solverName | [in] Name of the solver. |
file | [in] Path of the configuration file for the solver. |
The argument name
will be used as a prefix for the configuration of the underlying KSP solver in the provided configuration file.
Definition at line 16 of file linsolverksp.cpp.
|
virtual |
Default destructor.
Definition at line 23 of file linsolverksp.cpp.
|
virtual |
Manually destroy the data in the current instance.
Reimplemented from petibm::linsolver::LinSolverBase.
Definition at line 37 of file linsolverksp.cpp.
|
virtual |
Get the number of iterations of the solver.
iters | [out] Number of iterations. |
Implements petibm::linsolver::LinSolverBase.
Definition at line 110 of file linsolverksp.cpp.
|
virtual |
Get the final residual of the solver.
res | [out] Residual. |
Implements petibm::linsolver::LinSolverBase.
Definition at line 122 of file linsolverksp.cpp.
|
inherited |
Get the type of this instance.
_type | [out] String representing the type. |
Possible returns for _type
are NVIDIA AmgX
or PETSc KSP
.
Definition at line 49 of file linsolver.cpp.
|
protectedvirtual |
Private initialization function.
The design of linear solver classes is that only the factory function can initialize the instances, and it doesn't allow user to declare instance first and initialize the instance later. So it seems not necessary to make initialization function public.
Implements petibm::linsolver::LinSolverBase.
Definition at line 48 of file linsolverksp.cpp.
|
inherited |
Print information to standard output.
Definition at line 29 of file linsolver.cpp.
|
virtual |
Set the coefficient matrix of the linear system.
A | [in] Coefficient matrix. |
Implements petibm::linsolver::LinSolverBase.
Definition at line 72 of file linsolverksp.cpp.
|
virtual |
Solve the linear system.
x | [in, out] Vector of unknowns. |
b | [in] Right-hand side of the linear system. |
Implements petibm::linsolver::LinSolverBase.
Definition at line 85 of file linsolverksp.cpp.
|
protectedinherited |
Path of the solver configuration file to read.
Definition at line 132 of file linsolver.h.
|
protected |
the underlying KSP solver
Definition at line 58 of file linsolverksp.h.
|
protectedinherited |
Name of the linear solver.
The name should match the prefix used for to configure the solver from the command line or from a configuration file. For example, if the name is "velocity", the prefix should be "_velocity".
Definition at line 129 of file linsolver.h.
|
protectedinherited |
Type of the linear solver.
Definition at line 135 of file linsolver.h.