Shiokaze Framework
A research-oriented fluid solver for computer graphics
parallel_driver Class Reference

Class that facilitates the use of parallel_core class for parallel loop. More...

#include <parallel_driver.h>

Inheritance diagram for parallel_driver:
configurable credit

Public Member Functions

 parallel_driver (recursive_configurable *parent, std::string parallel_name=shkz_default_parallel_name, std::string splitter_name=shkz_default_splitter_name)
 Constructor for parallel_driver. More...
 
 parallel_driver (std::string parallel_name=shkz_default_parallel_name, std::string splitter_name=shkz_default_splitter_name)
 Constructor for parallel_driver. More...
 
int get_thread_num () const
 Get the number of maximal threads set. More...
 
void set_thread_num (int maximal_threads)
 Set the number of maximal threads set. More...
 
const parallel_coreget () const
 Get a pointer to the internal instance of parallel_core. More...
 
void run (const std::vector< std::function< void()> > &functions)
 Run operations in parallel. More...
 
void for_each_byte_safe (size_t size, std::function< void(size_t n, int thread_index)> func) const
 Perform a parallel loop operation. Thread is guaranteed the same if (n mod 8) is the same. More...
 
void for_each (size_t size, std::function< void(size_t n, int thread_index)> func) const
 Perform a parallel loop operation. More...
 
void for_each (size_t size, std::function< void(size_t n)> func) const
 Perform a parallel loop operation. More...
 
void for_each (const shape2 &shape, std::function< void(int i, int j, int thread_index)> func) const
 Perform a two dimensional parallel loop operation. More...
 
void for_each (const shape2 &shape, std::function< void(int i, int j)> func) const
 Perform a two dimensional parallel loop operation. More...
 
void for_each (const shape3 &shape, std::function< void(int i, int j, int k, int thread_index)> func) const
 Perform a three dimensional parallel loop operation. More...
 
void for_each (const shape3 &shape, std::function< void(int i, int j, int k)> func) const
 Perform a three dimensional parallel loop operation. More...
 
- Public Member Functions inherited from configurable
virtual void initialize (const environment_map &environment)
 Initialize the program. Used to get things ready for actual use. More...
 
virtual void setup_now (configuration &config=get_global_configuration())
 Run load - configure - initialize processes.
 
virtual bool not_recursive ()
 Check if this instance is not derived from recursive_configurable. More...
 
- Public Member Functions inherited from credit
 credit ()=default
 Default constructor.
 
 credit (std::string name, std::string argument_name)
 Constructor for credit. More...
 
virtual void set_name (std::string name, std::string argument_name="")
 Set name (and perhaps, argument name together) More...
 
virtual std::string get_name () const
 Get the name.
 
virtual void set_argument_name (std::string argument_name)
 Set an argument name. More...
 
virtual std::string get_argument_name () const
 Get an argument name. More...
 
virtual double get_version () const
 Get version. More...
 
virtual std::string get_author () const
 Get author's name. More...
 
virtual std::tuple< int, int, int > get_date () const
 Get currently set date. More...
 
virtual std::string get_email_address () const
 Get email address. More...
 

Additional Inherited Members

- Public Types inherited from configurable
using environment_map = std::map< std::string, const void * >
 Type for environment_map.
 
- Static Public Member Functions inherited from configurable
static configurationset_global_configuration (const configuration &config)
 Assign the global settings of the program. More...
 
static configurationget_global_configuration ()
 Get the global settings of the program. More...
 
template<class T >
static const T & get_env (const environment_map &environment, std::string key)
 Extract an specified type of pointer from the input environment. More...
 
- Protected Member Functions inherited from configurable
bool check_set (const environment_map &environment, std::vector< std::string > names)
 Check if the values for a variable keys exist. More...
 
- Protected Attributes inherited from credit
std::string m_name
 Name of credit.
 
std::string m_argument_name
 Argument name.
 

Detailed Description

Class that facilitates the use of parallel_core class for parallel loop.

Constructor & Destructor Documentation

◆ parallel_driver() [1/2]

parallel_driver::parallel_driver ( recursive_configurable parent,
std::string  parallel_name = shkz_default_parallel_name,
std::string  splitter_name = shkz_default_splitter_name 
)
inline

Constructor for parallel_driver.

Parameters
[in]parentPointer to an instance of recursive_configurable.
[in]parallel_nameCore name of the parallelization engine. "stdthread" is set as default.
[in]splitter_nameCore name of the parallel enumeration splitter name. "sequential_splitter" is set as default.

◆ parallel_driver() [2/2]

parallel_driver::parallel_driver ( std::string  parallel_name = shkz_default_parallel_name,
std::string  splitter_name = shkz_default_splitter_name 
)
inline

Constructor for parallel_driver.

Parameters
[in]parallel_nameCore name of the parallelization engine. "stdthread" is set as default.
[in]splitter_nameCore name of the parallel enumeration splitter name. "sequential_splitter" is set as default.

Member Function Documentation

◆ for_each() [1/6]

void parallel_driver::for_each ( const shape2 shape,
std::function< void(int i, int j)>  func 
) const
inline

Perform a two dimensional parallel loop operation.

Parameters
[in]shapeTwo dimensional shape.
[in]funcFunction that processes a loop.

◆ for_each() [2/6]

void parallel_driver::for_each ( const shape2 shape,
std::function< void(int i, int j, int thread_index)>  func 
) const
inline

Perform a two dimensional parallel loop operation.

Parameters
[in]shapeTwo dimensional shape.
[in]orderingOrdering of the loop.
[in]funcFunction that processes a loop.

◆ for_each() [3/6]

void parallel_driver::for_each ( const shape3 shape,
std::function< void(int i, int j, int k)>  func 
) const
inline

Perform a three dimensional parallel loop operation.

Parameters
[in]shapeThree dimensional shape.
[in]funcFunction that processes a loop.

◆ for_each() [4/6]

void parallel_driver::for_each ( const shape3 shape,
std::function< void(int i, int j, int k, int thread_index)>  func 
) const
inline

Perform a three dimensional parallel loop operation.

Parameters
[in]shapeThree dimensional shape.
[in]funcFunction that processes a loop.

◆ for_each() [5/6]

void parallel_driver::for_each ( size_t  size,
std::function< void(size_t n)>  func 
) const
inline

Perform a parallel loop operation.

Parameters
[in]sizeSize of the loop.
[in]funcFunction that processes a loop.

◆ for_each() [6/6]

void parallel_driver::for_each ( size_t  size,
std::function< void(size_t n, int thread_index)>  func 
) const
inline

Perform a parallel loop operation.

Parameters
[in]sizeSize of the loop.
[in]funcFunction that processes a loop.

◆ for_each_byte_safe()

void parallel_driver::for_each_byte_safe ( size_t  size,
std::function< void(size_t n, int thread_index)>  func 
) const
inline

Perform a parallel loop operation. Thread is guaranteed the same if (n mod 8) is the same.

Parameters
[in]sizeSize of the loop.
[in]funcFunction that processes a loop.

◆ get()

const parallel_core* parallel_driver::get ( ) const
inline

Get a pointer to the internal instance of parallel_core.

Returns
Pointer to the internal parallel_core instance.

◆ get_thread_num()

int parallel_driver::get_thread_num ( ) const
inline

Get the number of maximal threads set.

Returns
Number of threads set.

◆ run()

void parallel_driver::run ( const std::vector< std::function< void()> > &  functions)
inline

Run operations in parallel.

Parameters
[in]functionsList of operation functions that are ran in parallel.

◆ set_thread_num()

void parallel_driver::set_thread_num ( int  maximal_threads)
inline

Set the number of maximal threads set.

Parameters
maximal_threadsNumber of threads to set.

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