#include <LightBase.h>
Inheritance diagram for clLightBase:
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. | |
clLightOrg * | GetLightOrg () |
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 clLightOrg * | mp_oLightOrg |
clLightOrg object - this pointer is held in common by all shells | |
Friends | |
class | clLightOrg |
class | clGliLight |
class | clQuadratGliLight |
class | clGLIMap |
class | clGLIPoints |
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.
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.
p_oSimManager | Sim Manager object. |
virtual clLightBase::~clLightBase | ( | ) | [virtual] |
Destructor.
Deletes the light org object if it was the hooked object.
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 clGLIMap, clGLIPoints, 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.
p_oTree | Tree for which to calculate light level. | |
p_oPop | Tree population object. |
Implemented in clAverageLight, clBasalAreaLight, clConstantGLI, clDensityLight, clGapLight, clGliLight, clGLIMap, clGLIPoints, clLightDepSeedSurvival, clQuadratGliLight, and clSailLight.
virtual void clLightBase::DoShellSetup | ( | xercesc::DOMDocument * | p_oDoc | ) | [inline, protected, virtual] |
If a descendent class has specific setup needs, it can overload this function.
p_oDoc | DOM tree of parsed input file. |
Reimplemented in clAverageLight, clBasalAreaLight, clConstantGLI, clDensityLight, clGapLight, clGliLight, clQuadratGliLight, and clSailLight.
float clLightBase::GetAirmassEffect | ( | float & | fAltInDeg, | |
float & | fCosZenAng | |||
) | [inline, protected] |
Computes the airmass effect for a given altitude angle.
fAltInDeg | Altitude angle, in degrees | |
fCosZenAng | Cosine of solar zenith angle |
float clLightBase::GetAltitudeAngle | ( | float & | fCosZenAng | ) | [inline, protected] |
Computes altitude angle of the sun at a given time in radians.
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.
fDeclination | Solar declination, in radians | |
fLatInRadians | Location latitude in radians | |
fAltInRad | Sun's current altitude position, in radians | |
fTimeNow | Current solar time |
float clLightBase::GetBeamRadiation | ( | float & | fClearSkyTransCoeff, | |
float & | fAirmass, | |||
float & | fEccentricity, | |||
float & | fCosZenAng | |||
) | [inline, protected] |
Computes beam radiation strength.
fClearSkyTransCoeff | Clear sky transmission coefficient | |
fAirmass | Airmass effect | |
fEccentricity | Solar eccentricity | |
fCosZenAng | Cosine of solar zenith angle |
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.
fDeclination | Solar declination, in radians | |
fLatInRadians | Location latitude in radians | |
fTimeNow | Current time in solar time |
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.
p_oDoc | DOM tree of parsed input file. |
Implements clWorkerBase.
Reimplemented in clGLIMap, clGLIPoints, and clLightDepSeedSurvival.
float clLightBase::GetDayAngle | ( | int | iJulianDay | ) | [inline, protected] |
Computes day angle.
iJulianDay | Julian day for which to compute a day angle |
float clLightBase::GetDeclination | ( | float & | fDayAngle | ) | [inline, protected] |
Computes solar declination.
fDayAngle | Day angle, in radians, for which to compute declination. |
float clLightBase::GetEccentricity | ( | float & | fDayAngle | ) | [inline, protected] |
Computes solar eccentricity.
fDayAngle | Day angle, in radians, for which to compute eccentricity. |
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.
p_oTree | Tree for which to obtain the light extinction coefficient. |
Reimplemented in clLightDepSeedSurvival.
clLightOrg* clLightBase::GetLightOrg | ( | ) | [inline] |
Gets the light org object.
float clLightBase::GetSunrise | ( | float & | fLatInRadians, | |
float & | fDeclination | |||
) | [inline, protected] |
Computes sunrise.
fLatInRadians | Latitude, in radians | |
fDeclination | Solar declination on a given day, in radians |
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.
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 clLightDepSeedSurvival.
bool clLightBase::m_bHooked [protected] |
Whether or not this shell object is hooked to clLightOrg.
clLightOrg will set this flag.
bool clLightBase::m_bNeedsCommonParameters [protected] |
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::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_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.
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_iNumAziAng [protected] |
Number of azimuth angles into which the sky hemisphere is divided.
Each child object needs its own copy of this.
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.