1 #ifndef teca_cf_time_step_mapper_h
2 #define teca_cf_time_step_mapper_h
4 #include "teca_config.h"
5 #include "teca_metadata.h"
6 #include "teca_cf_layout_manager.h"
14 #include <unordered_map>
19 using p_teca_cf_time_step_mapper = std::shared_ptr<teca_cf_time_step_mapper>;
28 virtual bool initialized() {
return this->file_comms.size(); }
32 virtual int finalize();
36 std::vector<teca_metadata> &up_reqs);
40 virtual p_teca_cf_layout_manager get_layout_manager(
long time_step) = 0;
43 virtual int to_stream(std::ostream &os) = 0;
53 template<
typename op_t>
54 int file_table_apply(
const op_t &op);
58 index_request_key(
""), start_time_step(0), end_time_step(-1),
69 int alloc_file_comms();
70 int free_file_comms();
77 std::string index_initializer_key;
78 std::string index_request_key;
86 std::vector<long> block_size;
87 std::vector<long> block_start;
91 std::vector<std::set<int>> file_ranks;
94 std::vector<MPI_Comm> file_comms;
97 using file_table_t = std::unordered_map<long, p_teca_cf_layout_manager>;
98 file_table_t file_table;
103 template<
typename op_t>
104 int teca_cf_time_step_mapper::file_table_apply(
const op_t &op)
106 for (
long i = 0; i < this->n_files; ++i)
108 MPI_Comm comm_i = this->file_comms[i];
109 if (comm_i != MPI_COMM_NULL)
111 if (
int ierr = op(comm, i, this->file_table[i]))