Public Member Functions | Public Attributes | Private Attributes
parallel::internal::ReductionOnSubranges< ResultType, Function > Struct Template Reference

List of all members.

Public Member Functions

template<typename Reductor >
 ReductionOnSubranges (const Function &f, const Reductor &reductor, const ResultType neutral_element=ResultType())
 ReductionOnSubranges (const ReductionOnSubranges &r, tbb::split)
void join (const ReductionOnSubranges &r)
template<typename RangeType >
void operator() (const tbb::blocked_range< RangeType > &range)

Public Attributes

ResultType result

Private Attributes

const Function f
const ResultType neutral_element
const std_cxx1x::function
< ResultType(ResultType,
ResultType)> 
reductor

Detailed Description

template<typename ResultType, typename Function>
struct parallel::internal::ReductionOnSubranges< ResultType, Function >

A class that conforms to the Body requirements of the TBB parallel_reduce function. The first template argument denotes the type on which the reduction is to be done. The second denotes the type of the function object that shall be called for each subrange.


Constructor & Destructor Documentation

template<typename ResultType, typename Function>
template<typename Reductor >
parallel::internal::ReductionOnSubranges< ResultType, Function >::ReductionOnSubranges ( const Function &  f,
const Reductor &  reductor,
const ResultType  neutral_element = ResultType() 
) [inline]

Constructor. Take the function object to call on each sub-range as well as the neutral element with respect to the reduction operation.

The second argument denotes a function object that will be use to reduce the result of two computations into one number. An example if we want to simply accumulate integer results would be std::plus<int>().

template<typename ResultType, typename Function>
parallel::internal::ReductionOnSubranges< ResultType, Function >::ReductionOnSubranges ( const ReductionOnSubranges< ResultType, Function > &  r,
tbb::split   
) [inline]

Splitting constructor. See the TBB book for more details about this.


Member Function Documentation

template<typename ResultType, typename Function>
void parallel::internal::ReductionOnSubranges< ResultType, Function >::join ( const ReductionOnSubranges< ResultType, Function > &  r) [inline]

Join operation: merge the results from computations on different sub-intervals.

References parallel::internal::ReductionOnSubranges< ResultType, Function >::reductor, and parallel::internal::ReductionOnSubranges< ResultType, Function >::result.

template<typename ResultType, typename Function>
template<typename RangeType >
void parallel::internal::ReductionOnSubranges< ResultType, Function >::operator() ( const tbb::blocked_range< RangeType > &  range) [inline]

Member Data Documentation

template<typename ResultType, typename Function>
ResultType parallel::internal::ReductionOnSubranges< ResultType, Function >::result
template<typename ResultType, typename Function>
const Function parallel::internal::ReductionOnSubranges< ResultType, Function >::f [private]

The function object to call on every sub-range.

template<typename ResultType, typename Function>
const ResultType parallel::internal::ReductionOnSubranges< ResultType, Function >::neutral_element [private]

The neutral element with respect to the reduction operation. This is needed when calling the splitting constructor since we have to re-set the result variable in this case.

template<typename ResultType, typename Function>
const std_cxx1x::function<ResultType (ResultType, ResultType)> parallel::internal::ReductionOnSubranges< ResultType, Function >::reductor [private]

The function object to be used to reduce the result of two calls into one number.

Referenced by parallel::internal::ReductionOnSubranges< ResultType, Function >::join(), and parallel::internal::ReductionOnSubranges< ResultType, Function >::operator()().


The documentation for this struct was generated from the following file:

deal.II documentation generated on Fri Aug 12 2011 15:01:09 by doxygen 1.7.4