TECA
The Toolkit for Extreme Climate Analysis
teca_coordinate_util.h File Reference
#include "teca_config.h"
#include "teca_cartesian_mesh.h"
#include "teca_variant_array.h"
#include "teca_variant_array_impl.h"
#include "teca_metadata.h"
#include "teca_array_attributes.h"
#include <vector>
#include <cmath>
#include <type_traits>
#include <typeinfo>
#include <iomanip>
Include dependency graph for teca_coordinate_util.h:

Go to the source code of this file.

Classes

struct  teca_coordinate_util::equal_tt< n_t >
 traits classes used to get default tolerances for comparing numbers of a given precision. More...
 
struct  teca_coordinate_util::equal_tt< float >
 
struct  teca_coordinate_util::equal_tt< double >
 
struct  teca_coordinate_util::equal_tt< long double >
 
struct  teca_coordinate_util::equal_error
 
struct  teca_coordinate_util::leq< data_t >
 Less than or equal to predicate. More...
 
struct  teca_coordinate_util::geq< data_t >
 Greater than or equal to predicate. More...
 
struct  teca_coordinate_util::lt< data_t >
 Less than predicate. More...
 
struct  teca_coordinate_util::gt< data_t >
 Greater than predicate. More...
 
struct  teca_coordinate_util::ascend_bracket< data_t >
 comparator implementing bracket for ascending input arrays More...
 
struct  teca_coordinate_util::descend_bracket< data_t >
 comparator implementing bracket for descending input arrays More...
 
struct  teca_coordinate_util::interpolate_t< 0 >
 Zero'th order interpolant specialization. More...
 
struct  teca_coordinate_util::interpolate_t< 1 >
 First order interpolant specialization. More...
 
class  teca_coordinate_util::teca_validate_arrays
 compares a set of arrays against a reference array More...
 
class  teca_coordinate_util::teca_coordinate_axis_validator
 Check that cooridnate arrays from different sources match a refrence array. More...
 

Namespaces

 teca_coordinate_util
 Codes dealing with operations on coordinate systems.
 

Macros

#define TECA_TARGET
 
#define max_prec(T)   std::setprecision(std::numeric_limits<T>::digits10 + 1)
 For printing data as ASCII with the maximum supported numerical precision. More...
 
#define declare_equal_tt(cpp_t, atol, rtol)
 

Functions

template<typename T >
bool teca_coordinate_util::equal (T a, T b, T relTol=equal_tt< T >::relTol(), T absTol=equal_tt< T >::absTol(), typename std::enable_if< std::is_floating_point< T >::value >::type *=0)
 
template<typename T >
bool teca_coordinate_util::equal (T a, T b, T relTol=0, T absTol=0, typename std::enable_if< std::is_integral< T >::value >::type *=0)
 Compare two integral numbers. More...
 
template<typename T >
bool teca_coordinate_util::equal (T a, T b, std::string &diagnostic, T relTol=equal_tt< T >::relTol(), T absTol=equal_tt< T >::absTol(), typename std::enable_if< std::is_floating_point< T >::value >::type *=0)
 
template<typename T >
bool teca_coordinate_util::equal (T a, T b, std::string &diagnostic, T relTol=0, T absTol=0, typename std::enable_if< std::is_integral< T >::value >::type *=0)
 
TECA_EXPORT bool teca_coordinate_util::equal (const const_p_teca_variant_array &array1, const const_p_teca_variant_array &array2, double absTol, double relTol, int &errorNo, std::string &errorStr)
 
template<typename data_t , typename bracket_t = ascend_bracket<data_t>>
TECA_EXPORT int teca_coordinate_util::index_of (const data_t *data, unsigned long l, unsigned long r, data_t val, bool lower, unsigned long &id)
 
template<typename T >
TECA_EXPORT int teca_coordinate_util::index_of (const T *data, size_t l, size_t r, T val, unsigned long &id)
 
TECA_EXPORT int teca_coordinate_util::bounds_to_extent (const double *bounds, const const_p_teca_variant_array &x, const const_p_teca_variant_array &y, const const_p_teca_variant_array &z, unsigned long *extent)
 
TECA_EXPORT int teca_coordinate_util::bounds_to_extent (const double *bounds, const const_p_teca_variant_array &x, unsigned long *extent)
 
TECA_EXPORT int teca_coordinate_util::bounds_to_extent (const double *bounds, const teca_metadata &md, unsigned long *extent)
 
template<typename T >
TECA_EXPORT int teca_coordinate_util::index_of (const const_p_teca_cartesian_mesh &mesh, T x, T y, T z, unsigned long &i, unsigned long &j, unsigned long &k)
 
TECA_EXPORT int teca_coordinate_util::time_step_of (const const_p_teca_variant_array &time, bool lower, bool clamp, const std::string &calendar, const std::string &units, const std::string &date, unsigned long &step)
 
TECA_EXPORT int teca_coordinate_util::time_to_string (double val, const std::string &calendar, const std::string &units, const std::string &format, std::string &date)
 
template<typename int_t >
TECA_EXPORT void teca_coordinate_util::get_table_offsets (const int_t *index, unsigned long n_rows, unsigned long &n_entities, std::vector< unsigned long > &counts, std::vector< unsigned long > &offsets, std::vector< unsigned long > &ids)
 
template<typename CT , typename DT >
TECA_EXPORT int teca_coordinate_util::interpolate_nearest (CT cx, CT cy, CT cz, const CT *p_x, const CT *p_y, const CT *p_z, const DT *p_data, unsigned long ihi, unsigned long jhi, unsigned long khi, unsigned long nx, unsigned long nxy, DT &val)
 
template<typename coord_t , typename data_t >
TECA_EXPORT int teca_coordinate_util::interpolate_nearest (coord_t cx, coord_t cy, const coord_t *p_x, const coord_t *p_y, const data_t *p_data, unsigned long ihi, unsigned long jhi, unsigned long nx, data_t &val)
 
template<typename CT , typename DT >
TECA_EXPORT int teca_coordinate_util::interpolate_linear (CT cx, CT cy, CT cz, const CT *p_x, const CT *p_y, const CT *p_z, const DT *p_data, unsigned long ihi, unsigned long jhi, unsigned long khi, unsigned long nx, unsigned long nxy, DT &val)
 
template<typename CT , typename DT >
TECA_EXPORT int teca_coordinate_util::interpolate_linear (CT cx, CT cy, const CT *p_x, const CT *p_y, const DT *p_data, unsigned long ihi, unsigned long jhi, unsigned long nx, DT &val)
 
TECA_EXPORT int teca_coordinate_util::validate_centering (int centering)
 return 0 if the centering is one of the values defined in teca_array_attributes More...
 
template<typename num_t >
TECA_EXPORT int teca_coordinate_util::convert_cell_extent (num_t *extent, int centering)
 convert from a cell extent to a face, edge or point centered extent More...
 
TECA_EXPORT int teca_coordinate_util::get_cartesian_mesh_extent (const teca_metadata &md, unsigned long *whole_extent, double *bounds)
 
TECA_EXPORT int teca_coordinate_util::get_cartesian_mesh_bounds (const const_p_teca_variant_array x, const const_p_teca_variant_array y, const const_p_teca_variant_array z, double *bounds)
 get the mesh's bounds from the coordinate axis arrays More...
 
template<typename num_t >
TECA_EXPORT int teca_coordinate_util::covers_ascending (const num_t *whole, const num_t *part)
 
template<typename num_t >
TECA_EXPORT int teca_coordinate_util::covers (const num_t *whole, const num_t *part)
 
template<typename num_t >
TECA_EXPORT int teca_coordinate_util::same_orientation (const num_t *whole, const num_t *part)
 
TECA_EXPORT int teca_coordinate_util::clamp_dimensions_of_one (unsigned long nx_max, unsigned long ny_max, unsigned long nz_max, unsigned long *extent, bool verbose)
 
TECA_EXPORT int teca_coordinate_util::validate_extent (unsigned long nx_max, unsigned long ny_max, unsigned long nz_max, unsigned long *extent, bool verbose)
 

Variables

template<int >
struct TECA_EXPORT teca_coordinate_util::interpolate_t
 A functor templated on order of accuracy for above Cartesian mesh interpolants. More...
 

Macro Definition Documentation

◆ declare_equal_tt

#define declare_equal_tt (   cpp_t,
  atol,
  rtol 
)
Value:
/** Specialization for cpp_t with default absTol and relTol */ \
template <> \
struct equal_tt<cpp_t> \
{ \
TECA_TARGET static cpp_t absTol() { return atol; } \
TECA_TARGET static cpp_t relTol() { return rtol; } \
};

◆ max_prec

#define max_prec (   T)    std::setprecision(std::numeric_limits<T>::digits10 + 1)

For printing data as ASCII with the maximum supported numerical precision.