Traits.hpp 1.92 KB
Newer Older
1
2
#pragma once

3
4
5
6
7
8
9
10
#include <dune/common/fmatrix.hh>
#include <dune/common/fvector.hh>
#include <dune/grid/common/partitionset.hh>
#include <dune/istl/operators.hh>
#include <dune/istl/preconditioner.hh>
#include <dune/istl/scalarproducts.hh>
#include <dune/istl/solver.hh>

Praetorius, Simon's avatar
Praetorius, Simon committed
11
#include <amdis/linearalgebra/SparsityPattern.hpp>
12
13
#include <amdis/linearalgebra/istl/Communication.hpp>
#include <amdis/linearalgebra/istl/Creators.hpp>
Praetorius, Simon's avatar
Praetorius, Simon committed
14
15
#include <amdis/linearalgebra/istl/MatrixBackend.hpp>
#include <amdis/linearalgebra/istl/VectorBackend.hpp>
16
17
18
19
20
21

namespace AMDiS
{
  /** Traits class for a linear solver for the system AX=B using an FE space described by a dune-functions Basis
   *  Contains typedefs specific to the ISTL backend.
   */
Praetorius, Simon's avatar
Praetorius, Simon committed
22
23
  template <class Basis>
  struct ISTLTraits
24
  {
Praetorius, Simon's avatar
Praetorius, Simon committed
25
26
    using Comm = ISTLCommunication_t<Basis>;

Praetorius, Simon's avatar
Praetorius, Simon committed
27
    template <class Value>
Praetorius, Simon's avatar
Praetorius, Simon committed
28
    using MatrixImpl = ISTLBCRSMatrix<Value, Comm>;
29

Praetorius, Simon's avatar
Praetorius, Simon committed
30
31
32
    template <class Value>
    using VectorImpl = ISTLBlockVector<Value>;

33
    using PartitionSet    = Dune::Partitions::All;
34
    using SparsityPattern = AMDiS::SparsityPattern;
Praetorius, Simon's avatar
Praetorius, Simon committed
35
36
37
38
39
40
41
42
43
44
45
46
47
  };

  template <class Basis>
  using BackendTraits = ISTLTraits<Basis>;


  template <class Mat, class VecX, class VecY = VecX>
  struct SolverTraits
  {
    using M = typename Mat::BaseMatrix;
    using X = typename VecX::BaseVector;
    using Y = typename VecY::BaseVector;
    using Comm = typename Mat::Comm;
48

Praetorius, Simon's avatar
Praetorius, Simon committed
49
50
51
52
53
54
55
    using ScalProd        = Dune::ScalarProduct<X>;
    using LinOp           = Dune::AssembledLinearOperator<M, X, Y>;
    using Solver          = Dune::InverseOperator<X, Y>;
    using Prec            = Dune::Preconditioner<X, Y>;
    using ScalProdCreator = ISTLScalarProductCreator<X>;
    using ParPrecCreator  = ISTLParallelPreconditionerCreator<X, Y>;
    using LinOpCreator    = ISTLLinearOperatorCreator<M, X, Y>;
56
57
58
  };

  template <class Traits>
Praetorius, Simon's avatar
Praetorius, Simon committed
59
  struct SeqSolverTraits : Traits
60
61
  {
    using Comm = typename Traits::Comm::Sequential;
62
63
64
  };

} // end namespace AMDiS