6#include <dune/common/typeutilities.hh>
7#include <dune/istl/operators.hh>
8#include <dune/istl/scalarproducts.hh>
9#include <dune/istl/solvercategory.hh>
12#include <dune/istl/novlpschwarz.hh>
13#include <dune/istl/schwarz.hh>
16#include <amdis/Output.hpp>
17#include <amdis/linearalgebra/istl/PreconWrapper.hpp>
26 using Interface = Dune::ScalarProduct<X>;
29 static std::unique_ptr<Interface> create(Dune::SolverCategory::Category cat, Comm
const& comm)
31 return create_impl(cat, comm.impl(), Dune::PriorityTag<10>{});
35 static std::unique_ptr<Interface>
36 create_impl(Dune::SolverCategory::Category cat, Dune::Amg::SequentialInformation, Dune::PriorityTag<2>)
38 assert(cat == Dune::SolverCategory::sequential);
39 return std::make_unique< Dune::SeqScalarProduct<X> >();
43 static std::unique_ptr<Interface>
44 create_impl(Dune::SolverCategory::Category cat, Comm
const& comm, Dune::PriorityTag<1>)
48 case Dune::SolverCategory::sequential:
49 return std::make_unique< Dune::SeqScalarProduct<X> >();
51 case Dune::SolverCategory::overlapping:
52 return std::make_unique< Dune::OverlappingSchwarzScalarProduct<X,Comm> >(comm);
53 case Dune::SolverCategory::nonoverlapping:
54 return std::make_unique< Dune::NonoverlappingSchwarzScalarProduct<X,Comm> >(comm);
57 error_exit(
"Invalid solver category for scalar product\n");
64 template <
class M,
class X,
class Y>
68 using Interface = Dune::AssembledLinearOperator<M,X,Y>;
71 static std::unique_ptr<Interface> create(Dune::SolverCategory::Category cat, M
const& mat, Comm
const& comm)
73 return create_impl(cat, mat, comm.impl(), Dune::PriorityTag<10>{});
77 static std::unique_ptr<Interface>
78 create_impl(Dune::SolverCategory::Category cat, M
const& mat, Dune::Amg::SequentialInformation, Dune::PriorityTag<2>)
80 assert(cat == Dune::SolverCategory::sequential);
81 return std::make_unique< Dune::MatrixAdapter<M,X,Y> >(mat);
85 static std::unique_ptr<Interface>
86 create_impl(Dune::SolverCategory::Category cat, M
const& mat, Comm
const& comm, Dune::PriorityTag<1>)
90 case Dune::SolverCategory::sequential:
91 return std::make_unique< Dune::MatrixAdapter<M,X,Y> >(mat);
93 case Dune::SolverCategory::overlapping:
94 return std::make_unique< Dune::OverlappingSchwarzOperator<M,X,Y,Comm> >(mat, comm);
95 case Dune::SolverCategory::nonoverlapping:
96 return std::make_unique< Dune::NonoverlappingSchwarzOperator<M,X,Y,Comm> >(mat, comm);
99 error_exit(
"Invalid solver category for linear operator\n");
107 template <
class X,
class Y>
111 using Interface = Dune::Preconditioner<X,Y>;
113 template <
class Comm>
114 static std::unique_ptr<Interface> create(Dune::SolverCategory::Category cat, std::unique_ptr<Interface> prec, Comm
const& comm)
116 return create_impl(cat, std::move(prec), comm.impl(), Dune::PriorityTag<10>{});
120 static std::unique_ptr<Interface>
121 create_impl(Dune::SolverCategory::Category cat, std::unique_ptr<Interface> prec, Dune::Amg::SequentialInformation, Dune::PriorityTag<2>)
123 assert(cat == Dune::SolverCategory::sequential);
127 template <
class Comm>
128 static std::unique_ptr<Interface>
129 create_impl(Dune::SolverCategory::Category cat, std::unique_ptr<Interface> prec, Comm
const& comm, Dune::PriorityTag<1>)
133 case Dune::SolverCategory::sequential:
136 case Dune::SolverCategory::overlapping:
138 using BP = Dune::BlockPreconditioner<X,Y,Comm>;
139 return std::make_unique< PreconWrapper<BP,Interface> >(std::move(prec), comm);
141 case Dune::SolverCategory::nonoverlapping:
143 using BP = Dune::NonoverlappingBlockPreconditioner<Comm,Interface>;
144 return std::make_unique< PreconWrapper<BP,Interface> >(std::move(prec), comm);
148 error_exit(
"Invalid solver category for parallel preconditioner\n");
Creator to create Linear Operator objects.
Definition: Creators.hpp:66
Creator to create parallel Preconditioners.
Definition: Creators.hpp:109
Creator to create ScalarProduct objects.
Definition: Creators.hpp:24