code::CartesianGrid2D Class Reference

Inheritance diagram for code::CartesianGrid2D:

code::Data2D< T3, T4, X > code::DataType code::Dim2D< X > List of all members.

Detailed Description

Store float data (for example, a cross-section of a 3-D data set) on an uniformly spaced and arbitrarily oriented grid that defines a 2-D cartesian coordinate system embedded in euclidean 3-D space.

The origin is always located at a corner.

Time is constant across the grid.

See also:
Data2D

CrossSection

Author:
Thomas E. Vaughan
Version:
Author
lakshman
Date
2009/06/02 20:17:37
RCSfile
code_CartesianGrid2D.h,v


Public Types

typedef std::map< std::string,
SmartPtr< DataColumn > > 
AttrMap
 key-value pairs that describe the data.
 RadialSet
 LatLonGrid
 LatLonHeightGrid
 CartesianGrid2D
 Grid2D
 DataTable
 WindField
 WindFieldLLGVolume
 ElevationVolume
 ContourData
 Other
enum  Type {
  RadialSet, LatLonGrid, LatLonHeightGrid, CartesianGrid2D,
  Grid2D, DataTable, WindField, WindFieldLLGVolume,
  ElevationVolume, ContourData, Other
}
typedef __normal_iterator< X > iterator
typedef __normal_iterator<
const X > 
const_iterator

Public Member Functions

 CartesianGrid2D ()
 for STL use.
 CartesianGrid2D (const SpaceTimeRef &, const Coord &, const Displacement &, const Displacement &)
 Build an uninitialized CartesianGrid2D.
CartesianGrid2D clone () const
 return a completely separate copy of this grid.
CartesianGrid2D resize (const Length &x_length, const Length &y_length) const
 Resizes this CartesianGrid to be as close as possible to the given dimensions.
SpaceTimeRef getCenter () const
 returns the exact center of the grid (if the grid has an even number of points, returns the location of the separation boundary)
 CartesianGrid2D (const SpaceTimeRef &, const Coord &, const Length &, const Length &)
 Build an uninitialized tangent-plane CartesianGrid2D.
virtual void invoke (Algorithm &)
 Have an Algorithm process this object.
virtual short getType () const
 Get enum type of this class.
const DimType & getGridSpacing () const
 Return the grid spacing.
const LocationgetOrigin () const
 Return the Location of the origin.
const TimegetTime () const
 Return the Time corresponding to this grid.
void setTime (const Time &)
const DisplacementgetXAxis () const
 Return vector from origin to corner along first dimension.
const DisplacementgetYAxis () const
 Return vector from origin to corner along second dimension.
virtual SpaceTimeRef reference (size_t i, size_t j) const
 Return the reference corresponding to the grid point offset (i,j).
SpaceTimeRef gridCenterReference (size_t i, size_t j) const
 Obtain the reference corresponding to the grid center point of the offset(i,j).
virtual DimType coord_value (size_t i, size_t j) const
 Return the parametric displacement of grid point offset (i,j) from the origin (0,0,0).
const Coord & size () const
 Return number of grid points along each dimension.
virtual ~CartesianGrid2D ()
 Call descendant's destructor.
virtual SpaceTimeRef getSpaceTimeRef () const
 The virtual function demanded by DataType.
virtual double getRawValue (const Location &, bool=false) const
 Gets raw value from data set.
bool isValid ()
Datum< X > data (size_t i, size_t j) const
 Return the datum of the specified element.
std::string getTypeClassName () const
 returns a string such as RadialSet, LatLonGrid, etc.
void copyDataType (const DataType &dt)
 A convenience function provided for subclasses that implement clone() -- will copy into this data type all the attributes in the type dt.
const std::string & getTypeName () const
 Return the TypeName of this DataType.
void setTypeName (const std::string &)
 Set the TypeName of this DataType.
SmartPtr< DataCellgetAttributeValue (const std::string &key) const
 Return a single value associated with an attribute key corresponding to the function's argument.
bool getAttributeValue (const std::string &key, std::string &setme) const
 Assign `setme' with the attribute corresponding to `key'.
bool getAttributeValue (const std::string &key, double &setme) const
 Assign `setme' with the attribute corresponding to `key'.
void setAttributeValue (const std::string &key, const std::string &value, const std::string &unit="dimensionless")
 Set a single-valued attribute that describes this DataType.
void setAttributeValue (const std::string &key, double value, const std::string &unit="dimensionless", const std::string &format="%g")
 Set a single-valued attribute that describes this DataType.
void setAttribute (const std::string &key, SmartPtr< DataColumn > value)
 Set a multiple-valued attribute that describes this DataType.
SmartPtr< DataColumngetAttribute (const std::string &key) const
 Get the attribute value for a particular key.
const AttrMapgetAttributes () const
 Get the entire map of attributes available for this data type.
virtual TimeInterval getExpiryInterval () const
 Return 15 minutes as the length of time for which this DataType is valid.
bool hasQuality () const
const DataTypegetQuality () const
void setQuality (SmartPtr< DataType > dt)
void clearAttributes ()
iterator begin ()
const_iterator begin () const
iterator end ()
const_iterator end () const
iterator get_iterator (size_t row, size_t col)
const_iterator get_iterator (size_t row, size_t col) const
X & cell_ref (size_t row, size_t col)
 Deprecated alternative to dim2d[row][col].
const X & cell_ref (size_t row, size_t col) const
 Deprecated alternative to dim2d[row][col].
get_val (size_t row, size_t col) const
 Return a copy of the element in the specified coordinate.
void set_val (size_t row, size_t col, const X &value)
 Slightly more efficient form of dim2d[row][col] = value.
X * operator[] (size_t row)
const X * operator[] (size_t row) const
void get_1d_bounds (size_t row, X *&setme_begin, X *&setme_end)
void get_1d_bounds (size_t row, const X *&setme_begin, const X *&setme_end) const
void push_back (const X *begin, const X *end)
 Add a row of elements.
void push_back (const std::vector< X > &v)
 Add a row of elements.
void replace_1d (size_t row, const X *first, const X *last)
 Overwrite a 'row' of elements.
void replace_1d (int row, const std::vector< X > &v)
 Overwrite a 'row' of elements.
void replace_2d (const Dim2D< X > &d)
 Overwrite the entire 2D.
void set_2d (size_t x, size_t y, const X **values)
 Repopulate the grid as an X x Y grid with a copy of `values'.
void fill (const X &val)
 Set the entire grid to a value.
void fill (const X &val, size_t row_begin, size_t row_end, size_t col_begin, size_t col_end)
 Fill a 2D range with the specified value.
void clear ()
 resets this object to a 0x0 matrix
void reserve (size_t rows, size_t cols)
 ensure enough memory is allocated to populate an ROW x COL matrix.
void resize (size_t rows, size_t cols, const X &value=X())
 resizes to a ROW x COL grid and sets each cell to `value'
void replace (const X &old_value, const X &new_value)
 replace every instance of old_value with new_value
size_t size_d () const
 number of rows.
size_t size_d (size_t row) const
 number of columns.
int dim_x () const
 Number of rows.
int dim_y () const
 Number of cols.

Static Public Attributes

static const std::string IsTableData
static const std::string Unit
static const std::string ColorMap
static const std::string ExpiryInterval

Protected Member Functions

virtual void shallow_copy (const Data2D &x)
virtual void shallow_copy (const Dim2D< X > &source)
virtual void deep_copy (const Data2D &x)
virtual void deep_copy (const DataType &source)
virtual void deep_copy (const Dim2D< X > &source)

Protected Attributes

InitSmartPtr< Impl > _impl
 The array of 1D types that is held.


Member Typedef Documentation

typedef std::map< std::string, SmartPtr<DataColumn> > code::DataType::AttrMap [inherited]

key-value pairs that describe the data.

template<class X>
typedef __normal_iterator<const X> code::Dim2D< X >::const_iterator [inherited]

template<class X>
typedef __normal_iterator<X> code::Dim2D< X >::iterator [inherited]


Member Enumeration Documentation

enum code::DataType::Type [inherited]

Enumerator:
RadialSet 
LatLonGrid 
LatLonHeightGrid 
CartesianGrid2D 
Grid2D 
DataTable 
WindField 
WindFieldLLGVolume 
ElevationVolume 
ContourData 
Other 


Constructor & Destructor Documentation

code::CartesianGrid2D::CartesianGrid2D (  )  [inline]

for STL use.

code::CartesianGrid2D::CartesianGrid2D ( const SpaceTimeRef ,
const Coord &  ,
const Displacement ,
const Displacement  
)

Build an uninitialized CartesianGrid2D.

Parameters:
const_SpaceTimeRef& Time for grid as a whole and Location of grid's origin corner.
const_Coord& Number of grid points along each dimension.
const_Displacement& Vector from origin to corner along first dimension (x-axis direction and length of side along x-direction).
const_Displacement& Vector from origin to corner along second dimension (y-axis direction and length of side along y-direction).

code::CartesianGrid2D::CartesianGrid2D ( const SpaceTimeRef ,
const Coord &  ,
const Length ,
const Length  
)

Build an uninitialized tangent-plane CartesianGrid2D.

Consider the SpaceTimeRef to be a point on the surface of a sphere centered at the center of the earth. The CartesianGrid2D constructed here will be tangent to that sphere at that point. The CartesianGrid2D will be oriented so that its x-axis points east at the tangent point and so that its y-axis points north at the tangent point. The origin will be located at the southwest corner.

Parameters:
const_SpaceTimeRef& Time for grid as a whole and Location of grid's center.
const_Coord& Number of grid points along each dimension.
const_Length& Size of grid along east-west direction at tangent point.
const_Length& Size of grid along north-south direction at tangent point.

virtual code::CartesianGrid2D::~CartesianGrid2D (  )  [inline, virtual]

Call descendant's destructor.


Member Function Documentation

template<class X>
const_iterator code::Dim2D< X >::begin (  )  const [inline, inherited]

template<class X>
iterator code::Dim2D< X >::begin (  )  [inline, inherited]

template<class X>
const X& code::Dim2D< X >::cell_ref ( size_t  row,
size_t  col 
) const [inline, inherited]

Deprecated alternative to dim2d[row][col].

template<class X>
X& code::Dim2D< X >::cell_ref ( size_t  row,
size_t  col 
) [inline, inherited]

Deprecated alternative to dim2d[row][col].

template<class X>
void code::Dim2D< X >::clear (  )  [inline, inherited]

resets this object to a 0x0 matrix

void code::DataType::clearAttributes (  )  [inline, inherited]

CartesianGrid2D code::CartesianGrid2D::clone (  )  const

return a completely separate copy of this grid.

Reimplemented from code::Data2D< T3, T4, X >.

virtual DimType code::CartesianGrid2D::coord_value ( size_t  i,
size_t  j 
) const [virtual]

Return the parametric displacement of grid point offset (i,j) from the origin (0,0,0).

Implementation of virtual function in Data2D.

Reimplemented from code::Data2D< T3, T4, X >.

void code::DataType::copyDataType ( const DataType dt  )  [inherited]

A convenience function provided for subclasses that implement clone() -- will copy into this data type all the attributes in the type dt.

Attributes with the same name will be over-written, other attributes will remain unchanged.

template<class T3, class T4, class X>
Datum<X> code::Data2D< T3, T4, X >::data ( size_t  i,
size_t  j 
) const [inline, inherited]

Return the datum of the specified element.

template<class X>
virtual void code::Dim2D< X >::deep_copy ( const Dim2D< X > &  source  )  [inline, protected, virtual, inherited]

virtual void code::DataType::deep_copy ( const DataType source  )  [inline, protected, virtual, inherited]

template<class T3, class T4, class X>
virtual void code::Data2D< T3, T4, X >::deep_copy ( const Data2D< T3, T4, X > &  x  )  [inline, protected, virtual, inherited]

template<class X>
int code::Dim2D< X >::dim_x (  )  const [inline, inherited]

Number of rows.

Reimplemented in code::Image< T >, code::Image< float >, and code::Image< int >.

template<class X>
int code::Dim2D< X >::dim_y (  )  const [inline, inherited]

Number of cols.

Reimplemented in code::Image< T >, code::Image< float >, and code::Image< int >.

template<class X>
const_iterator code::Dim2D< X >::end (  )  const [inline, inherited]

template<class X>
iterator code::Dim2D< X >::end (  )  [inline, inherited]

template<class X>
void code::Dim2D< X >::fill ( const X &  val,
size_t  row_begin,
size_t  row_end,
size_t  col_begin,
size_t  col_end 
) [inline, inherited]

Fill a 2D range with the specified value.

Equivalent, but more efficient, form of "for (i=ibegin; i<iend; ++i) for (j=jbegin; j<jend; ++j) d[i][j]=val;"

template<class X>
void code::Dim2D< X >::fill ( const X &  val  )  [inline, inherited]

Set the entire grid to a value.

template<class X>
void code::Dim2D< X >::get_1d_bounds ( size_t  row,
const X *&  setme_begin,
const X *&  setme_end 
) const [inline, inherited]

template<class X>
void code::Dim2D< X >::get_1d_bounds ( size_t  row,
X *&  setme_begin,
X *&  setme_end 
) [inline, inherited]

template<class X>
const_iterator code::Dim2D< X >::get_iterator ( size_t  row,
size_t  col 
) const [inline, inherited]

template<class X>
iterator code::Dim2D< X >::get_iterator ( size_t  row,
size_t  col 
) [inline, inherited]

template<class X>
X code::Dim2D< X >::get_val ( size_t  row,
size_t  col 
) const [inline, inherited]

Return a copy of the element in the specified coordinate.

SmartPtr< DataColumn > code::DataType::getAttribute ( const std::string &  key  )  const [inherited]

Get the attribute value for a particular key.

Parameters:
key attribute key
Returns:
value attribute value in unit-safe manner, or an invalid SmartPtr on error.
See also:
getAttributeValue()

getAttributes() if you don't know the attribute key.

const AttrMap& code::DataType::getAttributes (  )  const [inline, inherited]

Get the entire map of attributes available for this data type.

See also:
getAttribute for a more selective get.

getAttributeValue for a convenient get.

bool code::DataType::getAttributeValue ( const std::string &  key,
double &  setme 
) const [inherited]

Assign `setme' with the attribute corresponding to `key'.

Returns:
true on success; false if no such attribute exists

bool code::DataType::getAttributeValue ( const std::string &  key,
std::string &  setme 
) const [inherited]

Assign `setme' with the attribute corresponding to `key'.

Returns:
true on success; false if no such attribute exists

SmartPtr< DataCell > code::DataType::getAttributeValue ( const std::string &  key  )  const [inherited]

Return a single value associated with an attribute key corresponding to the function's argument.

If no such attribute key exists, then return the NULL SmartPtr. In case multiple values are associated with the key, only the first item is returned.

See also:
getAttribute() to get all values.

SpaceTimeRef code::CartesianGrid2D::getCenter (  )  const

returns the exact center of the grid (if the grid has an even number of points, returns the location of the separation boundary)

virtual TimeInterval code::DataType::getExpiryInterval (  )  const [virtual, inherited]

Return 15 minutes as the length of time for which this DataType is valid.

Override this function in the descendant of DataType as appropriate.

Reimplemented in code::DEM.

const DimType& code::CartesianGrid2D::getGridSpacing (  )  const

Return the grid spacing.

const Location& code::CartesianGrid2D::getOrigin (  )  const

Return the Location of the origin.

const DataType& code::DataType::getQuality (  )  const [inline, inherited]

virtual double code::CartesianGrid2D::getRawValue ( const Location ,
bool  = false 
) const [virtual]

Gets raw value from data set.

Reimplemented from code::DataType.

virtual SpaceTimeRef code::CartesianGrid2D::getSpaceTimeRef (  )  const [virtual]

The virtual function demanded by DataType.

This function needs to be implemented by subclasses.

Reimplemented from code::Data2D< T3, T4, X >.

const Time& code::CartesianGrid2D::getTime (  )  const

Return the Time corresponding to this grid.

virtual short code::CartesianGrid2D::getType (  )  const [inline, virtual]

Get enum type of this class.

Reimplemented from code::DataType.

std::string code::DataType::getTypeClassName (  )  const [inherited]

returns a string such as RadialSet, LatLonGrid, etc.

See the enum Type for all the possible options. Subclasses need only to over-ride getType()

const std::string& code::DataType::getTypeName (  )  const [inherited]

Return the TypeName of this DataType.

const Displacement& code::CartesianGrid2D::getXAxis (  )  const

Return vector from origin to corner along first dimension.

const Displacement& code::CartesianGrid2D::getYAxis (  )  const

Return vector from origin to corner along second dimension.

SpaceTimeRef code::CartesianGrid2D::gridCenterReference ( size_t  i,
size_t  j 
) const

Obtain the reference corresponding to the grid center point of the offset(i,j).

This is the center point of the grid (see O). ------- | | | O | | | -------

bool code::DataType::hasQuality (  )  const [inline, inherited]

virtual void code::CartesianGrid2D::invoke ( Algorithm  )  [virtual]

Have an Algorithm process this object.

Reimplemented from code::DataType.

bool code::CartesianGrid2D::isValid (  )  [inline]

template<class X>
const X* code::Dim2D< X >::operator[] ( size_t  row  )  const [inline, inherited]

template<class X>
X* code::Dim2D< X >::operator[] ( size_t  row  )  [inline, inherited]

template<class X>
void code::Dim2D< X >::push_back ( const std::vector< X > &  v  )  [inline, inherited]

Add a row of elements.

template<class X>
void code::Dim2D< X >::push_back ( const X *  begin,
const X *  end 
) [inline, inherited]

Add a row of elements.

virtual SpaceTimeRef code::CartesianGrid2D::reference ( size_t  i,
size_t  j 
) const [virtual]

Return the reference corresponding to the grid point offset (i,j).

Implementation of virtual function in Data2D. This is the point on the left top of grid (see X). X----- | | | | ------

Reimplemented from code::Data2D< T3, T4, X >.

template<class X>
void code::Dim2D< X >::replace ( const X &  old_value,
const X &  new_value 
) [inline, inherited]

replace every instance of old_value with new_value

template<class X>
void code::Dim2D< X >::replace_1d ( int  row,
const std::vector< X > &  v 
) [inline, inherited]

Overwrite a 'row' of elements.

The number of new and old elements must match.

template<class X>
void code::Dim2D< X >::replace_1d ( size_t  row,
const X *  first,
const X *  last 
) [inline, inherited]

Overwrite a 'row' of elements.

The number of old and new elements must match.

template<class X>
void code::Dim2D< X >::replace_2d ( const Dim2D< X > &  d  )  [inline, inherited]

Overwrite the entire 2D.

This copies the elements from d, rather than sharing them. If you want to share them, use the assignment operator instead.

template<class X>
void code::Dim2D< X >::reserve ( size_t  rows,
size_t  cols 
) [inline, inherited]

ensure enough memory is allocated to populate an ROW x COL matrix.

template<class X>
void code::Dim2D< X >::resize ( size_t  rows,
size_t  cols,
const X &  value = X() 
) [inline, inherited]

resizes to a ROW x COL grid and sets each cell to `value'

CartesianGrid2D code::CartesianGrid2D::resize ( const Length x_length,
const Length y_length 
) const

Resizes this CartesianGrid to be as close as possible to the given dimensions.

If new rows/columns are added, the data values are initialized to Constants::MISSING_DATA. The resizing is done so that the center of the grid remains unchanged, i.e. adding/removing is done equally on both sides.

Parameters:
x_length length from bottom left to bottom right
y_length length from bottom left to top left

template<class X>
void code::Dim2D< X >::set_2d ( size_t  x,
size_t  y,
const X **  values 
) [inline, inherited]

Repopulate the grid as an X x Y grid with a copy of `values'.

template<class X>
void code::Dim2D< X >::set_val ( size_t  row,
size_t  col,
const X &  value 
) [inline, inherited]

Slightly more efficient form of dim2d[row][col] = value.

void code::DataType::setAttribute ( const std::string &  key,
SmartPtr< DataColumn value 
) [inherited]

Set a multiple-valued attribute that describes this DataType.

If value is 0 (i.e. invalid), this attribute will be removed from the map.

void code::DataType::setAttributeValue ( const std::string &  key,
double  value,
const std::string &  unit = "dimensionless",
const std::string &  format = "%g" 
) [inherited]

Set a single-valued attribute that describes this DataType.

This is a convenience function that allows you to set a dimensionless number as the value of an attribute.

If the attribute key does not already exist, then it will be constructed.

See also:
setAttribute() to set multiple values for an attribute.

void code::DataType::setAttributeValue ( const std::string &  key,
const std::string &  value,
const std::string &  unit = "dimensionless" 
) [inherited]

Set a single-valued attribute that describes this DataType.

This is a convenience function that allows you to set a text string as the value of an attribute.

If the attribute key does not already exist, then it will be constructed. The empty string may NOT be used as a value for the attribute; this function will return immediately if the value is the empty string.

See also:
setAttribute() to set multiple values for an attribute.

void code::DataType::setQuality ( SmartPtr< DataType dt  )  [inline, inherited]

void code::CartesianGrid2D::setTime ( const Time  ) 

void code::DataType::setTypeName ( const std::string &   )  [inherited]

Set the TypeName of this DataType.

template<class X>
virtual void code::Dim2D< X >::shallow_copy ( const Dim2D< X > &  source  )  [inline, protected, virtual, inherited]

template<class T3, class T4, class X>
virtual void code::Data2D< T3, T4, X >::shallow_copy ( const Data2D< T3, T4, X > &  x  )  [inline, protected, virtual, inherited]

const Coord& code::CartesianGrid2D::size (  )  const

Return number of grid points along each dimension.

Reimplemented from code::Dim2D< X >.

template<class X>
size_t code::Dim2D< X >::size_d ( size_t  row  )  const [inline, inherited]

number of columns.

template<class X>
size_t code::Dim2D< X >::size_d (  )  const [inline, inherited]

number of rows.


Member Data Documentation

template<class X>
InitSmartPtr< Impl > code::Dim2D< X >::_impl [protected, inherited]

The array of 1D types that is held.

const std::string code::DataType::ColorMap [static, inherited]

const std::string code::DataType::ExpiryInterval [static, inherited]

const std::string code::DataType::IsTableData [static, inherited]

const std::string code::DataType::Unit [static, inherited]


Generated on Fri May 4 13:40:10 2012 for WDSS-IIw2 by  doxygen 1.4.7