SORTIE Core C++ Documentation
|
Density Dependent Infestation. More...
#include <DensDepInfestation.h>
Public Member Functions | |
clDensDepInfestation (clSimManager *p_oSimManager) | |
Constructor. More... | |
~clDensDepInfestation () | |
Destructor. More... | |
void | GetData (xercesc::DOMDocument *p_oDoc) |
Does behavior setup. More... | |
void | Action () |
Does insect infestation each timestep. More... | |
void | RegisterTreeDataMembers () |
Registers the "YearsInfested" and "DensDepResistanceStatus" int data members. 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 | 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 Member Functions | |
void | ReadParFile (xercesc::DOMDocument *p_oDoc, clTreePopulation *p_oPop) |
Reads in parameters from the parameter file. More... | |
void | FormatQueryString (clTreePopulation *p_oPop) |
Formats the string in m_cQuery. More... | |
void | TreeInventory () |
This traverses the tree population and does a few things: More... | |
void | InfestInitialConditionsTrees () |
Assigns infestation status and length to initial conditions trees in the case that infestation starts before the beginning of the run. More... | |
void | DetermineCohortInfestationProbability (double fTargetRate) |
Calculates each cohort's probability of infestation for individual trees, based on the results of TreeInventory(). More... | |
void | EndInfestation () |
Ends infestation. 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 | |
short int ** | mp_iYearsInfestedCodes |
Return codes for the "YearsInfested" int tree data member. More... | |
short int ** | mp_iDensDepResistanceStatusCodes |
Return codes for the "DensDepResistanceStatus" int tree data member. More... | |
double * | mp_fMinDBH |
Minimum DBH for trees to be infested. More... | |
double * | mp_fCohortDBH |
Cohort cutoff DBH. More... | |
double * | mp_fProbResistant |
Probability that a tree is resistant, 0-1. More... | |
double * | mp_fProbConditionallySusceptible |
Probability that a tree is conditionally susceptible, 0-1. More... | |
double | m_fMax |
Maximum infestation rate parameter. More... | |
double | m_fA |
The "a" parameter. More... | |
double | m_fBx |
The "bx" parameter. More... | |
double | m_fBy |
The "by" parameter. More... | |
double | m_fPlotBA |
Total plot BA. More... | |
double | m_fPoolBA |
BA in the pool of trees to which this behavior applies (including resistant trees). More... | |
double | m_fSmallCohortProb |
Current probability of infestation for the smaller cohort. More... | |
double | m_fLargeCohortProb |
Current probability of infestation for the larger cohort. More... | |
long | m_iNumSmallCohortPoolTrees |
Number of trees in the pool to which this behavior applies (including resistant trees), below the cohort cutoff. More... | |
long | m_iNumLargeCohortPoolTrees |
Number of trees in the pool to which this behavior applies (including resistant trees), equal to or above the cohort cutoff. More... | |
long | m_iNumSmallCohortInfestedTrees |
Number of infested trees in the pool to which this behavior applies (including resistant trees), below the cohort cutoff. More... | |
long | m_iNumLargeCohortInfestedTrees |
Number of infested trees in the pool to which this behavior applies (including resistant trees), equal to or above the cohort cutoff. More... | |
long | m_iNumSmallInfestibleTrees |
Number of trees that can be infested (non-resistant, regardless of current infestation status), below the cohort cutoff. More... | |
long | m_iNumLargeInfestibleTrees |
Number of trees that can be infested (non-resistant, regardless of current infestation status), equal to or above the cohort cutoff. More... | |
int | m_iFirstTimestep |
Timestep to begin infestation. More... | |
int | m_iLastTimestep |
Timestep to end infestation. More... | |
int | m_iYearsOfInfestation |
Years since infestation began - 0 if there is no current infestation. More... | |
char * | m_cQuery |
String to pass to clTreePopulation::Find() in order to get the trees to apply damage to. More... | |
int | m_iTotalNumSpecies |
Total 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... | |
Density Dependent Infestation.
This behavior simulates the spread of a disease or infestation throughout a tree population.
The proportion of trees infested as a Gompertz function of time is as follows:
P = max * exp(-exp(a - b* T))
where:
b is calculated as follows:
b = bx * BA + by
where BA is the proportion of basal area comprised of trees to which this behavior has been assigned (0 - 1).
This behavior allows for the possibility that there are various levels of resistance in the tree population. Users can assign a percentage of trees that are "resistant" or "conditionally susceptible". This behavior will not infest "resistant" trees but otherwise does nothing with this information - other behaviors are planned that take advantage of this.
All species are treated as a common pool and there are no species-specific parameters for infestation. There are species-specific parameters for the rates of resistance and conditional susceptibility.
The proportion of trees infested at time T does not depend on additions to or subtractions from the tree population. The number of trees of a species at that time is counted and the number of trees that are newly infested is the number required to cause the appropriate proportion to be infested. If for some reason there are more trees infested than there should be at that time, no additional trees are infested.
Susceptible individuals come in two size classes, with the cutoff DBH set as a parameter. All the individuals above this DBH are infected before any below the cutoff are. Note that when max < 1, it is possible that no individuals below the DBH cutoff will ever be infected.
There is no spatial component to the selection of trees for infestation. It is assumed that all trees have an equal chance of becoming infested no matter where they are in the plot. The number of trees that should be infested for a given time step minus the number that actually are gives the probability that an uninfested tree will become infested this time step. A random number is used against this probability for each uninfested tree to determine whether or not it will become infested.
Infestation begins at a year specified by the user. This can be negative, indicating that the infestation began before the beginning of the run. In this case, the behavior setup before the run will include the step of determining the number of infested initial conditions trees and their length of infestation.
Two integer data member is added to trees. The first is called "YearsInfested" and tracks the number of years that a tree has been infested. The second is called "DensDepResistanceStatus" and equals a value in the enum densDepResistanceStatus in DataTypes.h.
This behavior will not infest trees below a minimum DBH set by the user. Because of the need for DBH, obviously seedlings are ignored.
This behavior's call string and name string are both "DensDepInfestation".
Copyright 2013 Charles D. Canham
clDensDepInfestation::clDensDepInfestation | ( | clSimManager * | p_oSimManager | ) |
Constructor.
p_oSimManager | Sim Manager object. |
clDensDepInfestation::~clDensDepInfestation | ( | ) |
Destructor.
|
virtual |
Does insect infestation each timestep.
TreeInventory() collects data about the tree population. This is used to calculate first the b parameter and then the proportion of trees infested.
The counter in m_iYearsOfInfestation is incremented and the target level of infestation is calculated for each species according to the function above. GetInfestationRate() calculates the actual current rate. The difference between the target and actual rates gives the probability of an uninfested tree becoming infested. Then for each tree to which this behavior is applied, if the tree is not infested, a random number compared to the infestation probability determines if it will become infested. If so, a value of 1 is entered into the "YearsInfested" data member. If the tree was already infested, the data member value is incremented.
Reimplemented from clBehaviorBase.
|
protected |
Calculates each cohort's probability of infestation for individual trees, based on the results of TreeInventory().
First, the desired number of new trees to infest is calculated. If it is 0, both probabilities are also 0. If there are enough infestible trees in the larger cohort to satisfy the new number, then the smaller cohort's probability is set to 0 and the larger cohort's probability is the number of new trees to infest divided by the number of non-infested trees. If there are not enough trees in the larger cohort, its probability is set to 1, and the smaller cohort's probability is set to the number of new trees to infest minus infestible trees in the larger cohort divided by number of non-infested small cohort trees.
Results are placed in m_fSmallCohortProb and m_fLargeCohortProb.
fTargetRate | Total current proportion of trees to be infested. |
|
protected |
Ends infestation.
All flags are reset to 0 and m_iYearsOfInfestation is set to 0 which will make sure no trees are infected in the future.
|
protected |
Formats the string in m_cQuery.
This value will be used in Action() to pass to clTreePopulation::Find() in order to get the trees to act on.
p_oPop | Tree population object. |
|
virtual |
|
protected |
Assigns infestation status and length to initial conditions trees in the case that infestation starts before the beginning of the run.
|
protected |
Reads in parameters from the parameter file.
p_oDoc | DOM tree of parsed input file. |
p_oPop | Tree population object. |
modelErr | if:
|
|
virtual |
Registers the "YearsInfested" and "DensDepResistanceStatus" int data members.
Reimplemented from clBehaviorBase.
|
protected |
This traverses the tree population and does a few things:
|
protected |
String to pass to clTreePopulation::Find() in order to get the trees to apply damage to.
This will instigate a species/type search for all the species and types to which this behavior applies.
|
protected |
The "a" parameter.
|
protected |
The "bx" parameter.
|
protected |
The "by" parameter.
|
protected |
Current probability of infestation for the larger cohort.
|
protected |
Maximum infestation rate parameter.
|
protected |
Total plot BA.
|
protected |
BA in the pool of trees to which this behavior applies (including resistant trees).
|
protected |
Current probability of infestation for the smaller cohort.
|
protected |
Timestep to begin infestation.
|
protected |
Timestep to end infestation.
|
protected |
Number of infested trees in the pool to which this behavior applies (including resistant trees), equal to or above the cohort cutoff.
|
protected |
Number of trees in the pool to which this behavior applies (including resistant trees), equal to or above the cohort cutoff.
|
protected |
Number of trees that can be infested (non-resistant, regardless of current infestation status), equal to or above the cohort cutoff.
|
protected |
Number of infested trees in the pool to which this behavior applies (including resistant trees), below the cohort cutoff.
|
protected |
Number of trees in the pool to which this behavior applies (including resistant trees), below the cohort cutoff.
|
protected |
Number of trees that can be infested (non-resistant, regardless of current infestation status), below the cohort cutoff.
|
protected |
Total number of species.
Primarily for the destructor.
|
protected |
Years since infestation began - 0 if there is no current infestation.
|
protected |
Cohort cutoff DBH.
Trees above this size are infested before trees below it. Array size is total # species.
|
protected |
Minimum DBH for trees to be infested.
Array size is total # species.
|
protected |
Probability that a tree is conditionally susceptible, 0-1.
Array size is total # species.
|
protected |
Probability that a tree is resistant, 0-1.
Array size is total # species.
|
protected |
Return codes for the "DensDepResistanceStatus" int tree data member.
Array index one is sized m_iTotalNumSpecies; array index two is sized number of total types.
|
protected |
Return codes for the "YearsInfested" int tree data member.
Array index one is sized m_iTotalNumSpecies; array index two is sized number of total types.