clInsectInfestation Class Reference

Insect Infestation version 1.0. More...

#include <InsectInfestation.h>

Inheritance diagram for clInsectInfestation:

clBehaviorBase clWorkerBase

List of all members.

Public Member Functions

 clInsectInfestation (clSimManager *p_oSimManager)
 Constructor.
 ~clInsectInfestation ()
 Destructor.
void GetData (xercesc::DOMDocument *p_oDoc)
 Does behavior setup.
void Action ()
 Does insect infestation each timestep.
void RegisterTreeDataMembers ()
 Registers the "YearsInfested" int data member.

Protected Member Functions

void ReadParFile (xercesc::DOMDocument *p_oDoc, clTreePopulation *p_oPop)
 Reads in parameters from the parameter file.
void FormatQueryString (clTreePopulation *p_oPop)
 Formats the string in m_cQuery.
void GetInfestationRate (long *p_iTotalTrees, long *p_iInfTrees)
 Gets the current rate of infestation in the tree population.

Protected Attributes

short int ** mp_iDataCodes
 Return codes for the "YearsInfested" int tree data member.
float * mp_fIntercept
 Intercept parameter - rate of infestation at time 1.
float * mp_fMax
 Maximum infestation rate for each species.
float * mp_fX0
 The "X0" parameter for each species.
float * mp_fXb
 The "Xb" parameter for each species.
float * mp_fMinDBH
 Minimum DBH for trees to be infested.
char * m_cQuery
 String to pass to clTreePopulation::Find() in order to get the trees to apply damage to.
int m_iFirstTimestep
 Timestep to begin infestation.
int m_iYearsOfInfestation
 Years since infestation began - 0 if there is no current infestation.
int m_iTotalNumSpecies
 Total number of species.


Detailed Description

Insect Infestation version 1.0.

This behavior simulates a spreading insect infestation throughout the tree population.

The proportion of trees infested as a lognormal function of time is as follows:

P = I +((MAX-I)/(1+(T/X0)^Xb))

where:

Infestation begins at a time step chosen by the user. Infestation continues until there are no more infested trees in the plot.

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.

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.

An integer data member is added to trees that tracks the number of years that they have been infested. This data member is called "YearsInfested".

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 "Insect Infestation".

Copyright 2010 Charles D. Canham

Author:
Lora E. Murphy
Edit history:
-----------------
December 6, 2010 - Created (LEM)

Constructor & Destructor Documentation

clInsectInfestation::clInsectInfestation ( clSimManager p_oSimManager  ) 

Constructor.

Parameters:
p_oSimManager Sim Manager object.

clInsectInfestation::~clInsectInfestation (  ) 

Destructor.

Frees memory.


Member Function Documentation

void clInsectInfestation::GetData ( xercesc::DOMDocument *  p_oDoc  )  [virtual]

Does behavior setup.

Calls the following functions:

  1. ReadParFile()
  2. FormatQueryString()
Parameters:
p_oDoc DOM tree of parsed input file.

Implements clWorkerBase.

void clInsectInfestation::Action (  )  [virtual]

Does insect infestation each timestep.

If the timestep has not yet reached the value in m_iFirstTimestep, or if the value in m_iYearsOfInfestation is 0 (indicating an infestation is over), then nothing happens.

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.

void clInsectInfestation::RegisterTreeDataMembers (  )  [virtual]

Registers the "YearsInfested" int data member.

The return codes are captured in the mp_iDataCodes array.

Reimplemented from clBehaviorBase.

void clInsectInfestation::ReadParFile ( xercesc::DOMDocument *  p_oDoc,
clTreePopulation p_oPop 
) [protected]

Reads in parameters from the parameter file.

Parameters:
p_oDoc DOM tree of parsed input file.
p_oPop Tree population object.
Exceptions:
modelErr if:
  • A value in the minimum DBH is less than 0
  • The timestep to start infestation is less than 0
  • The maximum infestation rate for any species is not between 0 and 1
  • The infestation intercept for any species is not between 0 and 1
  • The value for X0 for any species is 0

void clInsectInfestation::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_oPop Tree population object.

void clInsectInfestation::GetInfestationRate ( long *  p_iTotalTrees,
long *  p_iInfTrees 
) [protected]

Gets the current rate of infestation in the tree population.

This counts the total number of trees of each species eligible for infestation, and the number of those that are currently infested.

Parameters:
p_iTotalTrees Pointer to an array, sized m_iTotalNumSpecies, into which to put the total number of trees found of each species.
p_iInfTrees Pointer to an array, sized m_iTotalNumSpecies, into which to put the infested number of trees found of each species.


Member Data Documentation

short int** clInsectInfestation::mp_iDataCodes [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.

Intercept parameter - rate of infestation at time 1.

Array size is total # species.

float* clInsectInfestation::mp_fMax [protected]

Maximum infestation rate for each species.

Array size is total # species.

float* clInsectInfestation::mp_fX0 [protected]

The "X0" parameter for each species.

Array size is total # species.

float* clInsectInfestation::mp_fXb [protected]

The "Xb" parameter for each species.

Array size is total # species.

float* clInsectInfestation::mp_fMinDBH [protected]

Minimum DBH for trees to be infested.

Array size is total # species.

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

Timestep to begin infestation.

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

Total number of species.

Primarily for the destructor.


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

Generated on Tue Apr 19 13:56:11 2011 for SORTIE Core C++ Documentation by  doxygen 1.5.6