DUNE-ACFEM (unstable)

SequenceAccumulate

Accumulate over all elements of a sequence using functors. More...

Modules

 SequenceAccumulateFunctors
 Pre-defined functors as argument to the AccumulateSequence template.
 

Typedefs

template<class F , class Seq >
using Dune::ACFem::AccumulateSequence = Constant< typename Seq::value_type, AccumulateSequenceHelper< Seq, F >::value >
 Accumulate the values of the sequence according to the supplied functor. More...
 

Detailed Description

Accumulate over all elements of a sequence using functors.

Typedef Documentation

◆ AccumulateSequence

template<class F , class Seq >
using Dune::ACFem::AccumulateSequence = typedef Constant<typename Seq::value_type, AccumulateSequenceHelper<Seq, F>::value>

Accumulate the values of the sequence according to the supplied functor.

The functor must define an "Apply"-template of the following type, where the neutralValue is the result value for the empty sequence and the value the last element of the sequence will be combined with. Front is the current element, Tail the resulting value obtained by accumulating the rest of the sequence. T will be TYPE when instantiating the Apply alias.

struct Functor
{
template<class T>
using NeutralValue = Constant<T, SOMETHING>;
template<class T, T Front, T Tail>
using Apply = IntegerConstant<TYPE, EXPRESSION(Front, Tail)>;
};
Note
AccumulateSequence is rather general. For simple things it is probably better to use the builtin fold expressions of the compiler.
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.80.0 (Apr 19, 22:31, 2024)