PetIBM 0.5.4
Toolbox and applications of the immersed-boundary method for distributed-memory architectures
linsolverksp.h
Go to the documentation of this file.
1
8#pragma once
9
10#include <petscksp.h>
11
12#include <petibm/linsolver.h>
13
14namespace petibm
15{
16namespace linsolver
17{
29{
30public:
36 LinSolverKSP(const std::string &solverName, const std::string &file);
37
39 virtual ~LinSolverKSP();
40
42 virtual PetscErrorCode destroy();
43
45 virtual PetscErrorCode setMatrix(const Mat &A);
46
48 virtual PetscErrorCode solve(Vec &x, Vec &b);
49
51 virtual PetscErrorCode getIters(PetscInt &iters);
52
54 virtual PetscErrorCode getResidual(PetscReal &res);
55
56protected:
58 KSP ksp;
59
61 virtual PetscErrorCode init();
62
63}; // LinSolverKSP
64
65} // end of namespace linsolver
66
67} // end of namespace petibm
The abstract (base) class for different iterative solvers.
Definition: linsolver.h:60
Iterative solver using PETSc KSP.
Definition: linsolverksp.h:29
KSP ksp
the underlying KSP solver
Definition: linsolverksp.h:58
virtual PetscErrorCode solve(Vec &x, Vec &b)
Solve the linear system.
virtual PetscErrorCode init()
Private initialization function.
virtual PetscErrorCode setMatrix(const Mat &A)
Set the coefficient matrix of the linear system.
virtual PetscErrorCode destroy()
Manually destroy the data in the current instance.
virtual ~LinSolverKSP()
Default destructor.
virtual PetscErrorCode getResidual(PetscReal &res)
Get the final residual of the solver.
LinSolverKSP(const std::string &solverName, const std::string &file)
Constructor.
virtual PetscErrorCode getIters(PetscInt &iters)
Get the number of iterations of the solver.
Def. of LinSolverBase, LinSolver, and factory function.
A toolbox for building flow solvers.
Definition: bodypack.h:52