TECA
The Toolkit for Extreme Climate Analysis
teca_cf_space_time_time_step_mapper Class Reference

NetCDF CF2 files time step mapper. More...

#include <teca_cf_space_time_time_step_mapper.h>

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

Public Member Functions

int initialize (MPI_Comm comm, unsigned long first_step, unsigned long last_step, unsigned long number_of_temporal_partitions, unsigned long temporal_partition_size, unsigned long *extent, unsigned long number_of_spatial_partitions, int partition_x, int partition_y, int partition_z, unsigned long min_block_size_x, unsigned long min_block_size_y, unsigned long min_block_size_z, const teca_calendar_util::p_interval_iterator &it, int index_executive_compatability, const std::string &index_request_key)
 
int get_upstream_requests (teca_metadata base_req, std::vector< teca_metadata > &up_reqs) override
 construct requests for this rank More...
 
p_teca_cf_layout_manager get_layout_manager (long time_step) override
 given a time step returns the associated layout manager More...
 
int get_layout_manager (const unsigned long temporal_extent[2], std::vector< p_teca_cf_layout_manager > &managers) override
 
int to_stream (std::ostream &os) override
 print a summary to the stream More...
 
void write_partitions ()
 
- Public Member Functions inherited from teca_cf_time_step_mapper
virtual bool initialized ()
 returns true if the mapper has been successfully initialized More...
 
virtual int finalize ()
 
template<typename op_t >
int file_table_apply (const op_t &op)
 

Static Public Member Functions

static p_teca_cf_space_time_time_step_mapper New ()
 allocate and return a new object More...
 

Protected Types

using step_bracket_t = std::pair< long, long >
 
using temporal_extent_t = teca_coordinate_util::temporal_extent_t
 
using spatial_extent_t = teca_coordinate_util::spatial_extent_t
 
- Protected Types inherited from teca_cf_time_step_mapper
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_space_time_time_step_mapper (const teca_cf_space_time_time_step_mapper &)=delete
 
 teca_cf_space_time_time_step_mapper (const teca_cf_space_time_time_step_mapper &&)=delete
 
void operator= (const teca_cf_space_time_time_step_mapper &)=delete
 
void operator= (const teca_cf_space_time_time_step_mapper &&)=delete
 
int get_file_id (long time_step, long &file_id)
 given a time step, get the corresponding file id More...
 
- Protected Member Functions inherited from teca_cf_time_step_mapper
 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

int index_executive_compatability
 
std::string index_request_key
 
std::vector< step_bracket_t > file_steps
 
spatial_extent_t whole_extent
 
std::vector< temporal_extent_t > temporal_partitions
 
std::deque< spatial_extent_t > spatial_partitions
 
- Protected Attributes inherited from teca_cf_time_step_mapper
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

NetCDF CF2 files time step mapper.

Member Function Documentation

◆ get_file_id()

int teca_cf_space_time_time_step_mapper::get_file_id ( long  time_step,
long &  file_id 
)
protected

given a time step, get the corresponding file id

◆ get_layout_manager() [1/2]

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

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 from teca_cf_time_step_mapper.

◆ get_layout_manager() [2/2]

p_teca_cf_layout_manager teca_cf_space_time_time_step_mapper::get_layout_manager ( long  time_step)
overridevirtual

given a time step returns the associated layout manager

Reimplemented from teca_cf_time_step_mapper.

◆ get_upstream_requests()

int teca_cf_space_time_time_step_mapper::get_upstream_requests ( teca_metadata  base_req,
std::vector< teca_metadata > &  up_reqs 
)
overridevirtual

construct requests for this rank

Reimplemented from teca_cf_time_step_mapper.

◆ initialize()

int teca_cf_space_time_time_step_mapper::initialize ( MPI_Comm  comm,
unsigned long  first_step,
unsigned long  last_step,
unsigned long  number_of_temporal_partitions,
unsigned long  temporal_partition_size,
unsigned long *  extent,
unsigned long  number_of_spatial_partitions,
int  partition_x,
int  partition_y,
int  partition_z,
unsigned long  min_block_size_x,
unsigned long  min_block_size_y,
unsigned long  min_block_size_z,
const teca_calendar_util::p_interval_iterator &  it,
int  index_executive_compatability,
const std::string &  index_request_key 
)

initialize based on input metadata. this is a collective call creates communicator groups for each file and creates the file layout managers for the local rank. After this call one can access file managers to create, define and write local datasets to the NetCDF files in cf format.

Parameters
[in]commthe MPI communicator to parallelize execution across
[in]first_stepthe first step to process
[in]last_stepthe last step to process
[in]number_of_temporal_partitonsthe number of temporal partitions or zero to use the temporal_partiton_size parameter
[in]temporal_partition_sizenumber of time steps per partition or zero to use the number_of_temporal partitons parameter.
[in]extentthe spatial extent to partition [i0, i1, j0, j1, k0, k1]
[in]number_of_spatial_partitonsthe number of spatial partitons
[in]partition_xif zero skip splitting in the x-direction
[in]partition_yif zero skip splitting in the y-direction
[in]partition_zif zero skip splitting in the z-direction
[in]min_block_size_xsets the minimum block size in the x-direction
[in]min_block_size_ysets the minimum block size in the y-direction
[in]min_block_size_zsets the minimum block size in the z-direction
[in]ita teca_interval_iterator used to define the temporal layout of the files
[in]index_executive_compatabilityforces temporal_partion_size to 1
[in]index_request_keythe name of the key to use when making requests
Returns
zero if successful

◆ New()

static p_teca_cf_space_time_time_step_mapper teca_cf_space_time_time_step_mapper::New ( )
inlinestatic

allocate and return a new object

◆ to_stream()

int teca_cf_space_time_time_step_mapper::to_stream ( std::ostream &  os)
overridevirtual

print a summary to the stream

Implements teca_cf_time_step_mapper.


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