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

Density Dependent Infestation. More...

#include <DensDepInfestation.h>

Inheritance diagram for clDensDepInfestation:
clBehaviorBase clWorkerBase

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...
 
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 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...
 
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...
 

Detailed Description

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

Author
Lora E. Murphy
Edit history:
--------------—
August 5, 2013 - Created (LEM)
July 27, 2015 - Added infection end date (LEM)

Constructor & Destructor Documentation

◆ clDensDepInfestation()

clDensDepInfestation::clDensDepInfestation ( clSimManager p_oSimManager)

Constructor.

Parameters
p_oSimManagerSim Manager object.

◆ ~clDensDepInfestation()

clDensDepInfestation::~clDensDepInfestation ( )

Destructor.

Member Function Documentation

◆ Action()

void clDensDepInfestation::Action ( )
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.

◆ DetermineCohortInfestationProbability()

void clDensDepInfestation::DetermineCohortInfestationProbability ( double  fTargetRate)
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.

Parameters
fTargetRateTotal current proportion of trees to be infested.

◆ EndInfestation()

void clDensDepInfestation::EndInfestation ( )
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.

◆ FormatQueryString()

void clDensDepInfestation::FormatQueryString ( clTreePopulation p_oPop)
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.

Parameters
p_oPopTree population object.

◆ GetData()

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

Does behavior setup.

Parameters
p_oDocDOM tree of parsed input file.

Implements clWorkerBase.

◆ InfestInitialConditionsTrees()

void clDensDepInfestation::InfestInitialConditionsTrees ( )
protected

Assigns infestation status and length to initial conditions trees in the case that infestation starts before the beginning of the run.

◆ ReadParFile()

void clDensDepInfestation::ReadParFile ( xercesc::DOMDocument *  p_oDoc,
clTreePopulation p_oPop 
)
protected

Reads in parameters from the parameter file.

Parameters
p_oDocDOM tree of parsed input file.
p_oPopTree population object.
Exceptions
modelErrif:
  • A value in the minimum DBH is less than 0
  • The maximum infestation rate is not between 0 and 1
  • A value in the cohort cutoff DBH is less than 0
  • The probability of resistance is not between 0 and 1
  • The probability of conditional susceptibility is not between 0 and 1

◆ RegisterTreeDataMembers()

void clDensDepInfestation::RegisterTreeDataMembers ( )
virtual

Registers the "YearsInfested" and "DensDepResistanceStatus" int data members.

Reimplemented from clBehaviorBase.

◆ TreeInventory()

void clDensDepInfestation::TreeInventory ( )
protected

This traverses the tree population and does a few things:

  • Gets the total plot BA and puts it in m_fPlotBA
  • Gets the BA of the pool of trees to which this behavior applies (all trees above minimum infestible DBH, regardless of resistance status) and puts it in m_fPoolBA
  • Counts the number of trees in the pool to which this behavior applies and puts it in m_iNumSmallCohortPoolTrees and m_iNumLargeCohortPoolTrees
  • Checks for new trees with no current infestation status, and assigns them a status
  • Counts currently infested trees and puts it in m_iNumSmallCohortInfestedTrees and m_iNumLargeCohortInfestedTrees
  • Counts the number of infestible trees (not resistant), regardless of infestation status, and puts it in m_iNumSmallInfestibleTrees and m_iNumLargeInfestibleTrees

Member Data Documentation

◆ m_cQuery

char* clDensDepInfestation::m_cQuery
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.

◆ m_fA

double clDensDepInfestation::m_fA
protected

The "a" parameter.

◆ m_fBx

double clDensDepInfestation::m_fBx
protected

The "bx" parameter.

◆ m_fBy

double clDensDepInfestation::m_fBy
protected

The "by" parameter.

◆ m_fLargeCohortProb

double clDensDepInfestation::m_fLargeCohortProb
protected

Current probability of infestation for the larger cohort.

◆ m_fMax

double clDensDepInfestation::m_fMax
protected

Maximum infestation rate parameter.

◆ m_fPlotBA

double clDensDepInfestation::m_fPlotBA
protected

Total plot BA.

◆ m_fPoolBA

double clDensDepInfestation::m_fPoolBA
protected

BA in the pool of trees to which this behavior applies (including resistant trees).

◆ m_fSmallCohortProb

double clDensDepInfestation::m_fSmallCohortProb
protected

Current probability of infestation for the smaller cohort.

◆ m_iFirstTimestep

int clDensDepInfestation::m_iFirstTimestep
protected

Timestep to begin infestation.

◆ m_iLastTimestep

int clDensDepInfestation::m_iLastTimestep
protected

Timestep to end infestation.

◆ m_iNumLargeCohortInfestedTrees

long clDensDepInfestation::m_iNumLargeCohortInfestedTrees
protected

Number of infested trees in the pool to which this behavior applies (including resistant trees), equal to or above the cohort cutoff.

◆ m_iNumLargeCohortPoolTrees

long clDensDepInfestation::m_iNumLargeCohortPoolTrees
protected

Number of trees in the pool to which this behavior applies (including resistant trees), equal to or above the cohort cutoff.

◆ m_iNumLargeInfestibleTrees

long clDensDepInfestation::m_iNumLargeInfestibleTrees
protected

Number of trees that can be infested (non-resistant, regardless of current infestation status), equal to or above the cohort cutoff.

◆ m_iNumSmallCohortInfestedTrees

long clDensDepInfestation::m_iNumSmallCohortInfestedTrees
protected

Number of infested trees in the pool to which this behavior applies (including resistant trees), below the cohort cutoff.

◆ m_iNumSmallCohortPoolTrees

long clDensDepInfestation::m_iNumSmallCohortPoolTrees
protected

Number of trees in the pool to which this behavior applies (including resistant trees), below the cohort cutoff.

◆ m_iNumSmallInfestibleTrees

long clDensDepInfestation::m_iNumSmallInfestibleTrees
protected

Number of trees that can be infested (non-resistant, regardless of current infestation status), below the cohort cutoff.

◆ m_iTotalNumSpecies

int clDensDepInfestation::m_iTotalNumSpecies
protected

Total number of species.

Primarily for the destructor.

◆ m_iYearsOfInfestation

int clDensDepInfestation::m_iYearsOfInfestation
protected

Years since infestation began - 0 if there is no current infestation.

◆ mp_fCohortDBH

double* clDensDepInfestation::mp_fCohortDBH
protected

Cohort cutoff DBH.

Trees above this size are infested before trees below it. Array size is total # species.

◆ mp_fMinDBH

double* clDensDepInfestation::mp_fMinDBH
protected

Minimum DBH for trees to be infested.

Array size is total # species.

◆ mp_fProbConditionallySusceptible

double* clDensDepInfestation::mp_fProbConditionallySusceptible
protected

Probability that a tree is conditionally susceptible, 0-1.

Array size is total # species.

◆ mp_fProbResistant

double* clDensDepInfestation::mp_fProbResistant
protected

Probability that a tree is resistant, 0-1.

Array size is total # species.

◆ mp_iDensDepResistanceStatusCodes

short int** clDensDepInfestation::mp_iDensDepResistanceStatusCodes
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.

◆ mp_iYearsInfestedCodes

short int** clDensDepInfestation::mp_iYearsInfestedCodes
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.


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