21#ifndef OPM_PARALLELISTLINFORMATION_HEADER_INCLUDED
22#define OPM_PARALLELISTLINFORMATION_HEADER_INCLUDED
26#if HAVE_MPI && HAVE_DUNE_ISTL
34#include <dune/istl/owneroverlapcopy.hh>
36#include <opm/simulators/utils/ParallelCommunication.hpp>
47 using ParallelIndexSet = Dune::OwnerOverlapCopyCommunication<int, int>::ParallelIndexSet;
49 using RemoteIndices = Dune::OwnerOverlapCopyCommunication<int, int>::RemoteIndices;
72 std::shared_ptr<ParallelIndexSet>
indexSet()
const
84 Parallel::Communication communicator()
const
99 void copyOwnerToAll (
const T& source, T&
dest)
const;
133 template<
typename Container,
typename BinaryOperator,
typename T>
140 std::tuple<BinaryOperators...>&
operators,
141 std::tuple<ReturnValues...>& values)
const;
143 std::shared_ptr<ParallelIndexSet>
indexSet_;
156 template<
typename BinaryOperator>
165 template<
class T,
class T1>
166 T operator()(
const T& t1,
const T& t2,
const T1& mask)
168 return b_(t1, maskValue(t2, mask));
170 template<
class T,
class T1>
171 T maskValue(
const T& t,
const T1& mask)
175 BinaryOperator& localOperator()
199 T operator()(
const T& t1,
const T& t2,
const T1& mask)
201 T masked = maskValue(t2, mask);
202 return t1 + masked * masked;
205 T maskValue(
const T& t,
const T1& mask)
209 std::plus<T> localOperator()
211 return std::plus<T>();
213 template<
class V, std::enable_if_t<std::is_convertible_v<T, V>,
int> = 0>
225 template<
typename BinaryOperator>
228 explicit MaskToMinOperator(BinaryOperator b)
237 template<
class T,
class T1>
238 T operator()(
const T& t1,
const T& t2,
const T1& mask)
240 return b_(t1, maskValue(t2, mask));
242 template<
class T,
class T1>
243 T maskValue(
const T& t,
const T1& mask)
251 return getInitialValue<T>();
257 return std::numeric_limits<T>::lowest();
263 BinaryOperator& localOperator()
274 template<
typename BinaryOperator>
277 explicit MaskToMaxOperator(BinaryOperator b)
286 template<
class T,
class T1>
287 T operator()(
const T& t1,
const T& t2,
const T1& mask)
289 return b_(t1, maskValue(t2, mask));
291 template<
class T,
class T1>
292 T maskValue(
const T& t,
const T1& mask)
300 return std::numeric_limits<T>::max();
303 BinaryOperator& localOperator()
310 return std::numeric_limits<T>::max();
332 using result_type = T;
333 const result_type& operator()(
const T& t1,
const T& t2)
335 return std::max(t1, t2);
344 template<
typename T,
typename Enable =
void>
347 using result_type = T;
348 result_type operator()(
const T& t1,
351 return std::max(std::abs(t1), std::abs(t2));
359 struct MaxAbsFunctor<T, typename std::enable_if<std::is_unsigned<T>::value>::type>
361 using result_type = T;
362 result_type operator()(
const T& t1,
365 return std::max(t1, t2);
388 using result_type = T;
389 const result_type& operator()(
const T& t1,
const T& t2)
391 return std::min(t1, t2);
418 ->
decltype(
container[0]*(*maskContainer)[0]);
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition blackoilbioeffectsmodules.hh:43
constexpr auto getPropValue()
get the value data member of a property
Definition propertysystem.hh:240
auto accumulateMaskedValues(const T1 &container, const std::vector< double > *maskContainer) -> decltype(container[0] *(*maskContainer)[0])
Accumulates entries masked with 1.