27 #ifndef EWOMS_OVERLAPPING_SCALAR_PRODUCT_HH 28 #define EWOMS_OVERLAPPING_SCALAR_PRODUCT_HH 30 #include <dune/common/parallel/mpihelper.hh> 31 #include <dune/istl/scalarproducts.hh> 39 template <
class OverlappingBlockVector,
class Overlap>
41 :
public Dune::ScalarProduct<OverlappingBlockVector>
44 using field_type =
typename OverlappingBlockVector::field_type;
46 using CollectiveCommunication =
typename Dune::Communication<typename Dune::MPIHelper::MPICommunicator>;
47 using real_type =
typename Dune::ScalarProduct<OverlappingBlockVector>::real_type;
50 Dune::SolverCategory::Category
category()
const override 51 {
return Dune::SolverCategory::overlapping; }
55 comm_(
Dune::MPIHelper::getCommunication() )
58 field_type dot(
const OverlappingBlockVector& x,
59 const OverlappingBlockVector& y)
const override 62 size_t numLocal = overlap_.numLocal();
63 for (
unsigned localIdx = 0; localIdx < numLocal; ++localIdx) {
64 if (overlap_.iAmMasterOf(static_cast<int>(localIdx)))
65 sum += x[localIdx] * y[localIdx];
69 return comm_.sum( sum );
72 real_type norm(
const OverlappingBlockVector& x)
const override 73 {
return std::sqrt(dot(x, x)); }
76 const Overlap& overlap_;
77 const CollectiveCommunication comm_;
Definition: fvbaseprimaryvariables.hh:161
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition: blackoilbioeffectsmodules.hh:45
An overlap aware ISTL scalar product.
Definition: overlappingscalarproduct.hh:40
Dune::SolverCategory::Category category() const override
the kind of computations supported by the operator. Either overlapping or non-overlapping ...
Definition: overlappingscalarproduct.hh:50