24#ifndef DUMUX_LINEAR_SCALAR_PRODUCTS_HH
25#define DUMUX_LINEAR_SCALAR_PRODUCTS_HH
31#include <dune/common/ftraits.hh>
32#include <dune/common/hybridutilities.hh>
34#include <dune/istl/solvercategory.hh>
35#include <dune/istl/scalarproducts.hh>
53template<
class X,
class C>
56 static constexpr std::size_t numSubDomains = X::size();
61 using real_type =
typename Dune::FieldTraits<field_type>::real_type;
80 using namespace Dune::Hybrid;
81 forEach(integralRange(Dune::Hybrid::size(y)), [&](
auto&& i)
84 comms_[i]->dot(x[i], y[i], subResult);
97 return sqrt(
dot(x, x));
111 Dune::SolverCategory::Category
category()
const override
113 if (std::all_of(comms_.begin(), comms_.end(),
114 [](
auto& c){ return c->category() == Dune::SolverCategory::sequential; }
116 return Dune::SolverCategory::sequential;
117 else if (std::all_of(comms_.begin(), comms_.end(),
118 [](
auto& c){ return c->category() == Dune::SolverCategory::nonoverlapping; }
120 return Dune::SolverCategory::nonoverlapping;
122 return Dune::SolverCategory::overlapping;
126 std::array<std::shared_ptr<const communication_type>, numSubDomains> comms_;
Adaption of the non-isothermal two-phase two-component flow model to problems with CO2.
Definition: adapt.hh:29
A scalar product for multi-type vectors.
Definition: scalarproducts.hh:55
typename X::field_type field_type
Definition: scalarproducts.hh:60
ParallelMultiTypeScalarProduct(const std::array< std::shared_ptr< const communication_type >, numSubDomains > &comms)
Definition: scalarproducts.hh:64
C communication_type
Definition: scalarproducts.hh:62
X domain_type
Definition: scalarproducts.hh:59
Dune::SolverCategory::Category category() const override
category of the scalar product
Definition: scalarproducts.hh:111
typename Dune::FieldTraits< field_type >::real_type real_type
Definition: scalarproducts.hh:61
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:75
real_type norm(const X &x) const override
compute 2-norm of a right-hand side vector
Definition: scalarproducts.hh:94