clLightBase Class Reference

Light base - Version 1.0. More...

#include <LightBase.h>

Inheritance diagram for clLightBase:

clBehaviorBase clWorkerBase clAverageLight clBasalAreaLight clConstantGLI clDensityLight clGapLight clGLIBase clSailLight clEpiphyticEstablishment clGliLight clGLIMap clGLIPoints clLightDepSeedSurvival clQuadratGLILight

List of all members.

Public Member Functions

 clLightBase (clSimManager *p_oSimManager)
 Constructor.
virtual ~clLightBase ()
 Destructor.
void Action ()
 Performs all light calculations.
void RegisterTreeDataMembers ()
 Performs data member registrations for "Light".
virtual float CalcLightValue (clTree *p_oTree, clTreePopulation *p_oPop)=0
 Calculates the light value for a particular tree.
clLightOrgGetLightOrg ()
 Gets the light org object.

Protected Member Functions

void GetData (xercesc::DOMDocument *p_oDoc)
 Triggers all light setup.
virtual void DoShellSetup (xercesc::DOMDocument *p_oDoc)
 If a descendent class has specific setup needs, it can overload this function.
void PopulateGLIBrightnessArray ()
 Populates the GLI brightness array.
void PopulateSailLightBrightnessArray ()
 Populates the sail brightness array.
float GetDayAngle (int iJulianDay)
 Computes day angle.
float GetDeclination (float &fDayAngle)
 Computes solar declination.
float GetEccentricity (float &fDayAngle)
 Computes solar eccentricity.
float GetSunrise (float &fLatInRadians, float &fDeclination)
 Computes sunrise.
float GetCosineOfZenithAngle (float &fDeclination, float &fLatInRadians, float &fTimeNow)
 Computes cosine of the zenith angle of the sun at a given time.
float GetAltitudeAngle (float &fCosZenAng)
 Computes altitude angle of the sun at a given time in radians.
float GetAzimuthAngle (float &fDeclination, float &fLatInRadians, float &fAltInRad, float &fTimeNow)
 Computes azimuth angle of the sun at a given time in radians in SORTIE azimuth coordinates.
float GetAirmassEffect (float &fAltInDeg, float &fCosZenAng)
 Computes the airmass effect for a given altitude angle.
float GetBeamRadiation (float &fClearSkyTransCoeff, float &fAirmass, float &fEccentricity, float &fCosZenAng)
 Computes beam radiation strength.
virtual float GetLightExtinctionCoefficient (clTree *p_oTree)
 Gets the light extinction coefficent.

Protected Attributes

bool m_bHooked
 Whether or not this shell object is hooked to clLightOrg.
bool m_bNeedsCommonParameters
 Whether or not this shell object requires the common light parameters held in clLightOrg such as clLightOrg::m_iLastJulDay.
float ** mp_fBrightness
 Sky brightness array.
float ** mp_fPhoto
 Simulated fisheye photo array.
float m_fMinSunAngle
 The altitude angle below which the sky is assumed to be dark.
int m_iNumAziAng
 Number of azimuth angles into which the sky hemisphere is divided.
int m_iNumAltAng
 Number of altitude angles into which the sky hemisphere is divided.
int m_iMinAngRow
 Row in the brightness array corresponding to the minimum solar angle.

Static Protected Attributes

static clLightOrgmp_oLightOrg
 clLightOrg object - this pointer is held in common by all shells

Friends

class clLightOrg
class clGliLight
class clQuadratGLILight
class clGLIMap
class clGLIPoints


Detailed Description

Light base - Version 1.0.

This is the base class for light behavior shell classes. These shells implement a common set of functions in different ways which are specific to the way light is calculated according to their method.

The bulk of the organizational work is done by the class clLightOrg, which calls the needed shell functions for each tree. The clLightOrg object hooks into one particular light shell object, which calls clLightOrg when it is triggered by the behavior manager. It does not particularly matter which shell object is hooked; the first one will suffice. Any non-hooked shells do nothing when their Action() and other functions are called. The hooked shell also tells this object that it's time to register tree data members.

Every object made from this class or a descendent class must have the string "lightshell" in its namestring somewhere. The base class also declares a new tree float data member on behalf of each child shell object; the light org object then registers it. The descendents don't need to do anything. The new data member is called "Light", and will store the amount of light calculated.

Copyright 2003 Charles D. Canham.

Author:
Lora E. Murphy

Edit history:
-----------------
April 28, 2004 - Submitted as beta (LEM)
December 22, 2004 - Added m_bNeedsCommonParameters flag (LEM)
February 24, 2005 - Changed data member from "lgm" to "Light" (LEM)

Constructor & Destructor Documentation

clLightBase::clLightBase ( clSimManager p_oSimManager  ) 

Constructor.

Checks to see if the light org object has been created - if not, it creates it. Sets m_bNeedsCommonParameters to true, its default.

Parameters:
p_oSimManager Sim Manager object.

virtual clLightBase::~clLightBase (  )  [virtual]

Destructor.

Deletes the light org object if it was the hooked object.


Member Function Documentation

void clLightBase::Action (  )  [virtual]

Performs all light calculations.

This will be the same for all descendent classes - they do not need to override. If a particular object is hooked, it calls the light org object's DoLightAssignments. Otherwise it does nothing.

Reimplemented from clBehaviorBase.

Reimplemented in clEpiphyticEstablishment, clGLIMap, clGLIPoints, clLightDepSeedSurvival, and clQuadratGLILight.

void clLightBase::RegisterTreeDataMembers (  )  [virtual]

Performs data member registrations for "Light".

This will be the same for all descendent classes - they do not need to override. If a particular object is hooked, it calls the light org object's DoTreeDataMemberRegistrations(). Otherwise it does nothing.

Reimplemented from clBehaviorBase.

Reimplemented in clEpiphyticEstablishment, and clLightDepSeedSurvival.

virtual float clLightBase::CalcLightValue ( clTree p_oTree,
clTreePopulation p_oPop 
) [pure virtual]

Calculates the light value for a particular tree.

This must be overridden by all child classes.

The reason that the function does not just assign the value to the tree is because the data codes are managed by the light org object.

Parameters:
p_oTree Tree for which to calculate light level.
p_oPop Tree population object.
Returns:
Light level, in whatever format is appropriate to the light object that calculated it.

Implemented in clAverageLight, clBasalAreaLight, clConstantGLI, clDensityLight, clEpiphyticEstablishment, clGapLight, clGliLight, clGLIMap, clGLIPoints, clLightDepSeedSurvival, clQuadratGLILight, and clSailLight.

clLightOrg* clLightBase::GetLightOrg (  )  [inline]

Gets the light org object.

Returns:
The light org object.

void clLightBase::GetData ( xercesc::DOMDocument *  p_oDoc  )  [protected, virtual]

Triggers all light setup.

This will be the same for all descendent classes. If a particular object is hooked, it calls the light org object's DoSetup() function. Then it calls the function DoShellSetup() - if a descendent class has specific setup needs, it can overload that function.

Parameters:
p_oDoc DOM tree of parsed input file.

Implements clWorkerBase.

Reimplemented in clEpiphyticEstablishment, clGLIMap, clGLIPoints, and clLightDepSeedSurvival.

virtual void clLightBase::DoShellSetup ( xercesc::DOMDocument *  p_oDoc  )  [inline, protected, virtual]

If a descendent class has specific setup needs, it can overload this function.

Parameters:
p_oDoc DOM tree of parsed input file.

Reimplemented in clAverageLight, clBasalAreaLight, clConstantGLI, clDensityLight, clGapLight, clGliLight, clQuadratGLILight, and clSailLight.

void clLightBase::PopulateGLIBrightnessArray (  )  [protected]

Populates the GLI brightness array.

Yes, yes, this isn't strictly a function common to all light shells, but it's common to more than one. Plus it's really similar to the sail light brightness array calculator and I may merge them at some point.

This assumes that the brightness array has already been allocated.

void clLightBase::PopulateSailLightBrightnessArray (  )  [protected]

Populates the sail brightness array.

This is so similar to the GLI brightness array function that I wanted them together so I could consider merging them later. But right now it's too much, what with one doing all calcs in radians and one in degrees. If that seems trivial to you, you're welcome to do it yourself.

This assumes that the brightness array has already been allocated.

float clLightBase::GetDayAngle ( int  iJulianDay  )  [inline, protected]

Computes day angle.

Parameters:
iJulianDay Julian day for which to compute a day angle
Returns:
Day angle, in radians.

float clLightBase::GetDeclination ( float &  fDayAngle  )  [inline, protected]

Computes solar declination.

Parameters:
fDayAngle Day angle, in radians, for which to compute declination.
Returns:
Solar declination, in radians.

float clLightBase::GetEccentricity ( float &  fDayAngle  )  [inline, protected]

Computes solar eccentricity.

Parameters:
fDayAngle Day angle, in radians, for which to compute eccentricity.
Returns:
Solar eccentricity, in radians.

float clLightBase::GetSunrise ( float &  fLatInRadians,
float &  fDeclination 
) [inline, protected]

Computes sunrise.

Parameters:
fLatInRadians Latitude, in radians
fDeclination Solar declination on a given day, in radians
Returns:
Sunrise, in solar time

float clLightBase::GetCosineOfZenithAngle ( float &  fDeclination,
float &  fLatInRadians,
float &  fTimeNow 
) [inline, protected]

Computes cosine of the zenith angle of the sun at a given time.

This is needed in other calculations.

Parameters:
fDeclination Solar declination, in radians
fLatInRadians Location latitude in radians
fTimeNow Current time in solar time
Returns:
Cosine of zenith angle of the sun

float clLightBase::GetAltitudeAngle ( float &  fCosZenAng  )  [inline, protected]

Computes altitude angle of the sun at a given time in radians.

Parameters:
fCosZenAng Cosine of the sun's zenith angle

float clLightBase::GetAzimuthAngle ( float &  fDeclination,
float &  fLatInRadians,
float &  fAltInRad,
float &  fTimeNow 
) [inline, protected]

Computes azimuth angle of the sun at a given time in radians in SORTIE azimuth coordinates.

Parameters:
fDeclination Solar declination, in radians
fLatInRadians Location latitude in radians
fAltInRad Sun's current altitude position, in radians
fTimeNow Current solar time
Returns:
Azimuth angle of sun

float clLightBase::GetAirmassEffect ( float &  fAltInDeg,
float &  fCosZenAng 
) [inline, protected]

Computes the airmass effect for a given altitude angle.

Parameters:
fAltInDeg Altitude angle, in degrees
fCosZenAng Cosine of solar zenith angle
Returns:
Airmass effect

float clLightBase::GetBeamRadiation ( float &  fClearSkyTransCoeff,
float &  fAirmass,
float &  fEccentricity,
float &  fCosZenAng 
) [inline, protected]

Computes beam radiation strength.

Parameters:
fClearSkyTransCoeff Clear sky transmission coefficient
fAirmass Airmass effect
fEccentricity Solar eccentricity
fCosZenAng Cosine of solar zenith angle

virtual float clLightBase::GetLightExtinctionCoefficient ( clTree p_oTree  )  [protected, virtual]

Gets the light extinction coefficent.

This passes this through to clLightOrg::GetLightExtCoeff(). This structure allows for overriding by child classes if necessary.

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.

Reimplemented in clLightDepSeedSurvival.


Friends And Related Function Documentation

friend class clLightOrg [friend]

friend class clGliLight [friend]

friend class clQuadratGLILight [friend]

friend class clGLIMap [friend]

friend class clGLIPoints [friend]


Member Data Documentation

clLightOrg* clLightBase::mp_oLightOrg [static, protected]

clLightOrg object - this pointer is held in common by all shells

bool clLightBase::m_bHooked [protected]

Whether or not this shell object is hooked to clLightOrg.

clLightOrg will set this flag.

Whether or not this shell object requires the common light parameters held in clLightOrg such as clLightOrg::m_iLastJulDay.

mp_oLightOrg will check this flag to see whether it should fill these values.

float** clLightBase::mp_fBrightness [protected]

Sky brightness array.

Array size is # altitude angles by # azimuth angles. The altitude index increases from horizon to zenith, and the azimuth index increases from 0 to 2PI. Each child object needs its own copy of this.

float** clLightBase::mp_fPhoto [protected]

Simulated fisheye photo array.

Array size is # altitude angles by # azimuth angles. The altitude index increases from horizon to zenith, and the azimuth index increases from 0 to 2PI. Each child object needs its own copy of this.

float clLightBase::m_fMinSunAngle [protected]

The altitude angle below which the sky is assumed to be dark.

Could be in degrees or radians. Each child object needs its own copy of this.

int clLightBase::m_iNumAziAng [protected]

Number of azimuth angles into which the sky hemisphere is divided.

Each child object needs its own copy of this.

int clLightBase::m_iNumAltAng [protected]

Number of altitude angles into which the sky hemisphere is divided.

Each child object needs its own copy of this.

int clLightBase::m_iMinAngRow [protected]

Row in the brightness array corresponding to the minimum solar angle.

Used to compare calculated object positions. Each child object needs its own copy of this.


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

Generated on Tue Apr 19 13:56:11 2011 for SORTIE Core C++ Documentation by  doxygen 1.5.6