#include <WeibullSnagMort.h>
Public Member Functions | |
clWeibullSnagMort (clSimManager *p_oSimManager) | |
Constructor. | |
~clWeibullSnagMort () | |
Destructor. | |
void | DoShellSetup (xercesc::DOMDocument *p_oDoc) |
Performs specific setup for this behavior. | |
deadCode | DoMort (clTree *p_oTree, const float &fDbh, const short int &iSpecies) |
Calculates whether a snag lives or dies. | |
Protected Member Functions | |
void | ReadParameterFile (xercesc::DOMDocument *p_oDoc) |
Reads required data from the parameter file. | |
void | FillDeathProbArray () |
Declares and populates the mp_fProbabilityOfDeath array. | |
float | CalculateDeathProbability (int iSizeClass, int iSpecies, int iAge) |
Calculates a probability of death for snags of a certain age. | |
void | GetAgeCodes () |
Gets the data member return codes for the "age" snag data member. | |
void | ValidateTypes () |
Makes sure that this behavior has only been applied to snags. | |
Protected Attributes | |
float *** | mp_fProbabilityOfDeath |
Pre-calculated probabilities of death. | |
float ** | mp_fAParameter |
Parameter "a" in Weibull function. | |
float ** | mp_fBParameter |
Parameter "b" in Weibull function. | |
float ** | mp_fSnagSizeClasses |
Upper limit of DBH in each snag size class. | |
float | m_fNumYearsPerTimestep |
Number of years per timestep. | |
short int * | mp_iAgeCodes |
Data member codes for "age" snag member for each behavior species. | |
short int * | mp_iIndexes |
For accessing arrays. | |
short int | m_iMaxPrecalcAge |
Max age, in timesteps, that the probability of death is pre-calculated. | |
short int | m_iNumSizeClasses |
Number of snag size classes for which separate parameters can be defined. |
Snags are standing dead trees, and as such "mortality" is something of a misnomer. However, since this behavior fits in with the other mortality behaviors, we will continue to use that naming scheme.
Snag death really means that a snag falls over. The probability that this will happen to any one snag is a function of its age as a snag. The percentage standing of a snag population is:
The rate at which snags fall over changes with snag size. This behavior allows the definition of three snag size classes. Each size class can take a different set of a and b values.
This behavior can only be applied to snags.
The namestring for this behavior is "weibsnagmortshell". The parameter file call string is "weibull snag mortality".
Copyright 2004 Charles D. Canham.
clWeibullSnagMort::clWeibullSnagMort | ( | clSimManager * | p_oSimManager | ) |
Constructor.
Sets the namestring and nulls all pointers.
clWeibullSnagMort::~clWeibullSnagMort | ( | ) |
Destructor.
Frees memory.
void clWeibullSnagMort::DoShellSetup | ( | xercesc::DOMDocument * | p_oDoc | ) | [virtual] |
Performs specific setup for this behavior.
p_oDoc | Parsed DOM tree of parameter file. |
Reimplemented from clMortalityBase.
deadCode clWeibullSnagMort::DoMort | ( | clTree * | p_oTree, | |
const float & | fDbh, | |||
const short int & | iSpecies | |||
) | [virtual] |
Calculates whether a snag lives or dies.
If the snag age in timesteps is less than m_iMaxPrecalcAge, then a random number is compared to the appropriate value in mp_fProbabilityOfDeath. If it is greater than that age, then its probability of death is calculated directly from the Weibull function. In each case, if the random number is less than or equal to the probability of death, then the snag dies.
fDbh | DBH of tree being evaluated | |
p_oTree | Tree being evaluated | |
iSpecies | Species of the tree being evaluated |
natural if the tree is to "die", notdead if it "lives".
Implements clMortalityBase.
void clWeibullSnagMort::ReadParameterFile | ( | xercesc::DOMDocument * | p_oDoc | ) | [protected] |
Reads required data from the parameter file.
p_oDoc | Parsed DOM tree of parameter file. |
modelErr | if:
|
void clWeibullSnagMort::FillDeathProbArray | ( | ) | [protected] |
Declares and populates the mp_fProbabilityOfDeath array.
For each timestep t, it calculates the probability of mortality between t and t-1 using CalculateDeathProbability().
float clWeibullSnagMort::CalculateDeathProbability | ( | int | iSizeClass, | |
int | iSpecies, | |||
int | iAge | |||
) | [protected] |
Calculates a probability of death for snags of a certain age.
The probability is calculated as since the last timestep. If Ft is the value of the function above at timestep t, then the probability Pt of mortality between timesteps t-1 and t is:
If the age is within the first timestep, then the probability is the value of the function at time t.
iSizeClass | Size class number, as 0, 1, or 2. THIS NUMBER IS NOT CHECKED FOR VALIDITY. | |
iSpecies | Species number. NOT species index, just plain old species. | |
iAge | Age in years. |
void clWeibullSnagMort::GetAgeCodes | ( | ) | [protected] |
Gets the data member return codes for the "age" snag data member.
Return codes are captured in the mp_iAgeCodes array.
void clWeibullSnagMort::ValidateTypes | ( | ) | [protected] |
Makes sure that this behavior has only been applied to snags.
modelErr | if any tree type besides snags has been applied to this behavior. |
float*** clWeibullSnagMort::mp_fProbabilityOfDeath [protected] |
Pre-calculated probabilities of death.
Array is m_iNumSizeClasses by number of behavior species by m_iMaxPrecalcAge.
float** clWeibullSnagMort::mp_fAParameter [protected] |
Parameter "a" in Weibull function.
Array size is m_iNumSizeClasses by number of behavior species.
float** clWeibullSnagMort::mp_fBParameter [protected] |
Parameter "b" in Weibull function.
Array size is m_iNumSizeClasses by number of behavior species.
float** clWeibullSnagMort::mp_fSnagSizeClasses [protected] |
Upper limit of DBH in each snag size class.
This array is sized m_iNumSizeClasses by number of behavior species. The value in the third size class bucket for each species is ignored since it is always effectively infinity.
float clWeibullSnagMort::m_fNumYearsPerTimestep [protected] |
Number of years per timestep.
short int* clWeibullSnagMort::mp_iAgeCodes [protected] |
Data member codes for "age" snag member for each behavior species.
short int* clWeibullSnagMort::mp_iIndexes [protected] |
For accessing arrays.
One per species.
short int clWeibullSnagMort::m_iMaxPrecalcAge [protected] |
Max age, in timesteps, that the probability of death is pre-calculated.
short int clWeibullSnagMort::m_iNumSizeClasses [protected] |
Number of snag size classes for which separate parameters can be defined.