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

Class for organizing growth behaviors. More...

#include <GrowthOrg.h>

Public Member Functions

 ~clGrowthOrg ()
 Destructor. More...
 
 clGrowthOrg (clGrowthBase *p_oHookedShell)
 Constructor. More...
 
void DoGrowthAssignments ()
 Controls the calculation of growth values and their assignment to individual trees. More...
 
void DoSetup (clSimManager *p_oSimManager, xercesc::DOMDocument *p_oDoc)
 Does the setup for this object. More...
 
short int GetNumberOfSpecies ()
 Gets the number of total species. More...
 
short int GetNumberOfTypes ()
 Gets the total number of tree types. More...
 
short int GetLightCode (short int iSp, short int iTp)
 Gets the code for the "Light" data member. More...
 
short int GetGrowthCode (short int iSp, short int iTp)
 Gets the code for the "Growth" data member. More...
 
short int GetDiamCode (short int iSp, short int iTp)
 Gets the code for the diameter data member to which growth will be applied. More...
 
clGrowthBaseGetGrowthShell (short int iSp, short int iTp)
 Gets a pointer to the diameter-updating growth base object from the table. More...
 
void DoTreeDataMemberRegistrations (clSimManager *p_oSimManager, clTreePopulation *p_oPop)
 Does the registration of the "Growth" tree data member variable. More...
 

Protected Member Functions

void PopulateGrowthTables (clSimManager *p_oSimManager)
 Declares and populates the growth object tables. More...
 
void GetLightVariableCodes ()
 Queries for the return codes of the "Light" float data member of a tree. More...
 
void GetDiamVariableCodes ()
 Queries for the return codes of the diameters at which to apply growth for each type/species combo. More...
 
void GetHeightVariableCodes ()
 Queries for the return code for height for each type/species combo. More...
 
void GetMaxTreeHeights ()
 Gets a copy of the maximum tree height for each species. More...
 

Protected Attributes

clTreePopulationmp_oPop
 A pointer to the tree population object. More...
 
clGrowthBase *** mp_oDiameterGrowthTable
 Array of growth shell objects which either update diameter only or update diameter when height is automatically updated to match. More...
 
clGrowthBase *** mp_oHeightGrowthTable
 Array of growth shell objects which update height only. More...
 
clGrowthBase ** mp_oShellList
 All shell objects. More...
 
float * mp_fMaxTreeHeight
 Copy of the maximum heights for each species, minus 0.001, to represent the asymptotic max height a tree is allowed to reach. More...
 
short int m_iTotalSpecies
 Total number of species - should equal the tree pop's value. More...
 
short int m_iTotalTypes
 Total number of tree types - should equal the tree pop's value. More...
 
short int m_iNumShells
 Total number of growth shell objects. More...
 
short int ** mp_iGrowthCodes
 Return codes for the "Growth" tree float data member variable. More...
 
short int ** mp_iLightCodes
 Return codes for the "Light" tree float data member variable. More...
 
short int ** mp_iDiamCodes
 Return codes for diameter where to apply growth to each type/species combo. More...
 
short int ** mp_iHeightCodes
 Return codes for height where to apply growth to each type/species combo. More...
 

Detailed Description

Class for organizing growth behaviors.

This class does the organizational work for growing trees for a timestep. It finds all objects descended from clGrowthBase and coordinates their efforts for maximum efficiency. Since this class is not descended from clBehaviorBase, it does not receive the normal triggers from clSimManager (GetData(), Action(), etc). It therefore depends on a "hooked" growth shell object to tell it when to work by passing on those triggers that the hooked object receives.

Growth shell objects can do one of three jobs: update a tree's diameter and allow clTreePopulation to automatically update its height to match, update its diameter only with the expectation that another growth object will explicitly update the height, and update its height only with the expecation that another growth object will explicitly update the diameter. This class will make sure that a given tree species/type combination only has one growth method (either diameter with auto updating or explicit setting of both diameter and height), and that if explicit diameter/height setting is used, that there is one of each (so that one tree dimension does not go un-updated).

This class causes trees to grow by accessing each tree in the population. It uses a tree's species and type information to determine which growth shell (if any) is responsible for updating it. It then asks that growth shell (or pair of shells) to calculate by how much the tree is going to grow, and updates the tree dimensions accordingly.

Sometimes growth behaviors need to perform calculations at a time when it can be guaranteed that no tree sizes have been changed. The growth behaviors that need this override clGrowthBase::PreGrowthCalcs(). This will call this function for all growth behaviors BEFORE it allows any trees to be updated.

When updating a tree's diameter, the diameter used depends on the tree type. If the tree is a seedling or sapling, diameter increments are applied to diam10. Otherwise, they are applied to DBH. There is no ambiguity about where to apply height increments.

This class is conscious of growth's place in a sequence of biological submodels. Most growth methods take into account the tree's light level, so this class will check which tree species/types to which any kind of growth is applied also have a light behavior applied. It determines this by seeing if the tree species/type combinations have a float data member called "Light" registered. These access codes are collected. Child growth behaviors are responsible for checking these codes if light is required and throwing errors if the codes are -1. Growth behaviors assume that the value in this data member is light level at the time growth is called, and they may expect different things from it. See the child class documentation for more.

Growth expects that mortality will follow it, and some mortality behaviors take into account growth rate. So, this object register a tree float data member called "Growth" on behalf of all growth behaviors, which will hold amount of diameter growth in mm/yr.

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

◆ ~clGrowthOrg()

clGrowthOrg::~clGrowthOrg ( )

Destructor.

◆ clGrowthOrg()

clGrowthOrg::clGrowthOrg ( clGrowthBase p_oHookedShell)

Constructor.

Parameters
p_oHookedShellA clGrowthBase object (a growth shell object) that then becomes the hooked growth shell object.

Member Function Documentation

◆ DoGrowthAssignments()

void clGrowthOrg::DoGrowthAssignments ( )

Controls the calculation of growth values and their assignment to individual trees.

This should be called each timestep by the hooked shell's Action() function.

First, all growth shells have their PreCalcGrowth() functions called (if they've put any code there).

For each tree, if the pointer for its species/type combination in mp_oDiameterGrowthTable is NULL, then nothing happens for that tree. Otherwise, growth is called. If a tree uses both height and diameter growth, sometimes the one depends on the results of the other. So this is how this function decided in which order to call growth:

  • If diameter growth is diameter_auto, diameter growth goes first.
  • If both height and diameter growth are used, and the height growth requests to go last, diameter goes first.
  • If neither height nor diameter growth requests to go last, diameter goes first.
  • If both height and diameter growth request to go last, diameter goes first.
  • If diameter requests to go last and height has no request, height goes first.

Once diameter growth has been obtained, the tree's diameter growth object's clGrowthBase::GetGrowthMemberValue() is called, and that value is set into the "Growth" data member variable.

Once both growth increments are gotten (if applicable), then they are applied. If the growth shell object identifies itself as diameter_auto in clGrowthBase::m_iGrowthMethod, then the amount of growth increase is added to the tree's diameter and clTreePopulation is allowed to update its allometry. If the growth shell identifies itself as diameter_only in clGrowthBase::m_iGrowthMethod, then the amount of growth increase is added to the tree's diameter without an auto-height update. If there is a height increment, that amount is added to the tree's height.

In all cases, height is limited to the values in mp_fMaxTreeHeight, which are the maximum tree height for each species minus 0.001.

◆ DoSetup()

void clGrowthOrg::DoSetup ( clSimManager p_oSimManager,
xercesc::DOMDocument *  p_oDoc 
)

Does the setup for this object.

Steps:

DoSetup() is called by the hooked shell's GetData() function.

Parameters
p_oSimManagerPointer to the simulation manager. Since this object is not descended from clWorkerBase, it does not already have its own pointer.
p_oDocPointer to parsed parameter file.

◆ DoTreeDataMemberRegistrations()

void clGrowthOrg::DoTreeDataMemberRegistrations ( clSimManager p_oSimManager,
clTreePopulation p_oPop 
)

Does the registration of the "Growth" tree data member variable.

It goes through the growth functions table and, for every species/type combo that has a valid pointer, registers the variable. Return codes are captured in the mp_iLightCodes array.

Parameters
p_oSimManagerPointer to Sim Manager object.
p_oPopTree population object.

◆ GetDiamCode()

short int clGrowthOrg::GetDiamCode ( short int  iSp,
short int  iTp 
)
inline

Gets the code for the diameter data member to which growth will be applied.

Parameters
iSpThe species for which to get the code.
iTpThe tree type for which to get the code.
Returns
The diameter data member code for the specified species and type.

◆ GetDiamVariableCodes()

void clGrowthOrg::GetDiamVariableCodes ( )
protected

Queries for the return codes of the diameters at which to apply growth for each type/species combo.

It's diam10 if seedling or sapling, dbh for adults. Return codes are captured in the mp_iDiamCodes array.

Exceptions
Errorif there is no code for any tree which uses growth.

◆ GetGrowthCode()

short int clGrowthOrg::GetGrowthCode ( short int  iSp,
short int  iTp 
)

Gets the code for the "Growth" data member.

Parameters
iSpThe species for which to get the code.
iTpThe tree type for which to get the code.
Returns
The "Growth" data member code for the specified species and type.

◆ GetGrowthShell()

clGrowthBase* clGrowthOrg::GetGrowthShell ( short int  iSp,
short int  iTp 
)
inline

Gets a pointer to the diameter-updating growth base object from the table.

Parameters
iSpThe species for which to get the growth object.
iTpThe tree type for which to get the growth object.
Returns
Pointer to the growth object that applies to the given species and tree type.

◆ GetHeightVariableCodes()

void clGrowthOrg::GetHeightVariableCodes ( )
protected

Queries for the return code for height for each type/species combo.

Return codes are captured in the mp_iHeightCodes array.

Exceptions
Errorif there is no code for any tree which uses growth.

◆ GetLightCode()

short int clGrowthOrg::GetLightCode ( short int  iSp,
short int  iTp 
)
inline

Gets the code for the "Light" data member.

Parameters
iSpThe species for which to get the code.
iTpThe tree type for which to get the code.
Returns
The "Light" data member code for the specified species and type.

◆ GetLightVariableCodes()

void clGrowthOrg::GetLightVariableCodes ( )
protected

Queries for the return codes of the "Light" float data member of a tree.

"Light" should have been registered by clLightBase objects. Return codes are captured in the mp_iLightCodes array. Values of -1, in case light is not used, are okay.

◆ GetMaxTreeHeights()

void clGrowthOrg::GetMaxTreeHeights ( )
protected

Gets a copy of the maximum tree height for each species.

0.001 is subtracted from the maximum tree height to represent an asymptotic limit to tree height.

◆ GetNumberOfSpecies()

short int clGrowthOrg::GetNumberOfSpecies ( )
inline

Gets the number of total species.

Returns
Total number of species.

◆ GetNumberOfTypes()

short int clGrowthOrg::GetNumberOfTypes ( )
inline

Gets the total number of tree types.

Returns
Total number of tree types.

◆ PopulateGrowthTables()

void clGrowthOrg::PopulateGrowthTables ( clSimManager p_oSimManager)
protected

Declares and populates the growth object tables.

First, it declares mp_oDiameterGrowthTable and mp_oHeightGrowthTable. Then it goes through all the behaviors and finds the ones with "growthshell" in their names. For each species/type combo to which a behavior is applied, a pointer to that behavior is set in the appropriate table at the bucket corresponding to that species/type combo. If a behavior identifies itself as setting either diameter alone or diameter with automatic height updating, it goes in mp_oDiameterGrowthTable. If it identifies itself as setting height alone, it goes in mp_oHeightGrowthTable.

This behavior depends on m_iTotalSpecies & m_iTotalTypes having the correct values (i.e. not 0).

Parameters
p_oSimManagerSim Manager object.
Exceptions
modelErrif:
  • A species/type combo is claimed by more than one behavior in mp_oDiameterGrowthTable
  • A species/type combo is claimed by more than one behavior in mp_oHeightGrowthTable
  • A species/type combo has an explicit height or diameter setting behavior without a complimentary partner (there's a behavior that sets diameter but there's no height setting behavior, or vice versa

Member Data Documentation

◆ m_iNumShells

short int clGrowthOrg::m_iNumShells
protected

Total number of growth shell objects.

This is the size of the mp_oShellList array.

◆ m_iTotalSpecies

short int clGrowthOrg::m_iTotalSpecies
protected

Total number of species - should equal the tree pop's value.

◆ m_iTotalTypes

short int clGrowthOrg::m_iTotalTypes
protected

Total number of tree types - should equal the tree pop's value.

◆ mp_fMaxTreeHeight

float* clGrowthOrg::mp_fMaxTreeHeight
protected

Copy of the maximum heights for each species, minus 0.001, to represent the asymptotic max height a tree is allowed to reach.

◆ mp_iDiamCodes

short int** clGrowthOrg::mp_iDiamCodes
protected

Return codes for diameter where to apply growth to each type/species combo.

Array size is # species by # types

◆ mp_iGrowthCodes

short int** clGrowthOrg::mp_iGrowthCodes
protected

Return codes for the "Growth" tree float data member variable.

Array of species by type (even if not every species and type is represented).

◆ mp_iHeightCodes

short int** clGrowthOrg::mp_iHeightCodes
protected

Return codes for height where to apply growth to each type/species combo.

Array size is # species by # types

◆ mp_iLightCodes

short int** clGrowthOrg::mp_iLightCodes
protected

Return codes for the "Light" tree float data member variable.

Array size is number of species by number of types (even if not every species and type requires light)

◆ mp_oDiameterGrowthTable

clGrowthBase*** clGrowthOrg::mp_oDiameterGrowthTable
protected

Array of growth shell objects which either update diameter only or update diameter when height is automatically updated to match.

The array is sized species by type, and in each bucket, there's a pointer to the growth shell object which is handling that species/type combo's diameter growth calculation. A pointer may be NULL if a combo is not getting any growth calculations.

◆ mp_oHeightGrowthTable

clGrowthBase*** clGrowthOrg::mp_oHeightGrowthTable
protected

Array of growth shell objects which update height only.

The array is sized species by type, and in each bucket, there's a pointer to the growth shell object which is handling that species/type combo's height growth calculation. A pointer may be NULL if a combo is not getting any growth calculations, or if its diameter and height are not explicitly set separately.

◆ mp_oPop

clTreePopulation* clGrowthOrg::mp_oPop
protected

A pointer to the tree population object.

◆ mp_oShellList

clGrowthBase** clGrowthOrg::mp_oShellList
protected

All shell objects.

These are in no particular order but the list is unique. The array is sized m_iNumShells.


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