TECA
The Toolkit for Extreme Climate Analysis
teca_cf_time_step_mapper Class Referenceabstract

Defines the interface for mapping time steps to files. More...

#include <teca_cf_time_step_mapper.h>

Inheritance diagram for teca_cf_time_step_mapper:
[legend]
Collaboration diagram for teca_cf_time_step_mapper:
[legend]

Public Member Functions

virtual bool initialized ()
 returns true if the mapper has been successfully initialized More...
 
virtual int finalize ()
 
virtual int get_upstream_requests (teca_metadata base_req, std::vector< teca_metadata > &up_reqs)
 construct requests for this rank More...
 
virtual p_teca_cf_layout_manager get_layout_manager (long time_step)
 given a time step returns the associated layout manager More...
 
virtual int get_layout_manager (const unsigned long temporal_extent[2], std::vector< p_teca_cf_layout_manager > &managers)
 
virtual int to_stream (std::ostream &os)=0
 print a summary to the stream More...
 
template<typename op_t >
int file_table_apply (const op_t &op)
 

Protected Types

using file_table_t = std::unordered_map< long, p_teca_cf_layout_manager >
 the file table maps from a time step to a specific layout manager More...
 

Protected Member Functions

 teca_cf_time_step_mapper (const teca_cf_time_step_mapper &)=delete
 
 teca_cf_time_step_mapper (const teca_cf_time_step_mapper &&)=delete
 
void operator= (const teca_cf_time_step_mapper &)=delete
 
void operator= (const teca_cf_time_step_mapper &&)=delete
 
int alloc_file_comms ()
 create/free the per-file communicators More...
 
int free_file_comms ()
 

Protected Attributes

MPI_Comm comm
 communicator to partition into per-file communicators More...
 
std::string index_initializer_key
 pipeline control key names More...
 
std::string index_request_key
 
long start_time_step
 user provided overrides More...
 
long end_time_step
 
long n_time_steps
 time_steps to request by rank More...
 
std::vector< long > block_size
 
std::vector< long > block_start
 
long n_files
 output files More...
 
std::vector< std::set< int > > file_ranks
 
std::vector< MPI_Comm > file_comms
 per file communicators More...
 
file_table_t file_table
 

Detailed Description

Defines the interface for mapping time steps to files.

Member Typedef Documentation

◆ file_table_t

using teca_cf_time_step_mapper::file_table_t = std::unordered_map<long, p_teca_cf_layout_manager>
protected

the file table maps from a time step to a specific layout manager

Member Function Documentation

◆ alloc_file_comms()

int teca_cf_time_step_mapper::alloc_file_comms ( )
protected

create/free the per-file communicators

◆ file_table_apply()

template<typename op_t >
int teca_cf_time_step_mapper::file_table_apply ( const op_t &  op)

call the passed in functor once per file table entry, safe for MPI collective operations. The required functor signature is: int f(long file_id, teca_cf_layout_manager &manager)

a return of non-zero from the functor will immediately stop the apply and the value will be returned, but no error will be reported.

◆ finalize()

virtual int teca_cf_time_step_mapper::finalize ( )
virtual

close all files, destroy file managers, and release communicators this should be done once all I/O is complete.

◆ get_layout_manager() [1/2]

virtual int teca_cf_time_step_mapper::get_layout_manager ( const unsigned long  temporal_extent[2],
std::vector< p_teca_cf_layout_manager > &  managers 
)
inlinevirtual

given an inclusive range of time steps, get the corresponding layout managers that can be used to create, define and write the data to disk. When more than one manager is returned, each should be passed the data, giving it a chance to write the subset it is responsible for to disk.

Parameters
[in]temporal_extentthe first and last step that will be written
[out]managera vector of teca_cf_layout_manager instances that need to be called to write the data.
Returns
zero if successful.

Reimplemented in teca_cf_spatial_time_step_mapper, and teca_cf_space_time_time_step_mapper.

◆ get_layout_manager() [2/2]

virtual p_teca_cf_layout_manager teca_cf_time_step_mapper::get_layout_manager ( long  time_step)
inlinevirtual

◆ get_upstream_requests()

virtual int teca_cf_time_step_mapper::get_upstream_requests ( teca_metadata  base_req,
std::vector< teca_metadata > &  up_reqs 
)
virtual

construct requests for this rank

Reimplemented in teca_cf_spatial_time_step_mapper, and teca_cf_space_time_time_step_mapper.

◆ initialized()

virtual bool teca_cf_time_step_mapper::initialized ( )
inlinevirtual

returns true if the mapper has been successfully initialized

◆ to_stream()

virtual int teca_cf_time_step_mapper::to_stream ( std::ostream &  os)
pure virtual

Member Data Documentation

◆ comm

MPI_Comm teca_cf_time_step_mapper::comm
protected

communicator to partition into per-file communicators

◆ file_comms

std::vector<MPI_Comm> teca_cf_time_step_mapper::file_comms
protected

per file communicators

◆ index_initializer_key

std::string teca_cf_time_step_mapper::index_initializer_key
protected

pipeline control key names

◆ n_files

long teca_cf_time_step_mapper::n_files
protected

output files

◆ n_time_steps

long teca_cf_time_step_mapper::n_time_steps
protected

time_steps to request by rank

◆ start_time_step

long teca_cf_time_step_mapper::start_time_step
protected

user provided overrides


The documentation for this class was generated from the following file: