CARMA C++
sza::util::CoordAxes Class Reference

Class for managing coordinate axes. More...

#include <carma/szautil/CoordAxes.h>

Public Member Functions

 CoordAxes ()
 Constructors. More...
 
 CoordAxes (unsigned nel0)
 
 CoordAxes (unsigned nel0, unsigned nel1)
 
 CoordAxes (unsigned nel0, unsigned nel1, unsigned nel2)
 
 CoordAxes (CoordAxes *regAxes)
 Copy constructor. More...
 
Coord coordOf (unsigned element)
 An N-dimensional axis description can be thought of as indexing a contiguous one-dimensional array. More...
 
unsigned int elementOffsetOf (Coord &coord)
 An N-dimensional axis description can be thought of as indexing a contiguous one-dimensional array. More...
 
unsigned int elementOffsetOf (Coord *coord)
 
void fillRange (CoordRange &range)
 This method fills out any missing dimensions in the range object with the full range for that axis. More...
 
std::vector< Range< unsigned > > getRanges (CoordRange range)
 CoordRange objects can specify a different range of indices in each axis. More...
 
std::vector< Range< unsigned > > getRanges (CoordRange *range=0)
 
unsigned int nAxis ()
 Return the number of axes in this axis description. More...
 
unsigned int nEl (int axis=-1)
 Return the number of elements in an axis. More...
 
unsigned nEl (CoordRange &range)
 Return the total number of elements specified in a range object. More...
 
unsigned nEl (CoordRange *range)
 
bool operator== (CoordAxes &axes)
 An operator for testing equality of two Axes. More...
 
bool rangeIsValid (CoordRange &range)
 Check if a coordinate range is consistent with this axis specifier. More...
 
bool rangeIsValid (CoordRange *range)
 
void reset ()
 Reset this object. More...
 
void setAxis (unsigned nAxis, unsigned nEl)
 Method for setting the number of elements on an arbitrary axis. More...
 
virtual ~CoordAxes ()
 Destructor. More...
 

Friends

std::ostream & operator<< (std::ostream &os, CoordAxes axes)
 An operator for printing this object. More...
 

Detailed Description

Class for managing coordinate axes.

NB: All axis specifiers are indexed starting from 0

Definition at line 25 of file CoordAxes.h.

Constructor & Destructor Documentation

sza::util::CoordAxes::CoordAxes ( )

Constructors.

sza::util::CoordAxes::CoordAxes ( CoordAxes regAxes)

Copy constructor.

virtual sza::util::CoordAxes::~CoordAxes ( )
virtual

Destructor.

Member Function Documentation

Coord sza::util::CoordAxes::coordOf ( unsigned  element)

An N-dimensional axis description can be thought of as indexing a contiguous one-dimensional array.

This method returns the multi-dimensional coordinate corresponding to the requested element offset in that hypothetical 1-D array.

unsigned int sza::util::CoordAxes::elementOffsetOf ( Coord coord)

An N-dimensional axis description can be thought of as indexing a contiguous one-dimensional array.

This method returns the offset, in elements, of the specified multi-dimensional coordinate from the beginning of the hypothetical 1-D array corresponding to this axis descriptor.

void sza::util::CoordAxes::fillRange ( CoordRange &  range)

This method fills out any missing dimensions in the range object with the full range for that axis.

std::vector<Range<unsigned> > sza::util::CoordAxes::getRanges ( CoordRange  range)

CoordRange objects can specify a different range of indices in each axis.

In terms of the corresponding element offset in a hypothetical 1-D array corresponding to this multi-dimensional axis description, these may translate into a single contiguous element range, or a series of non-contiguous ranges.

This method takes a CoordRange object and returns a vector of contiguous element ranges in the 1-D array.

Neither one of these methods modifies the input. The second is provided so that a NULL range can be passed to mean "all"

unsigned int sza::util::CoordAxes::nAxis ( )

Return the number of axes in this axis description.

unsigned int sza::util::CoordAxes::nEl ( int  axis = -1)

Return the number of elements in an axis.

If axis < 0, return the total number of elements in this descriptor. Else return the number of elements in the requested axis.

unsigned sza::util::CoordAxes::nEl ( CoordRange &  range)

Return the total number of elements specified in a range object.

bool sza::util::CoordAxes::operator== ( CoordAxes axes)

An operator for testing equality of two Axes.

bool sza::util::CoordAxes::rangeIsValid ( CoordRange &  range)

Check if a coordinate range is consistent with this axis specifier.

void sza::util::CoordAxes::reset ( )

Reset this object.

void sza::util::CoordAxes::setAxis ( unsigned  nAxis,
unsigned  nEl 
)

Method for setting the number of elements on an arbitrary axis.

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
CoordAxes  axes 
)
friend

An operator for printing this object.


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