#include <LaggedPostHarvestGrowth.h>
Public Member Functions | |
clLaggedPostHarvestGrowth (clSimManager *p_oSimManager) | |
Constructor. | |
~clLaggedPostHarvestGrowth () | |
Destructor. | |
float | CalcDiameterGrowthValue (clTree *p_oTree, clTreePopulation *p_oPop, float fHeightGrowth) |
Returns the value in the tree's float data member that holds the value that was calculated by PreGrowthCalcs(). | |
void | PreGrowthCalcs (clTreePopulation *p_oPop) |
Calculates growth for all trees. | |
void | DoShellSetup (xercesc::DOMDocument *p_oDoc) |
Does setup. | |
void | SetNameData (char *cNameString) |
Captures the namestring passed to this behavior. | |
void | RegisterTreeDataMembers () |
Registers the "PreHarvGr" tree float data member. | |
Protected Member Functions | |
void | ValidateData () |
Makes sure all input data is valid. | |
void | GetTreeMemberCodes () |
Gets the return codes for needed tree "Growth" data members. | |
void | ReadParameterFile (xercesc::DOMDocument *p_oDoc) |
Reads data from the parameter file. | |
void | AssembleUniqueTypes () |
Assembles a unique list of types applied to this behavior and places it in mp_iWhatBehaviorTypes. | |
void | SetupTimeSinceHarvestGrid () |
This creates the Years Since Harvest grid at the beginning of the simulation if it doesn't already exist, and sets pointers to grids and saves other relevant grid info in class members. | |
float | LocalBasalAreaAroundTree (clTree *p_oTree) |
This calculates the basal area (in m2) of all trees within a certain distance of the tree passed as an argument. | |
int | GetTimeSinceHarvest (clTree *p_oTree) |
Returns the Time value from the Years Since Harvest grid at the location of a tree. | |
void | CalcTimeSinceHarvest () |
Updates the Years Since Last Harvest grid, if it hasn't already been updated. | |
Protected Attributes | |
short int ** | mp_iGrowthCodes |
Holds return data codes for the "Growth" tree data member. | |
short int * | mp_iWhatBehaviorTypes |
List of types managed by this behavior. | |
short int | m_iNumBehaviorTypes |
Number of types managed by this behavior. | |
float | m_fNciDistanceRadius |
Distance (m) from a given tree out to which local basal area is calculated. | |
float * | mp_fMaxGrowthConstant |
Maximum growth constant , p0 , in growth equation. | |
float * | mp_fMaxGrowthDbhEffect |
Maximum growth DBH effect , p1 , in growth equation. | |
float * | mp_fNciConstant |
NCI constant , p2 , in growth equation. | |
float * | mp_fNciDbhEffect |
NCI DBH effect , p3 , in growth equation. | |
float * | mp_fTimeSinceHarvestRateParam |
Rate parameter , p4 , which determines how quickly after harvest growth increases to it's new value. | |
short int * | mp_iIndexes |
Speeds access to the arrays. | |
short int | m_iNumTotalSpecies |
Keep our own copy for the destructor. | |
short int ** | mp_iPreHarvGrowthCodes |
Codes for pre-harvest growth data member. | |
int | m_iHarvestTypeCode |
Code for Harvest Type in Harvest Results grid. | |
int | m_iTimeCode |
Code for Time (since last harvest) in the Years Since Last Harvest grid. | |
int | m_iLastUpdated |
Code for LastUpdated (timestep) in the Years Since Last Harvest grid. | |
int | m_iNumXCells |
Number of X cells in grids. | |
int | m_iNumYCells |
Number of Y cells in grids. | |
clGridBase * | mp_oTimeSinceHarvestGrid |
Pointer to Years Since Last Harvest grid. | |
clGridBase * | mp_oHarvestResultsGrid |
Pointer to Harvest Results grid. | |
float | m_fNumberYearsPerTimestep |
Number of years per timestep. |
This is a growth shell object that incorporates a lag period after harvest during which growth increases gradually to a higher value.
Diameter growth of tree i before (Gpre) and well after harvest (Gpost) is calculated as:
Growth YSH years after harvest is calculated as:
The amount of growth is in cm/year. For multi-year timesteps, the behavior will calculate total growth by multiplying by the number of years per timestep.
This cannot be applied to seedlings. An error will be thrown if seedlings are passed.
This creates one new tree float data member called "PreHarvGr".
This also creates a grid called "Years Since Last Harvest".
The parameter file call string for this to be diameter-incrementing with auto-height updating is "lagged post-harvest growth"; for diameter-only incrementing, use "lagged post-harvest growth diam only". The namestring for this behavior is "laggedpostharvestgrowthshell".
Copyright 2003 Charles D. Canham.
clLaggedPostHarvestGrowth::clLaggedPostHarvestGrowth | ( | clSimManager * | p_oSimManager | ) |
Constructor.
p_oSimManager | Sim Manager object. |
clLaggedPostHarvestGrowth::~clLaggedPostHarvestGrowth | ( | ) |
Destructor.
float clLaggedPostHarvestGrowth::CalcDiameterGrowthValue | ( | clTree * | p_oTree, | |
clTreePopulation * | p_oPop, | |||
float | fHeightGrowth | |||
) | [virtual] |
Returns the value in the tree's float data member that holds the value that was calculated by PreGrowthCalcs().
p_oTree | Tree to which to apply growth. | |
p_oPop | Tree population object. | |
fHeightGrowth | Amount of height growth, in m (ignored). |
Reimplemented from clGrowthBase.
void clLaggedPostHarvestGrowth::PreGrowthCalcs | ( | clTreePopulation * | p_oPop | ) | [virtual] |
Calculates growth for all trees.
The values are stashed in the "Growth" tree float data member for later application.
Steps:
Growth per timestep is calculated by multiplying by the number of years per timestep.
p_oPop | Tree population object. |
Reimplemented from clGrowthBase.
void clLaggedPostHarvestGrowth::DoShellSetup | ( | xercesc::DOMDocument * | p_oDoc | ) | [virtual] |
Does setup.
p_oDoc | DOM tree of parsed input tree. |
Reimplemented from clGrowthBase.
void clLaggedPostHarvestGrowth::SetNameData | ( | char * | cNameString | ) | [virtual] |
Captures the namestring passed to this behavior.
This is overridden from clBehaviorBase so we can capture the namestring passed. Since this class can create multiple kinds of behaviors that function differently, this will capture what kind of behavior this is supposed to be.
cNameString | Behavior's namestring. |
Reimplemented from clBehaviorBase.
void clLaggedPostHarvestGrowth::RegisterTreeDataMembers | ( | ) | [virtual] |
void clLaggedPostHarvestGrowth::ValidateData | ( | ) | [protected] |
Makes sure all input data is valid.
The following must all be true:
modelErr | if any of the above conditions are not met. |
void clLaggedPostHarvestGrowth::GetTreeMemberCodes | ( | ) | [protected] |
Gets the return codes for needed tree "Growth" data members.
modelErr | if a code comes back -1 for any species/type combo to which this behavior is applied. |
void clLaggedPostHarvestGrowth::ReadParameterFile | ( | xercesc::DOMDocument * | p_oDoc | ) | [protected] |
Reads data from the parameter file.
p_oDoc | DOM tree of parsed input tree. |
modelErr | if this behavior has been applied to any types except sapling and adult. |
void clLaggedPostHarvestGrowth::AssembleUniqueTypes | ( | ) | [protected] |
Assembles a unique list of types applied to this behavior and places it in mp_iWhatBehaviorTypes.
void clLaggedPostHarvestGrowth::SetupTimeSinceHarvestGrid | ( | ) | [protected] |
This creates the Years Since Harvest grid at the beginning of the simulation if it doesn't already exist, and sets pointers to grids and saves other relevant grid info in class members.
float clLaggedPostHarvestGrowth::LocalBasalAreaAroundTree | ( | clTree * | p_oTree | ) | [protected] |
This calculates the basal area (in m2) of all trees within a certain distance of the tree passed as an argument.
p_oTree | Tree being evaluated |
int clLaggedPostHarvestGrowth::GetTimeSinceHarvest | ( | clTree * | p_oTree | ) | [protected] |
Returns the Time value from the Years Since Harvest grid at the location of a tree.
If there has been no harvest in the tree's grid cell, a value of 1000 will be returned.
p_oTree | Tree being evaluated |
void clLaggedPostHarvestGrowth::CalcTimeSinceHarvest | ( | ) | [protected] |
Updates the Years Since Last Harvest grid, if it hasn't already been updated.
short int** clLaggedPostHarvestGrowth::mp_iGrowthCodes [protected] |
Holds return data codes for the "Growth" tree data member.
Array size is number of species to which this behavior applies by 2 (saplings and adults).
short int* clLaggedPostHarvestGrowth::mp_iWhatBehaviorTypes [protected] |
List of types managed by this behavior.
short int clLaggedPostHarvestGrowth::m_iNumBehaviorTypes [protected] |
Number of types managed by this behavior.
float clLaggedPostHarvestGrowth::m_fNciDistanceRadius [protected] |
Distance (m) from a given tree out to which local basal area is calculated.
float* clLaggedPostHarvestGrowth::mp_fMaxGrowthConstant [protected] |
Maximum growth constant , p0 , in growth equation.
Array assumed to be sized number of species to which this behavior applies. This array is accessed by using the index returned for mp_iIndexes[species number].
float* clLaggedPostHarvestGrowth::mp_fMaxGrowthDbhEffect [protected] |
Maximum growth DBH effect , p1 , in growth equation.
Array assumed to be sized number of species to which this behavior applies. This array is accessed by using the index returned for mp_iIndexes[species number].
float* clLaggedPostHarvestGrowth::mp_fNciConstant [protected] |
NCI constant , p2 , in growth equation.
Array assumed to be sized number of species to which this behavior applies. This array is accessed by using the index returned for mp_iIndexes[species number].
float* clLaggedPostHarvestGrowth::mp_fNciDbhEffect [protected] |
NCI DBH effect , p3 , in growth equation.
Array assumed to be sized number of species to which this behavior applies. This array is accessed by using the index returned for mp_iIndexes[species number].
float* clLaggedPostHarvestGrowth::mp_fTimeSinceHarvestRateParam [protected] |
Rate parameter , p4 , which determines how quickly after harvest growth increases to it's new value.
Array assumed to be sized number of species to which this behavior applies. This array is accessed by using the index returned for mp_iIndexes[species number].
short int* clLaggedPostHarvestGrowth::mp_iIndexes [protected] |
Speeds access to the arrays.
Array size is assumed to be number of species.
short int clLaggedPostHarvestGrowth::m_iNumTotalSpecies [protected] |
Keep our own copy for the destructor.
This is the total number of tree species.
short int** clLaggedPostHarvestGrowth::mp_iPreHarvGrowthCodes [protected] |
Codes for pre-harvest growth data member.
int clLaggedPostHarvestGrowth::m_iHarvestTypeCode [protected] |
Code for Harvest Type in Harvest Results grid.
int clLaggedPostHarvestGrowth::m_iTimeCode [protected] |
Code for Time (since last harvest) in the Years Since Last Harvest grid.
int clLaggedPostHarvestGrowth::m_iLastUpdated [protected] |
Code for LastUpdated (timestep) in the Years Since Last Harvest grid.
int clLaggedPostHarvestGrowth::m_iNumXCells [protected] |
Number of X cells in grids.
int clLaggedPostHarvestGrowth::m_iNumYCells [protected] |
Number of Y cells in grids.
Pointer to Years Since Last Harvest grid.
Pointer to Harvest Results grid.
float clLaggedPostHarvestGrowth::m_fNumberYearsPerTimestep [protected] |
Number of years per timestep.