 |
Shiokaze Framework
A research-oriented fluid solver for computer graphics
|
|
Go to the documentation of this file.
25 #ifndef SHKZ_PARALLEL_CORE_H
26 #define SHKZ_PARALLEL_CORE_H
35 static bool *g_shkz_force_single_thread {
nullptr};
55 std::function<
void(
size_t n,
int thread_index)> func,
56 std::function<
size_t(
int thread_index)> iterator_start,
57 std::function<
bool(
size_t &n,
int thread_index)> iterator_advance,
58 int num_threads ) const = 0;
65 virtual
void run( const std::vector<std::function<
void()> > &functions ) const = 0;
73 if( ! g_shkz_force_single_thread ) {
74 g_shkz_force_single_thread =
static_cast<bool *
>(::dlsym(RTLD_DEFAULT,
"g_shkz_force_single_thread"));
75 assert(g_shkz_force_single_thread);
77 *g_shkz_force_single_thread = value;
82 using parallel_ptr = std::unique_ptr<parallel_core>;
virtual void for_each(std::function< void(size_t n, int thread_index)> func, std::function< size_t(int thread_index)> iterator_start, std::function< bool(size_t &n, int thread_index)> iterator_advance, int num_threads) const =0
Perform a parallel loop operation.
Abstract class that handles parallel operations. Used with loop_splitter. "stdthread" and "tbbthread"...
Definition: parallel_core.h:40
static void force_single_thread(bool value)
Set if force single thread.
Definition: parallel_core.h:72
#define DEFINE_MODULE(CLASS_T, LNG_NAME, ARG_NAME, DESCRIPTION)
Definition that simplifies the loading module.
Definition: recursive_configurable_module.h:39
#define SHKZ_BEGIN_NAMESPACE
Name space beggining definition for shiokaze.
Definition: common.h:39
virtual void run(const std::vector< std::function< void()> > &functions) const =0
Run operations in parallel.
#define SHKZ_END_NAMESPACE
Name space end definition for shiokaze.
Definition: common.h:44
recursive_configurable class that also inherits module.
Definition: recursive_configurable_module.h:49