iLand
Public Member Functions | List of all members
ThreadRunner Class Reference

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
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ ThreadRunner() [1/2]

ThreadRunner::ThreadRunner ( )

◆ ThreadRunner() [2/2]

ThreadRunner::ThreadRunner ( const QList< Species * > &  speciesList)
inline

Member Function Documentation

◆ multithreading()

bool ThreadRunner::multithreading ( ) const
inline

◆ print()

void ThreadRunner::print ( )

print useful debug messages

◆ run() [1/4]

template<class T >
void ThreadRunner::run ( T *(*)(T *)  funcptr,
const QVector< T * > &  container,
const bool  forceSingleThreaded = false 
) const

◆ run() [2/4]

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.

◆ run() [3/4]

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

◆ run() [4/4]

template<class T >
void ThreadRunner::run ( void(*)(T &)  funcptr,
QVector< T > &  container,
const bool  forceSingleThreaded = false 
) const

◆ runGrid()

template<class T >
void ThreadRunner::runGrid ( void(*)(T *, T *)  funcptr,
T *  begin,
T *  end,
const bool  forceSingleThreaded = false,
int  minsize = 10000,
int  maxchunks = 10000 
) const

◆ setMultithreading()

void ThreadRunner::setMultithreading ( const bool  do_multithreading)
inline

◆ setup() [1/2]

void ThreadRunner::setup ( const QList< ResourceUnit * > &  resourceUnitList)

◆ setup() [2/2]

void ThreadRunner::setup ( const QList< Species * > &  speciesList)
inline

The documentation for this class was generated from the following files: