SORTIE Core C++ Documentation
|
PLOT CLASS - Version 1.0 This class represents the underlying plot. More...
#include <Plot.h>
Public Member Functions | |
~clPlot () | |
Destructor. More... | |
clPlot (clSimManager *p_oSimManager) | |
Constructor. More... | |
double | GetLatitude () |
Gets the latitude. More... | |
double | GetXPlotLength () |
Gets the plot X length. More... | |
double | GetYPlotLength () |
Gets the plot Y length. More... | |
float | GetXCellLength () |
Gets the length of cells in the X direction. More... | |
float | GetYCellLength () |
Gets the length of cells in the Y direction. More... | |
float | GetPlotArea () |
Gets the plot area. More... | |
double | GetMeanAnnualPrecip () |
Gets the mean annual precipitation. More... | |
void | SetMeanAnnualPrecip (double fMeanAnnualPrecip) |
Sets the mean annual precipitation. More... | |
double | GetMeanAnnualTemp () |
Gets the mean annual temperature. More... | |
void | SetMeanAnnualTemp (double fMeanTemp) |
Sets the mean annual temperature. More... | |
double | GetNDeposition () |
Gets the annual N deposition. More... | |
void | SetNDeposition (double fNDep) |
Sets the annual N deposition. More... | |
std::string | GetPlotTitle () |
Gets the plot title. More... | |
int | GetNumXGrids () |
Gets number of X grid cells. More... | |
int | GetNumYGrids () |
Gets number of Y grid cells. More... | |
float | GetGridCellArea () |
Gets the area of a grid cell. More... | |
int | GetGridCellSize () |
Gets the length of a grid cell side (cells are square). More... | |
float | CorrectX (float fX) |
Translates an X coordinate to a position guaranteed to be valid. More... | |
float | CorrectY (float fY) |
Translates a Y coordinate to a position guaranteed to be valid. More... | |
float | GetDistance (float fFromX, float fFromY, float fToX, float fToY) |
Calculates the effective distance between two points, correcting for the torus. More... | |
float | GetAzimuthAngle (float fFromX, float fFromY, float fToX, float fToY) |
Calculates the azimuth angle between two points on the plot. More... | |
int | GetFastAzimuthAngle (float fFromX, float fFromY, float fToX, float fToY) |
Speedy way to do an azimuth calculation. More... | |
float | GetUncorrectedX (float fFromX, float fAzimuth, float fDistance) |
Gets the X coordinate of a point defined in polar coordinates relative to another point, uncorrected for torus topology. More... | |
float | GetUncorrectedY (float fFromY, float fAzimuth, float fDistance) |
Gets the Y coordinate of a point defined in polar coordinates relative to another point, uncorrected for torus topology. More... | |
float | GetXDistance (float fFromX, float fToX) |
Gets the distance between two points in the X plane, corrected for torus wrapping. More... | |
float | GetYDistance (float fFromY, float fToY) |
Gets the distance between two points in the Y plane, corrected for torus wrapping. More... | |
double | GetSeasonalPrecipitation () |
void | SetSeasonalPrecipitation (double fSeasonalPrecipitation) |
double | GetWaterDeficit () |
void | SetWaterDeficit (double fWaterDeficit) |
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 | |
void | GetData (xercesc::DOMDocument *p_oDoc) |
Reads data from the parameter file. More... | |
void | PopulateAziTans () |
Declares and populates the tangents of the azimuth angles. 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 | |
std::string | m_sPlotTitle |
Name for this plot. More... | |
int | m_iNumXGrids |
Number of grid divisions along the X axis. More... | |
int | m_iNumYGrids |
Number of grid divisions along the Y axis. More... | |
int | m_iCellSize |
Length of one side of a grid cell, in meters. More... | |
float | m_fPlotArea |
Plot area, in hectares. More... | |
double | m_fPlotLenX |
Plot length along the X axis, in m. More... | |
double | m_fPlotLenY |
Plot length along the Y axis, in m. More... | |
float | m_fMaxX |
Max allowed X value - m_fPlotLenX minus a small value. More... | |
float | m_fMaxY |
Max allowed Y value - m_fPlotLenY minus a small value. More... | |
double | m_fLatitude |
Plot latitude, in decimal degrees - from the par file. More... | |
double | m_fMeanAnnualPrecipMm |
Mean annual precipitation, mm. More... | |
double | m_fWaterDeficit |
Water deficit. More... | |
double | m_fSeasonalPrecipitation |
Seasonal precipitation. More... | |
double | m_fMeanTempC |
Mean annual temperature, degrees Celsius. More... | |
double | m_fNDep |
Annual N deposition. More... | |
float * | mp_fAziTans |
Tangent of each azimuth angle. 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... | |
PLOT CLASS - Version 1.0 This class represents the underlying plot.
It controls for torus topology and manages the grid coordinates. It also contains geographic and climate information about the plot, for those behaviors that require it.
There are some changes in the coordinate structure. The origin is in the southwest corner of the plot (unwrapped). The Y axis is NS and values increase to the north. The X axis is EW and values increase to the east. There are no negative values. The azimuth is north zero, east positive.
The truly underlying grid cell structure is no longer in the hands of the users. The base coordinates will be structured as 8 X 8 grid cells, which is what the trees will be organized into.
This class inherits from clWorkerBase to take advantage of the XML parsing functions in that class.
Copyright 2003 Charles D. Canham.
Edit history:
--------------—
October 20, 2011 - Wiped the slate clean for SORTIE 7.0 (LEM)
June 27, 2013 - Added N deposition value (LEM)
October 31, 2013 - Added water deficit and seasonal precipitation
clPlot::~clPlot | ( | ) |
Destructor.
clPlot::clPlot | ( | clSimManager * | p_oSimManager | ) |
Constructor.
p_oSimManager | Sim Manager object. |
float clPlot::CorrectX | ( | float | fX | ) |
Translates an X coordinate to a position guaranteed to be valid.
If the number passed is already within the plot, it is left alone. If the number is outside of the plot, it is "wrapped" by adding or subtracting the appropriate plot length until it is inside the plot. Because of the torus shape of the plot, a number corrected in this way will have the same geometric relationships as the original number. This function is recursive - it will call itself until the number is correct. The edge of the plot is actually considered to be m_fMaxX; this catches numbers so close to the edge of the plot that they are likely to be rounded up and then be out of the plot.
fX | Coordinate to correct. |
float clPlot::CorrectY | ( | float | fY | ) |
Translates a Y coordinate to a position guaranteed to be valid.
If the number passed is already within the plot, it is left alone. If the number is outside of the plot, it is "wrapped" by adding or subtracting the appropriate plot length until it is inside the plot. Because of the torus shape of the plot, a number corrected in this way will have the same geometric relationships as the original number. This function is recursive - it will call itself until the number is correct. The edge of the plot is actually considered to be m_fMaxY; this catches numbers so close to the edge of the plot that they are likely to be rounded up and then be out of the plot.
fY | Coordinate to correct. |
float clPlot::GetAzimuthAngle | ( | float | fFromX, |
float | fFromY, | ||
float | fToX, | ||
float | fToY | ||
) |
Calculates the azimuth angle between two points on the plot.
fFromX | X coordinate of the "from" point. |
fFromY | Y coordinate of the "from" point. |
fToX | X coordinate of the "to" point. |
fToY | Y coordinate of the "to" point. |
|
protectedvirtual |
Reads data from the parameter file.
p_oDoc | DOM tree of parsed input file. |
Implements clWorkerBase.
float clPlot::GetDistance | ( | float | fFromX, |
float | fFromY, | ||
float | fToX, | ||
float | fToY | ||
) |
Calculates the effective distance between two points, correcting for the torus.
Note that because of the torus, there are always two possible distances to any two points. This will return the shorter.
fFromX | X coordinate of the "from" point. |
fFromY | Y coordinate of the "from" point. |
fToX | X coordinate of the "to" point. |
fToY | Y coordinate of the "to" point. |
BAD_DATA | error if either of the points is not in the plot. |
int clPlot::GetFastAzimuthAngle | ( | float | fFromX, |
float | fFromY, | ||
float | fToX, | ||
float | fToY | ||
) |
Speedy way to do an azimuth calculation.
fFromX | X coordinate of the "from" point. |
fFromY | Y coordinate of the "from" point. |
fToX | X coordinate of the "to" point. |
fToY | Y coordinate of the "to" point. |
|
inline |
Gets the area of a grid cell.
|
inline |
Gets the length of a grid cell side (cells are square).
|
inline |
Gets the latitude.
|
inline |
Gets the mean annual precipitation.
|
inline |
Gets the mean annual temperature.
|
inline |
Gets the annual N deposition.
|
inline |
Gets number of X grid cells.
|
inline |
Gets number of Y grid cells.
|
inline |
Gets the plot area.
|
inline |
Gets the plot title.
|
inline |
float clPlot::GetUncorrectedX | ( | float | fFromX, |
float | fAzimuth, | ||
float | fDistance | ||
) |
Gets the X coordinate of a point defined in polar coordinates relative to another point, uncorrected for torus topology.
If you want a torus-corrected point, use CorrectX() on the result of this function.
fFromX | X coordinate of point that the desired point is defined relative to. |
fAzimuth | Azimuth angle from fFromX to the unknown point, in radians, north 0. |
fDistance | Distance from fFromX to the unknown point, in meters. |
modelErr | if the distance is negative, the azimuth is negative, or the azimuth is greater than 2PI. |
float clPlot::GetUncorrectedY | ( | float | fFromY, |
float | fAzimuth, | ||
float | fDistance | ||
) |
Gets the Y coordinate of a point defined in polar coordinates relative to another point, uncorrected for torus topology.
If you want a torus-corrected point, use CorrectY() on the result of this function.
fFromY | Y coordinate of point that the desired point is defined relative to. |
fAzimuth | Azimuth angle from fFromX to the unknown point, in radians, north 0. |
fDistance | Distance from fFromX to the unknown point, in meters. |
modelErr | if the distance is negative, the azimuth is negative, or the azimuth is greater than 2PI. |
|
inline |
|
inline |
Gets the length of cells in the X direction.
|
inline |
Gets the distance between two points in the X plane, corrected for torus wrapping.
If the "to" point is lower than the "from", the answer will be negative.
fFromX | X coordinate of the "from" point. |
fToX | X coordinate of the "to" point. |
|
inline |
Gets the plot X length.
|
inline |
Gets the length of cells in the Y direction.
|
inline |
Gets the distance between two points in the Y plane, corrected for torus wrapping.
If the "to" point is lower than the "from", the answer will be negative.
fFromY | Y coordinate of the "from" point. |
fToY | Y coordinate of the "to" point. |
|
inline |
Gets the plot Y length.
|
protected |
Declares and populates the tangents of the azimuth angles.
|
inline |
Sets the mean annual precipitation.
fMeanAnnualPrecip | Mean annual precipitation, in mm. |
|
inline |
Sets the mean annual temperature.
fMeanTemp | Mean annual precipitation, in degrees C. |
|
inline |
Sets the annual N deposition.
fNDep | Annual N deposition. |
|
inline |
|
inline |
|
protected |
Plot latitude, in decimal degrees - from the par file.
|
protected |
Max allowed X value - m_fPlotLenX minus a small value.
|
protected |
Max allowed Y value - m_fPlotLenY minus a small value.
|
protected |
Mean annual precipitation, mm.
|
protected |
Mean annual temperature, degrees Celsius.
|
protected |
Annual N deposition.
|
protected |
Plot area, in hectares.
|
protected |
Plot length along the X axis, in m.
|
protected |
Plot length along the Y axis, in m.
|
protected |
Seasonal precipitation.
|
protected |
Water deficit.
|
protected |
Length of one side of a grid cell, in meters.
Cells are square. Make this always a power of 2! The const means the compiler can optimize divisions and multiplications into bit shifts.
|
protected |
Number of grid divisions along the X axis.
|
protected |
Number of grid divisions along the Y axis.
|
protected |
Name for this plot.
Optional.
|
protected |
Tangent of each azimuth angle.
Array size is 360 (degrees).