OpenWalnut
1.5.0dev
|
The thread calculating the Turing concentration diffusion in a given range. More...
Public Member Functions | |
TextureThread (std::size_t id, std::size_t max) | |
Create a calculation thread. More... | |
~TextureThread () | |
Destructor. More... | |
void | setTextureSize (std::size_t sizeX, std::size_t sizeY, std::size_t sizeZ) |
Target texture size. More... | |
void | setSpotFactor (float spotFactor) |
The factor influencing size and shape of a spot. More... | |
void | setDiffusionConstants (float d1, float d2) |
Diffusion constants according to Turing Reaction Diffusion algorithm. More... | |
void | setBufferPointers (std::vector< float > const *concentration1, std::vector< float > const *concentration2, std::vector< float > const *noise, std::vector< float > *delta1, std::vector< float > *delta2) |
Define the memory to work in. More... | |
virtual void | threadMain () |
The actual thread function running the algorithm. More... | |
Public Member Functions inherited from WThreadedRunner | |
WThreadedRunner () | |
Default constructor. More... | |
virtual | ~WThreadedRunner () |
Destructor. More... | |
virtual void | run () |
Run thread. More... | |
void | run (THREADFUNCTION f) |
Run thread. More... | |
void | wait (bool requestFinish=false) |
Wait for the thread to be finished. More... | |
virtual void | requestStop () |
This method's purpose is to request a stop without waiting for it. More... | |
virtual boost::signals2::connection | subscribeSignal (THREAD_SIGNAL signal, t_ThreadErrorSignalHandlerType notifier) |
Connects a specified notify function with a signal this thread instance is offering. More... | |
const WBoolFlag & | isCrashed () const |
Checks whether this thread has been crashed. More... | |
const std::string & | getCrashMessage () const |
Get the message of the exception finally causing the crash. More... | |
void | setThreadName (std::string name) |
Set the name of the thread. More... | |
std::string | getThreadName () const |
Returns the current thread name. More... | |
Private Attributes | |
std::size_t | m_id |
ID of the thread. More... | |
std::size_t | m_maxThreads |
Number of all spawned threads. More... | |
std::size_t | m_sizeX |
Size of the resulting texture. More... | |
std::size_t | m_sizeY |
Size of the resulting texture. More... | |
std::size_t | m_sizeZ |
Size of the resulting texture. More... | |
float | m_spotFactor |
The factor defining the spot size and shape. More... | |
float | m_diffusionConstant1 |
The amount of diffusion of fluid 1. More... | |
float | m_diffusionConstant2 |
The amount of diffusion of fluid 2. More... | |
std::vector< float > const * | m_concentration1 |
the shared memory for concentration values of fluid 1 More... | |
std::vector< float > const * | m_concentration2 |
the shared memory for concentration values of fluid 2 More... | |
std::vector< float > const * | m_noise |
the input noise. More... | |
std::vector< float > * | m_delta1 |
the shared memory representing the concentration change of fluid 1 More... | |
std::vector< float > * | m_delta2 |
the shared memory representing the concentration change of fluid 2 More... | |
Additional Inherited Members | |
Public Types inherited from WThreadedRunner | |
typedef std::shared_ptr< WThreadedRunner > | SPtr |
Abbreviation to a shared_ptr to this type. More... | |
typedef std::shared_ptr< const WThreadedRunner > | ConstSPtr |
Abbreviation to a const shared_ptr to this type. More... | |
typedef boost::function< void(void) > | THREADFUNCTION |
Type used for simple thread functions. More... | |
Static Public Member Functions inherited from WThreadedRunner | |
static void | setThisThreadName (std::string name) |
Static function to set the name of the calling thread. More... | |
Protected Member Functions inherited from WThreadedRunner | |
virtual void | notifyStop () |
Gets called when the thread should be stopped. More... | |
void | yield () const |
Give remaining execution timeslice to another thread. More... | |
void | sleep (const int32_t t) const |
Sets thread asleep. More... | |
void | msleep (const int32_t t) const |
Sets thread asleep. More... | |
void | waitForStop () |
Let the thread sleep until a stop request was given. More... | |
virtual void | onThreadException (const WException &e) |
This method is called if an exception was caught, which came from the custom thread code. More... | |
void | handleDeadlyException (const WException &e, std::string sender="WThreadedRunner") |
Handle the specified exception which was not caught in the thread, which basically means the thread has crashed. More... | |
Protected Attributes inherited from WThreadedRunner | |
boost::thread | m_thread |
Thread instance. More... | |
WBoolFlag | m_shutdownFlag |
Condition getting fired whenever the thread should quit. More... | |
WBoolFlag | m_isCrashed |
True whenever an exception is thrown during threadMain. More... | |
std::string | m_crashMessage |
The crash message. More... | |
The thread calculating the Turing concentration diffusion in a given range.
Definition at line 92 of file WTuringTextureCreator.h.
WTuringTextureCreator::TextureThread::TextureThread | ( | std::size_t | id, |
std::size_t | max | ||
) |
Create a calculation thread.
This does not start calculation. It uses both parameters to define the memory range to work in.
id | the id of this thread. Must be in [0, max). |
max | the maximum number of threads. |
Definition at line 145 of file WTuringTextureCreator.cpp.
WTuringTextureCreator::TextureThread::~TextureThread | ( | ) |
Destructor.
Definition at line 158 of file WTuringTextureCreator.cpp.
void WTuringTextureCreator::TextureThread::setBufferPointers | ( | std::vector< float > const * | concentration1, |
std::vector< float > const * | concentration2, | ||
std::vector< float > const * | noise, | ||
std::vector< float > * | delta1, | ||
std::vector< float > * | delta2 | ||
) |
Define the memory to work in.
concentration1 | the shared memory for concentration values of fluid 1 |
concentration2 | the shared memory for concentration values of fluid 2 |
noise | the input noise. |
delta1 | the shared memory representing the concentration change of fluid 1 |
delta2 | the shared memory representing the concentration change of fluid 2 |
Definition at line 250 of file WTuringTextureCreator.cpp.
void WTuringTextureCreator::TextureThread::setDiffusionConstants | ( | float | d1, |
float | d2 | ||
) |
Diffusion constants according to Turing Reaction Diffusion algorithm.
d1 | Diffusion constant of fluid 1 |
d2 | Diffusion constant of fluid 2 |
Definition at line 162 of file WTuringTextureCreator.cpp.
void WTuringTextureCreator::TextureThread::setSpotFactor | ( | float | spotFactor | ) |
The factor influencing size and shape of a spot.
spotFactor | the factor. Refer to the Turing Reaction Diffusion algorithm. It mainly relates to the spot size. |
Definition at line 171 of file WTuringTextureCreator.cpp.
void WTuringTextureCreator::TextureThread::setTextureSize | ( | std::size_t | sizeX, |
std::size_t | sizeY, | ||
std::size_t | sizeZ | ||
) |
Target texture size.
sizeX | size in X |
sizeY | size in Y |
sizeZ | size in Z |
Definition at line 178 of file WTuringTextureCreator.cpp.
|
virtual |
The actual thread function running the algorithm.
Reimplemented from WThreadedRunner.
Definition at line 189 of file WTuringTextureCreator.cpp.
|
private |
the shared memory for concentration values of fluid 1
Definition at line 193 of file WTuringTextureCreator.h.
|
private |
the shared memory for concentration values of fluid 2
Definition at line 196 of file WTuringTextureCreator.h.
|
private |
the shared memory representing the concentration change of fluid 1
Definition at line 202 of file WTuringTextureCreator.h.
|
private |
the shared memory representing the concentration change of fluid 2
Definition at line 205 of file WTuringTextureCreator.h.
|
private |
The amount of diffusion of fluid 1.
Definition at line 185 of file WTuringTextureCreator.h.
|
private |
The amount of diffusion of fluid 2.
Definition at line 190 of file WTuringTextureCreator.h.
|
private |
ID of the thread.
Definition at line 155 of file WTuringTextureCreator.h.
|
private |
Number of all spawned threads.
Definition at line 160 of file WTuringTextureCreator.h.
|
private |
the input noise.
Definition at line 199 of file WTuringTextureCreator.h.
|
private |
Size of the resulting texture.
Definition at line 165 of file WTuringTextureCreator.h.
|
private |
Size of the resulting texture.
Definition at line 170 of file WTuringTextureCreator.h.
|
private |
Size of the resulting texture.
Definition at line 175 of file WTuringTextureCreator.h.
|
private |
The factor defining the spot size and shape.
Definition at line 180 of file WTuringTextureCreator.h.