IODA
ioda::ObsSpaceContainer< ContType > Class Template Reference

Obs container class for IODA. More...

#include <ObsSpaceContainer.h>

Inheritance diagram for ioda::ObsSpaceContainer< ContType >:
Collaboration diagram for ioda::ObsSpaceContainer< ContType >:

Classes

struct  by_group
 
struct  by_variable
 
struct  VarRecord
 elemental struct of the obs container More...
 

Public Types

typedef boost::multi_index::index< VarRecord_set, by_variable >::type VarIndex
 index by variable More...
 
typedef VarIndex::iterator VarIter
 variable iterator More...
 
typedef VarRecord_set::iterator DbIter
 container iterator More...
 

Public Member Functions

 ObsSpaceContainer ()
 
 ~ObsSpaceContainer ()
 
VarIter var_iter_begin ()
 
VarIter var_iter_end ()
 
std::string var_iter_vname (VarIter)
 
std::string var_iter_gname (VarIter)
 
std::string var_iter_mode (VarIter)
 
std::size_t var_iter_size (VarIter)
 
std::vector< std::size_t > var_iter_shape (VarIter)
 
DbIter find (const std::string &, const std::string &) const
 
DbIter begin () const
 
DbIter end () const
 
const std::type_info & dtype (const DbIter) const
 
const std::type_info & dtype (const std::string &, const std::string &) const
 
bool has (const std::string &group, const std::string &variable) const
 
std::size_t nlocs () const
 Return the number of uniqure observation locations on this PE. More...
 
std::size_t nvars () const
 Return the number of observational variables. More...
 
void LoadFromDb (const std::string &GroupName, const std::string &VarName, const std::vector< std::size_t > &VarShape, std::vector< ContType > &VarData, const std::size_t Start=0, const std::size_t Count=0) const
 load data from the obs container More...
 
void StoreToDb (const std::string &GroupName, const std::string &VarName, const std::vector< std::size_t > &VarShape, const std::vector< ContType > &VarData, const bool Append=false)
 store data into the obs container More...
 

Private Types

using VarRecord_set = multi_index_container< VarRecord, indexed_by< ordered_unique< composite_key< VarRecord, member< VarRecord, std::string, &VarRecord::group >, member< VarRecord, std::string, &VarRecord::variable > > >, ordered_non_unique< tag< by_group >, member< VarRecord, std::string, &VarRecord::group > >, ordered_non_unique< tag< by_variable >, member< VarRecord, std::string, &VarRecord::variable > > > >
 Multi Index container for obs data. More...
 

Private Member Functions

void print (std::ostream &) const
 Print. More...
 

Static Private Member Functions

static std::size_t SetSegmentEnd (std::size_t Start, std::size_t Count, std::size_t VarSize)
 set end of vector segment More...
 

Private Attributes

VarRecord_set DataContainer
 obs container instance More...
 
std::size_t nlocs_
 number of locations on this PE More...
 
std::size_t nvars_
 number of observational variables More...
 

Detailed Description

template<typename ContType>
class ioda::ObsSpaceContainer< ContType >

Obs container class for IODA.

This class provides a container to hold obs data in memory for use by the ObsSpace class. The container is a Boost Multi Index container (header-only implementation from Boost) which essentially creates indexing structures that point to a set of C structs. Each structure holds the keys that identify that structure and the data the are associated with those keys. There are two keys, group and variable, which identify each struct. The group corresponds to collections of variables such as "ObsValue", "ObsError", "PreQC" and "MetaData". The variables are individual quantities such as "air_temperature" and "brightness_temperature".

Author
Xin Zhang (JCSDA)

Definition at line 64 of file src/core/ObsSpaceContainer.h.

Member Typedef Documentation

◆ DbIter

template<typename ContType >
typedef VarRecord_set::iterator ioda::ObsSpaceContainer< ContType >::DbIter

container iterator

This typedef defines an iterator that can walk through the obs container using the primary indexing (by group and variable).

Definition at line 185 of file src/core/ObsSpaceContainer.h.

◆ VarIndex

template<typename ContType >
typedef boost::multi_index::index<VarRecord_set, by_variable>::type ioda::ObsSpaceContainer< ContType >::VarIndex

index by variable

This typedef defines the index mechanism that allows access to the obs container through the secondary indexing by variable.

Definition at line 169 of file src/core/ObsSpaceContainer.h.

◆ VarIter

template<typename ContType >
typedef VarIndex::iterator ioda::ObsSpaceContainer< ContType >::VarIter

variable iterator

This typedef defines an iterator that can walk through the obs container by variable. It utilizes the secondary indexing by variable.

Definition at line 177 of file src/core/ObsSpaceContainer.h.

◆ VarRecord_set

template<typename ContType >
using ioda::ObsSpaceContainer< ContType >::VarRecord_set = multi_index_container< VarRecord, indexed_by< ordered_unique< composite_key< VarRecord, member<VarRecord, std::string, &VarRecord::group>, member<VarRecord, std::string, &VarRecord::variable> > >, ordered_non_unique< tag<by_group>, member<VarRecord, std::string, &VarRecord::group> >, ordered_non_unique< tag<by_variable>, member<VarRecord, std::string, &VarRecord::variable> > > >
private

Multi Index container for obs data.

This typedef defines the indexing structure of the obs data container. The primary index is a composite key (tuple) consisting of the group and variable names. The iterator of the container itself uses this primary index, as well as the typical container methods such as find and insert. Two more secondary indexes are provided, one by group and the other by variable. These secondary indexes have their own iterators associated with them. See the boost::multiindex documentation for more details.

Definition at line 134 of file src/core/ObsSpaceContainer.h.

Constructor & Destructor Documentation

◆ ObsSpaceContainer()

template<typename ContType >
ioda::ObsSpaceContainer< ContType >::ObsSpaceContainer

Definition at line 241 of file src/core/ObsSpaceContainer.h.

◆ ~ObsSpaceContainer()

template<typename ContType >
ioda::ObsSpaceContainer< ContType >::~ObsSpaceContainer

Definition at line 248 of file src/core/ObsSpaceContainer.h.

Member Function Documentation

◆ begin()

template<typename ContType >
ObsSpaceContainer< ContType >::DbIter ioda::ObsSpaceContainer< ContType >::begin

This method returns the begin iterator for the obs container.

Definition at line 422 of file src/core/ObsSpaceContainer.h.

◆ dtype() [1/2]

template<typename ContType >
const std::type_info & ioda::ObsSpaceContainer< ContType >::dtype ( const DbIter  Idb) const

This method returns the data type associated with the obs container entry pointed to by Idb.

Parameters
[in]IdbIterator pointing to the current element of the obs container.

Definition at line 446 of file src/core/ObsSpaceContainer.h.

◆ dtype() [2/2]

template<typename ContType >
const std::type_info & ioda::ObsSpaceContainer< ContType >::dtype ( const std::string &  group,
const std::string &  variable 
) const

This method returns the data type associated with the obs container entry defined by the given group and variable. If the entry does not exist, the typeid for void is returned.

Parameters
[in]groupName of obs container group
[in]variableName of obs container variable

Definition at line 461 of file src/core/ObsSpaceContainer.h.

◆ end()

template<typename ContType >
ObsSpaceContainer< ContType >::DbIter ioda::ObsSpaceContainer< ContType >::end

This method returns the end iterator for the obs container.

Definition at line 433 of file src/core/ObsSpaceContainer.h.

◆ find()

template<typename ContType >
ObsSpaceContainer< ContType >::DbIter ioda::ObsSpaceContainer< ContType >::find ( const std::string &  group,
const std::string &  variable 
) const

This method returns an obs container iterator that indicates if the given group, variable entry exists. If the entry exists, then the iterator value that is returned will point to that entry. Otherwise, the iterator is set to the end() value to indicate the entry does is not found.

Parameters
[in]groupName of obs container group
[in]variableName of obs container variable

Definition at line 409 of file src/core/ObsSpaceContainer.h.

◆ has()

template<typename ContType >
bool ioda::ObsSpaceContainer< ContType >::has ( const std::string &  group,
const std::string &  variable 
) const

This method returns a boolean that indicates if the given group, variable entry exists in the obs container. If the entry exists, then "true" is returned. Otherwise, "false" is returned.

Parameters
[in]groupName of obs container group
[in]variableName of obs container variable

Definition at line 553 of file src/core/ObsSpaceContainer.h.

Here is the caller graph for this function:

◆ LoadFromDb()

template<typename ContType >
void ioda::ObsSpaceContainer< ContType >::LoadFromDb ( const std::string &  GroupName,
const std::string &  VarName,
const std::vector< std::size_t > &  VarShape,
std::vector< ContType > &  VarData,
const std::size_t  Start = 0,
const std::size_t  Count = 0 
) const

load data from the obs container

This method transfers data from the obs container to the caller's memory. The caller needs to allocate the memory that the VarData parameter points to. This method handles the lookup of the container group, variable entry, and checking that the data type in the container matches that of the VarData parameter.

Parameters
[in]GroupNameName of container group (ObsValue, ObsError, MetaData, etc.)
[in]VarNameName of container variable
[in]VarShapeDimension sizes of variable
[in]VarDataPointer to memory that will loaded from the container.

Definition at line 317 of file src/core/ObsSpaceContainer.h.

Here is the caller graph for this function:

◆ nlocs()

template<typename ContType >
std::size_t ioda::ObsSpaceContainer< ContType >::nlocs ( ) const
inline

Return the number of uniqure observation locations on this PE.

Definition at line 206 of file src/core/ObsSpaceContainer.h.

◆ nvars()

template<typename ContType >
std::size_t ioda::ObsSpaceContainer< ContType >::nvars ( ) const
inline

Return the number of observational variables.

Definition at line 209 of file src/core/ObsSpaceContainer.h.

◆ print()

template<typename ContType >
void ioda::ObsSpaceContainer< ContType >::print ( std::ostream &  os) const
private

Print.

print method for Printable base class

This method provides a print routine so that the obs container can be used in an output stream. A list of all group, variable combinations present in the obs container is printed out.

Definition at line 568 of file src/core/ObsSpaceContainer.h.

◆ SetSegmentEnd()

template<typename ContType >
std::size_t ioda::ObsSpaceContainer< ContType >::SetSegmentEnd ( std::size_t  Start,
std::size_t  Count,
std::size_t  VarSize 
)
staticprivate

set end of vector segment

This method returns the ending index for the vector segment given the start and count values.

Definition at line 351 of file src/core/ObsSpaceContainer.h.

◆ StoreToDb()

template<typename ContType >
void ioda::ObsSpaceContainer< ContType >::StoreToDb ( const std::string &  GroupName,
const std::string &  VarName,
const std::vector< std::size_t > &  VarShape,
const std::vector< ContType > &  VarData,
const bool  Append = false 
)

store data into the obs container

This method transfers data from the caller's memory into the obs conatiner. The caller needs to allocate and assign the memory that the VarData parameter points to. This method also handles checking that the varible has write permission if it already exists in the obs container.

Parameters
[in]GroupNameName of container group (ObsValue, ObsError, MetaData, etc.)
[in]VarNameName of container variable
[in]VarShapeDimension sizes of variable
[in]VarDataPointer to memory that will be stored in the container

Definition at line 268 of file src/core/ObsSpaceContainer.h.

Here is the caller graph for this function:

◆ var_iter_begin()

template<typename ContType >
ObsSpaceContainer< ContType >::VarIter ioda::ObsSpaceContainer< ContType >::var_iter_begin

This method returns the begin iterator for access by variable in the obs container.

Definition at line 377 of file src/core/ObsSpaceContainer.h.

Here is the caller graph for this function:

◆ var_iter_end()

template<typename ContType >
ObsSpaceContainer< ContType >::VarIter ioda::ObsSpaceContainer< ContType >::var_iter_end

This method returns the end iterator for access by variable in the obs container.

Definition at line 390 of file src/core/ObsSpaceContainer.h.

Here is the caller graph for this function:

◆ var_iter_gname()

template<typename ContType >
std::string ioda::ObsSpaceContainer< ContType >::var_iter_gname ( VarIter  )

This method returns the group name associated with the obs container entry pointed to by var_iter.

Parameters
[in]var_iterIterator of the indexing by variable type.

Definition at line 494 of file src/core/ObsSpaceContainer.h.

Here is the caller graph for this function:

◆ var_iter_mode()

template<typename ContType >
std::string ioda::ObsSpaceContainer< ContType >::var_iter_mode ( VarIter  )

This method returns the access mode associated with the obs container entry pointed to by var_iter.

Parameters
[in]var_iterIterator of the indexing by variable type.

Definition at line 508 of file src/core/ObsSpaceContainer.h.

◆ var_iter_shape()

template<typename ContType >
std::vector< std::size_t > ioda::ObsSpaceContainer< ContType >::var_iter_shape ( VarIter  )

This method returns the data shape associated with the obs container entry pointed to by var_iter.

Parameters
[in]var_iterIterator of the indexing by variable type.

Definition at line 536 of file src/core/ObsSpaceContainer.h.

Here is the caller graph for this function:

◆ var_iter_size()

template<typename ContType >
std::size_t ioda::ObsSpaceContainer< ContType >::var_iter_size ( VarIter  )

This method returns the data size associated with the obs container entry pointed to by var_iter.

Parameters
[in]var_iterIterator of the indexing by variable type.

Definition at line 522 of file src/core/ObsSpaceContainer.h.

◆ var_iter_vname()

template<typename ContType >
std::string ioda::ObsSpaceContainer< ContType >::var_iter_vname ( VarIter  )

This method returns the variable name associated with the obs container entry pointed to by var_iter.

Parameters
[in]var_iterIterator of the indexing by variable type.

Definition at line 480 of file src/core/ObsSpaceContainer.h.

Here is the caller graph for this function:

Member Data Documentation

◆ DataContainer

template<typename ContType >
VarRecord_set ioda::ObsSpaceContainer< ContType >::DataContainer
private

obs container instance

Definition at line 226 of file src/core/ObsSpaceContainer.h.

◆ nlocs_

template<typename ContType >
std::size_t ioda::ObsSpaceContainer< ContType >::nlocs_
private

number of locations on this PE

Definition at line 229 of file src/core/ObsSpaceContainer.h.

◆ nvars_

template<typename ContType >
std::size_t ioda::ObsSpaceContainer< ContType >::nvars_
private

number of observational variables

Definition at line 232 of file src/core/ObsSpaceContainer.h.


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