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

Lagged Post-Harvest Growth - Version 1.0. More...

#include <LaggedPostHarvestGrowth.h>

Inheritance diagram for clLaggedPostHarvestGrowth:
clGrowthBase clBehaviorBase clWorkerBase

Public Member Functions

 clLaggedPostHarvestGrowth (clSimManager *p_oSimManager)
 Constructor. More...
 
 ~clLaggedPostHarvestGrowth ()
 Destructor. More...
 
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(). More...
 
void PreGrowthCalcs (clTreePopulation *p_oPop)
 Calculates growth for all trees. More...
 
void DoShellSetup (xercesc::DOMDocument *p_oDoc)
 Does setup. More...
 
void SetNameData (std::string sNameString)
 Captures the namestring passed to this behavior. More...
 
void RegisterTreeDataMembers ()
 Registers the "PreHarvGr" tree float data member. More...
 
- Public Member Functions inherited from clGrowthBase
 clGrowthBase (clSimManager *p_oSimManager)
 Constructor. More...
 
virtual ~clGrowthBase ()
 Destructor. More...
 
void Action ()
 Performs all growth calculations if "hooked". More...
 
virtual float CalcHeightGrowthValue (clTree *p_oTree, clTreePopulation *p_oPop, float fDiameterGrowth)
 Calculates the amount of height growth increase for a particular tree, if applicable. More...
 
virtual float GetGrowthMemberValue (clTree *p_oTree, float fDiameterGrowth)
 Calculates the value to go into a tree's "Growth" data member as the amount of growth. More...
 
growthType GetGrowthMethod ()
 Gets the method by which this behavior increments growth. More...
 
clGrowthOrgGetGrowthOrg ()
 Get the growth org object. 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 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 ValidateData ()
 Makes sure all input data is valid. More...
 
void GetTreeMemberCodes ()
 Gets the return codes for needed tree "Growth" data members. More...
 
void ReadParameterFile (xercesc::DOMDocument *p_oDoc)
 Reads data from the parameter file. More...
 
void AssembleUniqueTypes ()
 Assembles a unique list of types applied to this behavior and places it in mp_iWhatBehaviorTypes. More...
 
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. More...
 
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. More...
 
int GetTimeSinceHarvest (clTree *p_oTree)
 Returns the Time value from the Years Since Harvest grid at the location of a tree. More...
 
void CalcTimeSinceHarvest ()
 Updates the Years Since Last Harvest grid, if it hasn't already been updated. More...
 
- Protected Member Functions inherited from clGrowthBase
void GetData (xercesc::DOMDocument *p_oDoc)
 Triggers all growth setup if an object is hooked. 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_iGrowthCodes
 Holds return data codes for the "Growth" tree data member. More...
 
short int * mp_iWhatBehaviorTypes
 List of types managed by this behavior. More...
 
short int m_iNumBehaviorTypes
 Number of types managed by this behavior. More...
 
double m_fNciDistanceRadius
 Distance (m) from a given tree out to which local basal area is calculated. More...
 
double * mp_fMaxGrowthConstant
 Maximum growth constant , p0 , in growth equation. More...
 
double * mp_fMaxGrowthDbhEffect
 Maximum growth DBH effect , p1 , in growth equation. More...
 
double * mp_fNciConstant
 NCI constant , p2 , in growth equation. More...
 
double * mp_fNciDbhEffect
 NCI DBH effect , p3 , in growth equation. More...
 
double * mp_fTimeSinceHarvestRateParam
 Rate parameter , p4 , which determines how quickly after harvest growth increases to it's new value. More...
 
short int * mp_iIndexes
 Speeds access to the arrays. More...
 
short int m_iNumTotalSpecies
 Keep our own copy for the destructor. More...
 
short int ** mp_iPreHarvGrowthCodes
 Codes for pre-harvest growth data member. More...
 
int m_iHarvestTypeCode
 Code for Harvest Type in Harvest Results grid. More...
 
int m_iTimeCode
 Code for Time (since last harvest) in the Years Since Last Harvest grid. More...
 
int m_iLastUpdated
 Code for LastUpdated (timestep) in the Years Since Last Harvest grid. More...
 
int m_iNumXCells
 Number of X cells in grids. More...
 
int m_iNumYCells
 Number of Y cells in grids. More...
 
clGridmp_oTimeSinceHarvestGrid
 Pointer to Years Since Last Harvest grid. More...
 
clGridmp_oHarvestResultsGrid
 Pointer to Harvest Results grid. More...
 
int m_iNumberYearsPerTimestep
 Number of years per timestep. More...
 
- Protected Attributes inherited from clGrowthBase
growthType m_iGrowthMethod
 The method by which this object plans to update tree dimensions. More...
 
float m_fConvertCmPerTSToMmPerYr
 Conversion factor from cm diameter growth per timestep to mm radial growth per year. More...
 
float m_fConvertMmPerYearToCmPerTS
 Conversion factor to take amounts from mm of radial growth per year to cm of diameter growth per timestep. More...
 
bool m_bHooked
 Wwhether or not this shell object is hooked to clGrowthOrg. More...
 
bool m_bGoLast
 Whether or not this behavior's growth should go last when used with a complementary growth behavior. 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...
 

Additional Inherited Members

- Public Types inherited from clGrowthBase
enum  growthType { diameter_auto, diameter_only, height_only }
 Values describing the method by which the object instance of this class plans to implement tree growth. More...
 
- Static Protected Attributes inherited from clGrowthBase
static clGrowthOrgmp_oGrowthOrg
 clGrowthOrg object - this pointer is held in common by all shells More...
 

Detailed Description

Lagged Post-Harvest Growth - Version 1.0.

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:

Gpre/post = MG * exp(-p2NCIi)
Where Maximum growth (MG) is:
MG = p0 * exp(-p1 * dbhi)
and NCIi is: NCIi = (Σ BAn) * exp(-p3*dbhi)

Growth YSH years after harvest is calculated as:

G = Gpre + (Gpost - Gpre)*(1-exp(-p4*YSH))

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 "LaggedPostHarvestGrowth"; for diameter-only incrementing, use "LaggedPostHarvestGrowth diam only". The namestring for this behavior is "laggedpostharvestgrowthshell".

Copyright 2011 Charles D. Canham.

Author
Lora E. Murphy


Edit history:
--------------—
October 20, 2011 - Wiped the slate clean for SORTIE 7.0 (LEM)

Constructor & Destructor Documentation

◆ clLaggedPostHarvestGrowth()

clLaggedPostHarvestGrowth::clLaggedPostHarvestGrowth ( clSimManager p_oSimManager)

Constructor.

Parameters
p_oSimManagerSim Manager object.

◆ ~clLaggedPostHarvestGrowth()

clLaggedPostHarvestGrowth::~clLaggedPostHarvestGrowth ( )

Destructor.

Member Function Documentation

◆ AssembleUniqueTypes()

void clLaggedPostHarvestGrowth::AssembleUniqueTypes ( )
protected

Assembles a unique list of types applied to this behavior and places it in mp_iWhatBehaviorTypes.

◆ CalcDiameterGrowthValue()

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

Parameters
p_oTreeTree to which to apply growth.
p_oPopTree population object.
fHeightGrowthAmount of height growth, in m (ignored).
Returns
Amount of diameter growth, in cm.

Reimplemented from clGrowthBase.

◆ CalcTimeSinceHarvest()

void clLaggedPostHarvestGrowth::CalcTimeSinceHarvest ( )
protected

Updates the Years Since Last Harvest grid, if it hasn't already been updated.

◆ DoShellSetup()

void clLaggedPostHarvestGrowth::DoShellSetup ( xercesc::DOMDocument *  p_oDoc)
virtual

Does setup.

  1. AssembleUniqueTypes() is called to create a list of unique behavior types.
  2. ReadParameterFile() is called to read the parameter file's data.
  3. ValidateData() is called to validate the data.
  4. GetTreeMemberCodes() is called to get tree data return codes.
  5. SetupTimeSinceHarvestGrid() is called to create a time since harvest grid, if it doesn't already exist.
Parameters
p_oDocDOM tree of parsed input tree.

Reimplemented from clGrowthBase.

◆ GetTimeSinceHarvest()

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.

Parameters
p_oTreeTree being evaluated
Returns
The time since harvest, in years, at the tree's location.

◆ GetTreeMemberCodes()

void clLaggedPostHarvestGrowth::GetTreeMemberCodes ( )
protected

Gets the return codes for needed tree "Growth" data members.

Exceptions
modelErrif a code comes back -1 for any species/type combo to which this behavior is applied.

◆ LocalBasalAreaAroundTree()

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.

Parameters
p_oTreeTree being evaluated
Returns
The local basal area of nearby trees.

◆ PreGrowthCalcs()

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:

  1. Get all trees for this behavior.
  2. For each tree, calculate the amount of growth for each using the equations above. Stash the end result in "Growth".

This must be called before any growth stuff because it uses nearby BA, and this must be calculated before growth has been applied.

Growth per timestep is calculated by multiplying by the number of years per timestep.

Parameters
p_oPopTree population object.

Reimplemented from clGrowthBase.

◆ ReadParameterFile()

void clLaggedPostHarvestGrowth::ReadParameterFile ( xercesc::DOMDocument *  p_oDoc)
protected

Reads data from the parameter file.

Parameters
p_oDocDOM tree of parsed input tree.
Exceptions
modelErrif this behavior has been applied to any types except sapling and adult.

◆ RegisterTreeDataMembers()

void clLaggedPostHarvestGrowth::RegisterTreeDataMembers ( )
virtual

Registers the "PreHarvGr" tree float data member.

Reimplemented from clGrowthBase.

◆ SetNameData()

void clLaggedPostHarvestGrowth::SetNameData ( std::string  sNameString)
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.

Parameters
sNameStringBehavior's namestring.

Reimplemented from clBehaviorBase.

◆ SetupTimeSinceHarvestGrid()

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.

◆ ValidateData()

void clLaggedPostHarvestGrowth::ValidateData ( )
protected

Makes sure all input data is valid.

The following must all be true:

  • Maximum potential growth (MPG) must be non-negative.
  • Time since harvest rate parameter must be greater than 0.
  • The basal area distance radius must be greater than 0.

Exceptions
modelErrif any of the above conditions are not met.

Member Data Documentation

◆ m_fNciDistanceRadius

double clLaggedPostHarvestGrowth::m_fNciDistanceRadius
protected

Distance (m) from a given tree out to which local basal area is calculated.

◆ m_iHarvestTypeCode

int clLaggedPostHarvestGrowth::m_iHarvestTypeCode
protected

Code for Harvest Type in Harvest Results grid.

◆ m_iLastUpdated

int clLaggedPostHarvestGrowth::m_iLastUpdated
protected

Code for LastUpdated (timestep) in the Years Since Last Harvest grid.

◆ m_iNumBehaviorTypes

short int clLaggedPostHarvestGrowth::m_iNumBehaviorTypes
protected

Number of types managed by this behavior.

◆ m_iNumberYearsPerTimestep

int clLaggedPostHarvestGrowth::m_iNumberYearsPerTimestep
protected

Number of years per timestep.

◆ m_iNumTotalSpecies

short int clLaggedPostHarvestGrowth::m_iNumTotalSpecies
protected

Keep our own copy for the destructor.

This is the total number of tree species.

◆ m_iNumXCells

int clLaggedPostHarvestGrowth::m_iNumXCells
protected

Number of X cells in grids.

◆ m_iNumYCells

int clLaggedPostHarvestGrowth::m_iNumYCells
protected

Number of Y cells in grids.

◆ m_iTimeCode

int clLaggedPostHarvestGrowth::m_iTimeCode
protected

Code for Time (since last harvest) in the Years Since Last Harvest grid.

◆ mp_fMaxGrowthConstant

double* 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].

◆ mp_fMaxGrowthDbhEffect

double* 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].

◆ mp_fNciConstant

double* 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].

◆ mp_fNciDbhEffect

double* 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].

◆ mp_fTimeSinceHarvestRateParam

double* 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].

◆ mp_iGrowthCodes

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

◆ mp_iIndexes

short int* clLaggedPostHarvestGrowth::mp_iIndexes
protected

Speeds access to the arrays.

Array size is assumed to be number of species.

◆ mp_iPreHarvGrowthCodes

short int** clLaggedPostHarvestGrowth::mp_iPreHarvGrowthCodes
protected

Codes for pre-harvest growth data member.

◆ mp_iWhatBehaviorTypes

short int* clLaggedPostHarvestGrowth::mp_iWhatBehaviorTypes
protected

List of types managed by this behavior.

◆ mp_oHarvestResultsGrid

clGrid* clLaggedPostHarvestGrowth::mp_oHarvestResultsGrid
protected

Pointer to Harvest Results grid.

◆ mp_oTimeSinceHarvestGrid

clGrid* clLaggedPostHarvestGrowth::mp_oTimeSinceHarvestGrid
protected

Pointer to Years Since Last Harvest grid.


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