#include <AverageLight.h>
Inheritance diagram for clAverageLight:
Public Member Functions | |
clAverageLight (clSimManager *p_oSimManager) | |
Constructor. | |
void | DoShellSetup (xercesc::DOMDocument *p_oDoc) |
Does setup for this behavior. | |
void | TimestepCleanup () |
Sets the "average calculated" flag back to false. | |
float | CalcLightValue (clTree *p_oTree, clTreePopulation *p_oPop) |
Gets the light value for a particular tree. | |
Protected Member Functions | |
void | CalculateAverage (clTreePopulation *p_oPop) |
Calculates the average light value each timestep. | |
Protected Attributes | |
clGridBase * | mp_oGLIMapGrid |
Grid object which holds the GLI light values to average. | |
clGridBase * | mp_oAvgLightGrid |
Grid object which holds the averaged light values. | |
short int | m_iMapLightCode |
Return code for the "GLI" data member of the "GLI Map" grid. | |
short int | m_iAvgLightCode |
Return code for the "GLI" data member of the "Average Light" grid. | |
bool | m_bAvgCalculated |
Whether or not the average GLI value has been calculated this timestep. |
This behavior averages light values taken over a finer scale to a coarser resolution. It gets the light levels for averaging from the GLI Map Creator's grid (class clGLIMap). This grid is called "GLI Map".
The Average Light behavior also has a grid, called "Average Light". The user sets the grid resolution on this grid to control the area over which light is averaged, up to the whole plot.
If the grid cell area of Average Light is not an exact multiple of the GLI Map grid cell area, then the averaging will be over all the cells touched by the Average Light grid, with no weighting for partial cells (see the clGridBase::GetAverageFloatValue method).
The namestring for this behavior is "averagelightshell"; the parameter file call string is "Average Light".
Copyright 2006 Charles D. Canham.
clAverageLight::clAverageLight | ( | clSimManager * | p_oSimManager | ) |
Constructor.
Sets the namestring.
p_oSimManager | Sim Manager object. |
float clAverageLight::CalcLightValue | ( | clTree * | p_oTree, | |
clTreePopulation * | p_oPop | |||
) | [virtual] |
Gets the light value for a particular tree.
First, it checks to see if the average has been calculated this timestep. If not, then CalculateAverage() is called. Then the average value is returned.
p_oTree | Tree for which to get light. | |
p_oPop | Tree population. |
Implements clLightBase.
void clAverageLight::CalculateAverage | ( | clTreePopulation * | p_oPop | ) | [protected] |
Calculates the average light value each timestep.
For each cell in the "Average Light" grid, it calculates an average of the grid cells in "GLI Map" that fall within its values using clGridBase::GetAverageFloatValue. At the end, this sets m_bAvgCalculated to true.
p_oPop | Tree population object |
void clAverageLight::DoShellSetup | ( | xercesc::DOMDocument * | p_oDoc | ) | [virtual] |
Does setup for this behavior.
This grabs a pointer to the "GLI Map" grid and either grabs the "Average Light" grid or sets it up if it doesn't exist yet.
p_oDoc | DOM tree of parsed input file. |
modelErr | if the "GLI Map" grid is not present. |
Reimplemented from clLightBase.
clGridBase* clAverageLight::mp_oAvgLightGrid [protected] |
Grid object which holds the averaged light values.
This grid is created by this class. Its name is "Average Light" and it has one float data member, "GLI".
clGridBase* clAverageLight::mp_oGLIMapGrid [protected] |
Grid object which holds the GLI light values to average.
This grid is not created by this class, but by the clGLIMap class.