clGridBase Class Reference

Grid Base - Version 1.0 Objects of the grid data type will be instantiated from this class. More...

#include <GridBase.h>

Inheritance diagram for clGridBase:

clWorkerBase List of all members.

Public Member Functions

int GetObjectVersion ()
 Returns the version number of the clGridBase class.
void GetData (xercesc::DOMDocument *p_oDoc)
 Reads in a grid's map, if present in a file.
void ReadMapFile (xercesc::DOMDocument *p_oDoc)
 Reads a map file.
void ChangePackageDataStructure (short int iNumIntVals, short int iNumFloatVals, short int iNumCharVals, short int iNumBoolVals)
 Changes the data structure for the packages, as for changing from defaults.
void GetValueAtPoint (float fX, float fY, short int iCode, int *p_iValHolder)
 Retrieves the value of an integer grid data member at an (X, Y) location.
void GetValueAtPoint (float fX, float fY, short int iCode, float *p_fValHolder)
 Retrieves the value of a float grid data member at an (X, Y) location.
void GetValueAtPoint (float fX, float fY, short int iCode, char *p_cValHolder)
 Retrieves the value of a char grid data member at an (X, Y) location.
void GetValueAtPoint (float fX, float fY, short int iCode, bool *p_bValHolder)
 Retrieves the value of a bool grid data member at an (X, Y) location.
void GetValueOfCell (int iX, int iY, short int iCode, int *p_iValHolder)
 Retrieves the value of an integer data member for a particular grid cell.
void GetValueOfCell (int iX, int iY, short int iCode, float *p_fValHolder)
 Retrieves the value of a float data member for a particular grid cell.
void GetValueOfCell (int iX, int iY, short int iCode, char *p_cValHolder)
 Retrieves the value of a char data member for a particular grid cell.
void GetValueOfCell (int iX, int iY, short int iCode, bool *p_bValHolder)
 Retrieves the value of a bool data member for a particular grid cell.
float GetAverageFloatValue (float fX, float fY, short int iCode, float fRadius)
 Returns the average value of the grid cells in a circle for a float data member.
float GetAverageIntValue (float fX, float fY, short int iCode, float fRadius)
 Returns the average value of the grid cells in a circle for a integer data member.
float GetAverageFloatValue (float fFromX, float fFromY, float fToX, float fToY, short int iCode)
 Returns the average value of the grid cells in a rectangle for a float data member.
float GetAverageIntValue (float fFromX, float fFromY, float fToX, float fToY, short int iCode)
 Returns the average value of the grid cells in a rectangle for an int data member.
float GetOriginXOfCell (int iX)
 Gets the real X coordinate of the origin of a grid cell at a given X grid number.
float GetOriginYOfCell (int iY)
 Gets the real Y coordinate of the origin of a grid cell at a given Y grid number.
float GetEndXOfCell (int iX)
 Gets the real X coordinate of the end of a grid cell at a given X grid number.
float GetEndYOfCell (int iY)
 Gets the real Y coordinate of the end of a grid cell at a given Y grid number.
clPackageGetFirstPackageOfCell (int iX, int iY)
 Retrieves first package in linked list for a grid cell.
clPackageGetFirstPackageAtPoint (float fX, float fY)
 Retrieves first package in linked list for a point.
void GetPointOfCell (short int iCellX, short int iCellY, float *fX, float *fY)
 Gets the coordinates of a point at the center of a grid cell.
void GetCellOfPoint (float fX, float fY, short int *iCellX, short int *iCellY)
 Retrieves the cell numbers for a point.
int GetNumberXCells ()
 Gets number of cells in the X direction.
int GetNumberYCells ()
 Gets number of cells in the Y direction.
float GetLengthXCells ()
 Gets the length of a cell in the X direction.
float GetLengthYCells ()
 Gets the length of a cell in the Y direction.
int GetNumberIntDataMembers ()
 Gets the number of int data members.
int GetNumberFloatDataMembers ()
 Gets the number of float data members.
int GetNumberCharDataMembers ()
 Gets the number of char data members.
int GetNumberBoolDataMembers ()
 Gets the number of bool data members.
int GetNumberIntPackageDataMembers ()
 Gets the number of package int data members.
int GetNumberFloatPackageDataMembers ()
 Gets the number of package float data members.
int GetNumberCharPackageDataMembers ()
 Gets the number of package char data members.
int GetNumberBoolPackageDataMembers ()
 Gets the number of package bool data members.
bool GetPackageDataChanged ()
 Gets whether or not the package data structure has changed.
void SetValueAtPoint (float fX, float fY, short int iCode, float fValue)
 Sets the value of a float data member for the grid cell containing an (X, Y) location.
void SetValueAtPoint (float fX, float fY, short int iCode, int iValue)
 Sets the value of an integer data member for the grid cell containing an (X, Y) location.
void SetValueAtPoint (float fX, float fY, short int iCode, char *p_cValue)
 Sets the value of a char data member for the grid cell containing an (X, Y) location.
void SetValueAtPoint (float fX, float fY, short int iCode, bool bValue)
 Sets the value of a bool data member for the grid cell containing an (X, Y) location.
void SetValueOfCell (int iX, int iY, short int iCode, float fValue)
 Sets the value of a float data member for a particular grid cell.
void SetValueOfCell (int iX, int iY, short int iCode, int iValue)
 Sets the value of an integer data member for a particular grid cell.
void SetValueOfCell (int iX, int iY, short int iCode, char *p_cValue)
 Sets the value of a char data member for a particular grid cell.
void SetValueOfCell (int iX, int iY, short int iCode, bool bValue)
 Sets the value of a bool data member for a particular grid cell.
short int RegisterInt (char *cLabel)
 Registers an integer data member.
short int RegisterFloat (char *cLabel)
 Registers a float data member.
short int RegisterChar (char *cLabel)
 Registers a char data member.
short int RegisterBool (char *cLabel)
 Registers a bool data member.
short int RegisterPackageInt (char *cLabel)
 Registers a package integer data member.
short int RegisterPackageFloat (char *cLabel)
 Registers a package float data member.
short int RegisterPackageChar (char *cLabel)
 Registers a package char data member.
short int RegisterPackageBool (char *cLabel)
 Registers a package bool data member.
clPackageCreatePackage (clPackage *p_oPreviousPackage)
 Creates a package.
clPackageCreatePackageOfCell (int iX, int iY)
 Creates a package.
clPackageCreatePackageAtPoint (float fX, float fY)
 Creates a package.
void DeletePackage (clPackage *p_oOldPackage)
 Deletes a package.
short int GetIntDataCode (char *cLabel)
 Gets the code for an integer data member.
short int GetFloatDataCode (char *cLabel)
 Gets the code for a float data member.
short int GetCharDataCode (char *cLabel)
 Gets the code for a char data member.
short int GetBoolDataCode (char *cLabel)
 Gets the code for a bool data member.
short int GetPackageIntDataCode (char *cLabel)
 Gets the code for a package integer data member.
short int GetPackageFloatDataCode (char *cLabel)
 Gets the code for a package float data member.
short int GetPackageCharDataCode (char *cLabel)
 Gets the code for a package char data member.
short int GetPackageBoolDataCode (char *cLabel)
 Gets the code for a package bool data member.
char * GetIntDataLabel (short int iCode)
 Gets the label for an integer data member.
char * GetFloatDataLabel (short int iCode)
 Gets the label for a float data member.
char * GetCharDataLabel (short int iCode)
 Gets the label for a char data member.
char * GetBoolDataLabel (short int iCode)
 Gets the label for a bool data member.
char * GetPackageIntDataLabel (short int iCode)
 Gets the label for a package integer data member.
char * GetPackageFloatDataLabel (short int iCode)
 Gets the label for a package float data member.
char * GetPackageCharDataLabel (short int iCode)
 Gets the label for a package char data member.
char * GetPackageBoolDataLabel (short int iCode)
 Gets the label for a package bool data member.

Protected Member Functions

 clGridBase (clSimManager *p_oSimManager, char *cGridName, short int iNumIntVals, short int iNumFloatVals, short int iNumCharVals, short int iNumBoolVals, float fXCellLength=0, float fYCellLength=0)
 Constructor.
 ~clGridBase ()
 Destructor.
short int RegisterDataMember (char *cLabel, short int iNumVals, char **p_cLabelList)
 Core function for registering new data members.
float GetAverageValue (float fX, float fY, short int iCode, float fRadius, bool bFloat)
 This is the function that actually calculates a circle's average value.
float GetAverageValue (float fFromX, float fFromY, float fToX, float fToY, short int iCode, bool bFloat)
 This is the function that actually calculates a rectangle's average value.

Protected Attributes

stcRecords ** mp_gridVals
 The structure holding grid cell data Grid cell array.
short int m_iNumIntVals
 How many integer data members per grid cell.
short int m_iNumFloatVals
 How many float data members per grid cell.
short int m_iNumCharVals
 How many char data members per grid cell.
short int m_iNumBoolVals
 How many bool data members per grid cell.
char ** mp_cIntLabels
 Labels for each of the integer data members.
char ** mp_cFloatLabels
 Labels for each of the float data members.
char ** mp_cCharLabels
 Labels for each of the char data members.
char ** mp_cBoolLabels
 Labels for each of the bool data members.
float m_fXCellSize
 Length of grid cells in the X direction, in meters.
float m_fYCellSize
 Length of grid cells in the Y direction, in meters.
float m_fYPlotLength
 Length of plot in Y direction.
float m_fXPlotLength
 Length of plot in X direction.
int m_iNumXCells
 Number of grid divisions along the X axis.
int m_iNumYCells
 Number of grid divisions along the Y axis.
char m_cMapFileVersion [MAX_VERSION_SIZE]
 File version of map file.
bool m_bPackageChangeAllowed
 Whether or not the package data structure may be changed.
bool m_bPackageDataChanged
 Whether or not the packages have been set up with a different data structure from the grid.
short int m_iNumPackageIntVals
 Number of package integer data members.
short int m_iNumPackageFloatVals
 Number of package float data members.
short int m_iNumPackageCharVals
 Number of package char data members.
short int m_iNumPackageBoolVals
 Number of package bool data members.
char ** mp_cPackageIntLabels
 Labels for each of the integer data members.
char ** mp_cPackageFloatLabels
 Labels for each of the float data members.
char ** mp_cPackageCharLabels
 Labels for each of the char data members.
char ** mp_cPackageBoolLabels
 Labels for each of the bool data members.

Friends

class clGridManager
class clPackage
class clGridTest
 For testing purposes.

Detailed Description

Grid Base - Version 1.0 Objects of the grid data type will be instantiated from this class.

The grid data type handles values which vary in space. It has its own grid coordinate system which may have a different resolution from the plot as a whole.

A grid is a 2D array of stcRecord structures. The size of the array is number of grid cells in the X direction by number in the Y direction (thus, one stcRecord per grid cell). The stcRecord structure has four arrays - one for ints, floats, char strings, and bools. All stcRecords for a grid have the same array size, which is set in the grid's constructor. You don't have to have variables of each type when you create a grid - the grid is happy to leave an array as NULL.

In addition, each stcRecord structure (and thus, each grid cell) has an optional linked list of clPackage objects. Each package object also has four arrays (int, float, char string, bool). All package objects for a grid are also uniform, but they can be different from the main grid. So for instance, your grid might contain space for 3 floats and 1 int in its cells within the stcRecord structures, and then 2 bools in its packages.

clBehavior objects can access and set grid values either through the grid's own coordinates (using X and Y grid numbers) or at specific point coordinates within the plot.

This class knows about the torus shape of the clPlot.

You cannot create objects of this correctly. Use the method clSimManager::CreateGrid() to create one. This ensures that created grids fall under the ownership of the clGridManager class. By the same token, do not delete grids you create. clGridManager will take care of freeing the memory.

Copyright 2003 Charles D. Canham.

Author:
Lora E. Murphy

Edit history:
-----------------
April 28, 2004 - Submitted as beta (LEM)


Constructor & Destructor Documentation

clGridBase::clGridBase clSimManager p_oSimManager,
char *  cGridName,
short int  iNumIntVals,
short int  iNumFloatVals,
short int  iNumCharVals,
short int  iNumBoolVals,
float  fXCellLength = 0,
float  fYCellLength = 0
[protected]
 

Constructor.

This will set up the value arrays for the grid cells. Values will be initialized to 0, false, or empty string, as appropriate. The grid will not be ready to use after this; the variables must be registered with labels first using the register functions below.

This will also default a package data structure which is the same as the grid's.

Parameters:
p_oSimManager A pointer to the sim manager object.
cGridName An identifying name string for the grid object.
iNumIntVals Number of integer data members in a grid cell record. Can be 0.
iNumFloatVals Number of float data members in a grid cell record. Can be 0.
iNumCharVals Number of char data members in a grid cell record. Can be 0.
iNumBoolVals Number of bool data members in a grid cell record. Can be 0.
fXCellLength The length of a grid cell in the X direction, in meters. Not required. If ommitted this will default to the plot's grid cell length.
fYCellLength The length of a grid cell in the Y direction, in meters. Not required. If this is ommitted (i.e. = 0), it is assumed the grid cells are square and the value for the X length is used.


Member Function Documentation

void clGridBase::ChangePackageDataStructure short int  iNumIntVals,
short int  iNumFloatVals,
short int  iNumCharVals,
short int  iNumBoolVals
 

Changes the data structure for the packages, as for changing from defaults.

This will wipe out all labels. This is only allowed until packages actually exist - then this will throw an ILLEGAL_OP error.

If this function is used, all variables for the package must be registered, even if they have already been registered with the grid.

Parameters:
iNumIntVals Number of package integer data memebers.
iNumFloatVals Number of package float data memebers.
iNumCharVals Number of package char data memebers.
iNumBoolVals Number of package bool data memebers.

clPackage* clGridBase::CreatePackage clPackage p_oPreviousPackage  ) 
 

Creates a package.

The new package will be placed after a specified other package, between it and the next package on the linked list.

Parameters:
p_oPreviousPackage The package after which to place the new package.
Returns:
Pointer to the new package.
Exceptions:
Error if p_oPreviousPackage is NULL.

clPackage* clGridBase::CreatePackageAtPoint float  fX,
float  fY
 

Creates a package.

The new package will be placed as the first package for the grid cell of a specific grid cell.

Parameters:
fX X coordinate of point.
fY Y coordinate of point.
Returns:
Pointer to the new package.
Exceptions:
Error if the point is not within the grid boundaries.

clPackage* clGridBase::CreatePackageOfCell int  iX,
int  iY
 

Creates a package.

The new package will be placed as the first package for a specific grid cell.

Parameters:
iX Grid cell number in the X direction.
iY Grid cell number in the Y direction.
Returns:
Pointer to the new package.
Exceptions:
Error if the grid numbers are invalid.

void clGridBase::DeletePackage clPackage p_oOldPackage  ) 
 

Deletes a package.

If the package is in the middle of the package list, the gap will be closed.

Parameters:
p_oOldPackage Package to delete.

float clGridBase::GetAverageFloatValue float  fFromX,
float  fFromY,
float  fToX,
float  fToY,
short int  iCode
 

Returns the average value of the grid cells in a rectangle for a float data member.

The first point is the point of the rectangle closest to the origin. All cells which are included in this rectangle, in whole or in part, are included in the average; there is no weighting factor if it's only a partial grid. This ignores packages.

Parameters:
fFromX X coordinate of the point closest to the origin.
fFromY Y coordinate of the point closest to the origin.
fToX X coordinate of the point farthest from the origin.
fToY Y coordinate of the point farthest from the origin.
iCode Code for the value desired. This is what is returned from registering a variable or from using GetDataCode.
Returns:
The average specified.
Exceptions:
modelErr if the "to" point coordinates are less than the "from" point coordinates.

float clGridBase::GetAverageFloatValue float  fX,
float  fY,
short int  iCode,
float  fRadius
 

Returns the average value of the grid cells in a circle for a float data member.

The circle is defined by a point and a radius (in meters). All grid cells which are included in this circle, in whole or in part, are included in the average; there is no weighting factor if it's only a partial grid. This ignores packages.

Parameters:
fX X coordinate of circle center.
fY Y coordinate of circle center.
fRadius Radius of circle over which to average values.
iCode Code for the value desired. This is what is returned from registering a variable or from using GetDataCode.
Returns:
The average specified.

float clGridBase::GetAverageIntValue float  fFromX,
float  fFromY,
float  fToX,
float  fToY,
short int  iCode
 

Returns the average value of the grid cells in a rectangle for an int data member.

The first point is the point of the rectangle closest to the origin. All cells which are included in this rectangle, in whole or in part, are included in the average; there is no weighting factor if it's only a partial grid. This ignores packages.

Parameters:
fFromX X coordinate of the point closest to the origin.
fFromY Y coordinate of the point closest to the origin.
fToX X coordinate of the point farthest from the origin.
fToY Y coordinate of the point farthest from the origin.
iCode Code for the value desired. This is what is returned from registering a variable or from using GetDataCode.
Returns:
The average specified.
Exceptions:
modelErr if the "to" point coordinates are less than the "from" point coordinates.

float clGridBase::GetAverageIntValue float  fX,
float  fY,
short int  iCode,
float  fRadius
 

Returns the average value of the grid cells in a circle for a integer data member.

The circle is defined by a point and a radius (in meters). All grid cells which are included in this circle, in whole or in part, are included in the average; there is no weighting factor if it's only a partial grid. This ignores packages.

Parameters:
fX X coordinate of circle center.
fY Y coordinate of circle center.
fRadius Radius of circle over which to average values.
iCode Code for the value desired. This is what is returned from registering a variable or from using GetDataCode.
Returns:
The average specified.

float clGridBase::GetAverageValue float  fFromX,
float  fFromY,
float  fToX,
float  fToY,
short int  iCode,
bool  bFloat
[protected]
 

This is the function that actually calculates a rectangle's average value.

Parameters:
fFromX X coordinate of the point closest to the origin.
fFromY Y coordinate of the point closest to the origin.
fToX X coordinate of the point farthest from the origin.
fToY Y coordinate of the point farthest from the origin.
iCode Code for the value desired. This is what is returned from registering a variable or from using GetDataCode.
bFloat If true, calculate float values; if false, calculate integer vals.
Returns:
The average specified.
Exceptions:
modelErr if the "to" point coordinates are less than the "from" point coordinates.

float clGridBase::GetAverageValue float  fX,
float  fY,
short int  iCode,
float  fRadius,
bool  bFloat
[protected]
 

This is the function that actually calculates a circle's average value.

Parameters:
fX X coordinate of circle center.
fY Y coordinate of circle center.
fRadius Radius of circle over which to average values.
bFloat If true, calculate float values; if false, calculate integer vals.
iCode Code for the value desired. This is what is returned from registering a variable or from using GetDataCode.
Returns:
The average specified.

short int clGridBase::GetBoolDataCode char *  cLabel  ) 
 

Gets the code for a bool data member.

This function will not be responsible for duplicate labels.

Parameters:
cLabel The data member's label.
Returns:
The code for the value, -1 if the label is unrecognized.

char* clGridBase::GetBoolDataLabel short int  iCode  ) 
 

Gets the label for a bool data member.

This function will not be responsible for duplicate labels.

Parameters:
iCode The data member's code.
Returns:
The code's data label, or an empty string if the code is unrecognized.

void clGridBase::GetCellOfPoint float  fX,
float  fY,
short int *  iCellX,
short int *  iCellY
 

Retrieves the cell numbers for a point.

Parameters:
fX X coordinate of point.
fY Y coordinate of point.
iCellX Address of variable in which to place X grid cell number
iCellY Address of variable in which to place X grid cell number

short int clGridBase::GetCharDataCode char *  cLabel  ) 
 

Gets the code for a char data member.

This function will not be responsible for duplicate labels.

Parameters:
cLabel The data member's label.
Returns:
The code for the value, -1 if the label is unrecognized.

char* clGridBase::GetCharDataLabel short int  iCode  ) 
 

Gets the label for a char data member.

This function will not be responsible for duplicate labels.

Parameters:
iCode The data member's code.
Returns:
The code's data label, or an empty string if the code is unrecognized.

void clGridBase::GetData xercesc::DOMDocument *  p_oDoc  )  [virtual]
 

Reads in a grid's map, if present in a file.

Parameters:
p_oDoc DOM tree of parsed document.

Implements clWorkerBase.

float clGridBase::GetEndXOfCell int  iX  ) 
 

Gets the real X coordinate of the end of a grid cell at a given X grid number.

The end of the cell is the point farthest from the origin of the plot. Since the grid line itself would be part of the next cell over, this is the grid line minus an infinitesimal amount.

Parameters:
iX X grid number of the cell.
Returns:
X end coordinate.
Exceptions:
modelErr if the coordinate is not inside the plot.

float clGridBase::GetEndYOfCell int  iY  ) 
 

Gets the real Y coordinate of the end of a grid cell at a given Y grid number.

The end of the cell is the point farthest from the origin of the plot. Since the grid line itself would be part of the next cell over, this is the grid line minus an infinitesimal amount.

Parameters:
iY Y grid number of the cell.
Returns:
Y end coordinate.
Exceptions:
modelErr if the coordinate is not inside the plot.

clPackage* clGridBase::GetFirstPackageAtPoint float  fX,
float  fY
 

Retrieves first package in linked list for a point.

If there are no packages for this point, NULL is returned.

Parameters:
fX X coordinate of point.
fY Y coordinate of point.
Returns:
First package at that point, or NULL if there are no packages.

clPackage* clGridBase::GetFirstPackageOfCell int  iX,
int  iY
 

Retrieves first package in linked list for a grid cell.

If there are no packages for this cell, NULL is returned.

Parameters:
iX Grid number in the X direction for cell for which the package is desired.
iY Grid number in the Y direction for cell for which the package is desired.
Returns:
First package of grid cell, or NULL if there are no packages.

short int clGridBase::GetFloatDataCode char *  cLabel  ) 
 

Gets the code for a float data member.

This function will not be responsible for duplicate labels.

Parameters:
cLabel The data member's label.
Returns:
The code for the value, -1 if the label is unrecognized.

char* clGridBase::GetFloatDataLabel short int  iCode  ) 
 

Gets the label for a float data member.

This function will not be responsible for duplicate labels.

Parameters:
iCode The data member's code.
Returns:
The code's data label, or an empty string if the code is unrecognized.

short int clGridBase::GetIntDataCode char *  cLabel  ) 
 

Gets the code for an integer data member.

This function will not be responsible for duplicate labels.

Parameters:
cLabel The data member's label.
Returns:
The code for the value, -1 if the label is unrecognized.

char* clGridBase::GetIntDataLabel short int  iCode  ) 
 

Gets the label for an integer data member.

This function will not be responsible for duplicate labels.

Parameters:
iCode The data member's code.
Returns:
The code's data label, or an empty string if the code is unrecognized.

float clGridBase::GetLengthXCells  )  [inline]
 

Gets the length of a cell in the X direction.

Returns:
Length of the cell in the X direction, in meters.

float clGridBase::GetLengthYCells  )  [inline]
 

Gets the length of a cell in the Y direction.

Returns:
Length of the cell in the Y direction, in meters.

int clGridBase::GetNumberBoolDataMembers  )  [inline]
 

Gets the number of bool data members.

Returns:
Number of bool data members.

int clGridBase::GetNumberBoolPackageDataMembers  )  [inline]
 

Gets the number of package bool data members.

Returns:
Number of package bool data members.

int clGridBase::GetNumberCharDataMembers  )  [inline]
 

Gets the number of char data members.

Returns:
Number of char data members.

int clGridBase::GetNumberCharPackageDataMembers  )  [inline]
 

Gets the number of package char data members.

Returns:
Number of package char data members.

int clGridBase::GetNumberFloatDataMembers  )  [inline]
 

Gets the number of float data members.

Returns:
Number of float data members.

int clGridBase::GetNumberFloatPackageDataMembers  )  [inline]
 

Gets the number of package float data members.

Returns:
Number of package float data members.

int clGridBase::GetNumberIntDataMembers  )  [inline]
 

Gets the number of int data members.

Returns:
Number of int data members.

int clGridBase::GetNumberIntPackageDataMembers  )  [inline]
 

Gets the number of package int data members.

Returns:
Number of package int data members.

int clGridBase::GetNumberXCells  )  [inline]
 

Gets number of cells in the X direction.

Returns:
Number of cells in the X direction.

int clGridBase::GetNumberYCells  )  [inline]
 

Gets number of cells in the Y direction.

Returns:
Number of cells in the Y direction.

int clGridBase::GetObjectVersion  )  [inline]
 

Returns the version number of the clGridBase class.

Returns:
clGridBase class version number.

Reimplemented from clWorkerBase.

float clGridBase::GetOriginXOfCell int  iX  ) 
 

Gets the real X coordinate of the origin of a grid cell at a given X grid number.

The origin of the cell is the point closest to the origin of the plot.

Parameters:
iX X grid number of the cell.
Returns:
X origin coordinate.
Exceptions:
modelErr if the coordinate is not inside the plot.

float clGridBase::GetOriginYOfCell int  iY  ) 
 

Gets the real Y coordinate of the origin of a grid cell at a given Y grid number.

The origin of the cell is the point closest to the origin of the plot.

Parameters:
iY Y grid number of the cell.
Returns:
Y origin coordinate.
Exceptions:
modelErr if the coordinate is not inside the plot.

short int clGridBase::GetPackageBoolDataCode char *  cLabel  ) 
 

Gets the code for a package bool data member.

This function will not be responsible for duplicate labels.

Parameters:
cLabel The data member's label.
Returns:
The code for the value, -1 if the label is unrecognized.

char* clGridBase::GetPackageBoolDataLabel short int  iCode  ) 
 

Gets the label for a package bool data member.

This function will not be responsible for duplicate labels.

Parameters:
iCode The data member's code.
Returns:
The code's data label, or an empty string if the code is unrecognized.

short int clGridBase::GetPackageCharDataCode char *  cLabel  ) 
 

Gets the code for a package char data member.

This function will not be responsible for duplicate labels.

Parameters:
cLabel The data member's label.
Returns:
The code for the value, -1 if the label is unrecognized.

char* clGridBase::GetPackageCharDataLabel short int  iCode  ) 
 

Gets the label for a package char data member.

This function will not be responsible for duplicate labels.

Parameters:
iCode The data member's code.
Returns:
The code's data label, or an empty string if the code is unrecognized.

bool clGridBase::GetPackageDataChanged  )  [inline]
 

Gets whether or not the package data structure has changed.

Returns:
True if package data structure is different from core data member structure; false otherwise.

short int clGridBase::GetPackageFloatDataCode char *  cLabel  ) 
 

Gets the code for a package float data member.

This function will not be responsible for duplicate labels.

Parameters:
cLabel The data member's label.
Returns:
The code for the value, -1 if the label is unrecognized.

char* clGridBase::GetPackageFloatDataLabel short int  iCode  ) 
 

Gets the label for a package float data member.

This function will not be responsible for duplicate labels.

Parameters:
iCode The data member's code.
Returns:
The code's data label, or an empty string if the code is unrecognized.

short int clGridBase::GetPackageIntDataCode char *  cLabel  ) 
 

Gets the code for a package integer data member.

This function will not be responsible for duplicate labels.

Parameters:
cLabel The data member's label.
Returns:
The code for the value, -1 if the label is unrecognized.

char* clGridBase::GetPackageIntDataLabel short int  iCode  ) 
 

Gets the label for a package integer data member.

This function will not be responsible for duplicate labels.

Parameters:
iCode The data member's code.
Returns:
The code's data label, or an empty string if the code is unrecognized.

void clGridBase::GetPointOfCell short int  iCellX,
short int  iCellY,
float *  fX,
float *  fY
 

Gets the coordinates of a point at the center of a grid cell.

Parameters:
iCellX X number of grid cell
iCellY Y number of grid cell
fX Address of variable in which to put X coordinate
fY Address of variable in which to put Y coordinate

void clGridBase::GetValueAtPoint float  fX,
float  fY,
short int  iCode,
bool *  p_bValHolder
 

Retrieves the value of a bool grid data member at an (X, Y) location.

This function determines which internal grid cell this location is and places the grid value into the variable passed.

Parameters:
fX X coordinate of point for which the value is desired.
fY Y coordinate of point for which the value is desired.
iCode Code for the value desired. This is what is returned from registering a variable or from using GetDataCode.
p_bValHolder Pointer to where the return value should be placed.
Exceptions:
BAD_DATA error if the point is not within the grid or the code is not valid.

void clGridBase::GetValueAtPoint float  fX,
float  fY,
short int  iCode,
char *  p_cValHolder
 

Retrieves the value of a char grid data member at an (X, Y) location.

This function determines which internal grid cell this location is and places the grid value into the variable passed.

Parameters:
fX X coordinate of point for which the value is desired.
fY Y coordinate of point for which the value is desired.
iCode Code for the value desired. This is what is returned from registering a variable or from using GetDataCode.
p_cValHolder Pointer to where the return value should be placed.
Exceptions:
BAD_DATA error if the point is not within the grid or the code is not valid.

void clGridBase::GetValueAtPoint float  fX,
float  fY,
short int  iCode,
float *  p_fValHolder
 

Retrieves the value of a float grid data member at an (X, Y) location.

This function determines which internal grid cell this location is and places the grid value into the variable passed.

Parameters:
fX X coordinate of point for which the value is desired.
fY Y coordinate of point for which the value is desired.
iCode Code for the value desired. This is what is returned from registering a variable or from using GetDataCode.
p_fValHolder Pointer to where the return value should be placed.
Exceptions:
BAD_DATA error if the point is not within the grid or the code is not valid.

void clGridBase::GetValueAtPoint float  fX,
float  fY,
short int  iCode,
int *  p_iValHolder
 

Retrieves the value of an integer grid data member at an (X, Y) location.

This function determines which internal grid cell this location is and places the grid value into the variable passed.

Parameters:
fX X coordinate of point for which the value is desired.
fY Y coordinate of point for which the value is desired.
iCode Code for the value desired. This is what is returned from registering a variable or from using GetDataCode.
p_iValHolder Pointer to where the return value should be placed.
Exceptions:
BAD_DATA error if the point is not within the grid or the code is not valid.

void clGridBase::GetValueOfCell int  iX,
int  iY,
short int  iCode,
bool *  p_bValHolder
 

Retrieves the value of a bool data member for a particular grid cell.

The grid cell numbering in each direction starts at 0 and goes to number of grid cells minus one.

Parameters:
iX Grid number in the X direction for cell for which the value is desired.
iY Grid number in the Y direction for cell for which the value is desired.
iCode Code for the value desired. This is what is returned from registering a variable or from using GetDataCode.
p_bValHolder Pointer to where the return value should be placed.
Exceptions:
BAD_DATA error if the grid cell coordinates are not within the grid or the code is not valid.

void clGridBase::GetValueOfCell int  iX,
int  iY,
short int  iCode,
char *  p_cValHolder
 

Retrieves the value of a char data member for a particular grid cell.

The grid cell numbering in each direction starts at 0 and goes to number of grid cells minus one.

Parameters:
iX Grid number in the X direction for cell for which the value is desired.
iY Grid number in the Y direction for cell for which the value is desired.
iCode Code for the value desired. This is what is returned from registering a variable or from using GetDataCode.
p_cValHolder Pointer to where the return value should be placed.
Exceptions:
BAD_DATA error if the grid cell coordinates are not within the grid or the code is not valid.

void clGridBase::GetValueOfCell int  iX,
int  iY,
short int  iCode,
float *  p_fValHolder
 

Retrieves the value of a float data member for a particular grid cell.

The grid cell numbering in each direction starts at 0 and goes to number of grid cells minus one.

Parameters:
iX Grid number in the X direction for cell for which the value is desired.
iY Grid number in the Y direction for cell for which the value is desired.
iCode Code for the value desired. This is what is returned from registering a variable or from using GetDataCode.
p_fValHolder Pointer to where the return value should be placed.
Exceptions:
BAD_DATA error if the grid cell coordinates are not within the grid or the code is not valid.

void clGridBase::GetValueOfCell int  iX,
int  iY,
short int  iCode,
int *  p_iValHolder
 

Retrieves the value of an integer data member for a particular grid cell.

The grid cell numbering in each direction starts at 0 and goes to number of grid cells minus one.

Parameters:
iX Grid number in the X direction for cell for which the value is desired.
iY Grid number in the Y direction for cell for which the value is desired.
iCode Code for the value desired. This is what is returned from registering a variable or from using GetDataCode.
p_iValHolder Pointer to where the return value should be placed.
Exceptions:
BAD_DATA error if the grid cell coordinates are not within the grid or the code is not valid.

void clGridBase::ReadMapFile xercesc::DOMDocument *  p_oDoc  ) 
 

Reads a map file.

Why is this here when map file writing is in output? Because a map might need to be read as part of parameter file input, and we can't depend on output's having been loaded as a behavior.

This will read a map file into the grid object. It will search for a grid map with a grid name matching this grid's name. It will stop and load the first one it finds; any subsequent grids with this name will be ignored. If the plot info doesn't match this grid's, it will throw a BAD_DATA error. The map doesn't have to have all the same data members as the grid, but all data members in the map must be in the grid, including all package data.

The absence of a map for this grid in the document causes no changes to be made.

Parameters:
p_oDoc DOM tree of parsed document.

short int clGridBase::RegisterBool char *  cLabel  ) 
 

Registers a bool data member.

This will not check to make sure that there is not already a variable registered with that name.

Parameters:
cLabel String with the name of this variable. Keep it short.
Returns:
A code that will be used to access values of that type in the future. This is faster than trying to do lookups by character string.
Exceptions:
ILLEGAL_OP error if there is no more space for new data members.

short int clGridBase::RegisterChar char *  cLabel  ) 
 

Registers a char data member.

This will not check to make sure that there is not already a variable registered with that name.

Parameters:
cLabel String with the name of this variable. Keep it short.
Returns:
A code that will be used to access values of that type in the future. This is faster than trying to do lookups by character string.
Exceptions:
ILLEGAL_OP error if there is no more space for new data members.

short int clGridBase::RegisterDataMember char *  cLabel,
short int  iNumVals,
char **  p_cLabelList
[inline, protected]
 

Core function for registering new data members.

If successful, it will return a code for that member for the species and type combo.

Parameters:
cLabel A string with the name of this variable - keep it short.
iNumVals Number total allowed variables of this type
p_cLabelList Pointer to the correct labels array
Returns:
A code that will be used to access values of that type in the future. This is faster than trying to do lookups by character string.
Exceptions:
If registration is unsuccessful, a BAD_DATA or ILLEGAL_OP error will be thrown.

short int clGridBase::RegisterFloat char *  cLabel  ) 
 

Registers a float data member.

This will not check to make sure that there is not already a variable registered with that name.

Parameters:
cLabel String with the name of this variable. Keep it short.
Returns:
A code that will be used to access values of that type in the future. This is faster than trying to do lookups by character string.
Exceptions:
ILLEGAL_OP error if there is no more space for new data members.

short int clGridBase::RegisterInt char *  cLabel  ) 
 

Registers an integer data member.

This will not check to make sure that there is not already a variable registered with that name.

Parameters:
cLabel String with the name of this variable. Keep it short.
Returns:
A code that will be used to access values of that type in the future. This is faster than trying to do lookups by character string.
Exceptions:
ILLEGAL_OP error if there is no more space for new data members.

short int clGridBase::RegisterPackageBool char *  cLabel  ) 
 

Registers a package bool data member.

This function must only be used if you need to set up packages with a different data structure than the main grid. If the data structures are the same, then packages automatically get the same data member registrations as the main grid.

Parameters:
cLabel String with the name of this variable. Keep it short.
Returns:
A code that will be used to access values of that type in the future. This is faster than trying to do lookups by character string.
Exceptions:
ILLEGAL_OP error if there is no more space for new data members.

short int clGridBase::RegisterPackageChar char *  cLabel  ) 
 

Registers a package char data member.

This function must only be used if you need to set up packages with a different data structure than the main grid. If the data structures are the same, then packages automatically get the same data member registrations as the main grid.

Parameters:
cLabel String with the name of this variable. Keep it short.
Returns:
A code that will be used to access values of that type in the future. This is faster than trying to do lookups by character string.
Exceptions:
ILLEGAL_OP error if there is no more space for new data members.

short int clGridBase::RegisterPackageFloat char *  cLabel  ) 
 

Registers a package float data member.

This function must only be used if you need to set up packages with a different data structure than the main grid. If the data structures are the same, then packages automatically get the same data member registrations as the main grid.

Parameters:
cLabel String with the name of this variable. Keep it short.
Returns:
A code that will be used to access values of that type in the future. This is faster than trying to do lookups by character string.
Exceptions:
ILLEGAL_OP error if there is no more space for new data members.

short int clGridBase::RegisterPackageInt char *  cLabel  ) 
 

Registers a package integer data member.

This function must only be used if you need to set up packages with a different data structure than the main grid. If the data structures are the same, then packages automatically get the same data member registrations as the main grid.

Parameters:
cLabel String with the name of this variable. Keep it short.
Returns:
A code that will be used to access values of that type in the future. This is faster than trying to do lookups by character string.
Exceptions:
ILLEGAL_OP error if there is no more space for new data members.

void clGridBase::SetValueAtPoint float  fX,
float  fY,
short int  iCode,
bool  bValue
 

Sets the value of a bool data member for the grid cell containing an (X, Y) location.

This function determines which internal grid cell this location is and assigns the grid cell for that grid.

Parameters:
fX X coordinate of point for which the value is desired.
fY Y coordinate of point for which the value is desired.
bValue Value to set.
iCode Code for the value desired. This is what is returned from registering a variable or from using GetDataCode.
Exceptions:
BAD_DATA error if the point is not within the grid or the code is not valid.

void clGridBase::SetValueAtPoint float  fX,
float  fY,
short int  iCode,
char *  p_cValue
 

Sets the value of a char data member for the grid cell containing an (X, Y) location.

This function determines which internal grid cell this location is and assigns the grid cell for that grid.

Parameters:
fX X coordinate of point for which the value is desired.
fY Y coordinate of point for which the value is desired.
p_cValue Value to set.
iCode Code for the value desired. This is what is returned from registering a variable or from using GetDataCode.
Exceptions:
BAD_DATA error if the point is not within the grid or the code is not valid.

void clGridBase::SetValueAtPoint float  fX,
float  fY,
short int  iCode,
int  iValue
 

Sets the value of an integer data member for the grid cell containing an (X, Y) location.

This function determines which internal grid cell this location is and assigns the grid cell for that grid.

Parameters:
fX X coordinate of point for which the value is desired.
fY Y coordinate of point for which the value is desired.
iValue Value to set.
iCode Code for the value desired. This is what is returned from registering a variable or from using GetDataCode.
Exceptions:
BAD_DATA error if the point is not within the grid or the code is not valid.

void clGridBase::SetValueAtPoint float  fX,
float  fY,
short int  iCode,
float  fValue
 

Sets the value of a float data member for the grid cell containing an (X, Y) location.

This function determines which internal grid cell this location is and assigns the grid cell for that grid.

Parameters:
fX X coordinate of point for which the value is desired.
fY Y coordinate of point for which the value is desired.
fValue Value to set.
iCode Code for the value desired. This is what is returned from registering a variable or from using GetDataCode.
Exceptions:
BAD_DATA error if the point is not within the grid or the code is not valid.

void clGridBase::SetValueOfCell int  iX,
int  iY,
short int  iCode,
bool  bValue
 

Sets the value of a bool data member for a particular grid cell.

The grid cell numbering in each direction starts at 0 and goes to number of grid cells minus one.

Parameters:
iX Grid number in the X direction for cell for which the value is desired.
iY Grid number in the Y direction for cell for which the value is desired.
iCode Code for the value desired. This is what is returned from registering a variable or from using GetDataCode.
bValue Value to set.
Exceptions:
BAD_DATA error if the grid cell coordinates are not within the grid or the code is not valid.

void clGridBase::SetValueOfCell int  iX,
int  iY,
short int  iCode,
char *  p_cValue
 

Sets the value of a char data member for a particular grid cell.

The grid cell numbering in each direction starts at 0 and goes to number of grid cells minus one.

Parameters:
iX Grid number in the X direction for cell for which the value is desired.
iY Grid number in the Y direction for cell for which the value is desired.
iCode Code for the value desired. This is what is returned from registering a variable or from using GetDataCode.
p_cValue Value to set.
Exceptions:
BAD_DATA error if the grid cell coordinates are not within the grid or the code is not valid.

void clGridBase::SetValueOfCell int  iX,
int  iY,
short int  iCode,
int  iValue
 

Sets the value of an integer data member for a particular grid cell.

The grid cell numbering in each direction starts at 0 and goes to number of grid cells minus one.

Parameters:
iX Grid number in the X direction for cell for which the value is desired.
iY Grid number in the Y direction for cell for which the value is desired.
iCode Code for the value desired. This is what is returned from registering a variable or from using GetDataCode.
iValue Value to set.
Exceptions:
BAD_DATA error if the grid cell coordinates are not within the grid or the code is not valid.

void clGridBase::SetValueOfCell int  iX,
int  iY,
short int  iCode,
float  fValue
 

Sets the value of a float data member for a particular grid cell.

The grid cell numbering in each direction starts at 0 and goes to number of grid cells minus one.

Parameters:
iX Grid number in the X direction for cell for which the value is desired.
iY Grid number in the Y direction for cell for which the value is desired.
iCode Code for the value desired. This is what is returned from registering a variable or from using GetDataCode.
fValue Value to set.
Exceptions:
BAD_DATA error if the grid cell coordinates are not within the grid or the code is not valid.


Member Data Documentation

stcRecords** clGridBase::mp_gridVals [protected]
 

The structure holding grid cell data Grid cell array.

Size is # X grids by # Y grids.


The documentation for this class was generated from the following file:
Generated on Mon Mar 27 12:51:13 2006 for SORTIE Core C++ Documentation by  doxygen 1.4.6-NO