SORTIE Core C++ Documentation
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | Friends | List of all members
clGrowthBase Class Reference

Base class for behaviors that implement tree growth. More...

#include <GrowthBase.h>

Inheritance diagram for clGrowthBase:
clBehaviorBase clWorkerBase clAllometricGrowthIncrementer clBrowsedRelativeGrowth clLaggedPostHarvestGrowth clLinearBiLevelGrowth clLogBiLevelGrowth clLogisticGrowth clLognormalGrowth clMichMenBase clMichMenNegGrowth clMichMenPhotoinhibition clNCIMasterGrowth clNCIMasterQuadratGrowth clPowerHeightGrowth clPRSemiStochGrowth clPRStormBiLevelGrowth clShadedLinearGrowth clSimpleLinearGrowth clSizeDepLogisticGrowth

Public Types

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

Public Member Functions

 clGrowthBase (clSimManager *p_oSimManager)
 Constructor. More...
 
virtual ~clGrowthBase ()
 Destructor. More...
 
void Action ()
 Performs all growth calculations if "hooked". More...
 
virtual float CalcDiameterGrowthValue (clTree *p_oTree, clTreePopulation *p_oPop, float fHeightGrowth)
 Calculates the amount of diameter growth increase for a particular tree, if applicable. 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...
 
virtual void PreGrowthCalcs (clTreePopulation *p_oPop)
 Performs calculations before any DBHs have been changed. More...
 
growthType GetGrowthMethod ()
 Gets the method by which this behavior increments growth. More...
 
clGrowthOrgGetGrowthOrg ()
 Get the growth org object. More...
 
void RegisterTreeDataMembers ()
 Performs data member registrations for "Growth". 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 GetData (xercesc::DOMDocument *p_oDoc)
 Triggers all growth setup if an object is hooked. More...
 
virtual void DoShellSetup (xercesc::DOMDocument *p_oDoc)
 Setup for a descendent class. 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

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

Static Protected Attributes

static clGrowthOrgmp_oGrowthOrg
 clGrowthOrg object - this pointer is held in common by all shells More...
 

Friends

class clGrowthOrg
 

Detailed Description

Base class for behaviors that implement tree growth.

Tree growth is the change of a tree's diameter and/or height. (The normal method is to increase these dimensions. This class has not been tested with code that causes trees to shrink.)

There are two ways to change a tree's size. The first method is to increment the tree's diameter, and allow the tree population to automatically change the height to match. The second method is to increment the diameter and height separately and explicitly, and override the tree population's auto-update of the other dimension. This base class can accommodate child classes that use either method. Each object of each child class is responsible for figuring out how the user intends it to work and setting the appropriate flags, especially if it can work by either method.

Sometimes growth behaviors need to make calculations before any DBHs have been incremented; for instance, neighborhood competition growth behaviors need to be assured that no trees have been changed when performing these calculations. If a growth behavior has to make these sorts of calculations, it can override the PreGrowthCalcs() function.

Classes descended from this class are referred to as shell classes. (That's my term - there's probably a better one.) This is because these child classes don't function as standalone behaviors, but leave the organizational work to another class (clGrowthOrg). The clGrowthOrg class coordinates the efforts of all objects of the shell classes for maximum efficiency.

Since clGrowthOrg is not descended from clBehaviorBase, it doesn't receive the triggers from the simulation manager that tell it when to work (calls to GetData(), Action(), etc). So, one shell object (any one, it doesn't matter which) is "hooked" to clGrowthOrg. When it receives the triggers from clSimManager, it passes them on to clGrowthOrg for processing. All other shells ignore these triggers, since they receive their instructions from clGrowthOrg.

Every object made from this class or a descendent class must have the string "growthshell" in its namestring somewhere, to identify it as a shell object.

This base class also declares a new tree float data member on behalf of each child shell object; the growth org object then registers it. The descendents don't need to do anything. The new data member is called "Growth", and will store the amount of diameter growth in mm/yr calculated.

You cannot create an object that is an instance of this class, although you can certainly cast pointers to instances of child classes to be of type clGrowthBase if needed.

Copyright 2003 Charles D. Canham.

Author
Lora E. Murphy


Edit history:
--------------—
April 28, 2004 - Submitted as beta (LEM)
May 21, 2004 - Added support for separate diameter / height increments (LEM)
February 24, 2005 - Added new data member "Growth" to replace "lgm" (LEM)

Member Enumeration Documentation

◆ growthType

Values describing the method by which the object instance of this class plans to implement tree growth.

Enumerator
diameter_auto 

The object calculates a diameter increase, and the height update is left to the tree population's auto-update process.

diameter_only 

The object sets a diameter increase only.

The height should be set manually by another object.

height_only 

The object sets a height increase only.

The diameter should be set manually by another object.

Constructor & Destructor Documentation

◆ clGrowthBase()

clGrowthBase::clGrowthBase ( clSimManager p_oSimManager)

Constructor.

The constructor checks to see if the growth org object has been created - if not, it creates it.

Parameters
p_oSimManagerSim Manager object.

◆ ~clGrowthBase()

virtual clGrowthBase::~clGrowthBase ( )
virtual

Destructor.

The destructor deletes the growth org object if it was the hooked object.

Member Function Documentation

◆ Action()

void clGrowthBase::Action ( )
virtual

Performs all growth calculations if "hooked".

This function is the same for all descendent classes - they do not need to override it (in fact, they can't). If a particular object is hooked, it calls mp_oGrowthOrg's DoGrowthAssignments function. Otherwise it does nothing.

Reimplemented from clBehaviorBase.

◆ CalcDiameterGrowthValue()

virtual float clGrowthBase::CalcDiameterGrowthValue ( clTree p_oTree,
clTreePopulation p_oPop,
float  fHeightGrowth 
)
inlinevirtual

Calculates the amount of diameter growth increase for a particular tree, if applicable.

If overridden, this function must not change the tree's diameter (clGrowthOrg will do that).

REMEMBER to appropriately compound growth by the number of years per timestep!

The tree being passed will NOT yet have had any growth applied to it.

Parameters
p_oTreeTree for which to calculate growth.
p_oPopTree population object, just in case it's needed.
fHeightGrowthAmount of height growth, in m. ONLY USE if this behavior has set m_bGoLast to true; otherwise this value will not be useful.
Returns
Amount, in cm, by which to increase the tree's diameter.

Reimplemented in clLaggedPostHarvestGrowth, clAllometricGrowthIncrementer, clPRStormBiLevelGrowth, clDoubleMMRelGrowth, clSizeDepLogisticGrowth, clShadedLinearGrowth, clRelativeGrowth, clLognormalGrowth, clBrowsedRelativeGrowth, clPRSemiStochGrowth, clLinearBiLevelGrowth, clLogisticGrowth, clSimpleLinearGrowth, clAbsoluteGrowth, clNCIMasterGrowth, clNCIMasterQuadratGrowth, clConstantBAGrowth, and clConstantRadialGrowth.

◆ CalcHeightGrowthValue()

virtual float clGrowthBase::CalcHeightGrowthValue ( clTree p_oTree,
clTreePopulation p_oPop,
float  fDiameterGrowth 
)
inlinevirtual

Calculates the amount of height growth increase for a particular tree, if applicable.

If overridden, this function must not change the tree's height (clGrowthOrg will do that).

REMEMBER to appropriately compound growth by the number of years per timestep!

The tree being passed will NOT yet have had any growth applied to it.

Parameters
p_oTreeTree for which to calculate growth.
p_oPopTree population object, just in case it's needed.
fDiameterGrowthAmount of diameter growth for this tree, in cm.
Returns
Amount, in m, by which to increase the tree's height.

Reimplemented in clRelativeGrowth, clAllometricGrowthIncrementer, clMichMenNegGrowth, clSizeDepLogisticGrowth, clShadedLinearGrowth, clLognormalGrowth, clLogBiLevelGrowth, clMichMenPhotoinhibition, clLogisticGrowth, clSimpleLinearGrowth, and clPowerHeightGrowth.

◆ DoShellSetup()

virtual void clGrowthBase::DoShellSetup ( xercesc::DOMDocument *  p_oDoc)
inlineprotectedvirtual

◆ GetData()

void clGrowthBase::GetData ( xercesc::DOMDocument *  p_oDoc)
protectedvirtual

Triggers all growth setup if an object is hooked.

This will be the same for all descendent classes. If a particular object is hooked, it calls mp_oGrowthOrg's DoSetup() function, which calls the function DoShellSetup()

  • if a descendent class has specific setup needs, it can overload that function.
Parameters
p_oDocDOM tree of parsed input file.

Implements clWorkerBase.

◆ GetGrowthMemberValue()

virtual float clGrowthBase::GetGrowthMemberValue ( clTree p_oTree,
float  fDiameterGrowth 
)
inlinevirtual

Calculates the value to go into a tree's "Growth" data member as the amount of growth.

If overridden, this function must not change the tree's "Growth" data member (clGrowthOrg will do that). This will only be called if this behavior was the DiameterIncrementer (either diameter_auto or diameter_only) for the tree being passed.

The tree being passed will NOT yet have had any growth applied to it.

Parameters
p_oTreeTree to get "Growth" for.
fDiameterGrowthAmount of diameter growth to be added, in mm per year.
Returns
Value to place in "Growth", in mm radial growth/yr.

Reimplemented in clMichMenBase.

◆ GetGrowthMethod()

growthType clGrowthBase::GetGrowthMethod ( )
inline

Gets the method by which this behavior increments growth.

The possible values are those values in the growthType enum.

Returns
Growth method, as diameter_only, diameter_auto, or height_only.

◆ GetGrowthOrg()

clGrowthOrg* clGrowthBase::GetGrowthOrg ( )
inline

Get the growth org object.

Returns
Growth org object.

◆ PreGrowthCalcs()

virtual void clGrowthBase::PreGrowthCalcs ( clTreePopulation p_oPop)
inlinevirtual

Performs calculations before any DBHs have been changed.

Override this function to perform some processing before any growth change has been applied. There are no guarantees as to what order the behaviors will be called for this function, but it is guaranteed that no growth incrementing has been applied. To make this guarantee worth something, DO NOT CHANGE ANY TREE SIZE VALUES in this function!

Reimplemented in clLaggedPostHarvestGrowth, clNCIMasterGrowth, and clNCIMasterQuadratGrowth.

◆ RegisterTreeDataMembers()

void clGrowthBase::RegisterTreeDataMembers ( )
virtual

Performs data member registrations for "Growth".

This will be the same for all descendent classes - they do not need to override. If a particular object is hooked, it calls the growth org object's DoTreeDataMemberRegistrations(). Otherwise it does nothing.

Reimplemented from clBehaviorBase.

Reimplemented in clLaggedPostHarvestGrowth, and clMichMenNegGrowth.

Friends And Related Function Documentation

◆ clGrowthOrg

friend class clGrowthOrg
friend

Member Data Documentation

◆ m_bGoLast

bool clGrowthBase::m_bGoLast
protected

Whether or not this behavior's growth should go last when used with a complementary growth behavior.

Some height-incrementing growth behaviors depend on the results of the growth-incrementers, and vice-versa. If this behavior is diam-with-auto-height growth, this flag is ignored. If separate growth and height behaviors are used, precedence is as follows: if one behavior requests to be last and the other does not, then the behavior that wants to go last will do so. If both of these flags are false or both are true, height-only behaviors win and get to go last. This defaults to false.

◆ m_bHooked

bool clGrowthBase::m_bHooked
protected

Wwhether or not this shell object is hooked to clGrowthOrg.

clGrowthOrg will set this flag.

◆ m_fConvertCmPerTSToMmPerYr

float clGrowthBase::m_fConvertCmPerTSToMmPerYr
protected

Conversion factor from cm diameter growth per timestep to mm radial growth per year.

◆ m_fConvertMmPerYearToCmPerTS

float clGrowthBase::m_fConvertMmPerYearToCmPerTS
protected

Conversion factor to take amounts from mm of radial growth per year to cm of diameter growth per timestep.

◆ m_iGrowthMethod

growthType clGrowthBase::m_iGrowthMethod
protected

The method by which this object plans to update tree dimensions.

◆ mp_oGrowthOrg

clGrowthOrg* clGrowthBase::mp_oGrowthOrg
staticprotected

clGrowthOrg object - this pointer is held in common by all shells


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