7 #include <dune/common/hybridutilities.hh> 8 #include <dune/common/shared_ptr.hh> 9 #include <dune/common/std/type_traits.hh> 10 #include <dune/istl/preconditioner.hh> 11 #include <dune/istl/solvercategory.hh> 13 #include <amdis/common/TypeTraits.hpp> 19 template <
class P,
class S>
21 :
public Dune::Preconditioner<typename P::domain_type, typename P::range_type>
23 using Preconditioner = P;
27 using domain_type =
typename P::domain_type;
28 using range_type =
typename P::range_type;
32 using HasApplyFoward = decltype(std::declval<P_>().
template apply<true>(std::declval<domain_type&>(), std::declval<range_type const&>()));
35 template <
class... Args>
37 : storage_(Dune::stackobject_to_shared_ptr(storage))
38 , precon_(*storage_, FWD(args)...)
41 template <
class... Args>
42 explicit PreconWrapper(std::shared_ptr<Storage> storage, Args&&... args)
43 : storage_(std::move(storage))
44 , precon_(*storage_, FWD(args)...)
48 void pre(domain_type& x, range_type& b)
override 54 void apply(domain_type& v, range_type
const& d)
override 60 template <
bool forward>
61 void apply(domain_type& v, range_type
const& d)
63 if constexpr (Dune::Std::is_detected<HasApplyFoward, P>::value)
64 precon_.template apply<forward>(v,d);
70 void post(domain_type& x)
override 76 Dune::SolverCategory::Category
category()
const override 78 return precon_.category();
82 std::shared_ptr<Storage> storage_;
83 Preconditioner precon_;
Dune::SolverCategory::Category category() const override
Category of the preconditioner.
Definition: PreconWrapper.hpp:76
Contains all classes needed for solving linear and non linear equation systems.
Definition: AdaptBase.hpp:6
void pre(domain_type &x, range_type &b) override
Prepare the preconditioner.
Definition: PreconWrapper.hpp:48
void apply(domain_type &v, range_type const &d)
Apply one step of the preconditioner in forward (or backward) direction.
Definition: PreconWrapper.hpp:61
void apply(domain_type &v, range_type const &d) override
Apply one step of the preconditioner to the system A(v)=d.
Definition: PreconWrapper.hpp:54
void post(domain_type &x) override
Clean up.
Definition: PreconWrapper.hpp:70
Definition: PreconWrapper.hpp:20