~njansson/dolfin/hpc

« back to all changes in this revision

Viewing changes to src/kernel/la/dolfin/KrylovSolver.h

  • Committer: Johannes Ring
  • Date: 2008-03-05 22:43:06 UTC
  • Revision ID: johannr@simula.no-20080305224306-2npsdyhfdpl2esji
The BIG commit!

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// Copyright (C) 2007 Garth N. Wells.
2
 
// Licensed under the GNU LGPL Version 2.1.
3
 
//
4
 
// First added:  2007-07-03
5
 
// Last changed: 2007-07-11
6
 
 
7
 
#ifndef __KRYLOV_SOLVER_H
8
 
#define __KRYLOV_SOLVER_H
9
 
 
10
 
#include <dolfin/LinearSolver.h>
11
 
#include <dolfin/Parametrized.h>
12
 
#include <dolfin/Vector.h>
13
 
#include <dolfin/Matrix.h>
14
 
 
15
 
#include <dolfin/KrylovMethod.h>
16
 
#include <dolfin/Preconditioner.h>
17
 
 
18
 
#include <dolfin/default_la_types.h>
19
 
 
20
 
namespace dolfin
21
 
{
22
 
 
23
 
  /// This class defines an interface for a Krylov solver. The underlying 
24
 
  /// Krylov solver type is defined in default_type.h.
25
 
 
26
 
  class KrylovSolver : public LinearSolver, public Parametrized
27
 
  {
28
 
  public:
29
 
 
30
 
    KrylovSolver() : solver() {}
31
 
    
32
 
    KrylovSolver(KrylovMethod method) : solver(method, default_pc) {}
33
 
    
34
 
    KrylovSolver(KrylovMethod method, Preconditioner pc) 
35
 
      : solver(method, pc) {}
36
 
    
37
 
    ~KrylovSolver() {}
38
 
    
39
 
    inline uint solve(const Matrix& A, Vector& x, const Vector& b)
40
 
    { return solver.solve(A.mat(), x.vec(), b.vec()); }
41
 
    
42
 
  private:
43
 
    
44
 
    DefaultKrylovSolver solver;
45
 
 
46
 
  };
47
 
 
48
 
}
49
 
 
50
 
#endif