12#ifndef DUMUX_LINEAR_SCALAR_PRODUCTS_HH
13#define DUMUX_LINEAR_SCALAR_PRODUCTS_HH
19#include <dune/common/ftraits.hh>
20#include <dune/common/hybridutilities.hh>
22#include <dune/istl/solvercategory.hh>
23#include <dune/istl/scalarproducts.hh>
41template<
class X,
class C>
44 static constexpr std::size_t numSubDomains = X::size();
49 using real_type =
typename Dune::FieldTraits<field_type>::real_type;
68 using namespace Dune::Hybrid;
69 forEach(integralRange(Dune::Hybrid::size(y)), [&](
auto&& i)
72 comms_[i]->dot(x[i], y[i], subResult);
85 return sqrt(
dot(x, x));
99 Dune::SolverCategory::Category
category()
const override
101 if (std::all_of(comms_.begin(), comms_.end(),
102 [](
auto& c){ return c->category() == Dune::SolverCategory::sequential; }
104 return Dune::SolverCategory::sequential;
105 else if (std::all_of(comms_.begin(), comms_.end(),
106 [](
auto& c){ return c->category() == Dune::SolverCategory::nonoverlapping; }
108 return Dune::SolverCategory::nonoverlapping;
110 return Dune::SolverCategory::overlapping;
114 std::array<std::shared_ptr<const communication_type>, numSubDomains> comms_;
A scalar product for multi-type vectors.
Definition: scalarproducts.hh:43
typename X::field_type field_type
Definition: scalarproducts.hh:48
ParallelMultiTypeScalarProduct(const std::array< std::shared_ptr< const communication_type >, numSubDomains > &comms)
Definition: scalarproducts.hh:52
C communication_type
Definition: scalarproducts.hh:50
X domain_type
Definition: scalarproducts.hh:47
Dune::SolverCategory::Category category() const override
category of the scalar product
Definition: scalarproducts.hh:99
typename Dune::FieldTraits< field_type >::real_type real_type
Definition: scalarproducts.hh:49
field_type dot(const X &x, const X &y) const override
Dot product of two vectors It is assumed that the vectors are consistent on the interior+border parti...
Definition: scalarproducts.hh:63
real_type norm(const X &x) const override
compute 2-norm of a right-hand side vector
Definition: scalarproducts.hh:82