RunnerInterface.hpp 1.25 KB
Newer Older
1
2
#pragma once

3
4
#include <amdis/common/TypeTraits.hpp>
#include <amdis/linearalgebra/PreconditionerInterface.hpp>
5
6
7

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

10
  /// Interface for Runner / Worker types used in solver classes
11
  template <class Traits>
12
  class RunnerInterface
13
  {
14
  protected:
15
16
17
18
19
    using PreconBase = PreconditionerInterface<Traits>;
    using Mat = typename Traits::Mat;
    using Sol = typename Traits::Sol;
    using Rhs = typename Traits::Rhs;
    using Comm = typename Traits::Comm;
20

21
22
  public:
    /// virtual destructor
23
    virtual ~RunnerInterface() = default;
24
25

    /// Is called at the beginning of a solution procedure
26
    virtual void init(Mat const& A, Comm& comm) = 0;
27
28
29
30
31

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

    /// Solve the system A*x = b
32
    virtual int solve(Mat const& A, Sol& x, Rhs const& b, SolverInfo& solverInfo) = 0;
33
34

    /// Solve the adjoint system A^T*x = b
35
    virtual int adjointSolve(Mat const& A, Sol& x, Rhs const& b, SolverInfo& solverInfo)
36
    {
37
      error_exit("Must be implemented by derived class.");
38
39
      return 0;
    }
40

Praetorius, Simon's avatar
Praetorius, Simon committed
41
42
    virtual std::shared_ptr<PreconBase> leftPrecon() { return {}; }
    virtual std::shared_ptr<PreconBase> rightPrecon() { return {}; }
43
44
45
  };

} // end namespace AMDiS