PFUNC
1.0
|
#include <pfunc/parallel_for.hpp>
Public Types | |
typedef PFuncInstanceType::taskmgr | TaskMgrType |
typedef PFuncInstanceType::task | TaskType |
Public Member Functions | |
parallel_for (SpaceType space, const ForExecutable &func, TaskMgrType &taskmgr) | |
void | operator() (void) |
Private Attributes | |
SpaceType | space |
const ForExecutable & | func |
TaskMgrType & | taskmgr |
A function much akin to for_each in STL. Takes in a range and a functor. The assumption is that the functor has the access to the entire container and hence all the harness needs to do is provide access to the correct range.
[in] | space | The iteration space. space is a model of Space. |
[in] | func | The function object to be applied to every element. This function object has to take in an object of space_1D. i.e., void operator (const space_1D& space) { ... } must be defined on func. func is a model of the ForExecutable concept. |
NOTE: This function currently uses a local task manager.
NOTE: To use parallel_for, the Functor used in PFuncInstanceType must be pfunc::use_default! If a definite type is given, parallel_for fails to execute.
typedef PFuncInstanceType::taskmgr pfunc::parallel_for< PFuncInstanceType, ForExecutable, SpaceType >::TaskMgrType |
typedef PFuncInstanceType::task pfunc::parallel_for< PFuncInstanceType, ForExecutable, SpaceType >::TaskType |
pfunc::parallel_for< PFuncInstanceType, ForExecutable, SpaceType >::parallel_for | ( | SpaceType | space, |
const ForExecutable & | func, | ||
TaskMgrType & | taskmgr | ||
) | [inline] |
Constructor
[in] | space | The space over which to iterate |
[in] | func | The function to execute over elements in this space |
[in] | taskmgr | The task manager to use for this parallel_for |
TODO: Make parallel_for work with global task manager.
void pfunc::parallel_for< PFuncInstanceType, ForExecutable, SpaceType >::operator() | ( | void | ) | [inline, virtual] |
Implements pfunc::virtual_functor.
const ForExecutable& pfunc::parallel_for< PFuncInstanceType, ForExecutable, SpaceType >::func [private] |
SpaceType pfunc::parallel_for< PFuncInstanceType, ForExecutable, SpaceType >::space [private] |
TaskMgrType& pfunc::parallel_for< PFuncInstanceType, ForExecutable, SpaceType >::taskmgr [private] |