iLand
|
Encapsulates the invokation of multiple threads for paralellized tasks. More...
#include <threadrunner.h>
Public Member Functions | |
ThreadRunner () | |
ThreadRunner (const QList< Species * > &speciesList) | |
void | setup (const QList< ResourceUnit * > &resourceUnitList) |
void | setup (const QList< Species * > &speciesList) |
bool | multithreading () const |
void | setMultithreading (const bool do_multithreading) |
void | print () |
print useful debug messages More... | |
void | run (void(*funcptr)(ResourceUnit *), const bool forceSingleThreaded=false) const |
execute 'funcptr' for all resource units in parallel More... | |
void | run (void(*funcptr)(Species *), const bool forceSingleThreaded=false) const |
execute 'funcptr' for set of species in parallel More... | |
template<class T > | |
void | run (T *(*funcptr)(T *), const QVector< T * > &container, const bool forceSingleThreaded=false) const |
template<class T > | |
void | run (void(*funcptr)(T &), QVector< T > &container, const bool forceSingleThreaded=false) const |
template<class T > | |
void | runGrid (void(*funcptr)(T *, T *), T *begin, T *end, const bool forceSingleThreaded=false, int minsize=10000, int maxchunks=10000) const |
Encapsulates the invokation of multiple threads for paralellized tasks.
To avoid lost updates during the light influence pattern application, all the resourceUnits are divided in two lists based on the index (even vs. uneven). These (for almost all cases) ensures, that no directly neighboring resourceUnits are processed.
ThreadRunner::ThreadRunner | ( | ) |
|
inline |
|
inline |
void ThreadRunner::print | ( | ) |
print useful debug messages
void ThreadRunner::run | ( | T *(*)(T *) | funcptr, |
const QVector< T * > & | container, | ||
const bool | forceSingleThreaded = false |
||
) | const |
void ThreadRunner::run | ( | void(*)(ResourceUnit *) | funcptr, |
const bool | forceSingleThreaded = false |
||
) | const |
execute 'funcptr' for all resource units in parallel
run a given function for each ressource unit either multithreaded or not.
void ThreadRunner::run | ( | void(*)(Species *) | funcptr, |
const bool | forceSingleThreaded = false |
||
) | const |
execute 'funcptr' for set of species in parallel
run a given function for each species
void ThreadRunner::run | ( | void(*)(T &) | funcptr, |
QVector< T > & | container, | ||
const bool | forceSingleThreaded = false |
||
) | const |
void ThreadRunner::runGrid | ( | void(*)(T *, T *) | funcptr, |
T * | begin, | ||
T * | end, | ||
const bool | forceSingleThreaded = false , |
||
int | minsize = 10000 , |
||
int | maxchunks = 10000 |
||
) | const |
|
inline |
void ThreadRunner::setup | ( | const QList< ResourceUnit * > & | resourceUnitList | ) |
|
inline |