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

Storm Light - Version 1.1. More...

#include <StormLight.h>

Inheritance diagram for clStormLight:
clBehaviorBase clWorkerBase

Public Member Functions

 clStormLight (clSimManager *p_oSimManager)
 Constructor. More...
 
 ~clStormLight ()
 Destructor. More...
 
void GetData (xercesc::DOMDocument *p_oDoc)
 Does setup for this behavior. More...
 
void Action ()
 Performs light calculations. 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...
 
clSimManagerGetSimManager ()
 
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 Types

enum  types { adult, snag }
 Enum to translate our types to array index. More...
 

Protected Attributes

clGridmp_oLightGrid
 Grid object which holds the light values. More...
 
int ** mp_iStmDmgCodes
 Return codes for the "stm_dmg" int tree data member. More...
 
double m_fMaxRadius
 The max radius, in m, to search for storm-damaged neighbors. More...
 
double m_fSlope
 The slope of the light function. More...
 
double m_fIntercept
 The intercept of the light function. More...
 
double m_fRandParameter
 Standard deviation if normal or lognormal distribution is desired. More...
 
double m_fMinCanopyTrees
 The minimum number of trees within the search radius for the site to qualify as under full canopy. More...
 
int m_iMaxDmgTime
 The max time since damage, in years, that a live tree can count toward light calculations. More...
 
int m_iMaxSnagDmgTime
 The max time since damage, in years, that a snag can count toward light calculations. More...
 
int m_iNumTypes
 Number of types - 2. More...
 
pdf m_iStochasticity
 What stochasticity to apply to light levels. More...
 
short int m_iGridLightCode
 Return code for the "Light" data member. 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...
 
stcSpeciesTypeCombomp_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...
 
clSimManagermp_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...
 

Detailed Description

Storm Light - Version 1.1.

This behavior calculates light level as a function of local storm damage. It uses a grid to store these light values (light values are not assigned to individual trees).

The light level is calculated as follows:

GLA = ((1 - T/M) * 100) + (a + b * N)

where:

The first term in the equation corrects for the possibility of not being under a full canopy. If T >= M, then the term drops out and only the linear second half is used. If T < M, then the trees get at least the proportion of full sun equal to the proportion of trees missing from the full canopy. When counting up T, all adults and snags count, whether storm-damaged or not.

For the second term in the equation, "trees that count" are those that have been heavily damaged in recent storms or those that have died from natural mortality. Trees count as heavily damaged if they are either snags with a storm counter (i.e. trees killed in storms) or live adults with a storm damage flag indicating heavy damage. Saplings and seedlings never count. Storm-damaged trees have a counter set for time since the storm, and natural mortality snags have an age. There is a maximum time, after which a tree is not counted in light calculations even if it is still damaged (or hanging around as a snag).

The trees are counted within a user-set radius of R from the center of the grid cell. The proportion is heavily damaged adults and snags divided by total adults and snags.

The light levels can be randomized, if desired. The user can choose to use this deterministically, in which case the values equal the GLA value as calculated in the function above. Alternately, this value can be used as the mean for a random draw on a probability distribution function. The user can specify the PDF to use.

This behavior creates a new grid called "Storm Light".

The namestring and parameter file call string for this behavior are both "StormLight".

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

◆ types

enum clStormLight::types
protected

Enum to translate our types to array index.

Enumerator
adult 
snag 

Constructor & Destructor Documentation

◆ clStormLight()

clStormLight::clStormLight ( clSimManager p_oSimManager)

Constructor.

Sets the namestring.

Parameters
p_oSimManagerSim Manager object.

◆ ~clStormLight()

clStormLight::~clStormLight ( )

Destructor.

Frees memory.

Member Function Documentation

◆ Action()

void clStormLight::Action ( )
virtual

Performs light calculations.

This goes through each cell in "Storm Light" and calculates its GLA value as described above.

Reimplemented from clBehaviorBase.

◆ GetData()

void clStormLight::GetData ( xercesc::DOMDocument *  p_oDoc)
virtual

Does setup for this behavior.

This reads parameter file values and sets up the grid.

Parameters
p_oDocDOM tree of parsed input file.
Exceptions
modelErrif the value for stochasticity is unrecognized, or if the minimum number of canopy trees is a negative number.

Implements clWorkerBase.

Member Data Documentation

◆ m_fIntercept

double clStormLight::m_fIntercept
protected

The intercept of the light function.

◆ m_fMaxRadius

double clStormLight::m_fMaxRadius
protected

The max radius, in m, to search for storm-damaged neighbors.

◆ m_fMinCanopyTrees

double clStormLight::m_fMinCanopyTrees
protected

The minimum number of trees within the search radius for the site to qualify as under full canopy.

◆ m_fRandParameter

double clStormLight::m_fRandParameter
protected

Standard deviation if normal or lognormal distribution is desired.

Or nothing, if we are using deterministic light levels.

◆ m_fSlope

double clStormLight::m_fSlope
protected

The slope of the light function.

◆ m_iGridLightCode

short int clStormLight::m_iGridLightCode
protected

Return code for the "Light" data member.

◆ m_iMaxDmgTime

int clStormLight::m_iMaxDmgTime
protected

The max time since damage, in years, that a live tree can count toward light calculations.

◆ m_iMaxSnagDmgTime

int clStormLight::m_iMaxSnagDmgTime
protected

The max time since damage, in years, that a snag can count toward light calculations.

◆ m_iNumTypes

int clStormLight::m_iNumTypes
protected

Number of types - 2.

◆ m_iStochasticity

pdf clStormLight::m_iStochasticity
protected

What stochasticity to apply to light levels.

◆ mp_iStmDmgCodes

int** clStormLight::mp_iStmDmgCodes
protected

Return codes for the "stm_dmg" int tree data member.

Array index one is sized m_iNumTypes; array index two is sized total number of species.

◆ mp_oLightGrid

clGrid* clStormLight::mp_oLightGrid
protected

Grid object which holds the light values.

The name of this grid is "Storm Light". It has one float data member called "Light". It uses the default grid cell resolution unless otherwise instructed in the parameter file. A map of this grid in the parameter file will be ignored.


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