RunnerInterface.hpp 941 Bytes
Newer Older
1
2
#pragma once

3
#include <amdis/Output.hpp>
4
5
6

namespace AMDiS
{
Praetorius, Simon's avatar
Praetorius, Simon committed
7
8
  class SolverInfo;

9
  /// Interface for Runner / Worker types used in solver classes
Praetorius, Simon's avatar
Praetorius, Simon committed
10
  template <class Mat, class Vec>
11
  class RunnerInterface
12
  {
Praetorius, Simon's avatar
Praetorius, Simon committed
13
14
15
    using M = typename Mat::BaseMatrix;
    using X = typename Vec::BaseVector;
    using Y = typename Vec::BaseVector;
16

17
18
  public:
    /// virtual destructor
19
    virtual ~RunnerInterface() = default;
20
21

    /// Is called at the beginning of a solution procedure
Praetorius, Simon's avatar
Praetorius, Simon committed
22
    virtual void init(M const& A) = 0;
23
24
25
26
27

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

    /// Solve the system A*x = b
Praetorius, Simon's avatar
Praetorius, Simon committed
28
    virtual int solve(M const& A, X& x, Y const& b, SolverInfo& solverInfo) = 0;
29

Praetorius, Simon's avatar
Praetorius, Simon committed
30
31
    /// Solve the system A*x = b
    virtual int adjointSolve(M const& A, X& x, Y const& b, SolverInfo& solverInfo)
32
    {
33
      error_exit("Must be implemented by derived class.");
34
35
      return 0;
    }
36
37
38
  };

} // end namespace AMDiS