1 #ifndef teca_cf_time_step_mapper_h
2 #define teca_cf_time_step_mapper_h
4 #include "teca_metadata.h"
5 #include "teca_cf_layout_manager.h"
13 #include <unordered_map>
18 using p_teca_cf_time_step_mapper = std::shared_ptr<teca_cf_time_step_mapper>;
27 virtual bool initialized() {
return this->file_comms.size(); }
31 virtual int finalize();
35 std::vector<teca_metadata> &up_reqs);
39 virtual p_teca_cf_layout_manager get_layout_manager(
long time_step) = 0;
42 virtual int to_stream(std::ostream &os) = 0;
52 template<
typename op_t>
53 int file_table_apply(
const op_t &op);
57 index_request_key(
""), start_time_step(0), end_time_step(-1),
68 int alloc_file_comms();
69 int free_file_comms();
76 std::string index_initializer_key;
77 std::string index_request_key;
85 std::vector<long> block_size;
86 std::vector<long> block_start;
90 std::vector<std::set<int>> file_ranks;
93 std::vector<MPI_Comm> file_comms;
96 using file_table_t = std::unordered_map<long, p_teca_cf_layout_manager>;
97 file_table_t file_table;
102 template<
typename op_t>
103 int teca_cf_time_step_mapper::file_table_apply(
const op_t &op)
105 for (
long i = 0; i < this->n_files; ++i)
107 MPI_Comm comm_i = this->file_comms[i];
108 if (comm_i != MPI_COMM_NULL)
110 if (
int ierr = op(comm, i, this->file_table[i]))