14 #ifndef THRILL_API_GENERATE_HEADER 15 #define THRILL_API_GENERATE_HEADER 22 #include <type_traits> 36 template <
typename ValueType,
typename GenerateFunction>
48 GenerateFunction generate_function,
50 :
Super(ctx,
"Generate"),
58 for (
size_t i = local.
begin; i < local.
end; i++) {
86 template <
typename GenerateFunction>
88 const GenerateFunction& generate_function) {
90 using GenerateResult =
91 typename common::FunctionTraits<GenerateFunction>::result_type;
97 common::FunctionTraits<GenerateFunction>::arity == 1,
98 "GenerateFunction must take exactly one parameter");
103 typename common::FunctionTraits<GenerateFunction>::template arg<0>
105 "GenerateFunction needs a const unsigned long int& (aka. size_t) as input");
107 auto node = tlx::make_counting<GenerateNode>(
108 ctx, generate_function, size);
127 return Generate(ctx, size, [](
const size_t& index) {
return index; });
137 #endif // !THRILL_API_GENERATE_HEADER DIA is the interface between the user and the Thrill framework.
void PushItem(const ValueType &item) const
Method for derived classes to Push a single item to all children.
auto Generate(Context &ctx, size_t size, const GenerateFunction &generate_function)
Generate is a Source-DOp, which creates a DIA of given size using a generator function.
common::Range CalculateLocalRange(size_t global_size) const
GenerateFunction generate_function_
The generator function which is applied to every index.
GenerateNode(Context &ctx, GenerateFunction generate_function, size_t size)
Constructor for a GenerateNode.
represents a 1 dimensional range (interval) [begin,end)
The Context of a job is a unique instance per worker which holds references to all underlying parts o...
A DIANode which performs a Generate operation.
size_t size_
Size of the output DIA.
void PushData(bool) final
Virtual method for pushing data. Triggers actual pushing in sub-classes.
Context & context_
associated Context