1 #ifndef teca_programmable_reduce_h
2 #define teca_programmable_reduce_h
4 #include "teca_config.h"
5 #include "teca_dataset.h"
6 #include "teca_metadata.h"
8 #include "teca_programmable_algorithm.h"
9 #include "teca_index_reduce.h"
18 typedef void* reduce_callback_t;
19 typedef void* finalize_callback_t;
22 using reduce_callback_t = std::function<p_teca_dataset(
23 int,
const const_p_teca_dataset &,
const const_p_teca_dataset &)>;
26 using finalize_callback_t = std::function<p_teca_dataset(
27 int,
const const_p_teca_dataset &)>;
47 int set_name(
const std::string &name);
50 {
return this->class_name; }
60 TECA_ALGORITHM_CALLBACK_PROPERTY(report_callback_t, report_callback)
70 TECA_ALGORITHM_CALLBACK_PROPERTY(request_callback_t, request_callback)
80 TECA_ALGORITHM_CALLBACK_PROPERTY(reduce_callback_t, reduce_callback)
89 TECA_ALGORITHM_CALLBACK_PROPERTY(finalize_callback_t, finalize_callback)
95 p_teca_dataset reduce(
int device_id, const const_p_teca_dataset &
left,
96 const const_p_teca_dataset &right) override;
98 p_teca_dataset finalize(
int device_id,
99 const const_p_teca_dataset &input) override;
102 unsigned int port, const std::vector<
teca_metadata> &input_md,
109 reduce_callback_t reduce_callback;
110 finalize_callback_t finalize_callback;
111 request_callback_t request_callback;
112 report_callback_t report_callback;