27 #ifndef EWOMS_OVERLAPPING_PRECONDITIONER_HH
28 #define EWOMS_OVERLAPPING_PRECONDITIONER_HH
32 #include <opm/common/Exceptions.hpp>
33 #include <opm/common/ErrorMacros.hpp>
35 #include <dune/istl/preconditioners.hh>
43 template <
class SeqPreCond,
class Overlap>
45 :
public Dune::Preconditioner<typename SeqPreCond::domain_type,
46 typename SeqPreCond::range_type>
49 typedef typename SeqPreCond::domain_type domain_type;
50 typedef typename SeqPreCond::range_type range_type;
52 enum { category = Dune::SolverCategory::overlapping };
55 : seqPreCond_(seqPreCond), overlap_(&overlap)
58 void pre(domain_type& x, range_type& y)
64 seqPreCond_.pre(x, y);
65 short localSuccess = 1;
66 MPI_Allreduce(&localSuccess,
75 short localSuccess = 0;
76 MPI_Allreduce(&localSuccess,
88 OPM_THROW(Opm::NumericalProblem,
89 "Preconditioner threw an exception in pre() method on some process.");
91 seqPreCond_.pre(x, y);
99 void apply(domain_type& x,
const range_type& d)
102 if (overlap_->peerSet().size() > 0) {
110 seqPreCond_.apply(x, d);
111 short localSuccess = 1;
112 MPI_Allreduce(&localSuccess,
121 short localSuccess = 0;
122 MPI_Allreduce(&localSuccess,
134 OPM_THROW(Opm::NumericalProblem,
135 "Preconditioner threw an exception on some process.");
139 seqPreCond_.apply(x, d);
142 void post(domain_type& x)
149 short localSuccess = 1;
150 MPI_Allreduce(&localSuccess,
159 short localSuccess = 0;
160 MPI_Allreduce(&localSuccess,
172 OPM_THROW(Opm::NumericalProblem,
"Preconditioner threw an "
173 "exception in post() method on "
181 SeqPreCond& seqPreCond_;
182 const Overlap *overlap_;
An overlap aware preconditioner for any ISTL linear solver.
Definition: overlappingpreconditioner.hh:44
An overlap aware ISTL scalar product.