clLightOrg Class Reference

Light org - Version 1.0. More...

#include <LightOrg.h>

List of all members.

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

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


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 2003 Charles D. Canham.

Author:
Lora E. Murphy

Edit history:
-----------------
April 28, 2004 - Submitted as beta (LEM)
June 17, 2004 - Added snag light extinction (LEM)
February 24, 2005 - Changed data member "lgm" to "Light" (LEM)

Member Enumeration Documentation

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 (  ) 

Destructor.

clLightOrg::clLightOrg ( clLightBase p_oHookedShell  ) 

Constructor.

Parameters:
p_oHookedShell A clLightBase object (a light shell object) which then becomes the hooked light shell object.


Member Function Documentation

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.

Parameters:
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.

Parameters:
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.

Parameters:
p_oTree Tree 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.

float clLightOrg::GetBeamFractionGlobalRadiation (  )  [inline]

Gets the beam fraction of global radiation.

Returns:
The beam fraction of global radiation.

float clLightOrg::GetClearSkyTransmissionCoefficient (  )  [inline]

Gets the clear sky transmission coefficient.

Returns:
The clear sky transmission coefficient.

float clLightOrg::GetMaxTreeHeight (  )  [inline]

Gets the maximum tree height across all species.

Returns:
The maximum tree height, in meters.

enum fotocrowndpth clLightOrg::GetPhotoDepth (  )  [inline]

Gets the depth of the fisheye photo.

Returns:
Depth of the fisheye photo.

int clLightOrg::GetFirstDayOfGrowingSeason (  )  [inline]

Gets the first day of the growing season.

Returns:
First day of the growing season, as a julian day.

int clLightOrg::GetLastDayOfGrowingSeason (  )  [inline]

Gets the last day of the growing season.

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

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

Gets a pointer to a light shell object.

Parameters:
iSp Species for which to get the light shell object.
iTp Tree 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.

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_oSimManager Sim Manager object.
p_oPop Tree population object.
Exceptions:
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.

Parameters:
p_oSimManager Sim Manager object.
p_oDoc DOM tree of parsed input file.
Exceptions:
modelErr if:
  • 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


Member Data Documentation

Stashed pointer to the tree population object.

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.

int clLightOrg::m_iTotalSpecies [protected]

Total number of species.

int clLightOrg::m_iTotalTypes [protected]

Total number of tree types.

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.

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.

Clear sky transmission coefficient.

Old parameter tran

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

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)


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

Generated on Wed Oct 28 13:58:46 2009 for SORTIE Core C++ Documentation by  doxygen 1.5.6