Reference documentation for deal.II version 9.1.0-pre
Public Member Functions | Public Attributes | Private Attributes | List of all members
parallel::internal::ReductionOnSubranges< ResultType, Function > Struct Template Reference

#include <deal.II/base/parallel.h>

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::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 512 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 used 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 529 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 541 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 553 of file parallel.h.

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

Execute the given function on the specified range.

Definition at line 563 of file parallel.h.

Member Data Documentation

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

A variable that will hold the result of the reduction.

Definition at line 517 of file parallel.h.

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 572 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 579 of file parallel.h.

template<typename ResultType, typename Function>
const std::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 585 of file parallel.h.


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