LinearSolverInterface.hpp 1.4 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
#pragma once

/** \file LinearSolverInterface.h */

/**
 * \defgroup Solver Solver module
 * @{ <img src="solver.png"> @}
 *
 * \brief
 * Contains all classes needed for solving linear and non linear equation
 * systems.
 */

14
15
#include <dune/amdis/linear_algebra/Preconditioner.hpp>
#include <dune/amdis/linear_algebra/SolverStatistics.hpp>
16

17
18
19
namespace AMDiS
{  
  /// Abstract base class for linear solvers
20
21
  template <class Matrix, class VectorX, class VectorB = VectorX>
  class LinearSolverInterface
22
  {
23
24
25
26
27
28
29
30
31
32
33
34
35
36
    /// Destructor.
    virtual ~LinearSolverInterface() {}
    
    /// Public method to call in order to solve a linear system Ax = b.
    /**
     * The method redirects to the specific linear solver and prints statistics
     * and error estimations at the end.
     * 
     * The parameters correspond to
     *  \p A     A block-matrix that represents the system-matrix.
     *  \p x     A block-vector for the unknown components.
     *  \p b     A block-vector for the right-hand side of the linear system.
     **/
    void solve(Matrix const& A, VectorX& x, VectorB const& b,
37
               SolverStatistics& statistics)
38
    {      
39
      solveImpl(A, x, b, statistics);
40
41
42
43
44
45
    }
    

  private:
    /// main methods that all solvers must implement
    virtual void solveImpl(Matrix const& A, VectorX& x, VectorB const& b,
46
                           SolverStatistics& statistics) = 0;
47
48
49
50
  };

} // end namespace AMDiS