mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Fixes formatting according to Atgeirr's coding style.
This commit is contained in:
parent
7bce15c04b
commit
4a80474782
@ -131,7 +131,9 @@ public:
|
||||
AllSet destFlags;
|
||||
Dune::Interface interface(communicator_);
|
||||
if( !remoteIndices_->isSynced() )
|
||||
{
|
||||
remoteIndices_->rebuild<false>();
|
||||
}
|
||||
interface.build(*remoteIndices_,sourceFlags,destFlags);
|
||||
Dune::BufferedCommunicator communicator;
|
||||
communicator.template build<T>(interface);
|
||||
@ -142,14 +144,20 @@ public:
|
||||
void updateOwnerMask(const T& container)
|
||||
{
|
||||
if( ! indexSet_ )
|
||||
{
|
||||
OPM_THROW(std::runtime_error, "Trying to update owner mask without parallel information!");
|
||||
}
|
||||
if( container.size()!= ownerMask_.size() )
|
||||
{
|
||||
ownerMask_.resize(container.size(), 1.);
|
||||
for( auto i=indexSet_->begin(), end=indexSet_->end(); i!=end; ++i )
|
||||
{
|
||||
if (i->local().attribute()!=Dune::OwnerOverlapCopyAttributeSet::owner)
|
||||
{
|
||||
ownerMask_[i->local().local()] = 0.;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
/// \brief Compute one or more global reductions.
|
||||
///
|
||||
@ -208,7 +216,9 @@ private:
|
||||
std::tuple_size<std::tuple<ReturnValues...> >::value,
|
||||
"We need the same number of containers and return values");
|
||||
if( std::tuple_size<std::tuple<Containers...> >::value==0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
// Copy the initial values.
|
||||
std::tuple<ReturnValues...> init=values;
|
||||
updateOwnerMask(std::get<0>(containers));
|
||||
@ -219,8 +229,10 @@ private:
|
||||
values=init;
|
||||
for( auto rvals=receivedValues.begin(), endvals=receivedValues.end(); rvals!=endvals;
|
||||
++rvals )
|
||||
{
|
||||
computeGlobalReduction(*rvals, operators, values);
|
||||
}
|
||||
}
|
||||
/// \brief TMP for computing the the global reduction after receiving the local ones.
|
||||
///
|
||||
/// End of recursion.
|
||||
@ -269,8 +281,10 @@ private:
|
||||
|
||||
for( auto endVal=container.end(); newVal!=endVal;
|
||||
++newVal, ++mask )
|
||||
{
|
||||
value = reduceOperator(value, *newVal, *mask);
|
||||
}
|
||||
}
|
||||
computeLocalReduction<I+1>(containers, operators, values);
|
||||
}
|
||||
/** \brief gather/scatter callback for communcation */
|
||||
@ -370,17 +384,24 @@ private:
|
||||
T maskValue(const T& t, const T1& mask)
|
||||
{
|
||||
if( mask )
|
||||
{
|
||||
return t;
|
||||
else{
|
||||
}
|
||||
else
|
||||
{
|
||||
//g++-4.4 does not support std::numeric_limits<T>::lowest();
|
||||
// we rely on IEE 754 for floating point values and use min()
|
||||
// for integral types.
|
||||
if( std::is_integral<T>::value )
|
||||
{
|
||||
return -std::numeric_limits<float>::min();
|
||||
}
|
||||
else
|
||||
{
|
||||
return -std::numeric_limits<float>::max();
|
||||
}
|
||||
}
|
||||
}
|
||||
/// \brief Get the underlying binary operator.
|
||||
///
|
||||
/// This might be needed to compute the reduction after each processor
|
||||
@ -408,16 +429,20 @@ private:
|
||||
template<class T, class T1>
|
||||
T operator()(const T& t1, const T& t2, const T1& mask)
|
||||
{
|
||||
b_(t1, maskValue(t2, mask));
|
||||
return b_(t1, maskValue(t2, mask));
|
||||
}
|
||||
template<class T, class T1>
|
||||
T maskValue(const T& t, const T1& mask)
|
||||
{
|
||||
if( mask )
|
||||
{
|
||||
return t;
|
||||
}
|
||||
else
|
||||
{
|
||||
return std::numeric_limits<T>::max();
|
||||
}
|
||||
}
|
||||
BinaryOperator& localOperator()
|
||||
{
|
||||
return b_;
|
||||
|
Loading…
Reference in New Issue
Block a user