SORTIE Core C++ Documentation
|
Grid Base - Version 1.0 Objects of the grid data type will be instantiated from this class. More...
#include <Grid.h>
Classes | |
struct | stcRecords |
Public Member Functions | |
void | GetData (xercesc::DOMDocument *p_oDoc) |
Reads in a grid's map, if present in a file. More... | |
void | ReadMapFile (xercesc::DOMDocument *p_oDoc) |
Reads a map file. More... | |
void | ChangePackageDataStructure (short int iNumIntVals, short int iNumFloatVals, short int iNumStringVals, short int iNumBoolVals) |
Changes the data structure for the packages, as for changing from defaults. More... | |
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. More... | |
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. More... | |
void | GetValueAtPoint (float fX, float fY, short int iCode, std::string *p_sValHolder) |
Retrieves the value of a string grid data member at an (X, Y) location. More... | |
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. More... | |
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. More... | |
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. More... | |
void | GetValueOfCell (int iX, int iY, short int iCode, std::string *p_sValHolder) |
Retrieves the value of a string data member for a particular grid cell. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
float | GetOriginXOfCell (int iX) |
Gets the real X coordinate of the origin of a grid cell at a given X grid number. More... | |
float | GetOriginYOfCell (int iY) |
Gets the real Y coordinate of the origin of a grid cell at a given Y grid number. More... | |
float | GetEndXOfCell (int iX) |
Gets the real X coordinate of the end of a grid cell at a given X grid number. More... | |
float | GetEndYOfCell (int iY) |
Gets the real Y coordinate of the end of a grid cell at a given Y grid number. More... | |
clPackage * | GetFirstPackageOfCell (int iX, int iY) |
Retrieves first package in linked list for a grid cell. More... | |
clPackage * | GetFirstPackageAtPoint (float fX, float fY) |
Retrieves first package in linked list for a point. More... | |
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. More... | |
void | GetCellOfPoint (float fX, float fY, short int *iCellX, short int *iCellY) |
Retrieves the cell numbers for a point. More... | |
int | GetNumberXCells () |
Gets number of cells in the X direction. More... | |
int | GetNumberYCells () |
Gets number of cells in the Y direction. More... | |
float | GetLengthXCells () |
Gets the length of a cell in the X direction. More... | |
float | GetLengthYCells () |
Gets the length of a cell in the Y direction. More... | |
int | GetNumberIntDataMembers () |
Gets the number of int data members. More... | |
int | GetNumberFloatDataMembers () |
Gets the number of float data members. More... | |
int | GetNumberStringDataMembers () |
Gets the number of string data members. More... | |
int | GetNumberBoolDataMembers () |
Gets the number of bool data members. More... | |
int | GetNumberIntPackageDataMembers () |
Gets the number of package int data members. More... | |
int | GetNumberFloatPackageDataMembers () |
Gets the number of package float data members. More... | |
int | GetNumberStringPackageDataMembers () |
Gets the number of package string data members. More... | |
int | GetNumberBoolPackageDataMembers () |
Gets the number of package bool data members. More... | |
bool | GetPackageDataChanged () |
Gets whether or not the package data structure has changed. More... | |
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. More... | |
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. More... | |
void | SetValueAtPoint (float fX, float fY, short int iCode, std::string sValue) |
Sets the value of a string data member for the grid cell containing an (X, Y) location. More... | |
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. More... | |
void | SetValueOfCell (int iX, int iY, short int iCode, float fValue) |
Sets the value of a float data member for a particular grid cell. More... | |
void | SetValueOfCell (int iX, int iY, short int iCode, int iValue) |
Sets the value of an integer data member for a particular grid cell. More... | |
void | SetValueOfCell (int iX, int iY, short int iCode, std::string sValue) |
Sets the value of a string data member for a particular grid cell. More... | |
void | SetValueOfCell (int iX, int iY, short int iCode, bool bValue) |
Sets the value of a bool data member for a particular grid cell. More... | |
short int | RegisterInt (const std::string sLabel) |
Registers an integer data member. More... | |
short int | RegisterFloat (const std::string sLabel) |
Registers a float data member. More... | |
short int | RegisterString (const std::string sLabel) |
Registers a string data member. More... | |
short int | RegisterBool (const std::string sLabel) |
Registers a bool data member. More... | |
short int | RegisterPackageInt (const std::string sLabel) |
Registers a package integer data member. More... | |
short int | RegisterPackageFloat (const std::string sLabel) |
Registers a package float data member. More... | |
short int | RegisterPackageString (const std::string sLabel) |
Registers a package string data member. More... | |
short int | RegisterPackageBool (const std::string sLabel) |
Registers a package bool data member. More... | |
clPackage * | CreatePackage (clPackage *p_oPreviousPackage) |
Creates a package. More... | |
clPackage * | CreatePackageOfCell (int iX, int iY) |
Creates a package. More... | |
clPackage * | CreatePackageAtPoint (float fX, float fY) |
Creates a package. More... | |
void | DeletePackage (clPackage *p_oOldPackage) |
Deletes a package. More... | |
short int | GetIntDataCode (const std::string sLabel) |
Gets the code for an integer data member. More... | |
short int | GetFloatDataCode (const std::string sLabel) |
Gets the code for a float data member. More... | |
short int | GetStringDataCode (const std::string sLabel) |
Gets the code for a string data member. More... | |
short int | GetBoolDataCode (const std::string sLabel) |
Gets the code for a bool data member. More... | |
short int | GetPackageIntDataCode (const std::string sLabel) |
Gets the code for a package integer data member. More... | |
short int | GetPackageFloatDataCode (const std::string sLabel) |
Gets the code for a package float data member. More... | |
short int | GetPackageStringDataCode (const std::string sLabel) |
Gets the code for a package string data member. More... | |
short int | GetPackageBoolDataCode (const std::string sLabel) |
Gets the code for a package bool data member. More... | |
const std::string | GetIntDataLabel (short int iCode) |
Gets the label for an integer data member. More... | |
const std::string | GetFloatDataLabel (short int iCode) |
Gets the label for a float data member. More... | |
const std::string | GetStringDataLabel (short int iCode) |
Gets the label for a string data member. More... | |
const std::string | GetBoolDataLabel (short int iCode) |
Gets the label for a bool data member. More... | |
const std::string | GetPackageIntDataLabel (short int iCode) |
Gets the label for a package integer data member. More... | |
const std::string | GetPackageFloatDataLabel (short int iCode) |
Gets the label for a package float data member. More... | |
const std::string | GetPackageStringDataLabel (short int iCode) |
Gets the label for a package string data member. More... | |
const std::string | GetPackageBoolDataLabel (short int iCode) |
Gets the label for a package bool data member. More... | |
Public Member Functions inherited from clWorkerBase | |
clWorkerBase (clSimManager *p_oSimManager) | |
Constructor. More... | |
virtual | ~clWorkerBase () |
Destructor. More... | |
std::string | GetName () |
Gets the object's namestring. More... | |
clSimManager * | GetSimManager () |
void | DoObjectSetup (xercesc::DOMDocument *p_oDoc, fileType iFileType) |
Triggers the setup process. More... | |
virtual void | TimestepCleanup () |
Performs any necessary cleanup operations at the end of a timestep. More... | |
virtual void | EndOfRunCleanup () |
Performs any necessary cleanup operations at the end of a run. More... | |
Protected Member Functions | |
clGrid (clSimManager *p_oSimManager, const std::string sGridName, short int iNumIntVals, short int iNumFloatVals, short int iNumStringVals, short int iNumBoolVals, float fXCellLength=0, float fYCellLength=0) | |
Constructor. More... | |
~clGrid () | |
Destructor. More... | |
short int | RegisterDataMember (std::string sLabel, short int iNumVals, std::string *p_sLabelList) |
Core function for registering new data members. More... | |
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. More... | |
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. More... | |
Protected Member Functions inherited from clWorkerBase | |
void | AssembleFileCode (int iFileType, int iFileVersion, char *cCode) |
Creates the proper identifying filecode for an XML file. More... | |
Protected Attributes | |
stcRecords ** | mp_gridVals |
Grid cell array. More... | |
short int | m_iNumIntVals |
How many integer data members per grid cell. More... | |
short int | m_iNumFloatVals |
How many float data members per grid cell. More... | |
short int | m_iNumStringVals |
How many string data members per grid cell. More... | |
short int | m_iNumBoolVals |
How many bool data members per grid cell. More... | |
std::string * | mp_sIntLabels |
Labels for each of the integer data members. More... | |
std::string * | mp_sFloatLabels |
Labels for each of the float data members. More... | |
std::string * | mp_sStringLabels |
Labels for each of the string data members. More... | |
std::string * | mp_sBoolLabels |
Labels for each of the bool data members. More... | |
float | m_fXCellSize |
Length of grid cells in the X direction, in meters. More... | |
float | m_fYCellSize |
Length of grid cells in the Y direction, in meters. More... | |
float | m_fYPlotLength |
Length of plot in Y direction. More... | |
float | m_fXPlotLength |
Length of plot in X direction. More... | |
int | m_iNumXCells |
Number of grid divisions along the X axis. More... | |
int | m_iNumYCells |
Number of grid divisions along the Y axis. More... | |
bool | m_bPackageChangeAllowed |
Whether or not the package data structure may be changed. More... | |
bool | m_bPackageDataChanged |
Whether or not the packages have been set up with a different data structure from the grid. More... | |
short int | m_iNumPackageIntVals |
Number of package integer data members. More... | |
short int | m_iNumPackageFloatVals |
Number of package float data members. More... | |
short int | m_iNumPackageStringVals |
Number of package string data members. More... | |
short int | m_iNumPackageBoolVals |
Number of package bool data members. More... | |
std::string * | mp_sPackageIntLabels |
Labels for each of the integer data members. More... | |
std::string * | mp_sPackageFloatLabels |
Labels for each of the float data members. More... | |
std::string * | mp_sPackageStringLabels |
Labels for each of the string data members. More... | |
std::string * | mp_sPackageBoolLabels |
Labels for each of the bool data members. More... | |
Protected Attributes inherited from clWorkerBase | |
std::string | m_sNameString |
If a behavior has registered a command line command with the sim manager, this allows it to be called. More... | |
clSimManager * | mp_oSimManager |
Pointer to the simulation manager object. More... | |
int * | mp_iAllowedFileTypes |
List of the input file types this object can handle. More... | |
int | m_iNumAllowedTypes |
Number of input file types this object can handle. More... | |
Friends | |
class | clGridManager |
class | clPackage |
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, 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, 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.
Edit history:
--------------—
October 20, 2011 - Wiped the slate clean for SORTIE 7.0 (LEM)
November 12, 2012 - Chars became strings (LEM)
|
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.
p_oSimManager | A pointer to the sim manager object. |
sGridName | 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. |
iNumStringVals | Number of string 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. |
|
protected |
Destructor.
void clGrid::ChangePackageDataStructure | ( | short int | iNumIntVals, |
short int | iNumFloatVals, | ||
short int | iNumStringVals, | ||
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.
iNumIntVals | Number of package integer data members. |
iNumFloatVals | Number of package float data members. |
iNumStringVals | Number of package string data members. |
iNumBoolVals | Number of package bool data members. |
Creates a package.
The new package will be placed after a specified other package, between it and the next package on the linked list.
p_oPreviousPackage | The package after which to place the new package. |
Error | if p_oPreviousPackage is NULL. |
clPackage* clGrid::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.
fX | X coordinate of point. |
fY | Y coordinate of point. |
Error | if the point is not within the grid boundaries. |
clPackage* clGrid::CreatePackageOfCell | ( | int | iX, |
int | iY | ||
) |
Creates a package.
The new package will be placed as the first package for a specific grid cell.
iX | Grid cell number in the X direction. |
iY | Grid cell number in the Y direction. |
Error | if the grid numbers are invalid. |
void clGrid::DeletePackage | ( | clPackage * | p_oOldPackage | ) |
Deletes a package.
If the package is in the middle of the package list, the gap will be closed.
p_oOldPackage | Package to delete. |
float clGrid::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.
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. |
float clGrid::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.
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. |
modelErr | if the "to" point coordinates are less than the "from" point coordinates. |
float clGrid::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.
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. |
float clGrid::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.
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. |
modelErr | if the "to" point coordinates are less than the "from" point coordinates. |
|
protected |
This is the function that actually calculates a circle's average value.
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. |
|
protected |
This is the function that actually calculates a rectangle's average value.
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. |
modelErr | if the "to" point coordinates are less than the "from" point coordinates. |
short int clGrid::GetBoolDataCode | ( | const std::string | sLabel | ) |
Gets the code for a bool data member.
This function will not be responsible for duplicate labels.
sLabel | The data member's label. |
const std::string clGrid::GetBoolDataLabel | ( | short int | iCode | ) |
Gets the label for a bool data member.
This function will not be responsible for duplicate labels.
iCode | The data member's code. |
void clGrid::GetCellOfPoint | ( | float | fX, |
float | fY, | ||
short int * | iCellX, | ||
short int * | iCellY | ||
) |
Retrieves the cell numbers for a point.
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 |
|
virtual |
Reads in a grid's map, if present in a file.
p_oDoc | DOM tree of parsed document. |
Implements clWorkerBase.
float clGrid::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.
iX | X grid number of the cell. |
modelErr | if the coordinate is not inside the plot. |
float clGrid::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.
iY | Y grid number of the cell. |
modelErr | if the coordinate is not inside the plot. |
clPackage* clGrid::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.
fX | X coordinate of point. |
fY | Y coordinate of point. |
clPackage* clGrid::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.
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. |
short int clGrid::GetFloatDataCode | ( | const std::string | sLabel | ) |
Gets the code for a float data member.
This function will not be responsible for duplicate labels.
sLabel | The data member's label. |
const std::string clGrid::GetFloatDataLabel | ( | short int | iCode | ) |
Gets the label for a float data member.
This function will not be responsible for duplicate labels.
iCode | The data member's code. |
short int clGrid::GetIntDataCode | ( | const std::string | sLabel | ) |
Gets the code for an integer data member.
This function will not be responsible for duplicate labels.
sLabel | The data member's label. |
const std::string clGrid::GetIntDataLabel | ( | short int | iCode | ) |
Gets the label for an integer data member.
This function will not be responsible for duplicate labels.
iCode | The data member's code. |
|
inline |
Gets the length of a cell in the X direction.
|
inline |
Gets the length of a cell in the Y direction.
|
inline |
Gets the number of bool data members.
|
inline |
Gets the number of package bool data members.
|
inline |
Gets the number of float data members.
|
inline |
Gets the number of package float data members.
|
inline |
Gets the number of int data members.
|
inline |
Gets the number of package int data members.
|
inline |
Gets the number of string data members.
|
inline |
Gets the number of package string data members.
|
inline |
Gets number of cells in the X direction.
|
inline |
Gets number of cells in the Y direction.
float clGrid::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.
iX | X grid number of the cell. |
modelErr | if the coordinate is not inside the plot. |
float clGrid::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.
iY | Y grid number of the cell. |
modelErr | if the coordinate is not inside the plot. |
short int clGrid::GetPackageBoolDataCode | ( | const std::string | sLabel | ) |
Gets the code for a package bool data member.
This function will not be responsible for duplicate labels.
sLabel | The data member's label. |
const std::string clGrid::GetPackageBoolDataLabel | ( | short int | iCode | ) |
Gets the label for a package bool data member.
This function will not be responsible for duplicate labels.
iCode | The data member's code. |
|
inline |
Gets whether or not the package data structure has changed.
short int clGrid::GetPackageFloatDataCode | ( | const std::string | sLabel | ) |
Gets the code for a package float data member.
This function will not be responsible for duplicate labels.
sLabel | The data member's label. |
const std::string clGrid::GetPackageFloatDataLabel | ( | short int | iCode | ) |
Gets the label for a package float data member.
This function will not be responsible for duplicate labels.
iCode | The data member's code. |
short int clGrid::GetPackageIntDataCode | ( | const std::string | sLabel | ) |
Gets the code for a package integer data member.
This function will not be responsible for duplicate labels.
sLabel | The data member's label. |
const std::string clGrid::GetPackageIntDataLabel | ( | short int | iCode | ) |
Gets the label for a package integer data member.
This function will not be responsible for duplicate labels.
iCode | The data member's code. |
short int clGrid::GetPackageStringDataCode | ( | const std::string | sLabel | ) |
Gets the code for a package string data member.
This function will not be responsible for duplicate labels.
sLabel | The data member's label. |
const std::string clGrid::GetPackageStringDataLabel | ( | short int | iCode | ) |
Gets the label for a package string data member.
This function will not be responsible for duplicate labels.
iCode | The data member's code. |
void clGrid::GetPointOfCell | ( | short int | iCellX, |
short int | iCellY, | ||
float * | fX, | ||
float * | fY | ||
) |
Gets the coordinates of a point at the center of a grid cell.
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 |
short int clGrid::GetStringDataCode | ( | const std::string | sLabel | ) |
Gets the code for a string data member.
This function will not be responsible for duplicate labels.
sLabel | The data member's label. |
const std::string clGrid::GetStringDataLabel | ( | short int | iCode | ) |
Gets the label for a string data member.
This function will not be responsible for duplicate labels.
iCode | The data member's code. |
void clGrid::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.
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. |
BAD_DATA | error if the point is not within the grid or the code is not valid. |
void clGrid::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.
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. |
BAD_DATA | error if the point is not within the grid or the code is not valid. |
void clGrid::GetValueAtPoint | ( | float | fX, |
float | fY, | ||
short int | iCode, | ||
std::string * | p_sValHolder | ||
) |
Retrieves the value of a string 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.
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_sValHolder | Pointer to where the return value should be placed. |
BAD_DATA | error if the point is not within the grid or the code is not valid. |
void clGrid::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.
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. |
BAD_DATA | error if the point is not within the grid or the code is not valid. |
void clGrid::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.
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. |
BAD_DATA | error if the grid cell coordinates are not within the grid or the code is not valid. |
void clGrid::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.
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. |
BAD_DATA | error if the grid cell coordinates are not within the grid or the code is not valid. |
void clGrid::GetValueOfCell | ( | int | iX, |
int | iY, | ||
short int | iCode, | ||
std::string * | p_sValHolder | ||
) |
Retrieves the value of a string 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.
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_sValHolder | Pointer to where the return value should be placed. |
BAD_DATA | error if the grid cell coordinates are not within the grid or the code is not valid. |
void clGrid::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.
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. |
BAD_DATA | error if the grid cell coordinates are not within the grid or the code is not valid. |
void clGrid::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.
p_oDoc | DOM tree of parsed document. |
short int clGrid::RegisterBool | ( | const std::string | sLabel | ) |
Registers a bool data member.
This will not check to make sure that there is not already a variable registered with that name.
sLabel | String with the name of this variable. Keep it short. |
ILLEGAL_OP | error if there is no more space for new data members. |
|
inlineprotected |
Core function for registering new data members.
If successful, it will return a code for that member for the species and type combo.
sLabel | A string with the name of this variable. |
iNumVals | Number total allowed variables of this type |
p_sLabelList | Pointer to the correct labels array |
If | registration is unsuccessful, a BAD_DATA or ILLEGAL_OP error will be thrown. |
short int clGrid::RegisterFloat | ( | const std::string | sLabel | ) |
Registers a float data member.
This will not check to make sure that there is not already a variable registered with that name.
sLabel | String with the name of this variable. Keep it short. |
ILLEGAL_OP | error if there is no more space for new data members. |
short int clGrid::RegisterInt | ( | const std::string | sLabel | ) |
Registers an integer data member.
This will not check to make sure that there is not already a variable registered with that name.
sLabel | String with the name of this variable. Keep it short. |
ILLEGAL_OP | error if there is no more space for new data members. |
short int clGrid::RegisterPackageBool | ( | const std::string | sLabel | ) |
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.
sLabel | String with the name of this variable. Keep it short. |
ILLEGAL_OP | error if there is no more space for new data members. |
short int clGrid::RegisterPackageFloat | ( | const std::string | sLabel | ) |
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.
sLabel | String with the name of this variable. Keep it short. |
ILLEGAL_OP | error if there is no more space for new data members. |
short int clGrid::RegisterPackageInt | ( | const std::string | sLabel | ) |
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.
sLabel | String with the name of this variable. Keep it short. |
ILLEGAL_OP | error if there is no more space for new data members. |
short int clGrid::RegisterPackageString | ( | const std::string | sLabel | ) |
Registers a package string 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.
sLabel | String with the name of this variable. Keep it short. |
ILLEGAL_OP | error if there is no more space for new data members. |
short int clGrid::RegisterString | ( | const std::string | sLabel | ) |
Registers a string data member.
This will not check to make sure that there is not already a variable registered with that name.
sLabel | String with the name of this variable. Keep it short. |
ILLEGAL_OP | error if there is no more space for new data members. |
void clGrid::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.
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. |
BAD_DATA | error if the point is not within the grid or the code is not valid. |
void clGrid::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.
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. |
BAD_DATA | error if the point is not within the grid or the code is not valid. |
void clGrid::SetValueAtPoint | ( | float | fX, |
float | fY, | ||
short int | iCode, | ||
std::string | sValue | ||
) |
Sets the value of a string 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.
fX | X coordinate of point for which the value is desired. |
fY | Y coordinate of point for which the value is desired. |
sValue | Value to set. |
iCode | Code for the value desired. This is what is returned from registering a variable or from using GetDataCode. |
BAD_DATA | error if the point is not within the grid or the code is not valid. |
void clGrid::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.
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. |
BAD_DATA | error if the point is not within the grid or the code is not valid. |
void clGrid::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.
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. |
BAD_DATA | error if the grid cell coordinates are not within the grid or the code is not valid. |
void clGrid::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.
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. |
BAD_DATA | error if the grid cell coordinates are not within the grid or the code is not valid. |
void clGrid::SetValueOfCell | ( | int | iX, |
int | iY, | ||
short int | iCode, | ||
std::string | sValue | ||
) |
Sets the value of a string 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.
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. |
sValue | Value to set. |
BAD_DATA | error if the grid cell coordinates are not within the grid or the code is not valid. |
void clGrid::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.
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. |
BAD_DATA | error if the grid cell coordinates are not within the grid or the code is not valid. |
|
friend |
|
friend |
|
protected |
Whether or not the package data structure may be changed.
|
protected |
Whether or not the packages have been set up with a different data structure from the grid.
|
protected |
Length of grid cells in the X direction, in meters.
|
protected |
Length of plot in X direction.
|
protected |
Length of grid cells in the Y direction, in meters.
|
protected |
Length of plot in Y direction.
|
protected |
How many bool data members per grid cell.
|
protected |
How many float data members per grid cell.
|
protected |
How many integer data members per grid cell.
|
protected |
Number of package bool data members.
|
protected |
Number of package float data members.
|
protected |
Number of package integer data members.
|
protected |
Number of package string data members.
|
protected |
How many string data members per grid cell.
|
protected |
Number of grid divisions along the X axis.
|
protected |
Number of grid divisions along the Y axis.
|
protected |
Grid cell array.
Size is # X grids by # Y grids.
|
protected |
Labels for each of the bool data members.
|
protected |
Labels for each of the float data members.
|
protected |
Labels for each of the integer data members.
|
protected |
Labels for each of the bool data members.
|
protected |
Labels for each of the float data members.
|
protected |
Labels for each of the integer data members.
|
protected |
Labels for each of the string data members.
|
protected |
Labels for each of the string data members.