1
// Copyright (C) 2007 Garth N. Wells.
2
// Licensed under the GNU LGPL Version 2.1.
4
// First added: 2007-07-03
5
// Last changed: 2007-07-11
7
#ifndef __KRYLOV_SOLVER_H
8
#define __KRYLOV_SOLVER_H
10
#include <dolfin/LinearSolver.h>
11
#include <dolfin/Parametrized.h>
12
#include <dolfin/Vector.h>
13
#include <dolfin/Matrix.h>
15
#include <dolfin/KrylovMethod.h>
16
#include <dolfin/Preconditioner.h>
18
#include <dolfin/default_la_types.h>
23
/// This class defines an interface for a Krylov solver. The underlying
24
/// Krylov solver type is defined in default_type.h.
26
class KrylovSolver : public LinearSolver, public Parametrized
30
KrylovSolver() : solver() {}
32
KrylovSolver(KrylovMethod method) : solver(method, default_pc) {}
34
KrylovSolver(KrylovMethod method, Preconditioner pc)
35
: solver(method, pc) {}
39
inline uint solve(const Matrix& A, Vector& x, const Vector& b)
40
{ return solver.solve(A.mat(), x.vec(), b.vec()); }
44
DefaultKrylovSolver solver;