IFEM 90A354
ISTLSupport.h
Go to the documentation of this file.
1// $Id$
2//==============================================================================
12//==============================================================================
13
14#ifndef _ISTL_SUPPORT_H_
15#define _ISTL_SUPPORT_H_
16
17#include <vector>
18
19#ifdef HAS_ISTL
20#include <dune/common/version.hh>
21#include <dune/istl/bcrsmatrix.hh>
22#include <dune/istl/overlappingschwarz.hh>
23#include <dune/istl/preconditioners.hh>
24#include <dune/istl/solvers.hh>
25#include <dune/istl/schwarz.hh>
26#include <dune/istl/owneroverlapcopy.hh>
27#ifdef HAVE_SUPERLU
28#include <dune/istl/superlu.hh>
29#endif
30#ifdef HAVE_UMFPACK
31#include <dune/istl/umfpack.hh>
32#endif
33
34namespace ISTL
35{
36 using Mat = Dune::BCRSMatrix<Dune::FieldMatrix<double,1,1>>;
37 using Vec = Dune::BlockVector<Dune::FieldVector<double,1>>;
38 using Operator = Dune::MatrixAdapter<Mat,Vec,Vec>;
39 using InverseOperator = Dune::InverseOperator<Vec, Vec>;
40 using Preconditioner = Dune::Preconditioner<Vec,Vec>;
41
43 template<template<class M> class Pre>
44 class IOp2Pre : public Dune::InverseOperator2Preconditioner<Pre<ISTL::Mat>,
45 Dune::SolverCategory::sequential>
46 {
47 using SolverType = Dune::InverseOperator2Preconditioner<Pre<ISTL::Mat>,
48 Dune::SolverCategory::sequential>;
49
50 public:
51 explicit IOp2Pre(Pre<ISTL::Mat>* iop) : SolverType(*iop)
52 {
53 m_op.reset(iop);
54 }
55
56 protected:
57 std::unique_ptr<Pre<ISTL::Mat>> m_op;
58 };
59
60#if defined(HAVE_UMFPACK)
61 using LUType = Dune::UMFPack<ISTL::Mat>;
62 using LU = IOp2Pre<Dune::UMFPack>;
63#elif defined(HAVE_SUPERLU)
64 using LUType = Dune::SuperLU<ISTL::Mat>;
65 using LU = IOp2Pre<Dune::SuperLU>;
66#endif
67
68 // Preconditioner types
69 using ILU = Dune::SeqILU<Mat, Vec, Vec>;
70 using SOR = Dune::SeqSOR<Mat, Vec, Vec>;
71 using SSOR = Dune::SeqSSOR<Mat, Vec,Vec>;
72 using GJ = Dune::SeqJac<Mat, Vec, Vec>;
73 using GS = Dune::SeqGS<Mat, Vec, Vec>;
74 using ASMLU = Dune::SeqOverlappingSchwarz<Mat, Vec,
75 Dune::AdditiveSchwarzMode,
76 LUType>;
77 using ASM = Dune::SeqOverlappingSchwarz<Mat, Vec>;
78}
79#endif
80
81#endif
Assembly scope.
Definition SIMdummy.h:24
@ ISTL
Sparse matrices / Dune solver.
Definition LinAlgenums.h:28