SORTIE Core C++ Documentation
|
Light org - Version 1.0. More...
#include <LightOrg.h>
Public Types | |
enum | fotocrowndpth { mid, top } |
Describes the placement of the fisheye photo. More... | |
Public Member Functions | |
~clLightOrg () | |
Destructor. More... | |
clLightOrg (clLightBase *p_oHookedShell) | |
Constructor. More... | |
void | DoLightAssignments () |
Performs the light calculations. More... | |
void | DoSetup (clSimManager *p_oSimManager, xercesc::DOMDocument *p_oDoc) |
Performs setup functions. More... | |
void | DoTreeDataMemberRegistrations (clSimManager *p_oSimManager, clTreePopulation *p_oPop) |
Does the registration of the "Light" tree data member variable. More... | |
float | GetLightExtCoeff (clTree *p_oTree) |
Gets the light extinction coefficent. More... | |
float | GetBeamFractionGlobalRadiation () |
Gets the beam fraction of global radiation. More... | |
float | GetClearSkyTransmissionCoefficient () |
Gets the clear sky transmission coefficient. More... | |
float | GetMaxTreeHeight () |
Gets the maximum tree height across all species. More... | |
int | GetFirstDayOfGrowingSeason () |
Gets the depth of the fisheye photo. More... | |
int | GetLastDayOfGrowingSeason () |
Gets the last day of the growing season. More... | |
clLightBase * | GetLightShell (short int iSp, short int iTp) |
Gets a pointer to a light shell object. More... | |
Protected Member Functions | |
void | PopulateLightFunctionsTable (clSimManager *p_oSimManager, clTreePopulation *p_oPop) |
Declares the light functions table and populates it with the appropriate behavior pointers. More... | |
void | GetParameterFileData (clSimManager *p_oSimManager, xercesc::DOMDocument *p_oDoc) |
Reads data from the parameter file. More... | |
Protected Attributes | |
clTreePopulation * | mp_oPop |
Stashed pointer to the tree population object. More... | |
clLightBase *** | mp_oLightFunctionTable |
Light shell objects. More... | |
int | m_iTotalSpecies |
Total number of species. More... | |
int | m_iTotalTypes |
Total number of tree types. More... | |
double * | mp_fLightExtCoef |
Light extinction coefficient of live tree crowns. More... | |
double ** | mp_fSnagLightExtCoef |
Light extinction coefficient of snag crowns. More... | |
int * | mp_iSnagAgeClasses |
Upper limit of age in each snag age class. More... | |
double | m_fBeamFracGlobRad |
Beam fraction of global radiation. More... | |
double | m_fClearSkyTransCoeff |
Clear sky transmission coefficient. More... | |
int | m_iFirstJulDay |
First julian day of growing season. More... | |
int | m_iLastJulDay |
Last julian day of growing season. More... | |
int | m_iNumSnagAgeClasses |
Number of age classes for snags, for the purpose of dividing up the light extinction coefficients. More... | |
float | m_fMaxTreeHeight |
Maximum height possible for any tree. More... | |
short int ** | mp_iLightCodes |
Return codes for the "Light" tree float data member variable. More... | |
Light org - Version 1.0.
This class does the organizational work for getting trees their light values for a timestep. It hooks into a light shell object and is triggered by that object when it is triggered by the behavior manager.
All light objects require a tree float data member called "Light", which this object will register for them.
An object of this class will then call each tree and direct it to the appropriate light shell object function for calculation of its light value.
This class has a core job for those light objects that apply to trees. However, there are many behaviors which don't calculate tree light levels in the traditional sense but calculate light levels for other purposes and are descended from the clLightBase class. This class can still perform useful services for them, such as keeping the common light parameters.
A fatal error will be thrown if the number of years per timestep in the sim manager is not an integer. This is less a calculations problem than a conceptual one; these light behaviors cannot handle partial growing seasons and it would be a shame not to alert someone to that.
Copyright 2011 Charles D. Canham.
Edit history:
--------------—
October 20, 2011 - Wiped the slate clean for SORTIE 7.0 (LEM)
clLightOrg::~clLightOrg | ( | ) |
Destructor.
clLightOrg::clLightOrg | ( | clLightBase * | p_oHookedShell | ) |
Constructor.
p_oHookedShell | A clLightBase object (a light shell object) which then becomes the hooked light shell object. |
void clLightOrg::DoLightAssignments | ( | ) |
Performs the light calculations.
This will control the calculation of light values and their assignment to individual trees. This should be called each timestep by the hooked shell's Action() function.
void clLightOrg::DoSetup | ( | clSimManager * | p_oSimManager, |
xercesc::DOMDocument * | p_oDoc | ||
) |
Performs setup functions.
It creates and populates the light functions table. It can find any light shell behavior as long as the namestring of that object has "lightshell" somewhere in it. Any behavior which happens to have "lightshell" in its name but is not a light shell behavior will probably cause crashing.
DoSetup() is called by the hooked shell's GetData() function.
p_oSimManager | Pointer to the simulation manager. Since this object is not descended from clWorkerBase, it does not already have its own pointer. |
p_oDoc | Pointer to parsed parameter file. |
void clLightOrg::DoTreeDataMemberRegistrations | ( | clSimManager * | p_oSimManager, |
clTreePopulation * | p_oPop | ||
) |
Does the registration of the "Light" tree data member variable.
It goes through the light functions table and, for every species/type combo that has a valid pointer, registers the variable. Return codes are captured in the mp_iLightCodes array.
p_oSimManager | Pointer to Sim Manager object. |
p_oPop | Tree population object. |
|
inline |
Gets the beam fraction of global radiation.
|
inline |
Gets the clear sky transmission coefficient.
|
inline |
Gets the depth of the fisheye photo.
|
inline |
Gets the last day of the growing season.
float clLightOrg::GetLightExtCoeff | ( | clTree * | p_oTree | ) |
Gets the light extinction coefficent.
If the tree type is snag, then the snag age is extracted and the coefficient value matching its age is returned. Otherwise, the value in mp_fLightExtCoef for the appropriate species is returned.
p_oTree | Tree for which to obtain the light extinction coefficient. |
|
inline |
Gets a pointer to a light shell object.
iSp | Species for which to get the light shell object. |
iTp | Tree type for which to get the light shell object. |
|
inline |
Gets the maximum tree height across all species.
|
protected |
Reads data from the parameter file.
The first thing to determine is whether there are any light objects in need of the common parameters. To determine this, this function tests each behavior first to see if it can be casted to type clLightBase. If it can, its flag "m_bNeedsCommonParameters" is checked. Parameters are only read if there is a behavior whose flag is set to "true". Additionally, if the tree population indicates that snags are made, then the light extinction information for them is required.
p_oSimManager | Sim Manager object. |
p_oDoc | DOM tree of parsed input file. |
modelErr | if:
|
|
protected |
Declares the light functions table and populates it with the appropriate behavior pointers.
It does this by going through the behaviors and looking for the ones with "lightshell" in their names, and then getting the species/type combos those behaviors are supposed to act on. For each of these combos, their respective place in the table is populated with the behavior's pointer.
p_oSimManager | Sim Manager object. |
p_oPop | Tree population object. |
Error | if a species/type combo is claimed by more than one behavior. |
|
protected |
Beam fraction of global radiation.
Old parameter kt.
|
protected |
Clear sky transmission coefficient.
Old parameter tran
|
protected |
Maximum height possible for any tree.
In meters. Old parameter maxht.
|
protected |
First julian day of growing season.
Old parameter jdb
|
protected |
Last julian day of growing season.
Old parameter jde
|
protected |
Number of age classes for snags, for the purpose of dividing up the light extinction coefficients.
The last age class upper bound is always infinity.
|
protected |
Total number of species.
|
protected |
Total number of tree types.
|
protected |
Light extinction coefficient of live tree crowns.
One for each species.
|
protected |
Light extinction coefficient of snag crowns.
First index is sized m_iNumSnagAgeClasses, second is sized number of total species. This is only required from the parameter file if the tree population indicates that snags will be made this run.
|
protected |
Return codes for the "Light" tree float data member variable.
Array size is number of species by number of types (even if not every species and type requires light)
|
protected |
Upper limit of age in each snag age class.
This is for determining a snag's light extinction coefficient. This is only required from the parameter file if the tree population indicates that snags will be made this run. This array is sized m_iNumSnagAgeClasses, but there won't be a value in the last bucket since the value is always infinity.
|
protected |
Light shell objects.
Array size is number of species by number of types. For each combo, this points to the light shell object which is handling its light calculation. A pointer may be NULL if a combo is not getting any light calculations.
|
protected |
Stashed pointer to the tree population object.