#include <GridBase.h>
Inheritance diagram for clGridBase:
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. | |
clPackage * | GetFirstPackageOfCell (int iX, int iY) |
Retrieves first package in linked list for a grid cell. | |
clPackage * | GetFirstPackageAtPoint (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. | |
clPackage * | CreatePackage (clPackage *p_oPreviousPackage) |
Creates a package. | |
clPackage * | CreatePackageOfCell (int iX, int iY) |
Creates a package. | |
clPackage * | CreatePackageAtPoint (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. |
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.
|
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.
|
|
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.
|
|
Creates a package. The new package will be placed after a specified other package, between it and the next package on the linked list.
|
|
Creates a package. The new package will be placed as the first package for the grid cell of a specific grid cell.
|
|
Creates a package. The new package will be placed as the first package for a specific grid cell.
|
|
Deletes a package. If the package is in the middle of the package list, the gap will be closed.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
This is the function that actually calculates a rectangle's average value.
|
|
This is the function that actually calculates a circle's average value.
|
|
Gets the code for a bool data member. This function will not be responsible for duplicate labels.
|
|
Gets the label for a bool data member. This function will not be responsible for duplicate labels.
|
|
Retrieves the cell numbers for a point.
|
|
Gets the code for a char data member. This function will not be responsible for duplicate labels.
|
|
Gets the label for a char data member. This function will not be responsible for duplicate labels.
|
|
Reads in a grid's map, if present in a file.
Implements clWorkerBase. |
|
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.
|
|
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.
|
|
Retrieves first package in linked list for a point. If there are no packages for this point, NULL is returned.
|
|
Retrieves first package in linked list for a grid cell. If there are no packages for this cell, NULL is returned.
|
|
Gets the code for a float data member. This function will not be responsible for duplicate labels.
|
|
Gets the label for a float data member. This function will not be responsible for duplicate labels.
|
|
Gets the code for an integer data member. This function will not be responsible for duplicate labels.
|
|
Gets the label for an integer data member. This function will not be responsible for duplicate labels.
|
|
Gets the length of a cell in the X direction.
|
|
Gets the length of a cell in the Y direction.
|
|
Gets the number of bool data members.
|
|
Gets the number of package bool data members.
|
|
Gets the number of char data members.
|
|
Gets the number of package char data members.
|
|
Gets the number of float data members.
|
|
Gets the number of package float data members.
|
|
Gets the number of int data members.
|
|
Gets the number of package int data members.
|
|
Gets number of cells in the X direction.
|
|
Gets number of cells in the Y direction.
|
|
Returns the version number of the clGridBase class.
Reimplemented from clWorkerBase. |
|
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.
|
|
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.
|
|
Gets the code for a package bool data member. This function will not be responsible for duplicate labels.
|
|
Gets the label for a package bool data member. This function will not be responsible for duplicate labels.
|
|
Gets the code for a package char data member. This function will not be responsible for duplicate labels.
|
|
Gets the label for a package char data member. This function will not be responsible for duplicate labels.
|
|
Gets whether or not the package data structure has changed.
|
|
Gets the code for a package float data member. This function will not be responsible for duplicate labels.
|
|
Gets the label for a package float data member. This function will not be responsible for duplicate labels.
|
|
Gets the code for a package integer data member. This function will not be responsible for duplicate labels.
|
|
Gets the label for a package integer data member. This function will not be responsible for duplicate labels.
|
|
Gets the coordinates of a point at the center of a grid cell.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
Registers a bool data member. This will not check to make sure that there is not already a variable registered with that name.
|
|
Registers a char data member. This will not check to make sure that there is not already a variable registered with that name.
|
|
Core function for registering new data members. If successful, it will return a code for that member for the species and type combo.
|
|
Registers a float data member. This will not check to make sure that there is not already a variable registered with that name.
|
|
Registers an integer data member. This will not check to make sure that there is not already a variable registered with that name.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
The structure holding grid cell data Grid cell array. Size is # X grids by # Y grids. |