#include <LightOrg.h>
Public Types | |
enum | fotocrowndpth { mid, top } |
Describes the placement of the fisheye photo. More... | |
Public Member Functions | |
~clLightOrg () | |
Destructor. | |
clLightOrg (clLightBase *p_oHookedShell) | |
Constructor. | |
void | DoLightAssignments () |
Performs the light calculations. | |
void | DoSetup (clSimManager *p_oSimManager, xercesc::DOMDocument *p_oDoc) |
Performs setup functions. | |
void | DoTreeDataMemberRegistrations (clSimManager *p_oSimManager, clTreePopulation *p_oPop) |
Does the registration of the "Light" tree data member variable. | |
float | GetLightExtCoeff (clTree *p_oTree) |
Gets the light extinction coefficent. | |
float | GetBeamFractionGlobalRadiation () |
Gets the beam fraction of global radiation. | |
float | GetClearSkyTransmissionCoefficient () |
Gets the clear sky transmission coefficient. | |
float | GetMaxTreeHeight () |
Gets the maximum tree height across all species. | |
enum fotocrowndpth | GetPhotoDepth () |
Gets the depth of the fisheye photo. | |
int | GetFirstDayOfGrowingSeason () |
Gets the first day of the growing season. | |
int | GetLastDayOfGrowingSeason () |
Gets the last day of the growing season. | |
clLightBase * | GetLightShell (short int iSp, short int iTp) |
Gets a pointer to a light shell object. | |
Protected Member Functions | |
void | PopulateLightFunctionsTable (clSimManager *p_oSimManager, clTreePopulation *p_oPop) |
Declares the light functions table and populates it with the appropriate behavior pointers. | |
void | GetParameterFileData (clSimManager *p_oSimManager, xercesc::DOMDocument *p_oDoc) |
Reads data from the parameter file. | |
Protected Attributes | |
clTreePopulation * | mp_oPop |
Stashed pointer to the tree population object. | |
clLightBase *** | mp_oLightFunctionTable |
Light shell objects. | |
int | m_iTotalSpecies |
Total number of species. | |
int | m_iTotalTypes |
Total number of tree types. | |
float * | mp_fLightExtCoef |
Light extinction coefficient of live tree crowns. | |
float ** | mp_fSnagLightExtCoef |
Light extinction coefficient of snag crowns. | |
int * | mp_iSnagAgeClasses |
Upper limit of age in each snag age class. | |
float | m_fBeamFracGlobRad |
Beam fraction of global radiation. | |
float | m_fClearSkyTransCoeff |
Clear sky transmission coefficient. | |
enum fotocrowndpth | m_iPhotoDepth |
Depth of fisheye photo in tree. | |
int | m_iFirstJulDay |
First julian day of growing season. | |
int | m_iLastJulDay |
Last julian day of growing season. | |
int | m_iNumSnagAgeClasses |
Number of age classes for snags, for the purpose of dividing up the light extinction coefficients. | |
float | m_fMaxTreeHeight |
Maximum height possible for any tree. | |
short int ** | mp_iLightCodes |
Return codes for the "Light" tree float data member variable. |
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 2003 Charles D. Canham.
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. |
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. |
float clLightOrg::GetBeamFractionGlobalRadiation | ( | ) | [inline] |
Gets the beam fraction of global radiation.
float clLightOrg::GetClearSkyTransmissionCoefficient | ( | ) | [inline] |
Gets the clear sky transmission coefficient.
float clLightOrg::GetMaxTreeHeight | ( | ) | [inline] |
Gets the maximum tree height across all species.
enum fotocrowndpth clLightOrg::GetPhotoDepth | ( | ) | [inline] |
Gets the depth of the fisheye photo.
int clLightOrg::GetFirstDayOfGrowingSeason | ( | ) | [inline] |
Gets the first day of the growing season.
int clLightOrg::GetLastDayOfGrowingSeason | ( | ) | [inline] |
Gets the last day of the growing season.
clLightBase* clLightOrg::GetLightShell | ( | short int | iSp, | |
short int | iTp | |||
) | [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. |
void clLightOrg::PopulateLightFunctionsTable | ( | clSimManager * | p_oSimManager, | |
clTreePopulation * | p_oPop | |||
) | [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. |
void clLightOrg::GetParameterFileData | ( | clSimManager * | p_oSimManager, | |
xercesc::DOMDocument * | p_oDoc | |||
) | [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:
|
clLightBase*** clLightOrg::mp_oLightFunctionTable [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.
float* clLightOrg::mp_fLightExtCoef [protected] |
Light extinction coefficient of live tree crowns.
One for each species.
float** clLightOrg::mp_fSnagLightExtCoef [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.
int* clLightOrg::mp_iSnagAgeClasses [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.
float clLightOrg::m_fBeamFracGlobRad [protected] |
Beam fraction of global radiation.
Old parameter kt.
float clLightOrg::m_fClearSkyTransCoeff [protected] |
Clear sky transmission coefficient.
Old parameter tran
enum fotocrowndpth clLightOrg::m_iPhotoDepth [protected] |
Depth of fisheye photo in tree.
Defaults to top of crown, and thus is not required in the parameter file. Old parameter fotodepth
int clLightOrg::m_iFirstJulDay [protected] |
First julian day of growing season.
Old parameter jdb
int clLightOrg::m_iLastJulDay [protected] |
Last julian day of growing season.
Old parameter jde
int clLightOrg::m_iNumSnagAgeClasses [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.
float clLightOrg::m_fMaxTreeHeight [protected] |
Maximum height possible for any tree.
In meters. Old parameter maxht.
short int** clLightOrg::mp_iLightCodes [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)