SORTIE Core C++ Documentation
|
Implements a light filter according to Beer's Law. More...
#include <LightFilter.h>
Public Member Functions | |
clLightFilter (clSimManager *p_oSimManager) | |
Constructor. More... | |
~clLightFilter () | |
Destructor. More... | |
void | GetData (xercesc::DOMDocument *p_oDoc) |
Reads values from parameter file and registers our data members. More... | |
void | Action () |
Applies the light filtering to all tree type/species combos to which this behavior is applied. More... | |
Public Member Functions inherited from clBehaviorBase | |
virtual float | GetBehaviorVersion () |
Gets the behavior version number. More... | |
clBehaviorBase (clSimManager *p_oSimManager) | |
Constructor. More... | |
virtual | ~clBehaviorBase () |
Destructor. More... | |
virtual short int | ValidateVersionNumber (float fTestVersion) |
Makes sure that the version number of a file passed is between the minimum and current version numbers. More... | |
virtual void | RegisterTreeDataMembers () |
Registers tree data members. More... | |
virtual void | SetSpeciesTypeCombos (short int iNumCombos, stcSpeciesTypeCombo *p_whatCombos) |
Sets the species/type combos for a behavior. More... | |
virtual void | SetNameData (std::string sNameString) |
Sets the string for the parameter file behavior. More... | |
virtual short int | GetNewTreeInts () |
Gets the number of new tree integer data members this behavior wants to register. More... | |
virtual short int | GetNewTreeFloats () |
Gets the number of new tree float data members this behavior wants to register. More... | |
virtual short int | GetNewTreeChars () |
Gets the number of new tree character data members this behavior wants to register. More... | |
virtual short int | GetNewTreeBools () |
Gets the number of new tree bool data members this behavior wants to register. More... | |
virtual short int | GetNumSpeciesTypeCombos () |
Gets the number of species/type combos to which this behavior applies. More... | |
virtual short int | GetNumBehaviorSpecies () |
Gets the number of unique tree species to which this behavior applies. More... | |
struct stcSpeciesTypeCombo | GetSpeciesTypeCombo (short int iIndex) |
Gets one of this behavior's type/species combos. More... | |
virtual short int | GetBehaviorSpecies (short int iIndex) |
Gets one of the behavior's species. More... | |
short int | GetBehaviorListNumber () |
Gets the behavior list number for this behavior, which differentiates between multiple copies of the behavior in the behavior list. More... | |
void | SetBehaviorListNumber (short int iNumber) |
Sets the behavior list number for this behavior, which differentiates between multiple copies of the behavior in the behavior list. More... | |
std::string | FormatSpeciesTypeQueryString () |
Formats the string for species/types query. More... | |
virtual DOMElement * | GetParentParametersElement (xercesc::DOMDocument *p_oDoc) |
This will get the correct set of parameters for this behavior based on the behavior list position number. More... | |
Public Member Functions inherited from clWorkerBase | |
clWorkerBase (clSimManager *p_oSimManager) | |
Constructor. More... | |
virtual | ~clWorkerBase () |
Destructor. More... | |
std::string | GetName () |
Gets the object's namestring. More... | |
clSimManager * | GetSimManager () |
void | DoObjectSetup (xercesc::DOMDocument *p_oDoc, fileType iFileType) |
Triggers the setup process. More... | |
virtual void | TimestepCleanup () |
Performs any necessary cleanup operations at the end of a timestep. More... | |
virtual void | EndOfRunCleanup () |
Performs any necessary cleanup operations at the end of a run. More... | |
Protected Attributes | |
double | m_fLightExtinctionCoefficient |
The light extinction coefficient of the filter. More... | |
int | m_iFilterHeight |
The height of the filter, in mm; will be converted from the value in the parameter file in meters. More... | |
short int ** | mp_iLightCodes |
Holds data member codes for "Light" - first array index is species number, second is type number. More... | |
short int ** | mp_iCounterCodes |
Holds data member codes for "lf_count" - first array index is species number, second is type number. More... | |
short int ** | mp_iZCodes |
Holds data member codes for "z" - first array index is species number, second is type number. More... | |
short int ** | mp_iHeightCodes |
Holds data member codes for tree height - first array index is species number, second is type number. More... | |
short int | m_iNumSpecies |
For the sake of the destructor - the number of species. More... | |
Protected Attributes inherited from clBehaviorBase | |
short int | m_iNumSpeciesTypeCombos |
How many type/species combos a behavior will act on. More... | |
short int | m_iNumBehaviorSpecies |
How many distinct species are in the combo list - important for filling species-specific values from parameter file. More... | |
short int * | mp_iWhatSpecies |
List of distinct species - for filling species-specific values from parameter file. More... | |
stcSpeciesTypeCombo * | mp_whatSpeciesTypeCombos |
Array of species/type combos that the behavior will act on. More... | |
short int | m_iNewTreeInts |
The number of new tree integer data members this behavior wants to add. More... | |
short int | m_iNewTreeFloats |
The number of new tree float data members this behavior wants to add. More... | |
short int | m_iNewTreeChars |
The number of new tree character data members this behavior wants to add. More... | |
short int | m_iNewTreeBools |
The number of new tree boolean data members this behavior wants to add. More... | |
short int | m_iBehaviorListNumber |
The number of this behavior in the behavior list, to differentiate between possible multiple copies of this behavior. More... | |
float | m_fVersionNumber |
Version number - this will be rounded to 2 digits after the decimal place. More... | |
std::string | m_sXMLRoot |
XML root that encloses the parameters for this behavior. More... | |
float | m_fMinimumVersionNumber |
Minimum version number - this behavior will run parameter data for a file marked between this number and the current version number, inclusive. More... | |
Protected Attributes inherited from clWorkerBase | |
std::string | m_sNameString |
If a behavior has registered a command line command with the sim manager, this allows it to be called. More... | |
clSimManager * | mp_oSimManager |
Pointer to the simulation manager object. More... | |
int * | mp_iAllowedFileTypes |
List of the input file types this object can handle. More... | |
int | m_iNumAllowedTypes |
Number of input file types this object can handle. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from clWorkerBase | |
void | AssembleFileCode (int iFileType, int iFileVersion, char *cCode) |
Creates the proper identifying filecode for an XML file. More... | |
Implements a light filter according to Beer's Law.
Imagine a fog that hangs out on the forest floor and ends abruptly at a certain height. All trees shorter than the top of the fog layer will have their light attenuated but not blocked completely. The closer they get to the top of the fog the more light is let in. The amount of light which actually gets through is calculated according to Beer's Law, where transmission = e-az, where a = light extinction coefficient of the filter (in 1/meter units, somehow) and z = thickness of the filter, in meters (which is the distance from the light point to the top of the filter). This filter behavior can be used to, for instance, replicate the effects of an herbaceous layer in reducing light to young seedlings.
The height of the filter is randomized slightly each time the thickness of the filter over the light point is calculated to introduce a stochastic element.
Trees can be given a respite from the effects of the filter. This behavior will create an integer tree data member for a counter for years of respite (called "lf_count"). This behavior doesn't set the value in the counter; that is left to another behavior, such as recruitment. Once a counter is set, this behavior will decrement it until it is zero, leaving the tree alone for the duration.
Trees are given a rooting height (integer tree data member, in mm, called "z", added by this behavior). This value is added to their existing height to get their effective height, which is what will be applied when determining the thickness of the filter overhead. Again, this behavior does not set this height but will use it if another behavior sets it.
This behavior DOES NOT ACTUALLY CALCULATE LIGHT LEVELS. It will check all tree types to which it is applied to ensure that a float data member called "Light" has been registerd. This data member is assumed to contain a GLI-like value, which is reduced by the percent transmission calculated. A fatal error will be thrown if this data member has not been registered during setup.
This behavior only affects tree types and species to which it is applied in the behavior list of the parameter file. It will ignore all other trees, even if they are short enough to be beneath the filter level.
Units are kept in integer number of millimeters, where possible, to increase the amount of integer math (fast) and decrease the amount of float math (slow).
The namestring for this behavior is "LightFilter". Call this behavior in the parameter file with the string "LightFilter".
Copyright 2004 Charles D. Canham
Edit history:
--------------—
October 20, 2011 - Wiped the slate clean for SORTIE 7.0 (LEM)
clLightFilter::clLightFilter | ( | clSimManager * | p_oSimManager | ) |
Constructor.
p_oSimManager | clSimManager object. |
clLightFilter::~clLightFilter | ( | ) |
Destructor.
Deletes arrays.
|
virtual |
Applies the light filtering to all tree type/species combos to which this behavior is applied.
If the value of lf_count in a tree is greater than zero, it is decremented by the number of years per timestep and no further action is taken. Otherwise, a tree's z and height values are added together and Beer's Law is calculated as described above. The value in "Light" is multiplied by the resulting transmission percentage.
This does an "all" tree search. I figured it was simplest, since we still have to validate species and type even if we do a species/type search. The presence of a return code for "z" that is greater than -1 will be used as a simple proxy for assignment to species/type combo.
Reimplemented from clBehaviorBase.
|
virtual |
Reads values from parameter file and registers our data members.
p_oDoc | DOM tree of parsed input file. |
Implements clWorkerBase.
|
protected |
The light extinction coefficient of the filter.
In the parameter file the units are 1/m but it will be stored here as 1/mm by dividing by 1000
|
protected |
The height of the filter, in mm; will be converted from the value in the parameter file in meters.
|
protected |
For the sake of the destructor - the number of species.
|
protected |
Holds data member codes for "lf_count" - first array index is species number, second is type number.
|
protected |
Holds data member codes for tree height - first array index is species number, second is type number.
|
protected |
Holds data member codes for "Light" - first array index is species number, second is type number.
|
protected |
Holds data member codes for "z" - first array index is species number, second is type number.