PreconditionerInterface.hpp 944 Bytes
Newer Older
Praetorius, Simon's avatar
Praetorius, Simon committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#pragma once

#include <amdis/Output.hpp>

namespace AMDiS
{
  /// Interface for Preconditioner y = M*x
  template <class Mat, class Vec>
  class PreconditionerInterface
  {
    using M = typename Mat::BaseMatrix;
    using X = typename Vec::BaseVector;
    using Y = typename Vec::BaseVector;

  public:
    /// Virtual destructor.
    virtual ~PreconditionerInterface() = default;

    /// Is called a the beginning of a solution procedure
    virtual void init(M const& A) = 0;

    /// Is called at the end of a solution procedure
    virtual void exit() = 0;

    /// Apply the preconditioner to a vector \p x and store the result in \p y
    virtual void solve(X const& x, Y& y) const = 0;

    /// Apply the transposed preconditioner to a vector \p x and store the result in \p y
    virtual void adjoint_solve(X const& x, Y& y) const
    {
      error_exit("Must be implemented by derived class.");
    }
  };

} // end namespace AMDiS