TECA
The Toolkit for Extreme Climate Analysis
teca_cartesian_mesh_source Class Reference

An algorithm that generates a teca_cartesian_mesh of the requested spatial and temporal dimensions with optional user defined fields. More...

#include <teca_cartesian_mesh_source.h>

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

Public Member Functions

std::shared_ptr< teca_cartesian_mesh_sourceshared_from_this ()
 
std::shared_ptr< teca_cartesian_mesh_source const > shared_from_this () const
 
 teca_cartesian_mesh_source (const teca_cartesian_mesh_source &src)=delete
 
 teca_cartesian_mesh_source (teca_cartesian_mesh_source &&src)=delete
 
teca_cartesian_mesh_sourceoperator= (const teca_cartesian_mesh_source &src)=delete
 
teca_cartesian_mesh_sourceoperator= (teca_cartesian_mesh_source &&src)=delete
 
const char * get_class_name () const override
 
coordinate_type_code

set/get the type code for generated coordinates. The default is a 64 bit floating point type. Use teca_variant_array_code<NT>::get() to get specific type codes for C++ POD types NT.

void set_coordinate_type_code (const unsigned int &v)
 
const unsigned int & get_coordinate_type_code () const
 
field_type_code

set/get the type code for generated fields. The default is a 64 bit floating point type. Use teca_variant_array_code<NT>::get() to get specific type codes for C++ POD types NT.

void set_field_type_code (const unsigned int &v)
 
const unsigned int & get_field_type_code () const
 
whole_extent

set/get the global index space extent of the data. the extents are given by 8 values, 6 spatial plus 2 temporal, in the following order [i0 i1 j0 j1 k0 k1 q0 q1] This should be the same on all ranks

size_t get_number_of_whole_extents ()
 
void append_whole_extent (const unsigned long &v)
 
void set_whole_extent (const unsigned long &v)
 
void set_whole_extent (size_t i, const unsigned long &v)
 
void set_whole_extents (const std::vector< unsigned long > &v)
 
void set_whole_extents (const std::initializer_list< unsigned long > &&l)
 
const unsigned long & get_whole_extent (size_t i) const
 
const std::vector< unsigned long > & get_whole_extents () const
 
void clear_whole_extents ()
 
int set_spatial_extents (const teca_metadata &md, bool three_d=true)
 
bounds

set/get the global bounds of the data. the bounds are 8 values 6 spatial plus 2 temporal in the following order. [x0 x1 y0 y1 z0 z1 t0 t1] this should be the same on all ranks.

size_t get_number_of_bounds ()
 
void append_bound (const double &v)
 
void set_bound (const double &v)
 
void set_bound (size_t i, const double &v)
 
void set_bounds (const std::vector< double > &v)
 
void set_bounds (const std::initializer_list< double > &&l)
 
const double & get_bound (size_t i) const
 
const std::vector< double > & get_bounds () const
 
void clear_bounds ()
 
int set_spatial_bounds (const teca_metadata &md, bool three_d=true)
 
x_axis_variable

set the name of the variable to use for the coordinate axes and optionally associated attributes.

void set_x_axis_variable (const std::string &name)
 
void set_x_axis_variable (const std::string &name, const teca_metadata &atts)
 
int set_x_axis_variable (const teca_metadata &md)
 
y_axis_variable

set the name of the variable to use for the coordinate axes and optionally associated attributes.

void set_y_axis_variable (const std::string &name)
 
void set_y_axis_variable (const std::string &name, const teca_metadata &atts)
 
int set_y_axis_variable (const teca_metadata &md)
 
z_axis_variable

set the name of the variable to use for the coordinate axes and optionally associated attributes.

void set_z_axis_variable (const std::string &name)
 
void set_z_axis_variable (const std::string &name, const teca_metadata &atts)
 
int set_z_axis_variable (const teca_metadata &md)
 
t_axis_variable

set the name of the variable to use for the coordinate axes and optionally associated attributes.

void set_t_axis_variable (const std::string &name)
 
void set_calendar (const std::string &calendar, const std::string &units)
 
void set_t_axis_variable (const std::string &name, const teca_metadata &atts)
 
int set_t_axis_variable (const teca_metadata &md)
 
int set_t_axis (const teca_metadata &md)
 
void set_t_axis (const p_teca_variant_array &t)
 
output_metadata

Set the output metadata directly. The provided metadata must contain "coordinates" as defined by the teca_cf_reader because these are required for mesh generation. Pipeline execution control keys as defined by teca_index_executive are also required. Calendaring metadata is recommended. A copy of the passed object is made but "variables" are replaced with those generated by this class, if any. As a result be sure to specifiy field generators before calling this method. Returns 0 if successful, and non-zero if the supplied metadata doesn't contain the expected information. No error messages are sent to the terminal.

int set_output_metadata (const teca_metadata &md)
 
append_field_generator

set a callback function f(x,y,z,t) that generates a field named name x,y,z are coordinate axes in variant arrays, t is the double precision time value.

void append_field_generator (const std::string &name, const teca_metadata &atts, field_generator_callback &callback)
 
field_generator

Set/get the named callbacks that generate fields on the mesh. These should be packaged in the field_generator struct so that field name and attributes for I/O are provided together with the callback.

size_t get_number_of_field_generators ()
 
void append_field_generator (const field_generator_t &v)
 
void set_field_generator (const field_generator_t &v)
 
void set_field_generator (size_t i, const field_generator_t &v)
 
void set_field_generators (const std::vector< field_generator_t > &v)
 
void set_field_generators (const std::initializer_list< field_generator_t > &&l)
 
const field_generator_tget_field_generator (size_t i) const
 
const std::vector< field_generator_t > & get_field_generators () const
 
void clear_field_generators ()
 
- Public Member Functions inherited from teca_algorithm
 teca_algorithm (const teca_algorithm &src)=delete
 
 teca_algorithm (teca_algorithm &&src)=delete
 
teca_algorithmoperator= (const teca_algorithm &src)=delete
 
teca_algorithmoperator= (teca_algorithm &&src)=delete
 
void set_communicator (MPI_Comm comm)
 
MPI_Comm get_communicator ()
 get the active communicator More...
 
virtual teca_algorithm_output_port get_output_port (unsigned int port=0)
 
void set_input_connection (const teca_algorithm_output_port &port)
 set an input to this algorithm More...
 
virtual void set_input_connection (unsigned int id, const teca_algorithm_output_port &port)
 set an input to this algorithm More...
 
virtual void remove_input_connection (unsigned int id)
 remove input connections More...
 
void clear_input_connections ()
 remove all input connections More...
 
const_p_teca_dataset get_output_data (unsigned int port=0)
 
void pop_cache (unsigned int port=0, int top=0)
 
void set_cache_size (unsigned int n)
 set the cache size. the default is 1. (threadsafe) More...
 
virtual int update ()
 execute the pipeline from this instance up. More...
 
virtual int update (unsigned int port)
 execute the pipeline from this instance up. More...
 
virtual teca_metadata update_metadata (unsigned int port=0)
 get meta data considering this instance up. More...
 
void set_executive (p_teca_algorithm_executive exe)
 set the executive More...
 
p_teca_algorithm_executive get_executive ()
 get the executive More...
 
virtual void to_stream (std::ostream &s) const
 
virtual void from_stream (std::istream &s)
 deserialize from the stream. More...
 
void set_verbose (const int &v)
 
const int & get_verbose () const
 

Static Public Member Functions

static p_teca_cartesian_mesh_source New ()
 

Additional Inherited Members

- Protected Member Functions inherited from teca_algorithm
void set_number_of_input_connections (unsigned int n)
 
void set_number_of_output_ports (unsigned int n)
 
void set_modified (unsigned int port)
 an overload to set_modified by port More...
 
virtual std::vector< teca_metadataget_upstream_request (unsigned int port, const std::vector< teca_metadata > &input_md, const teca_metadata &request)
 
virtual teca_metadata get_cache_key (unsigned int port, const teca_metadata &request) const
 
virtual teca_metadata get_output_metadata (teca_algorithm_output_port &current)
 
virtual const_p_teca_dataset request_data (teca_algorithm_output_port &port, const teca_metadata &request)
 
virtual int validate_cache (teca_algorithm_output_port &current)
 
virtual void clear_modified (teca_algorithm_output_port current)
 
const_p_teca_dataset get_output_data (unsigned int port, const teca_metadata &request)
 
int cache_output_data (unsigned int port, const teca_metadata &request, const_p_teca_dataset &data)
 
void clear_cache (unsigned int port)
 clear the cache on the given output port More...
 
unsigned int get_number_of_input_connections ()
 get the number of input connections More...
 
teca_algorithm_output_portget_input_connection (unsigned int i)
 
void clear_modified (unsigned int port)
 clear the modified flag on the i'th output More...
 
int get_modified (unsigned int port) const
 return the output port's modified flag value More...
 
- Protected Attributes inherited from teca_algorithm
int verbose
 

Detailed Description

An algorithm that generates a teca_cartesian_mesh of the requested spatial and temporal dimensions with optional user defined fields.

User defined fields are specified by passing callbacks and metadata via field_generator and append_field_generator

The spatial and temporal dimensions are set by the combination of whole_extent and bounds.

The names of coordinate axes are set by the combination of x_axis_variable, y_axis_variable, z_axis_variable, and t_axis_variable

The units of the coordinate axes are set by the combination of x_axis_units, y_axis_units, z_axis_units, calendar, and time_units.

Member Function Documentation

◆ append_bound()

void teca_cartesian_mesh_source::append_bound ( const double &  v)
inline

append to the bound algorithm vector property

◆ append_field_generator()

void teca_cartesian_mesh_source::append_field_generator ( const field_generator_t v)
inline

append to the field_generator algorithm vector property

◆ append_whole_extent()

void teca_cartesian_mesh_source::append_whole_extent ( const unsigned long &  v)
inline

append to the whole_extent algorithm vector property

◆ clear_bounds()

void teca_cartesian_mesh_source::clear_bounds ( )
inline

clear the bound algorithm vector property

◆ clear_field_generators()

void teca_cartesian_mesh_source::clear_field_generators ( )
inline

clear the field_generator algorithm vector property

◆ clear_whole_extents()

void teca_cartesian_mesh_source::clear_whole_extents ( )
inline

clear the whole_extent algorithm vector property

◆ get_bound()

const double& teca_cartesian_mesh_source::get_bound ( size_t  i) const
inline

get the i-th element of the bound algorithm vector property

◆ get_bounds()

const std::vector< double >& teca_cartesian_mesh_source::get_bounds ( ) const
inline

get the bound algorithm vector property

◆ get_class_name()

const char* teca_cartesian_mesh_source::get_class_name ( ) const
inlineoverridevirtual

returns the name of the class

Implements teca_algorithm.

◆ get_coordinate_type_code()

const unsigned int& teca_cartesian_mesh_source::get_coordinate_type_code ( ) const
inline

Get the value of the coordinate_type_code algorithm property

◆ get_field_generator()

const field_generator_t& teca_cartesian_mesh_source::get_field_generator ( size_t  i) const
inline

get the i-th element of the field_generator algorithm vector property

◆ get_field_generators()

const std::vector< field_generator_t >& teca_cartesian_mesh_source::get_field_generators ( ) const
inline

get the field_generator algorithm vector property

◆ get_field_type_code()

const unsigned int& teca_cartesian_mesh_source::get_field_type_code ( ) const
inline

Get the value of the field_type_code algorithm property

◆ get_number_of_bounds()

size_t teca_cartesian_mesh_source::get_number_of_bounds ( )
inline

get the size of the bound algorithm vector property

◆ get_number_of_field_generators()

size_t teca_cartesian_mesh_source::get_number_of_field_generators ( )
inline

get the size of the field_generator algorithm vector property

◆ get_number_of_whole_extents()

size_t teca_cartesian_mesh_source::get_number_of_whole_extents ( )
inline

get the size of the whole_extent algorithm vector property

◆ get_whole_extent()

const unsigned long& teca_cartesian_mesh_source::get_whole_extent ( size_t  i) const
inline

get the i-th element of the whole_extent algorithm vector property

◆ get_whole_extents()

const std::vector< unsigned long >& teca_cartesian_mesh_source::get_whole_extents ( ) const
inline

get the whole_extent algorithm vector property

◆ New()

static p_teca_cartesian_mesh_source teca_cartesian_mesh_source::New ( )
inlinestatic

Returns an instance of teca_cartesian_mesh_source

◆ set_bound() [1/2]

void teca_cartesian_mesh_source::set_bound ( const double &  v)
inline

set the bound algorithm vector property to a single value

◆ set_bound() [2/2]

void teca_cartesian_mesh_source::set_bound ( size_t  i,
const double &  v 
)
inline

set the i-th element of the bound algorithm vector property

◆ set_bounds() [1/2]

void teca_cartesian_mesh_source::set_bounds ( const std::initializer_list< double > &&  l)
inline

set the bound algorithm vector property

◆ set_bounds() [2/2]

void teca_cartesian_mesh_source::set_bounds ( const std::vector< double > &  v)
inline

set the bound algorithm vector property

◆ set_calendar()

void teca_cartesian_mesh_source::set_calendar ( const std::string &  calendar,
const std::string &  units 
)

Set the calendar, and time units of the t_axis_variable

◆ set_coordinate_type_code()

void teca_cartesian_mesh_source::set_coordinate_type_code ( const unsigned int &  v)
inline

Set the value of the coordinate_type_code algorithm property

◆ set_field_generator() [1/2]

void teca_cartesian_mesh_source::set_field_generator ( const field_generator_t v)
inline

set the field_generator algorithm vector property to a single value

◆ set_field_generator() [2/2]

void teca_cartesian_mesh_source::set_field_generator ( size_t  i,
const field_generator_t v 
)
inline

set the i-th element of the field_generator algorithm vector property

◆ set_field_generators() [1/2]

void teca_cartesian_mesh_source::set_field_generators ( const std::initializer_list< field_generator_t > &&  l)
inline

set the field_generator algorithm vector property

◆ set_field_generators() [2/2]

void teca_cartesian_mesh_source::set_field_generators ( const std::vector< field_generator_t > &  v)
inline

set the field_generator algorithm vector property

◆ set_field_type_code()

void teca_cartesian_mesh_source::set_field_type_code ( const unsigned int &  v)
inline

Set the value of the field_type_code algorithm property

◆ set_spatial_bounds()

int teca_cartesian_mesh_source::set_spatial_bounds ( const teca_metadata md,
bool  three_d = true 
)

Set the spatial bounds from a metadata object following the conventions defined by the teca_cf_reader. Returns zero if successful and non-zero if the supplied metadata is missing any of the requisite information.

◆ set_spatial_extents()

int teca_cartesian_mesh_source::set_spatial_extents ( const teca_metadata md,
bool  three_d = true 
)

Set the spatial extents from a metadata object following the conventions defined by the teca_cf_reader. If three_d is true the extents in the z-direction are copied, otherwise they are set to 0. Returns zero if successful and non-zero if the supplied metadata is missing any of the requisite information.

◆ set_t_axis() [1/2]

void teca_cartesian_mesh_source::set_t_axis ( const p_teca_variant_array t)

Set the time axis directly. When a time axis is provided values are served up from the array rather than being generated. Execution control keys are also made use of if present.

◆ set_t_axis() [2/2]

int teca_cartesian_mesh_source::set_t_axis ( const teca_metadata md)

Set the time axis using coordinate conventions defined by the teca_cf_reader. When a time axis is provided values are served up from the array rather than being generated. Execution control keys are also made use of if present. Returns zero if successful and non-zero if the supplied metadata is missing any of the requisite information.

◆ set_t_axis_variable() [1/3]

void teca_cartesian_mesh_source::set_t_axis_variable ( const std::string &  name)

set the name of the t_axis_variable

◆ set_t_axis_variable() [2/3]

void teca_cartesian_mesh_source::set_t_axis_variable ( const std::string &  name,
const teca_metadata atts 
)

Set the name of the variable and its attributes. See teca_array_attributes for more information.

◆ set_t_axis_variable() [3/3]

int teca_cartesian_mesh_source::set_t_axis_variable ( const teca_metadata md)

Set the name of the variable and its attributes using conventions defined by the teca_cf_reader. Returns zero if successful and non-zero if the supplied metadata is missing any of the requisite information.

◆ set_whole_extent() [1/2]

void teca_cartesian_mesh_source::set_whole_extent ( const unsigned long &  v)
inline

set the whole_extent algorithm vector property to a single value

◆ set_whole_extent() [2/2]

void teca_cartesian_mesh_source::set_whole_extent ( size_t  i,
const unsigned long &  v 
)
inline

set the i-th element of the whole_extent algorithm vector property

◆ set_whole_extents() [1/2]

void teca_cartesian_mesh_source::set_whole_extents ( const std::initializer_list< unsigned long > &&  l)
inline

set the whole_extent algorithm vector property

◆ set_whole_extents() [2/2]

void teca_cartesian_mesh_source::set_whole_extents ( const std::vector< unsigned long > &  v)
inline

set the whole_extent algorithm vector property

◆ set_x_axis_variable() [1/3]

void teca_cartesian_mesh_source::set_x_axis_variable ( const std::string &  name)

set the name of the t_axis_variable

◆ set_x_axis_variable() [2/3]

void teca_cartesian_mesh_source::set_x_axis_variable ( const std::string &  name,
const teca_metadata atts 
)

Set the name of the variable and its attributes. See teca_array_attributes for more information.

◆ set_x_axis_variable() [3/3]

int teca_cartesian_mesh_source::set_x_axis_variable ( const teca_metadata md)

Set the name of the variable and its attributes using conventions defined by the teca_cf_reader. Returns zero if successful and non-zero if the supplied metadata is missing any of the requisite information.

◆ set_y_axis_variable() [1/3]

void teca_cartesian_mesh_source::set_y_axis_variable ( const std::string &  name)

set the name of the y_axis_variable

◆ set_y_axis_variable() [2/3]

void teca_cartesian_mesh_source::set_y_axis_variable ( const std::string &  name,
const teca_metadata atts 
)

Set the name of the variable and its attributes. See teca_array_attributes for more information.

◆ set_y_axis_variable() [3/3]

int teca_cartesian_mesh_source::set_y_axis_variable ( const teca_metadata md)

Set the name of the variable and its attributes using conventions defined by the teca_cf_reader. Returns zero if successful and non-zero if the supplied metadata is missing any of the requisite information.

◆ set_z_axis_variable() [1/3]

void teca_cartesian_mesh_source::set_z_axis_variable ( const std::string &  name)

set the name of the z_axis_variable

◆ set_z_axis_variable() [2/3]

void teca_cartesian_mesh_source::set_z_axis_variable ( const std::string &  name,
const teca_metadata atts 
)

Set the name of the variable and its attributes. See teca_array_attributes for more information.

◆ set_z_axis_variable() [3/3]

int teca_cartesian_mesh_source::set_z_axis_variable ( const teca_metadata md)

Set the name of the variable and its attributes using conventions defined by the teca_cf_reader. Returns zero if successful and non-zero if the supplied metadata is missing any of the requisite information.

◆ shared_from_this() [1/2]

std::shared_ptr< teca_cartesian_mesh_source > teca_cartesian_mesh_source::shared_from_this ( )
inline

Enables the static constructor

◆ shared_from_this() [2/2]

std::shared_ptr< teca_cartesian_mesh_source const> teca_cartesian_mesh_source::shared_from_this ( ) const
inline

Enables the static constructor


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