Parallel Analog Ensemble
Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Friends | List of all members
ObservationsPointer Class Reference

ObservationsPointer is an implementation of the abstract class Observations. The underlying storage uses a pointer which is optimized for performance. More...

#include <ObservationsPointer.h>

Inheritance diagram for ObservationsPointer:
Observations BasicData

Public Member Functions

 ObservationsPointer ()
 
 ObservationsPointer (const ObservationsPointer &orig)
 
 ObservationsPointer (const Parameters &, const Stations &, const Times &)
 
virtual ~ObservationsPointer ()
 
std::size_t num_elements () const override
 
const double * getValuesPtr () const override
 
double * getValuesPtr () override
 
virtual void setDimensions (const Parameters &parameters, const Stations &stations, const Times &times) override
 
virtual void initialize (double) override
 
virtual double getValue (std::size_t parameter_index, std::size_t station_index, std::size_t time_index) const override
 
virtual void setValue (double val, std::size_t parameter_index, std::size_t station_index, std::size_t time_index) override
 
virtual void subset (Observations &) const override
 
virtual void subset (const Parameters &, const Stations &, const Times &, Observations &) const override
 
virtual void print (std::ostream &) const override
 
- Public Member Functions inherited from Observations
 Observations ()
 
 Observations (const Observations &orig)
 
 Observations (const Parameters &, const Stations &, const Times &)
 
virtual ~Observations ()
 
- Public Member Functions inherited from BasicData
 BasicData ()
 
 BasicData (const Parameters &, const Stations &, const Times &)
 
 BasicData (const BasicData &orig)
 
virtual ~BasicData ()
 
void setMembers (const Parameters &, const Stations &, const Times &)
 
const ParametersgetParameters () const
 
const StationsgetStations () const
 
const TimesgetTimes () const
 
ParametersgetParameters ()
 
StationsgetStations ()
 
TimesgetTimes ()
 
std::size_t getTimeStamp (std::size_t index) const
 
std::size_t getTimeIndex (std::size_t timestamp) const
 
std::size_t getTimeIndex (const Time &) const
 
BasicDataoperator= (const BasicData &)
 

Static Public Attributes

static const size_t _DIM_PARAMETER = 0
 
static const size_t _DIM_STATION = 1
 
static const size_t _DIM_TIME = 2
 

Protected Member Functions

size_t toIndex_ (size_t dim0, size_t dim1, size_t dim2) const
 
void allocateMemory_ ()
 
void subset_data_ (const Parameters &, const Stations &, const Times &, Observations &) const
 
void subset_data_ (const std::vector< std::size_t > &, const std::vector< std::size_t > &, const std::vector< std::size_t > &, double *) const
 

Protected Attributes

vector3 dims_
 
double * data_
 
bool allocated_
 
- Protected Attributes inherited from BasicData
Parameters parameters_
 
Stations stations_
 
Times times_
 

Friends

std::ostream & operator<< (std::ostream &, const ObservationsPointer &)
 

Detailed Description

ObservationsPointer is an implementation of the abstract class Observations. The underlying storage uses a pointer which is optimized for performance.

Constructor & Destructor Documentation

◆ ObservationsPointer() [1/3]

ObservationsPointer::ObservationsPointer ( )

◆ ObservationsPointer() [2/3]

ObservationsPointer::ObservationsPointer ( const ObservationsPointer orig)

◆ ObservationsPointer() [3/3]

ObservationsPointer::ObservationsPointer ( const Parameters parameters,
const Stations stations,
const Times times 
)

◆ ~ObservationsPointer()

ObservationsPointer::~ObservationsPointer ( )
virtual

Member Function Documentation

◆ allocateMemory_()

void ObservationsPointer::allocateMemory_ ( )
protected

◆ getValue()

double ObservationsPointer::getValue ( std::size_t  parameter_index,
std::size_t  station_index,
std::size_t  time_index 
) const
overridevirtual

Gets or sets a value using the array indices.

Parameters
parameter_indexParameter index.
station_indexStation index.
time_indexTime index.
Returns
a value.

Implements Observations.

◆ getValuesPtr() [1/2]

const double * ObservationsPointer::getValuesPtr ( ) const
overridevirtual

Gets a double pointer to the start of the values.

Returns
A double pointer.

Implements Observations.

◆ getValuesPtr() [2/2]

double * ObservationsPointer::getValuesPtr ( )
overridevirtual

Implements Observations.

◆ initialize()

void ObservationsPointer::initialize ( double  value)
overridevirtual

Implements Observations.

◆ num_elements()

size_t ObservationsPointer::num_elements ( ) const
overridevirtual

Returns the total number of data values as one dimension.

Returns
A value.

Implements Observations.

◆ print()

void ObservationsPointer::print ( std::ostream &  os) const
overridevirtual

Reimplemented from Observations.

◆ setDimensions()

void ObservationsPointer::setDimensions ( const Parameters parameters,
const Stations stations,
const Times times 
)
overridevirtual

Sets the dimensions of forecasts and allocates memory for data values.

Parameters
parametersThe Parameters container.
stationsThe Stations container.
timesThe Times container.

Implements Observations.

◆ setValue()

void ObservationsPointer::setValue ( double  val,
std::size_t  parameter_index,
std::size_t  station_index,
std::size_t  time_index 
)
overridevirtual

Implements Observations.

◆ subset() [1/2]

void ObservationsPointer::subset ( const Parameters ,
const Stations ,
const Times ,
Observations  
) const
overridevirtual

Subset Observations. Dimensions are specified by the input arguments. The input Observations should be an empty Observations that will hold all subset information and values at the end of this function call.

Implements Observations.

◆ subset() [2/2]

void ObservationsPointer::subset ( Observations ) const
overridevirtual

Subset Observations. Dimensions to be extracted are determined from the function input Observations. The input Observations should have already allocated enough memory by calling setDimensions prior to this function call.

Implements Observations.

◆ subset_data_() [1/2]

void ObservationsPointer::subset_data_ ( const Parameters parameters,
const Stations stations,
const Times times,
Observations observations_subset 
) const
protected

◆ subset_data_() [2/2]

void ObservationsPointer::subset_data_ ( const std::vector< std::size_t > &  ,
const std::vector< std::size_t > &  ,
const std::vector< std::size_t > &  ,
double *   
) const
protected

◆ toIndex_()

size_t ObservationsPointer::toIndex_ ( size_t  dim0,
size_t  dim1,
size_t  dim2 
) const
protected

Friends And Related Function Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  os,
const ObservationsPointer obj 
)
friend

Member Data Documentation

◆ _DIM_PARAMETER

const size_t ObservationsPointer::_DIM_PARAMETER = 0
static

◆ _DIM_STATION

const size_t ObservationsPointer::_DIM_STATION = 1
static

◆ _DIM_TIME

const size_t ObservationsPointer::_DIM_TIME = 2
static

◆ allocated_

bool ObservationsPointer::allocated_
protected

This variable is used to keep track of whether the data memory is allocated internally and whether the pointer should be deleted during the de-constructor.

◆ data_

double* ObservationsPointer::data_
protected

◆ dims_

vector3 ObservationsPointer::dims_
protected

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