#include #include #include #include "monoid.hpp" typedef unsigned long int results_type[MAX_GENUS]; void walk_children_stack(monoid m, results_type res,results_type resq); void walk_children_stack(monoid m, ind_t bound, results_type res,results_type resq); struct Results { results_type values; inline Results() {reset();}; inline void reset() {for(int i=0; i { inline static void reduce (Results *left, Results *right){ for(auto i=0; ivalues[i] += right->values[i]; } }; private: cilk::reducer imp_; public: ResultsReducer() : imp_() {}; inline unsigned long int & operator[](ind_t i) { return imp_.view().values[i]; }; inline results_type &get_array() {return imp_.view().values;} inline void reset() {imp_.view().reset();} }; extern ResultsReducer cilk_results; extern ResultsReducer cilk_results_quotient; #ifdef TBB #include extern cilk::reducer_list_append> cilk_list_results; #else extern cilk::reducer_list_append cilk_list_results; #endif void walk_children(const monoid m); void walk_children(const monoid &m, ind_t bound); void list_children(const monoid &m, ind_t bound); void treat(const monoid &m,results_type res,results_type res_quotient); void treat(const monoid &m,ResultsReducer& res,ResultsReducer& res_quotient);