OpenWalnut  1.5.0dev
Public Member Functions | Private Attributes | List of all members
WTuringTextureCreator::TextureThread Class Reference

The thread calculating the Turing concentration diffusion in a given range. More...

+ Inheritance diagram for WTuringTextureCreator::TextureThread:
+ Collaboration diagram for WTuringTextureCreator::TextureThread:

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 WBoolFlagisCrashed () 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< WThreadedRunnerSPtr
 Abbreviation to a shared_ptr to this type. More...
 
typedef std::shared_ptr< const WThreadedRunnerConstSPtr
 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...
 

Detailed Description

The thread calculating the Turing concentration diffusion in a given range.

Definition at line 92 of file WTuringTextureCreator.h.

Constructor & Destructor Documentation

◆ TextureThread()

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.

Parameters
idthe id of this thread. Must be in [0, max).
maxthe maximum number of threads.

Definition at line 145 of file WTuringTextureCreator.cpp.

◆ ~TextureThread()

WTuringTextureCreator::TextureThread::~TextureThread ( )

Destructor.

Definition at line 158 of file WTuringTextureCreator.cpp.

Member Function Documentation

◆ setBufferPointers()

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.

Parameters
concentration1the shared memory for concentration values of fluid 1
concentration2the shared memory for concentration values of fluid 2
noisethe input noise.
delta1the shared memory representing the concentration change of fluid 1
delta2the shared memory representing the concentration change of fluid 2

Definition at line 250 of file WTuringTextureCreator.cpp.

◆ setDiffusionConstants()

void WTuringTextureCreator::TextureThread::setDiffusionConstants ( float  d1,
float  d2 
)

Diffusion constants according to Turing Reaction Diffusion algorithm.

Parameters
d1Diffusion constant of fluid 1
d2Diffusion constant of fluid 2

Definition at line 162 of file WTuringTextureCreator.cpp.

◆ setSpotFactor()

void WTuringTextureCreator::TextureThread::setSpotFactor ( float  spotFactor)

The factor influencing size and shape of a spot.

Parameters
spotFactorthe factor. Refer to the Turing Reaction Diffusion algorithm. It mainly relates to the spot size.

Definition at line 171 of file WTuringTextureCreator.cpp.

◆ setTextureSize()

void WTuringTextureCreator::TextureThread::setTextureSize ( std::size_t  sizeX,
std::size_t  sizeY,
std::size_t  sizeZ 
)

Target texture size.

Parameters
sizeXsize in X
sizeYsize in Y
sizeZsize in Z

Definition at line 178 of file WTuringTextureCreator.cpp.

◆ threadMain()

void WTuringTextureCreator::TextureThread::threadMain ( )
virtual

The actual thread function running the algorithm.

Reimplemented from WThreadedRunner.

Definition at line 189 of file WTuringTextureCreator.cpp.

Member Data Documentation

◆ m_concentration1

std::vector< float > const* WTuringTextureCreator::TextureThread::m_concentration1
private

the shared memory for concentration values of fluid 1

Definition at line 193 of file WTuringTextureCreator.h.

◆ m_concentration2

std::vector< float > const* WTuringTextureCreator::TextureThread::m_concentration2
private

the shared memory for concentration values of fluid 2

Definition at line 196 of file WTuringTextureCreator.h.

◆ m_delta1

std::vector< float >* WTuringTextureCreator::TextureThread::m_delta1
private

the shared memory representing the concentration change of fluid 1

Definition at line 202 of file WTuringTextureCreator.h.

◆ m_delta2

std::vector< float >* WTuringTextureCreator::TextureThread::m_delta2
private

the shared memory representing the concentration change of fluid 2

Definition at line 205 of file WTuringTextureCreator.h.

◆ m_diffusionConstant1

float WTuringTextureCreator::TextureThread::m_diffusionConstant1
private

The amount of diffusion of fluid 1.

Definition at line 185 of file WTuringTextureCreator.h.

◆ m_diffusionConstant2

float WTuringTextureCreator::TextureThread::m_diffusionConstant2
private

The amount of diffusion of fluid 2.

Definition at line 190 of file WTuringTextureCreator.h.

◆ m_id

std::size_t WTuringTextureCreator::TextureThread::m_id
private

ID of the thread.

Definition at line 155 of file WTuringTextureCreator.h.

◆ m_maxThreads

std::size_t WTuringTextureCreator::TextureThread::m_maxThreads
private

Number of all spawned threads.

Definition at line 160 of file WTuringTextureCreator.h.

◆ m_noise

std::vector< float > const* WTuringTextureCreator::TextureThread::m_noise
private

the input noise.

Definition at line 199 of file WTuringTextureCreator.h.

◆ m_sizeX

std::size_t WTuringTextureCreator::TextureThread::m_sizeX
private

Size of the resulting texture.

Definition at line 165 of file WTuringTextureCreator.h.

◆ m_sizeY

std::size_t WTuringTextureCreator::TextureThread::m_sizeY
private

Size of the resulting texture.

Definition at line 170 of file WTuringTextureCreator.h.

◆ m_sizeZ

std::size_t WTuringTextureCreator::TextureThread::m_sizeZ
private

Size of the resulting texture.

Definition at line 175 of file WTuringTextureCreator.h.

◆ m_spotFactor

float WTuringTextureCreator::TextureThread::m_spotFactor
private

The factor defining the spot size and shape.

Definition at line 180 of file WTuringTextureCreator.h.


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