1 #ifndef teca_index_reduce_h
2 #define teca_index_reduce_h
4 #include "teca_config.h"
5 #include "teca_dataset.h"
6 #include "teca_metadata.h"
8 #include "teca_threaded_algorithm.h"
53 using extent_type = std::vector<long>;
54 using bounds_type = std::vector<double>;
62 TECA_GET_ALGORITHM_PROPERTIES_DESCRIPTION()
63 TECA_SET_ALGORITHM_PROPERTIES()
72 TECA_ALGORITHM_PROPERTY(extent_type, extent)
82 TECA_ALGORITHM_PROPERTY(bounds_type, bounds)
90 TECA_ALGORITHM_VECTOR_PROPERTY(std::
string, array)
98 TECA_ALGORITHM_PROPERTY(
long, start_index)
107 TECA_ALGORITHM_PROPERTY(
long, end_index)
125 virtual p_teca_dataset reduce(
int device_id,
126 const const_p_teca_dataset &
left,
127 const const_p_teca_dataset &right) = 0;
141 virtual p_teca_dataset finalize(
int device_id,
142 const const_p_teca_dataset &ds)
145 return std::const_pointer_cast<teca_dataset>(ds);
156 unsigned int port,
const std::vector<teca_metadata> &input_md,
165 const std::vector<teca_metadata> &input_md);
172 using teca_threaded_algorithm::execute;
178 unsigned int port,
const std::vector<teca_metadata> &input_md,
186 const_p_teca_dataset
execute(
unsigned int port,
187 const std::vector<const_p_teca_dataset> &input_data,
192 const std::vector<teca_metadata> &input_md)
override;
198 const_p_teca_dataset reduce_local(
int device_id,
199 std::vector<const_p_teca_dataset> local_data);
204 const_p_teca_dataset reduce_remote(
int device_id,
205 const_p_teca_dataset local_data);
210 std::vector<std::string> arrays;
virtual teca_metadata get_output_metadata(unsigned int port, const std::vector< teca_metadata > &input_md)
Base class for MPI+threads+GPUs map reduce reduction over a set of indices.
Definition: teca_index_reduce.h:51
std::vector< teca_metadata > get_upstream_request(unsigned int port, const std::vector< teca_metadata > &input_md, const teca_metadata &request) override
const_p_teca_dataset execute(unsigned int port, const std::vector< const_p_teca_dataset > &input_data, const teca_metadata &request, int streaming) override
virtual teca_metadata initialize_output_metadata(unsigned int port, const std::vector< teca_metadata > &input_md)
teca_metadata get_output_metadata(unsigned int port, const std::vector< teca_metadata > &input_md) override
consumes index metadata, and partitions indices across MPI ranks.
virtual std::vector< teca_metadata > initialize_upstream_request(unsigned int port, const std::vector< teca_metadata > &input_md, const teca_metadata &request)
This is the base class defining a threaded algorithm.
Definition: teca_threaded_algorithm.h:71
p_teca_error_handler error_handler TECA_EXPORT
The global error handler instance.
TECA_EXPORT bool left(n_t e0x, n_t e0y, n_t e1x, n_t e1y, n_t px, n_t py)
tests if a point is Left|On|Right of an infinite line.
Definition: teca_geometry.h:29