#include <StochasticGapGrowth.h>
Inheritance diagram for clStochasticGapGrowth:
Public Member Functions | |
clStochasticGapGrowth (clSimManager *p_oSimManager) | |
Constructor. | |
~clStochasticGapGrowth () | |
Destructor. | |
void | Action () |
Performs growth calculations. | |
void | GetData (xercesc::DOMDocument *p_oDoc) |
Does the setup for this behavior. | |
Protected Attributes | |
clGridBase * | mp_oGapLight |
Pointer to the "Gap Light" grid (this behavior does not create this grid). | |
clGridBase * | mp_oGrowthCounter |
Grid called "Growth Counter", created by this behavior. | |
bool ** | mp_bAppliedTo |
Array for determining to which trees this behavior is applied. | |
char * | m_cQuery |
Query for finding trees to which this behavior applies. | |
int | m_iNumSpecies |
Keep a copy of this for the destructor for freeing memory. | |
short int | m_iIsGapCode |
Data member code for the "Is Gap" bool data member of the "Gap Light" grid. | |
short int | m_iCurrentCode |
Data member code for the "Current" int data member of the "Growth Counter" grid. | |
short int | m_iTargetCode |
Data member code for the "Target" int data member of the "Growth Counter" grid. |
This behavior takes a shortcut for simulating rapid growth in high-light, very competitive conditions.
The behavior creates growth under gap conditions. To recognize gap conditions, it relies on the "Gap Light" grid produced by the clGapLight class. For any cell which has gap status, from the group of trees in that cell to which this behavior is applied, a tree is randomly chosen to be given whatever growth is necessary for it to reach the minimum DBH for adults. No other trees in the cell grow at all. In cells that have non-gap status, no trees at all grow.
To randomly select a tree to grow, this behavior uses a grid called "Growth Counter". The behavior counts up the number of eligible trees in each cell of "Growth Counter". It then multiplies a random number by the number of trees, arriving at a target tree (i.e. number 34 out of 56 found). Then this tree is given the amount of growth necessary for it to reach the minimum adult DBH.
The namestring and parameter file call string for this behavior is "Stochastic Gap Growth". Note that this behavior does not descend from clGrowthBase. There is nothing to be gained from that association, and it is easier for this behavior to perform all of its work at once rather than on one tree at a time.
It is a fatal error if this behavior cannot find the "Gap Light" grid during setup.
Copyright 2005 Charles D. Canham.
clStochasticGapGrowth::clStochasticGapGrowth | ( | clSimManager * | p_oSimManager | ) |
Constructor.
Sets the namestring.
clStochasticGapGrowth::~clStochasticGapGrowth | ( | ) |
Destructor.
Frees memory.
void clStochasticGapGrowth::Action | ( | ) | [virtual] |
Performs growth calculations.
This function cycles through all of the trees twice. On the first pass, each tree is assigned to the appropriate cell in "Growth Counter". If that cell has gap status, the number in the "Current" data member is incremented. If the cell does not have gap status, nothing happens. Then, for each cell in "Growth Counter" that has a positive count in "Current", a random number is multiplied by it and that number is placed in "Target". Then the trees are cycled through again in exactly the same way. For each cell, when the tree number in "Target" has been reached, that tree is allowed to grow to adult status.
Reimplemented from clBehaviorBase.
void clStochasticGapGrowth::GetData | ( | xercesc::DOMDocument * | p_oDoc | ) | [virtual] |
Does the setup for this behavior.
This gets a pointer to the "Gap Light" grid and sets up the "Growth Counter" grid. Then it populates the mp_bAppliedTo array. Then it sets up the query for doing tree searches.
p_oDoc | Parsed parameter file. |
modelErr | if the "Gap Light" grid cannot be found. |
Implements clWorkerBase.
clGridBase* clStochasticGapGrowth::mp_oGapLight [protected] |
Pointer to the "Gap Light" grid (this behavior does not create this grid).
This grid is expected to have one bool data member called "Is Gap".
clGridBase* clStochasticGapGrowth::mp_oGrowthCounter [protected] |
Grid called "Growth Counter", created by this behavior.
It has a grid cell resolution matching "Gap Light". It has two int data members, "Current" (which holds the number of trees found in gap cells) and "Target" (which holds the target number of the tree, out of the total in "Current", which has been chosen to grow). Any map of this grid entered in the parameter file will be ignored, including just setting the grid cell resolution.
bool** clStochasticGapGrowth::mp_bAppliedTo [protected] |
Array for determining to which trees this behavior is applied.
The array size is # total species by # total types.
char* clStochasticGapGrowth::m_cQuery [protected] |
Query for finding trees to which this behavior applies.
This will instigate a species/type search for all the species and types to which this behavior applies.
short int clStochasticGapGrowth::m_iIsGapCode [protected] |
Data member code for the "Is Gap" bool data member of the "Gap Light" grid.
short int clStochasticGapGrowth::m_iCurrentCode [protected] |
Data member code for the "Current" int data member of the "Growth Counter" grid.
short int clStochasticGapGrowth::m_iTargetCode [protected] |
Data member code for the "Target" int data member of the "Growth Counter" grid.