GCLgrid :: GCLgrid classes

class GCLscalarfield

? ^ 
    extends GCLgrid as public

Two-dimensional scalar field defined on a GCLgrid framework.
Source:
gclgrid.h:689
Author:
unascribed
Version:
unknown
Friend:
function ostream&operator<< stream output operator for a field.

Format is:

line 1:  n1 n2
line 2+:  x1, x2, x3, lat(deg), lon(deg), r(km), val in C output order 
		(index 2 most rapidly varying).

Contents

^ 
EntityInherited FromTypeScopeShort Description
~GCLscalarfielddestructor public Destructor.
GCLscalarfieldconstructor publicDefault constructor
GCLscalarfieldconstructor public Simple constructor.
GCLscalarfieldconstructor publicStandard copy constructor
GCLscalarfieldconstructor public Partial copy constructor cloning grid but not setting field variable.
GCLscalarfieldconstructor public Antelope database driven constructor.
compute_extentsGCLgridmethod publicundocumented
ctogBasicGCLgridmethod public Convert Cartesian coordinates to geographical coordinates.
ctogBasicGCLgridmethod public Convert from Cartesian coordinates to geographical coordinates.
dbsavemethod public Save field to an Antelope (Datascope) database.
depthGCLgridmethod public Get the depth below the standard reference ellipsoid of a grid point.
fetch_transformation_matrixBasicGCLgridmethod public Returns the transformation matrix for this grid as a 3x3 dmatrix object.
fetch_translation_vectorBasicGCLgridmethod public Returns a newly allocated 3 vector of double containing a copy of the translation vector defining the GCLgrid transformation property.
geo_coordinatesGCLgridmethod public Returns the geographical coordinates of a point in the grid specified by grid index positions.
get_indexGCLgridmethod publicSee BasicGCLgrid::get_index
gtocBasicGCLgridmethod public Convert from geographical to Cartesian coordinates in the GCLgrid coordinate system.
gtocBasicGCLgridmethod public Convert from geographical to Cartesian coordinates in the GCLgrid coordinate system.
interpolatemethod public Linear interpolation function for a field.
latGCLgridmethod public Get the latitude (in radians) of a grid point.
lonGCLgridmethod public Get the longitude (in radians) of a grid point.
lookupGCLgridmethod public Find the index position of a point in a GCLgrid.
operator *=operator public Multiply all field values by a constant scale factor.
operator +=operator public Add one field to another.
operator =operator publicStandard assignment operator
rGCLgridmethod public Get the radius from the center of the Earth of a grid point.
reset_indexGCLgridmethod publicSee BasicGCLgrid::reset_index
set_transformation_matrixBasicGCLgridmethod public Set or reset the transformation properties for the grid.
valattribute public Scalar field variable stored in a two-dimensional C array.

destructor ~GCLscalarfield

? ^  > 
Destructor.

Note the same precautions about application of the default constructor as noted in GCLgrid::~GCLgrid

Source:
gclgrid.h:747
Code:
public ~ GCLscalarfield ( )

constructor GCLscalarfield

? ^  < > 
Default constructor
Source:
gclgrid.h:699
Code:
public GCLscalarfield ( )

constructor GCLscalarfield

? ^  < > 
Simple constructor.

Allocates space for all arrays but loads nothing. Do not assume anything is initialized.

Source:
gclgrid.h:707
Params:
n1size number of grid points on generalized coordinate axis 1.
n2size number of grid points on generalized coordinate axis 2.
Code:
public GCLscalarfield ( int n1size ,
int n2size )

constructor GCLscalarfield

? ^  < > 
Standard copy constructor
Source:
gclgrid.h:709
Code:
public GCLscalarfield ( const GCLscalarfield & )

constructor GCLscalarfield

? ^  < > 
Partial copy constructor cloning grid but not setting field variable.

A common situation is to have a grid that is already defined that needs to be cloned and have field variables set through some other mechanism. For example, one might create a standard grid and then plan to load it with values from a different grid or compute values of a field variable at the grid points.

Source:
gclgrid.h:721
Param:
g Grid to be cloned.
Code:
public GCLscalarfield ( GCLgrid & )

constructor GCLscalarfield

? ^  < > 
Antelope database driven constructor.

This is a specialized constructor that loads a field tagged with two names: grid name and the field name (see below). The two components are stored separately in the external database using two different tables. This constructor has a fair amount of memory overhead as it loads a copy of the parent GCLgrid object before creating the field and then loading field variable data from the database.

Source:
gclgrid.h:741
Params:
db Antelope database pointer.
grdnm name of grid to be loaded from the database.
fn name tag for the field to be loaded from the database.
Exception:
int Exception is thrown if there are any i/o problems. A simple int exception is used because errors are posted to the Antelope elog mechanism. If this exception is caught, call elog_complain to flush the elog buffer.

Code:
public GCLscalarfield ( Dbptr db ,
string grdnm ,
string fn )

method compute_extents

? ^  < > 
undocumented
Inherited From:
GCLgrid
Source:
gclgrid.h:469
Code:
public void compute_extents ( )

method ctog

? ^  < > 
Convert Cartesian coordinates to geographical coordinates.
Inherited From:
BasicGCLgrid
Source:
gclgrid.h:208
Params:
x1p - Cartesian x1 coordinate of point to convert
x2p - Cartesian x2 coordinate of point to convert
x3p - Cartesian x3 coordinate of point to convert
Returns:
Geographic_point data structure (see Geographic_point )
Code:
public Geographic_point ctog ( double x1p ,
double x2p ,
double x3p )

method ctog

? ^  < > 
Convert from Cartesian coordinates to geographical coordinates.
Inherited From:
BasicGCLgrid
Source:
gclgrid.h:214
Param:
p point to convert stored in a Cartesian_point data structure
Returns:
Geographic_point data structure (see Geographic_point )
Code:
public Geographic_point ctog ( Cartesian_point p )

method dbsave

? ^  < > 
Save field to an Antelope (Datascope) database.

This routine writes the object attributes to a special table and writes the grid coordinate data to an output file. Note the file name used to store the grid is the same as the name parameter passed to this function. The field variable data are written to a different file and stored indexed with a different database table. An odd feature of this routine is that if the directory name for the field passed to the function is empty (the string equivalent of NULL) the grid is not saved. This is a necessary feature for saving multiple fields on the same parent grid structure.

Source:
gclgrid.h:782
Params:
db Antelope database pointer.
gclgdir directory to save gclgrid data. If zero length, grid data is not saved.
fielddir directory where field (val) data will be saved. Can be the same as gclgdir, but should not be zero length.
fieldname name assigned to this field.
dfile name of file to be used to save field (val) data. Note the grid data is always saved to a name based in the name attribure of the grid.
Exception:
int Exception is thrown if save failed. A simple int exception is used because errors are posted to the Antelope elog mechanism. If this exception is caught, call elog_complain to flush the elog buffer.

Code:
public void dbsave ( Dbptr db ,
string gclgdir ,
string fielddir ,
string fieldname ,
string dfile ) throw ( int )

method depth

? ^  < > 
Get the depth below the standard reference ellipsoid of a grid point.

Inherited From:
GCLgrid
Source:
gclgrid.h:467
Params:
i1 Value of grid index 1 for point desired.
i2 Value of grid index 2 for point desired.
Returns:
depth in kilometers of the requested grid point.
Code:
public double depth ( int i1 ,
int i2 )

method fetch_transformation_matrix

? ^  < > 
Returns the transformation matrix for this grid as a 3x3 dmatrix object.
Inherited From:
BasicGCLgrid
Source:
gclgrid.h:194
Code:
public dmatrix fetch_transformation_matrix ( )

method fetch_translation_vector

? ^  < > 
Returns a newly allocated 3 vector of double containing a copy of the translation vector defining the GCLgrid transformation property.

The user must be sure to call delete [] after using this vector to avoid a memory leak.

Inherited From:
BasicGCLgrid
Source:
gclgrid.h:200
Code:
public double * fetch_translation_vector ( )

method geo_coordinates

? ^  < > 
Returns the geographical coordinates of a point in the grid specified by grid index positions.

If you need the actual coordinates of the points that define the grid converted to geographic coordinates use this function. Use the ctog function to convert an arbitrary ordered triplet.

Inherited From:
GCLgrid
Source:
gclgrid.h:435
Params:
i1 Value of grid index 1 for point desired.
i2 Value of grid index 2 for point desired.
Returns:
grid point requested in an Geographic_point data structure.
Code:
public Geographic_point geo_coordinates ( int i1 ,
int i2 )

method get_index

? ^  < > 
See BasicGCLgrid::get_index
Inherited From:
GCLgrid
Source:
gclgrid.h:423
Code:
public void get_index ( int * ind )

method gtoc

? ^  < > 
Convert from geographical to Cartesian coordinates in the GCLgrid coordinate system.

Inherited From:
BasicGCLgrid
Source:
gclgrid.h:224
Params:
plat Latitude (radians) of point to convert.
plon Longitude (radians) of point to convert.
pr Earth radius (km) of point to convert.
Returns:
Cartesian_point data structure (see @endlink)
Code:
public Cartesian_point gtoc ( double plat ,
double plon ,
double pr )

method gtoc

? ^  < > 
Convert from geographical to Cartesian coordinates in the GCLgrid coordinate system.

Inherited From:
BasicGCLgrid
Source:
gclgrid.h:232
Param:
p point to convert stored in a @link Geographic_point @endlink data structure.
Returns:
Cartesian_point data structure (see @endlink) )
Code:
public Cartesian_point gtoc ( Geographic_point p )

method interpolate

? ^  < > 
Linear interpolation function for a field.

This is one of the core algorithms described in detail in the Fan and Pavlis (in review) paper. It is intended as a low level routine accessible to the user if desired. Most applications, however, will likely prefer to use a higher level application of this method through something like the += operator. It is CRITICAL to recognize that this function must be called AFTER a previous call to lookup on the same point. This routine blindly uses the index stored in the object and will return total garbage if the lookup was not called or returned an error condition that was not handled. i.e. for efficieny this function simply assumes the interpolation requested will work. For this reason it will never throw an exception.

Source:
gclgrid.h:825
Params:
x1p - Cartesian x1 coordinate of point to where the field is to be interpolated
x2p - Cartesian x2 coordinate of point to where the field is to be interpolated
x3p - Cartesian x3 coordinate of point to where the field is to be interpolated
Returns:
interpolated value of the field at the requested point.
Code:
public double interpolate ( double x1p ,
double x2p ,
double x3p )

method lat

? ^  < > 
Get the latitude (in radians) of a grid point.

Inherited From:
GCLgrid
Source:
gclgrid.h:443
Params:
i1 Value of grid index 1 for point desired.
i2 Value of grid index 2 for point desired.
Returns:
latitude in radians of the requested grid point.
Code:
public double lat ( int i1 ,
int i2 )

method lon

? ^  < > 
Get the longitude (in radians) of a grid point.

Inherited From:
GCLgrid
Source:
gclgrid.h:451
Params:
i1 Value of grid index 1 for point desired.
i2 Value of grid index 2 for point desired.
Returns:
longitude in radians of the requested grid point.
Code:
public double lon ( int i1 ,
int i2 )

method lookup

? ^  < > 
Find the index position of a point in a GCLgrid.

This is a low level function to find the location of a point specified as the Cartesian, ordered pair (x1p,x2p) in a grid. It does not return the actual index positions, but only sets the internal index. The routine is very procedural returning an integer code (see below) indicating success or failure of the lookup. This was intentional as this routine is called millions of times in some contexts so efficiency is critical. The alternative would be to throw an exception when a lookup failed, but since this is viewed as a common problem that could happen millions of times this was a potential efficiency problems (the books all say throwing exceptions is an expensive operation).

Inherited From:
GCLgrid
Source:
gclgrid.h:419
Params:
x1p - Cartesian x1 coordinate of point to find within the grid
x2p - Cartesian x2 coordinate of point to find within the grid
Returns:
2 when point is in gray area within on nominal grid spacing of the edge 1 when the point is outside the bounding box. 0 on success.\ -1 if the lookup function did not converge.

Code:
public int lookup ( double x1p ,
double x2p )

operator *=

? ^  < > 
Multiply all field values by a constant scale factor.

Source:
gclgrid.h:805
Param:
c constant by which the field is to be scaled.
Code:
public void operator *= ( double c )

operator +=

? ^  < > 
Add one field to another.

This acts like the += operator for simple types, but does so for an entire field defined on a grid. As for simple types the field on the right hand side is accumulated to the field on the left had side of the operator. This works even if the the two fields have different transformation properties and do not match in positions. The most important limitation to understand, however, is basic sampling. The field to contain the accumulation needs to be as denser or more densely sampled as the field on the right hand side to avoid aliasing effects. This is exactly like time series sampling -- upsampling can just be done by interpolation but downsampling requires an antialiasing (smoother) filter.

Source:
gclgrid.h:799
Code:
public void operator += ( GCLscalarfield & )

operator =

? ^  < > 
Standard assignment operator
Source:
gclgrid.h:749
Code:
public GCLscalarfield & operator = ( const GCLscalarfield & )

method r

? ^  < > 
Get the radius from the center of the Earth of a grid point.

Inherited From:
GCLgrid
Source:
gclgrid.h:459
Params:
i1 Value of grid index 1 for point desired.
i2 Value of grid index 2 for point desired.
Returns:
Earth radius in kilometers of the requested grid point.
Code:
public double r ( int i1 ,
int i2 )

method reset_index

? ^  < > 
See BasicGCLgrid::reset_index
Inherited From:
GCLgrid
Source:
gclgrid.h:421
Code:
public void reset_index ( )

method set_transformation_matrix

? ^  < > 
Set or reset the transformation properties for the grid.

The transformation properties are uniquely defined by the coordinate system origin and azimuth_y so if these are all that are known this low level member function can be called to set the transformation properties. It is of minimal use to most users and should be used cautiously and only if you thoroughly understand the way this all works.

Inherited From:
BasicGCLgrid
Source:
gclgrid.h:190
Code:
public void set_transformation_matrix ( )

attribute val

? ^  < > 
Scalar field variable stored in a two-dimensional C array.

Index of the field is parallel with coordinate arrays x1, x2, and x3 that define grid point positions in space.

Source:
gclgrid.h:696
Code:
public double * * val

Created Fri Jan 21 08:54:55 2005.
This documentation was generated automatically by
ccdoc v08r41 2004/09/29 bin_opt_suncc_sun4-solaris-2.8.
Click here to submit a bug report or feature request for ccdoc.
Click here to return to the top of the page.