16#include <yaml-cpp/yaml.h>
78 virtual PetscErrorCode
destroy();
90 PetscErrorCode
getType(std::string &_type)
const;
105 virtual PetscErrorCode
solve(Vec &
x, Vec &b) = 0;
112 virtual PetscErrorCode
getIters(PetscInt &iters) = 0;
145 virtual PetscErrorCode
init() = 0;
174typedef std::shared_ptr<linsolver::LinSolverBase>
LinSolver;
The abstract (base) class for different iterative solvers.
virtual PetscErrorCode setMatrix(const Mat &A)=0
Set the coefficient matrix of the linear system.
PetscErrorCode printInfo() const
Print information to standard output.
LinSolverBase()=default
Default constructor.
LinSolverBase(const std::string &solverName, const std::string &file)
Constructor.
std::string config
Path of the solver configuration file to read.
virtual ~LinSolverBase()=default
Default destructor.
std::string name
Name of the linear solver.
PetscErrorCode getType(std::string &_type) const
Get the type of this instance.
virtual PetscErrorCode destroy()
Manually destroy the data in the current instance.
virtual PetscErrorCode getIters(PetscInt &iters)=0
Get the number of iterations of the solver.
std::string type
Type of the linear solver.
virtual PetscErrorCode solve(Vec &x, Vec &b)=0
Solve the linear system.
virtual PetscErrorCode getResidual(PetscReal &res)=0
Get the final residual of the solver.
virtual PetscErrorCode init()=0
Private initialization function.
PetscErrorCode createLinSolver(const std::string &solverName, const YAML::Node &node, type::LinSolver &solver)
A factory function for creating a LinSolver.
std::shared_ptr< linsolver::LinSolverBase > LinSolver
Type definition of LinSolver.
A toolbox for building flow solvers.
Definition of user-defined types for convenience.