SORTIE Core C++ Documentation
|
Aggregated mortality version 1.0. More...
#include <AggregatedMortality.h>
Public Member Functions | |
clAggregatedMortality (clSimManager *p_oSimManager) | |
Constructor. More... | |
~clAggregatedMortality () | |
Destructor. More... | |
void | DoShellSetup (xercesc::DOMDocument *p_oDoc) |
Does behavior setup. More... | |
void | PreMortCalcs (clTreePopulation *p_oPop) |
Performs mortality. More... | |
float | GetMortalityEpisodeProbability () |
For testing purposes. More... | |
float | GetTreeMortalityProb () |
For testing purposes. More... | |
deadCode | DoMort (clTree *p_oTree, const float &fDbh, const short int &iSpecies) |
Determines mortality for a tree. More... | |
Public Member Functions inherited from clMortalityBase | |
clMortalityBase (clSimManager *p_oSimManager) | |
Constructor. More... | |
virtual | ~clMortalityBase () |
Destructor. More... | |
void | Action () |
Performs mortality calculations. More... | |
clMortalityOrg * | GetMortOrg () |
Gets the mortality org object. More... | |
void | RegisterTreeDataMembers () |
Triggers the mortality data member registrations. More... | |
short int | GetNewTreeInts () |
Overridden from clBehaviorBase. More... | |
bool | UsesThisMortality (short int iSp, short int iTp) |
Whether or not a species/type combo uses this mortality object. 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 | 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 | 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 Member Functions | |
void | ReadParFile (xercesc::DOMDocument *p_oDoc) |
Reads in parameters from the parameter file. More... | |
void | GetDeadCodes (clTreePopulation *p_oPop) |
Gets codes for the "dead" data member for each tree type to which this behavior applies. More... | |
void | SetUpAppliesTo (clTreePopulation *p_oPop) |
Sets up the mp_bAppliesTo matrix. More... | |
bool | IsValid (clTree *p_oTree) |
Tests a tree to see whether it is eligible for killing. More... | |
void | KillClump (clTreePopulation *p_oPop, clTree *p_oTree, int iNumToKill) |
Kills a single clump of trees. More... | |
Protected Member Functions inherited from clMortalityBase | |
void | GetData (xercesc::DOMDocument *p_oDoc) |
Triggers all mortality setup. More... | |
void | PopulateUsesThisMortality () |
Declares and populates the mp_bUsesThisMortality array. More... | |
Protected Member Functions inherited from clWorkerBase | |
void | AssembleFileCode (int iFileType, int iFileVersion, char *cCode) |
Creates the proper identifying filecode for an XML file. More... | |
Protected Attributes | |
int ** | mp_iDeadCodes |
Return codes for the "dead" bool tree data member. More... | |
bool ** | mp_bAppliesTo |
Matrix for which tree types and species this behavior is applied. More... | |
double | m_fMortalityEpisodeProbability |
Per-timestep probability of a mortality episode occuring, 0 - 1. More... | |
double | m_fMortalityProb |
Per-timestep proportion of trees to kill, 0 - 1. More... | |
int | m_iNumTreesToClump |
Number of trees to kill together in a clump. More... | |
double | m_fClumpingParameter |
Clumping parameter for the negative binomial distribution, if applicable. More... | |
int | m_iTotalNumSpecies |
Total number of species. More... | |
bool | m_bClumpSizeDeterministic |
If true, the size of a single clump of trees to kill is deterministic. More... | |
Protected Attributes inherited from clMortalityBase | |
short int | m_iNumTotalSpecies |
Keep a copy for the constructor. More... | |
bool | m_bHooked |
Whether or not this shell object is hooked to clMortalityOrg. More... | |
bool ** | mp_bUsesThisMortality |
2D array, species by type, of whether or not this mortality shell applies to a given species/type combo. 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 | |
Static Protected Attributes inherited from clMortalityBase | |
static clMortalityOrg * | mp_oMortalityOrg |
clMortalityOrg object. More... | |
Aggregated mortality version 1.0.
This behavior kills trees in a way that is clumped in both time and space.
Mortality occurs in discrete episodes, governed by a return interval specified by the user. Each timestep, the probability of a mortality episode is T/RI, where T is the number of years per timestep and RI is the return interval in years. At each timestep, a uniform random number is compared to this probability to decide whether or not an episode of mortality occurs. If not, no trees are killed by this behavior.
When a mortality episode occurs, trees are killed in clumps of a size set by the user. Each tree has an equal probability of being the first tree to die in a clump, and is evaluated individually. The probability of mortality is the total mortality probability given by the user divided by the size of the clump. This probability applies only to trees to which this behavior is applied. Other trees are not killed by this behavior, either directly or as part of a clump.
Trees are killed in clumps. The number of trees in a clump can either be deterministic, meaning the clumps are always the same size, or it can be drawn from a negative binomial probability distribution.
For each tree in the pool, the behavior uses a random number to see if it will start a clump. If it will, the behavior kills it, then its closest neighbors to which the behavior applies, until it has killed the number of trees in the clump. If the clump size is 1, then this behavior replicates the clStochasticMort method.
The mortality rate is given as per year. The per timestep amount to kill is 1-(1-AD)^X, where AD is the amount of damage and X is the number of years per timestep.
Because of the clumping thing, this chooses all its trees to kill in the PreMortCalcs function.
There could be problems if there are other mortality behaviors that come before this one. Not in a code way, but they might kill again trees this behavior has chosen to kill; so fewer than expected trees might die.
The namestring for this class is "aggregatedmortshell". The parameter file call string is "AggregatedMortality".
This behavior is only descended from clMortalityBase in order to take advantage of the registration of the "dead" tree data member.
Copyright 2011 Charles D. Canham
clAggregatedMortality::clAggregatedMortality | ( | clSimManager * | p_oSimManager | ) |
Constructor.
p_oSimManager | Sim Manager object. |
clAggregatedMortality::~clAggregatedMortality | ( | ) |
Destructor.
Frees memory.
|
virtual |
Determines mortality for a tree.
This just returns the value in the "dead" bool tree data member.
p_oTree | Tree being evaluated. |
fDbh | DBH of tree being evaluated. |
iSpecies | Species of tree being evaluated. |
Implements clMortalityBase.
|
virtual |
Does behavior setup.
Calls the following functions:
Then final calculations for mortality episode probability and amount of damage are made.
p_oDoc | DOM tree of parsed input file. |
Reimplemented from clMortalityBase.
|
protected |
Gets codes for the "dead" data member for each tree type to which this behavior applies.
p_oPop | Tree population object. |
modelErr | if the codes are not available for every tree type to which this behavior is applied, or if this behavior is applied to seedlings. |
|
inline |
For testing purposes.
|
inline |
For testing purposes.
|
protected |
Tests a tree to see whether it is eligible for killing.
It must be of a species and tree type to which this behavior is applied, and not dead.
p_oTree | Tree to test. |
|
protected |
Kills a single clump of trees.
This function gets the coordinate of the first tree in the clump. It searches a circle of an ever-widening radius until it finds enough trees to make a complete clump. It then sorts the trees it finds in distance order so that the trees closest to the target will be killed to make the clump.
p_oPop | Tree population object. |
p_oTree | First tree in the clump. |
iNumToKill | Number of trees to kill. |
|
virtual |
Performs mortality.
A random number compared to the probability of a mortality episode decides if an episode occurs. If not, this exits. If so, this goes through all the trees to which it applies. For each, if the tree is not already "dead", then a random number decides whether it begins a dead clump. To find the trees in the clump, it searches in a circle of radius 5 meters for neighbors. The trees eligible to die are killed in order of distance until the number in the clump has been reached. If not enough trees are found in 5 meters, the circle is widened in 5 meter increments until enough trees are found.
p_oPop | Tree population. |
Reimplemented from clMortalityBase.
|
protected |
Reads in parameters from the parameter file.
p_oDoc | DOM tree of parsed input file. |
modelErr | if:
|
|
protected |
Sets up the mp_bAppliesTo matrix.
p_oPop | Tree population object. |
|
protected |
If true, the size of a single clump of trees to kill is deterministic.
If false, the size is chosen from a negative binomial probability distribution.
|
protected |
Clumping parameter for the negative binomial distribution, if applicable.
|
protected |
Per-timestep probability of a mortality episode occuring, 0 - 1.
Read from the parameter file as a return interval, then this value is calculated as T/RI, where T is the number of years per timestep and RI is the return interval in years.
|
protected |
Per-timestep proportion of trees to kill, 0 - 1.
Read from the parameter file as an annual amount, then this value is calculated as (1-(1-AD)^X)/C, where AD is the amount of damage, X is the number of years per timestep, and C is the clump size.
|
protected |
Number of trees to kill together in a clump.
This is either a deterministic value or the mean of the negative binomial probability distribution from which to choose a value.
|
protected |
Total number of species.
Primarily for the destructor.
|
protected |
Matrix for which tree types and species this behavior is applied.
Array index is sized total number of species by total number of life history stages.
|
protected |
Return codes for the "dead" bool tree data member.
Array index one is sized total number of species by total number of life history stages.