SORTIE Core C++ Documentation
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
clGrid Class Reference

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

#include <Grid.h>

Inheritance diagram for clGrid:
clWorkerBase

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...
 
clPackageGetFirstPackageOfCell (int iX, int iY)
 Retrieves first package in linked list for a grid cell. More...
 
clPackageGetFirstPackageAtPoint (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...
 
clPackageCreatePackage (clPackage *p_oPreviousPackage)
 Creates a package. More...
 
clPackageCreatePackageOfCell (int iX, int iY)
 Creates a package. More...
 
clPackageCreatePackageAtPoint (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...
 
clSimManagerGetSimManager ()
 
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...
 
clSimManagermp_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
 

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, 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.

Author
Lora E. Murphy


Edit history:
--------------—
October 20, 2011 - Wiped the slate clean for SORTIE 7.0 (LEM)
November 12, 2012 - Chars became strings (LEM)

Constructor & Destructor Documentation

◆ clGrid()

clGrid::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 
)
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_oSimManagerA pointer to the sim manager object.
sGridNameAn identifying name string for the grid object.
iNumIntValsNumber of integer data members in a grid cell record. Can be 0.
iNumFloatValsNumber of float data members in a grid cell record. Can be 0.
iNumStringValsNumber of string data members in a grid cell record. Can be 0.
iNumBoolValsNumber of bool data members in a grid cell record. Can be 0.
fXCellLengthThe 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.
fYCellLengthThe 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.

◆ ~clGrid()

clGrid::~clGrid ( )
protected

Destructor.

Member Function Documentation

◆ ChangePackageDataStructure()

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.

Parameters
iNumIntValsNumber of package integer data members.
iNumFloatValsNumber of package float data members.
iNumStringValsNumber of package string data members.
iNumBoolValsNumber of package bool data members.

◆ CreatePackage()

clPackage* clGrid::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_oPreviousPackageThe package after which to place the new package.
Returns
Pointer to the new package.
Exceptions
Errorif p_oPreviousPackage is NULL.

◆ CreatePackageAtPoint()

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.

Parameters
fXX coordinate of point.
fYY coordinate of point.
Returns
Pointer to the new package.
Exceptions
Errorif the point is not within the grid boundaries.

◆ CreatePackageOfCell()

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.

Parameters
iXGrid cell number in the X direction.
iYGrid cell number in the Y direction.
Returns
Pointer to the new package.
Exceptions
Errorif the grid numbers are invalid.

◆ DeletePackage()

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.

Parameters
p_oOldPackagePackage to delete.

◆ GetAverageFloatValue() [1/2]

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.

Parameters
fXX coordinate of circle center.
fYY coordinate of circle center.
fRadiusRadius of circle over which to average values.
iCodeCode for the value desired. This is what is returned from registering a variable or from using GetDataCode.
Returns
The average specified.

◆ GetAverageFloatValue() [2/2]

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.

Parameters
fFromXX coordinate of the point closest to the origin.
fFromYY coordinate of the point closest to the origin.
fToXX coordinate of the point farthest from the origin.
fToYY coordinate of the point farthest from the origin.
iCodeCode for the value desired. This is what is returned from registering a variable or from using GetDataCode.
Returns
The average specified.
Exceptions
modelErrif the "to" point coordinates are less than the "from" point coordinates.

◆ GetAverageIntValue() [1/2]

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.

Parameters
fXX coordinate of circle center.
fYY coordinate of circle center.
fRadiusRadius of circle over which to average values.
iCodeCode for the value desired. This is what is returned from registering a variable or from using GetDataCode.
Returns
The average specified.

◆ GetAverageIntValue() [2/2]

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.

Parameters
fFromXX coordinate of the point closest to the origin.
fFromYY coordinate of the point closest to the origin.
fToXX coordinate of the point farthest from the origin.
fToYY coordinate of the point farthest from the origin.
iCodeCode for the value desired. This is what is returned from registering a variable or from using GetDataCode.
Returns
The average specified.
Exceptions
modelErrif the "to" point coordinates are less than the "from" point coordinates.

◆ GetAverageValue() [1/2]

float clGrid::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
fXX coordinate of circle center.
fYY coordinate of circle center.
fRadiusRadius of circle over which to average values.
bFloatIf true, calculate float values; if false, calculate integer vals.
iCodeCode for the value desired. This is what is returned from registering a variable or from using GetDataCode.
Returns
The average specified.

◆ GetAverageValue() [2/2]

float clGrid::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
fFromXX coordinate of the point closest to the origin.
fFromYY coordinate of the point closest to the origin.
fToXX coordinate of the point farthest from the origin.
fToYY coordinate of the point farthest from the origin.
iCodeCode for the value desired. This is what is returned from registering a variable or from using GetDataCode.
bFloatIf true, calculate float values; if false, calculate integer vals.
Returns
The average specified.
Exceptions
modelErrif the "to" point coordinates are less than the "from" point coordinates.

◆ GetBoolDataCode()

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.

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

◆ GetBoolDataLabel()

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.

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

◆ GetCellOfPoint()

void clGrid::GetCellOfPoint ( float  fX,
float  fY,
short int *  iCellX,
short int *  iCellY 
)

Retrieves the cell numbers for a point.

Parameters
fXX coordinate of point.
fYY coordinate of point.
iCellXAddress of variable in which to place X grid cell number
iCellYAddress of variable in which to place X grid cell number

◆ GetData()

void clGrid::GetData ( xercesc::DOMDocument *  p_oDoc)
virtual

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

Parameters
p_oDocDOM tree of parsed document.

Implements clWorkerBase.

◆ GetEndXOfCell()

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.

Parameters
iXX grid number of the cell.
Returns
X end coordinate.
Exceptions
modelErrif the coordinate is not inside the plot.

◆ GetEndYOfCell()

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.

Parameters
iYY grid number of the cell.
Returns
Y end coordinate.
Exceptions
modelErrif the coordinate is not inside the plot.

◆ GetFirstPackageAtPoint()

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.

Parameters
fXX coordinate of point.
fYY coordinate of point.
Returns
First package at that point, or NULL if there are no packages.

◆ GetFirstPackageOfCell()

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.

Parameters
iXGrid number in the X direction for cell for which the package is desired.
iYGrid 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.

◆ GetFloatDataCode()

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.

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

◆ GetFloatDataLabel()

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.

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

◆ GetIntDataCode()

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.

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

◆ GetIntDataLabel()

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.

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

◆ GetLengthXCells()

float clGrid::GetLengthXCells ( )
inline

Gets the length of a cell in the X direction.

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

◆ GetLengthYCells()

float clGrid::GetLengthYCells ( )
inline

Gets the length of a cell in the Y direction.

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

◆ GetNumberBoolDataMembers()

int clGrid::GetNumberBoolDataMembers ( )
inline

Gets the number of bool data members.

Returns
Number of bool data members.

◆ GetNumberBoolPackageDataMembers()

int clGrid::GetNumberBoolPackageDataMembers ( )
inline

Gets the number of package bool data members.

Returns
Number of package bool data members.

◆ GetNumberFloatDataMembers()

int clGrid::GetNumberFloatDataMembers ( )
inline

Gets the number of float data members.

Returns
Number of float data members.

◆ GetNumberFloatPackageDataMembers()

int clGrid::GetNumberFloatPackageDataMembers ( )
inline

Gets the number of package float data members.

Returns
Number of package float data members.

◆ GetNumberIntDataMembers()

int clGrid::GetNumberIntDataMembers ( )
inline

Gets the number of int data members.

Returns
Number of int data members.

◆ GetNumberIntPackageDataMembers()

int clGrid::GetNumberIntPackageDataMembers ( )
inline

Gets the number of package int data members.

Returns
Number of package int data members.

◆ GetNumberStringDataMembers()

int clGrid::GetNumberStringDataMembers ( )
inline

Gets the number of string data members.

Returns
Number of string data members.

◆ GetNumberStringPackageDataMembers()

int clGrid::GetNumberStringPackageDataMembers ( )
inline

Gets the number of package string data members.

Returns
Number of package string data members.

◆ GetNumberXCells()

int clGrid::GetNumberXCells ( )
inline

Gets number of cells in the X direction.

Returns
Number of cells in the X direction.

◆ GetNumberYCells()

int clGrid::GetNumberYCells ( )
inline

Gets number of cells in the Y direction.

Returns
Number of cells in the Y direction.

◆ GetOriginXOfCell()

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.

Parameters
iXX grid number of the cell.
Returns
X origin coordinate.
Exceptions
modelErrif the coordinate is not inside the plot.

◆ GetOriginYOfCell()

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.

Parameters
iYY grid number of the cell.
Returns
Y origin coordinate.
Exceptions
modelErrif the coordinate is not inside the plot.

◆ GetPackageBoolDataCode()

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.

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

◆ GetPackageBoolDataLabel()

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.

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

◆ GetPackageDataChanged()

bool clGrid::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.

◆ GetPackageFloatDataCode()

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.

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

◆ GetPackageFloatDataLabel()

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.

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

◆ GetPackageIntDataCode()

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.

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

◆ GetPackageIntDataLabel()

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.

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

◆ GetPackageStringDataCode()

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.

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

◆ GetPackageStringDataLabel()

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.

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

◆ GetPointOfCell()

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.

Parameters
iCellXX number of grid cell
iCellYY number of grid cell
fXAddress of variable in which to put X coordinate
fYAddress of variable in which to put Y coordinate

◆ GetStringDataCode()

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.

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

◆ GetStringDataLabel()

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.

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

◆ GetValueAtPoint() [1/4]

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.

Parameters
fXX coordinate of point for which the value is desired.
fYY coordinate of point for which the value is desired.
iCodeCode for the value desired. This is what is returned from registering a variable or from using GetDataCode.
p_iValHolderPointer to where the return value should be placed.
Exceptions
BAD_DATAerror if the point is not within the grid or the code is not valid.

◆ GetValueAtPoint() [2/4]

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.

Parameters
fXX coordinate of point for which the value is desired.
fYY coordinate of point for which the value is desired.
iCodeCode for the value desired. This is what is returned from registering a variable or from using GetDataCode.
p_fValHolderPointer to where the return value should be placed.
Exceptions
BAD_DATAerror if the point is not within the grid or the code is not valid.

◆ GetValueAtPoint() [3/4]

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.

Parameters
fXX coordinate of point for which the value is desired.
fYY coordinate of point for which the value is desired.
iCodeCode for the value desired. This is what is returned from registering a variable or from using GetDataCode.
p_sValHolderPointer to where the return value should be placed.
Exceptions
BAD_DATAerror if the point is not within the grid or the code is not valid.

◆ GetValueAtPoint() [4/4]

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.

Parameters
fXX coordinate of point for which the value is desired.
fYY coordinate of point for which the value is desired.
iCodeCode for the value desired. This is what is returned from registering a variable or from using GetDataCode.
p_bValHolderPointer to where the return value should be placed.
Exceptions
BAD_DATAerror if the point is not within the grid or the code is not valid.

◆ GetValueOfCell() [1/4]

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.

Parameters
iXGrid number in the X direction for cell for which the value is desired.
iYGrid number in the Y direction for cell for which the value is desired.
iCodeCode for the value desired. This is what is returned from registering a variable or from using GetDataCode.
p_iValHolderPointer to where the return value should be placed.
Exceptions
BAD_DATAerror if the grid cell coordinates are not within the grid or the code is not valid.

◆ GetValueOfCell() [2/4]

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.

Parameters
iXGrid number in the X direction for cell for which the value is desired.
iYGrid number in the Y direction for cell for which the value is desired.
iCodeCode for the value desired. This is what is returned from registering a variable or from using GetDataCode.
p_fValHolderPointer to where the return value should be placed.
Exceptions
BAD_DATAerror if the grid cell coordinates are not within the grid or the code is not valid.

◆ GetValueOfCell() [3/4]

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.

Parameters
iXGrid number in the X direction for cell for which the value is desired.
iYGrid number in the Y direction for cell for which the value is desired.
iCodeCode for the value desired. This is what is returned from registering a variable or from using GetDataCode.
p_sValHolderPointer to where the return value should be placed.
Exceptions
BAD_DATAerror if the grid cell coordinates are not within the grid or the code is not valid.

◆ GetValueOfCell() [4/4]

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.

Parameters
iXGrid number in the X direction for cell for which the value is desired.
iYGrid number in the Y direction for cell for which the value is desired.
iCodeCode for the value desired. This is what is returned from registering a variable or from using GetDataCode.
p_bValHolderPointer to where the return value should be placed.
Exceptions
BAD_DATAerror if the grid cell coordinates are not within the grid or the code is not valid.

◆ ReadMapFile()

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.

Parameters
p_oDocDOM tree of parsed document.

◆ RegisterBool()

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.

Parameters
sLabelString 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_OPerror if there is no more space for new data members.

◆ RegisterDataMember()

short int clGrid::RegisterDataMember ( std::string  sLabel,
short int  iNumVals,
std::string *  p_sLabelList 
)
inlineprotected

Core function for registering new data members.

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

Parameters
sLabelA string with the name of this variable.
iNumValsNumber total allowed variables of this type
p_sLabelListPointer 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
Ifregistration is unsuccessful, a BAD_DATA or ILLEGAL_OP error will be thrown.

◆ RegisterFloat()

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.

Parameters
sLabelString 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_OPerror if there is no more space for new data members.

◆ RegisterInt()

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.

Parameters
sLabelString 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_OPerror if there is no more space for new data members.

◆ RegisterPackageBool()

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.

Parameters
sLabelString 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_OPerror if there is no more space for new data members.

◆ RegisterPackageFloat()

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.

Parameters
sLabelString 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_OPerror if there is no more space for new data members.

◆ RegisterPackageInt()

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.

Parameters
sLabelString 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_OPerror if there is no more space for new data members.

◆ RegisterPackageString()

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.

Parameters
sLabelString 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_OPerror if there is no more space for new data members.

◆ RegisterString()

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.

Parameters
sLabelString 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_OPerror if there is no more space for new data members.

◆ SetValueAtPoint() [1/4]

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.

Parameters
fXX coordinate of point for which the value is desired.
fYY coordinate of point for which the value is desired.
fValueValue to set.
iCodeCode for the value desired. This is what is returned from registering a variable or from using GetDataCode.
Exceptions
BAD_DATAerror if the point is not within the grid or the code is not valid.

◆ SetValueAtPoint() [2/4]

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.

Parameters
fXX coordinate of point for which the value is desired.
fYY coordinate of point for which the value is desired.
iValueValue to set.
iCodeCode for the value desired. This is what is returned from registering a variable or from using GetDataCode.
Exceptions
BAD_DATAerror if the point is not within the grid or the code is not valid.

◆ SetValueAtPoint() [3/4]

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.

Parameters
fXX coordinate of point for which the value is desired.
fYY coordinate of point for which the value is desired.
sValueValue to set.
iCodeCode for the value desired. This is what is returned from registering a variable or from using GetDataCode.
Exceptions
BAD_DATAerror if the point is not within the grid or the code is not valid.

◆ SetValueAtPoint() [4/4]

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.

Parameters
fXX coordinate of point for which the value is desired.
fYY coordinate of point for which the value is desired.
bValueValue to set.
iCodeCode for the value desired. This is what is returned from registering a variable or from using GetDataCode.
Exceptions
BAD_DATAerror if the point is not within the grid or the code is not valid.

◆ SetValueOfCell() [1/4]

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.

Parameters
iXGrid number in the X direction for cell for which the value is desired.
iYGrid number in the Y direction for cell for which the value is desired.
iCodeCode for the value desired. This is what is returned from registering a variable or from using GetDataCode.
fValueValue to set.
Exceptions
BAD_DATAerror if the grid cell coordinates are not within the grid or the code is not valid.

◆ SetValueOfCell() [2/4]

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.

Parameters
iXGrid number in the X direction for cell for which the value is desired.
iYGrid number in the Y direction for cell for which the value is desired.
iCodeCode for the value desired. This is what is returned from registering a variable or from using GetDataCode.
iValueValue to set.
Exceptions
BAD_DATAerror if the grid cell coordinates are not within the grid or the code is not valid.

◆ SetValueOfCell() [3/4]

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.

Parameters
iXGrid number in the X direction for cell for which the value is desired.
iYGrid number in the Y direction for cell for which the value is desired.
iCodeCode for the value desired. This is what is returned from registering a variable or from using GetDataCode.
sValueValue to set.
Exceptions
BAD_DATAerror if the grid cell coordinates are not within the grid or the code is not valid.

◆ SetValueOfCell() [4/4]

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.

Parameters
iXGrid number in the X direction for cell for which the value is desired.
iYGrid number in the Y direction for cell for which the value is desired.
iCodeCode for the value desired. This is what is returned from registering a variable or from using GetDataCode.
bValueValue to set.
Exceptions
BAD_DATAerror if the grid cell coordinates are not within the grid or the code is not valid.

Friends And Related Function Documentation

◆ clGridManager

friend class clGridManager
friend

◆ clPackage

friend class clPackage
friend

Member Data Documentation

◆ m_bPackageChangeAllowed

bool clGrid::m_bPackageChangeAllowed
protected

Whether or not the package data structure may be changed.

◆ m_bPackageDataChanged

bool clGrid::m_bPackageDataChanged
protected

Whether or not the packages have been set up with a different data structure from the grid.

◆ m_fXCellSize

float clGrid::m_fXCellSize
protected

Length of grid cells in the X direction, in meters.

◆ m_fXPlotLength

float clGrid::m_fXPlotLength
protected

Length of plot in X direction.

◆ m_fYCellSize

float clGrid::m_fYCellSize
protected

Length of grid cells in the Y direction, in meters.

◆ m_fYPlotLength

float clGrid::m_fYPlotLength
protected

Length of plot in Y direction.

◆ m_iNumBoolVals

short int clGrid::m_iNumBoolVals
protected

How many bool data members per grid cell.

◆ m_iNumFloatVals

short int clGrid::m_iNumFloatVals
protected

How many float data members per grid cell.

◆ m_iNumIntVals

short int clGrid::m_iNumIntVals
protected

How many integer data members per grid cell.

◆ m_iNumPackageBoolVals

short int clGrid::m_iNumPackageBoolVals
protected

Number of package bool data members.

◆ m_iNumPackageFloatVals

short int clGrid::m_iNumPackageFloatVals
protected

Number of package float data members.

◆ m_iNumPackageIntVals

short int clGrid::m_iNumPackageIntVals
protected

Number of package integer data members.

◆ m_iNumPackageStringVals

short int clGrid::m_iNumPackageStringVals
protected

Number of package string data members.

◆ m_iNumStringVals

short int clGrid::m_iNumStringVals
protected

How many string data members per grid cell.

◆ m_iNumXCells

int clGrid::m_iNumXCells
protected

Number of grid divisions along the X axis.

◆ m_iNumYCells

int clGrid::m_iNumYCells
protected

Number of grid divisions along the Y axis.

◆ mp_gridVals

stcRecords** clGrid::mp_gridVals
protected

Grid cell array.

Size is # X grids by # Y grids.

◆ mp_sBoolLabels

std::string* clGrid::mp_sBoolLabels
protected

Labels for each of the bool data members.

◆ mp_sFloatLabels

std::string* clGrid::mp_sFloatLabels
protected

Labels for each of the float data members.

◆ mp_sIntLabels

std::string* clGrid::mp_sIntLabels
protected

Labels for each of the integer data members.

◆ mp_sPackageBoolLabels

std::string* clGrid::mp_sPackageBoolLabels
protected

Labels for each of the bool data members.

◆ mp_sPackageFloatLabels

std::string* clGrid::mp_sPackageFloatLabels
protected

Labels for each of the float data members.

◆ mp_sPackageIntLabels

std::string* clGrid::mp_sPackageIntLabels
protected

Labels for each of the integer data members.

◆ mp_sPackageStringLabels

std::string* clGrid::mp_sPackageStringLabels
protected

Labels for each of the string data members.

◆ mp_sStringLabels

std::string* clGrid::mp_sStringLabels
protected

Labels for each of the string data members.


The documentation for this class was generated from the following file: