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.

Definition at line 497 of file parallel.h.


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>().

Definition at line 521 of file parallel.h.

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.

Definition at line 535 of file parallel.h.


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.

Definition at line 549 of file parallel.h.

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.

Definition at line 570 of file parallel.h.

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.

Definition at line 580 of file parallel.h.

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.

Definition at line 587 of file parallel.h.

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:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

deal.II documentation generated on Fri Feb 3 2012 06:04:15 by doxygen 1.7.2