SORTIE Core C++ Documentation
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
clLightOrg Class Reference

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...
 
clLightBaseGetLightShell (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

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

Detailed Description

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.

Author
Lora E. Murphy


Edit history:
--------------—
October 20, 2011 - Wiped the slate clean for SORTIE 7.0 (LEM)

Member Enumeration Documentation

◆ fotocrowndpth

Describes the placement of the fisheye photo.

Enumerator
mid 

Middle of the crown (halfway down)

top 

Top of the crown.

Constructor & Destructor Documentation

◆ ~clLightOrg()

clLightOrg::~clLightOrg ( )

Destructor.

◆ clLightOrg()

clLightOrg::clLightOrg ( clLightBase p_oHookedShell)

Constructor.

Parameters
p_oHookedShellA clLightBase object (a light shell object) which then becomes the hooked light shell object.

Member Function Documentation

◆ DoLightAssignments()

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.

◆ DoSetup()

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.

Parameters
p_oSimManagerPointer to the simulation manager. Since this object is not descended from clWorkerBase, it does not already have its own pointer.
p_oDocPointer to parsed parameter file.

◆ DoTreeDataMemberRegistrations()

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.

Parameters
p_oSimManagerPointer to Sim Manager object.
p_oPopTree population object.

◆ GetBeamFractionGlobalRadiation()

float clLightOrg::GetBeamFractionGlobalRadiation ( )
inline

Gets the beam fraction of global radiation.

Returns
The beam fraction of global radiation.

◆ GetClearSkyTransmissionCoefficient()

float clLightOrg::GetClearSkyTransmissionCoefficient ( )
inline

Gets the clear sky transmission coefficient.

Returns
The clear sky transmission coefficient.

◆ GetFirstDayOfGrowingSeason()

int clLightOrg::GetFirstDayOfGrowingSeason ( )
inline

Gets the depth of the fisheye photo.

Returns
Depth of the fisheye photo. Gets the first day of the growing season.
First day of the growing season, as a julian day.

◆ GetLastDayOfGrowingSeason()

int clLightOrg::GetLastDayOfGrowingSeason ( )
inline

Gets the last day of the growing season.

Returns
Last day of the growing season, as a julian day.

◆ GetLightExtCoeff()

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.

Parameters
p_oTreeTree for which to obtain the light extinction coefficient.
Returns
The light extinction coefficient, as the proportion of light transmitted by the tree, as a value between 0 and 1.

◆ GetLightShell()

clLightBase* clLightOrg::GetLightShell ( short int  iSp,
short int  iTp 
)
inline

Gets a pointer to a light shell object.

Parameters
iSpSpecies for which to get the light shell object.
iTpTree type for which to get the light shell object.
Returns
Light shell object for the given species and type, or NULL if it does not exist.

◆ GetMaxTreeHeight()

float clLightOrg::GetMaxTreeHeight ( )
inline

Gets the maximum tree height across all species.

Returns
The maximum tree height, in meters.

◆ GetParameterFileData()

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.

Parameters
p_oSimManagerSim Manager object.
p_oDocDOM tree of parsed input file.
Exceptions
modelErrif:
  • The value for m_iPhotoDepth is not a member of fotocrowndepth
  • The snag age classes are not greater than zero, and the second age class is not greater than the first
  • Any of the light extinction coefficients are not between 0 and 1
  • The value of the clear sky transmission coefficient is 0

◆ PopulateLightFunctionsTable()

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.

Parameters
p_oSimManagerSim Manager object.
p_oPopTree population object.
Exceptions
Errorif a species/type combo is claimed by more than one behavior.

Member Data Documentation

◆ m_fBeamFracGlobRad

double clLightOrg::m_fBeamFracGlobRad
protected

Beam fraction of global radiation.

Old parameter kt.

◆ m_fClearSkyTransCoeff

double clLightOrg::m_fClearSkyTransCoeff
protected

Clear sky transmission coefficient.

Old parameter tran

◆ m_fMaxTreeHeight

float clLightOrg::m_fMaxTreeHeight
protected

Maximum height possible for any tree.

In meters. Old parameter maxht.

◆ m_iFirstJulDay

int clLightOrg::m_iFirstJulDay
protected

First julian day of growing season.

Old parameter jdb

◆ m_iLastJulDay

int clLightOrg::m_iLastJulDay
protected

Last julian day of growing season.

Old parameter jde

◆ m_iNumSnagAgeClasses

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.

◆ m_iTotalSpecies

int clLightOrg::m_iTotalSpecies
protected

Total number of species.

◆ m_iTotalTypes

int clLightOrg::m_iTotalTypes
protected

Total number of tree types.

◆ mp_fLightExtCoef

double* clLightOrg::mp_fLightExtCoef
protected

Light extinction coefficient of live tree crowns.

One for each species.

◆ mp_fSnagLightExtCoef

double** 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.

◆ mp_iLightCodes

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)

◆ mp_iSnagAgeClasses

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.

◆ mp_oLightFunctionTable

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.

◆ mp_oPop

clTreePopulation* clLightOrg::mp_oPop
protected

Stashed pointer to the tree population object.


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