TECA
The Toolkit for Extreme Climate Analysis
teca_array_collection Class Reference

A collection of named arrays. More...

#include <teca_array_collection.h>

Inheritance diagram for teca_array_collection:
Collaboration diagram for teca_array_collection:

Public Member Functions

std::shared_ptr< teca_array_collectionshared_from_this ()
 
std::shared_ptr< teca_array_collection const > shared_from_this () const
 
virtual p_teca_dataset new_instance () const override
 
virtual p_teca_dataset new_copy () const override
 
virtual p_teca_dataset new_shallow_copy () override
 
void set_time (const std::vector< double > &vals)
 
int get_time (std::vector< double > &vals) const
 
void set_time (const p_teca_variant_array &vals)
 
int get_time (p_teca_variant_array vals) const
 
void set_time (const std::initializer_list< double > &l)
 
void set_time (const double *vals)
 
int get_time (double *vals) const
 
void set_time (const double &val_1)
 
int get_time (double &val_1) const
 
void set_calendar (const std::vector< std::string > &vals)
 
int get_calendar (std::vector< std::string > &vals) const
 
void set_calendar (const p_teca_variant_array &vals)
 
int get_calendar (p_teca_variant_array vals) const
 
void set_calendar (const std::initializer_list< std::string > &l)
 
void set_calendar (const std::string *vals)
 
int get_calendar (std::string *vals) const
 
void set_calendar (const std::string &val_1)
 
int get_calendar (std::string &val_1) const
 
void set_time_units (const std::vector< std::string > &vals)
 
int get_time_units (std::vector< std::string > &vals) const
 
void set_time_units (const p_teca_variant_array &vals)
 
int get_time_units (p_teca_variant_array vals) const
 
void set_time_units (const std::initializer_list< std::string > &l)
 
void set_time_units (const std::string *vals)
 
int get_time_units (std::string *vals) const
 
void set_time_units (const std::string &val_1)
 
int get_time_units (std::string &val_1) const
 
void set_time_step (const std::vector< unsigned long > &vals)
 
int get_time_step (std::vector< unsigned long > &vals) const
 
void set_time_step (const p_teca_variant_array &vals)
 
int get_time_step (p_teca_variant_array vals) const
 
void set_time_step (const std::initializer_list< unsigned long > &l)
 
void set_time_step (const unsigned long *vals)
 
int get_time_step (unsigned long *vals) const
 
void set_time_step (const unsigned long &val_1)
 
int get_time_step (unsigned long &val_1) const
 
void set_attributes (const std::vector< teca_metadata > &vals)
 
int get_attributes (std::vector< teca_metadata > &vals) const
 
void set_attributes (const p_teca_variant_array &vals)
 
int get_attributes (p_teca_variant_array vals) const
 
void set_attributes (const std::initializer_list< teca_metadata > &l)
 
void set_attributes (const teca_metadata *vals)
 
int get_attributes (teca_metadata *vals) const
 
void set_attributes (const teca_metadata &val_1)
 
int get_attributes (teca_metadata &val_1) const
 
void clear ()
 reset to empty state More...
 
template<typename nT , typename aT , typename... oT>
void declare_set (nT &&a_name, aT a_type, oT &&...args)
 
template<typename nT , typename aT >
void declare (nT &&a_name, aT a_type)
 declare a single array More...
 
int append (p_teca_variant_array array)
 
int append (const std::string &name, p_teca_variant_array array)
 
int set (unsigned int i, p_teca_variant_array array)
 
int set (const std::string &name, p_teca_variant_array array)
 add or replace the named array, returns 0 on success. More...
 
int remove (unsigned int i)
 remove the ith array More...
 
int remove (const std::string &name)
 remove the named array More...
 
unsigned int size () const noexcept
 Return the number of arrays. More...
 
p_teca_variant_array get (unsigned int i)
 access an array by its by id More...
 
const_p_teca_variant_array get (unsigned int i) const
 access an array by its by id More...
 
bool has (const std::string &name) const
 test for array More...
 
p_teca_variant_array get (const std::string &name)
 access an array by name More...
 
const_p_teca_variant_array get (const std::string &name) const
 access an array by name More...
 
p_teca_variant_array operator[] (const std::string &name)
 access an array by name More...
 
const_p_teca_variant_array operator[] (const std::string &name) const
 access an array by name More...
 
std::string & get_name (unsigned int i)
 
const std::string & get_name (unsigned int i) const
 
std::vector< std::string > & get_names ()
 
const std::vector< std::string > & get_names () const
 
std::string get_class_name () const override
 Return the name of the class. More...
 
int get_type_code () const override
 return an integer identifier uniquely naming the dataset type More...
 
void copy (const const_p_teca_dataset &other) override
 copy More...
 
void shallow_copy (const p_teca_dataset &other) override
 shallow copy More...
 
int append (const const_p_teca_array_collection &other)
 append More...
 
int shallow_append (const p_teca_array_collection &other)
 shallow append More...
 
void swap (const p_teca_dataset &other) override
 swap More...
 
int to_stream (teca_binary_stream &s) const override
 serialize the data to the given stream for I/O or communication More...
 
int from_stream (teca_binary_stream &s) override
 serialize the data from the given stream for I/O or communication More...
 
int to_stream (std::ostream &) const override
 stream to a human readable representation More...
 
- Public Member Functions inherited from teca_dataset
void set_index_request_key (const std::vector< std::string > &vals)
 
int get_index_request_key (std::vector< std::string > &vals) const
 
void set_index_request_key (const p_teca_variant_array &vals)
 
int get_index_request_key (p_teca_variant_array vals) const
 
void set_index_request_key (const std::initializer_list< std::string > &l)
 
void set_index_request_key (const std::string *vals)
 
int get_index_request_key (std::string *vals) const
 
void set_index_request_key (const std::string &val_1)
 
int get_index_request_key (std::string &val_1) const
 
virtual int get_request_index (long &val) const
 
virtual int set_request_index (const std::string &key, long val)
 
virtual int set_request_index (long val)
 
 operator bool () const noexcept
 
virtual bool empty () const noexcept
 
virtual void copy_metadata (const const_p_teca_dataset &other)
 
virtual teca_metadataget_metadata () noexcept
 
virtual const teca_metadataget_metadata () const noexcept
 
virtual void set_metadata (const teca_metadata &md)
 
virtual int from_stream (std::istream &)
 

Static Public Member Functions

static p_teca_array_collection New ()
 

Protected Member Functions

 teca_array_collection (const teca_array_collection &)=delete
 
 teca_array_collection (const teca_array_collection &&)=delete
 
void operator= (const teca_array_collection &)=delete
 
void operator= (const teca_array_collection &&)=delete
 
void declare_set ()
 
- Protected Member Functions inherited from teca_dataset
 teca_dataset (const teca_dataset &)=delete
 
 teca_dataset (const teca_dataset &&)=delete
 
void operator= (const p_teca_dataset &other)=delete
 
void operator= (p_teca_dataset &&other)=delete
 

Additional Inherited Members

- Protected Attributes inherited from teca_dataset
teca_metadatametadata
 

Detailed Description

A collection of named arrays.

The array collection is used internally in other mesh based datasets. It can also be used to process more general data where the arrays have differing lengths or a non-geometric association.

Member Function Documentation

◆ append() [1/3]

int teca_array_collection::append ( const const_p_teca_array_collection &  other)

append

◆ append() [2/3]

int teca_array_collection::append ( const std::string &  name,
p_teca_variant_array  array 
)

add, return the index of the new entry, or -1 if the array name already exists.

◆ append() [3/3]

int teca_array_collection::append ( p_teca_variant_array  array)

add, return the index of the new entry, or -1 if the array name already exists.

◆ clear()

void teca_array_collection::clear ( )

reset to empty state

◆ copy()

void teca_array_collection::copy ( const const_p_teca_dataset &  other)
overridevirtual

copy

Reimplemented from teca_dataset.

◆ declare()

template<typename nT , typename aT >
void teca_array_collection::declare ( nT &&  a_name,
aT  a_type 
)

declare a single array

◆ declare_set()

template<typename nT , typename aT , typename... oT>
void teca_array_collection::declare_set ( nT &&  a_name,
aT  a_type,
oT &&...  args 
)

declare a set of arrays. requires name,type pairs for ex. define("c1",int(),"c2",float()) creates 2 arrays in the collection the first storing int the second storing float.

◆ from_stream()

int teca_array_collection::from_stream ( teca_binary_stream s)
overridevirtual

serialize the data from the given stream for I/O or communication

Reimplemented from teca_dataset.

◆ get() [1/4]

p_teca_variant_array teca_array_collection::get ( const std::string &  name)

access an array by name

◆ get() [2/4]

const_p_teca_variant_array teca_array_collection::get ( const std::string &  name) const

access an array by name

◆ get() [3/4]

p_teca_variant_array teca_array_collection::get ( unsigned int  i)
inline

access an array by its by id

◆ get() [4/4]

const_p_teca_variant_array teca_array_collection::get ( unsigned int  i) const
inline

access an array by its by id

◆ get_class_name()

std::string teca_array_collection::get_class_name ( ) const
inlineoverridevirtual

Return the name of the class.

Implements teca_dataset.

◆ get_type_code()

int teca_array_collection::get_type_code ( ) const
overridevirtual

return an integer identifier uniquely naming the dataset type

Implements teca_dataset.

◆ has()

bool teca_array_collection::has ( const std::string &  name) const

test for array

◆ operator[]() [1/2]

p_teca_variant_array teca_array_collection::operator[] ( const std::string &  name)
inline

access an array by name

◆ operator[]() [2/2]

const_p_teca_variant_array teca_array_collection::operator[] ( const std::string &  name) const
inline

access an array by name

◆ remove() [1/2]

int teca_array_collection::remove ( const std::string &  name)

remove the named array

◆ remove() [2/2]

int teca_array_collection::remove ( unsigned int  i)

remove the ith array

◆ set() [1/2]

int teca_array_collection::set ( const std::string &  name,
p_teca_variant_array  array 
)

add or replace the named array, returns 0 on success.

◆ set() [2/2]

int teca_array_collection::set ( unsigned int  i,
p_teca_variant_array  array 
)

replace the ith array, return 0 on success. the name of the array is not changed.

◆ shallow_append()

int teca_array_collection::shallow_append ( const p_teca_array_collection &  other)

shallow append

◆ shallow_copy()

void teca_array_collection::shallow_copy ( const p_teca_dataset &  other)
overridevirtual

shallow copy

Reimplemented from teca_dataset.

◆ size()

unsigned int teca_array_collection::size ( ) const
inlinenoexcept

Return the number of arrays.

◆ swap()

void teca_array_collection::swap ( const p_teca_dataset &  other)
overridevirtual

swap

Reimplemented from teca_dataset.

◆ to_stream() [1/2]

int teca_array_collection::to_stream ( std::ostream &  ) const
overridevirtual

stream to a human readable representation

Reimplemented from teca_dataset.

◆ to_stream() [2/2]

int teca_array_collection::to_stream ( teca_binary_stream s) const
overridevirtual

serialize the data to the given stream for I/O or communication

Reimplemented from teca_dataset.


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