BITL_Preconditioner.hpp 841 Bytes
Newer Older
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
#pragma once

#include <dune/amdis/linear_algebra/mtl/ITL_Preconditioner.hpp>
#include "itl/block_diagonal.hpp"

namespace AMDiS
{

  template <class SubMatrix, size_t N, size_t M, class Vector>
  struct PreconditionerCreator< BlockMTLMatrix<SubMatrix, N, M>, Vector >
  {
    using Matrix = BlockMTLMatrix<SubMatrix, N, M>;
    using PreconBase = PreconditionerInterface<Matrix, Vector>;
    
    template <template<class> class ITLPrecon>
    using Precon = Preconditioner<Matrix, Vector, ITLPrecon<Matrix>>;
    
    static std::unique_ptr<PreconBase> create(std::string name)
    { 
      if (name == "diag" || name == "jacobi")
        return std::make_unique<Precon<DiagonalPreconditioner>>();
      else // by default, do nothing
        return std::make_unique<Precon<IdentityPreconditioner>>();
    }
  };

} // end namespace AMDiS