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

Snag Decay Class Dynamics Version 2.0. More...

#include <SnagDecomp.h>

Inheritance diagram for clSnagDecomp:
clBehaviorBase clWorkerBase

Public Member Functions

 clSnagDecomp (clSimManager *p_oSimManager)
 Constructor. More...
 
 ~clSnagDecomp ()
 Destructor. More...
 
void Action ()
 Runs snags through the fall models and decay class transition matrix. More...
 
void CalcGridValues ()
 Calculates live and cut basal area on a grid. More...
 
void GetData (xercesc::DOMDocument *p_oDoc)
 Does setup for this behavior. More...
 
void RegisterTreeDataMembers ()
 Registers the "SnagDecayClass" int data member. 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 Attributes

double mp_fSnagTransProb [6][6]
 Species-specific matrices of transition probabilities. More...
 
double m_fTreefallAlpha
 Parameters used in treefall and snag fall models. More...
 
double * mp_fTreefallBeta
 
double m_fTreefallDelta
 
double m_fTreefallTheta
 
double m_fTreefallIota
 
double m_fTreefallLamda
 
double m_fSnagfallAlpha
 
double * mp_fSnagfallBeta
 
double * mp_fSnagfallGamma
 
double m_fSnagfallZeta
 
double m_fSnagfallEta
 
double m_fSnagfallKappa
 
double m_fMinBreakHeight
 The minimum snag break height. More...
 
double m_fMaxBreakHeight
 The maximum snag break height. More...
 
char * m_cQuery
 String to pass to clTreePopulation::Find() in order to get the trees for which to run snag dynamics. More...
 
clGridmp_oBasalAreaGrid
 Grid to hold live and cut basal area in local cells. More...
 
short int m_iLiveBACode
 
short int m_iCutBACode
 
float m_fGridCellLength
 
short int ** mp_iSnagDCCode
 Holds relevant data member codes. More...
 
short int ** mp_iNewBreakCode
 
short int ** mp_iDeadCodes
 
short int * mp_iAdultFallCode
 
short int * mp_iOldBreakCode
 
short int * mp_iIndexes
 
int m_iNumSpecies
 Keep a copy of this for the destructor. 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

- Protected Member Functions inherited from clWorkerBase
void AssembleFileCode (int iFileType, int iFileVersion, char *cCode)
 Creates the proper identifying filecode for an XML file. More...
 

Detailed Description

Snag Decay Class Dynamics Version 2.0.

This class simulates the dynamics of standing dead trees as they pass through a series of decay classes and eventually fall.

Trees that die from natural causes in the timestep are run through a tree fall model to determine whether they become a snag, or fall and are removed from tree population. Snags created in previous timesteps are run through a separate fall model to determine whether they remain standing or are removed. Snags remaining standing are run through a decay class transition matrix (decay class is a parameter of the snag fall model).

This behavior adds one integer data member called "SnagDecayClass" representing snag decay class. There are five decay classes, numbered 1-5. Parameter values can be set to utilize fewer classes if desired.

This behavior adds two float data members called "NewBreakHeight" and "SnagOldBreakHeight", both of which represent the height at which a snag has broken. This is held by NewBreakHeight if the breakage occurred this timestep, or SnagOldBreakHeight otherwise. If the snag is unbroken or did not break at the appropriate time, the value of these members is -1.0.

This behavior adds one bool data member called "Fall". This represents whether or not a tree that has died this timestep has fallen (true), or remains standing as a snag (false).

Parameters correspond to the tree fall and snag fall models in Vanderwel et al. 2006 (Can. J. For. Res. 36: 2769-2779), and to a transition matrix representing the probability of undergoing a transition from a given decay class to another (or the same one) during the timestep. All transition matrix values must be non-negative and the sum of each column should add up to 1.

All parameters are based on a five-year timestep; the behavior will adjust fall probabilities for other timestep lengths if necessary.

This class's namestring and parameter call string are both "SnagDecayClassDynamics".

This behavior can be applied to adults and snags. It should run after mortality and before substrate and dead tree remover behaviors are applied in each timestep.

Copyright 2011 Charles D. Canham.

Author
Mark Vanderwel


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

Constructor & Destructor Documentation

◆ clSnagDecomp()

clSnagDecomp::clSnagDecomp ( clSimManager p_oSimManager)

Constructor.

Parameters
p_oSimManagerclSimManager object.

◆ ~clSnagDecomp()

clSnagDecomp::~clSnagDecomp ( )

Destructor.

Deletes arrays.

Member Function Documentation

◆ Action()

void clSnagDecomp::Action ( )
virtual

Runs snags through the fall models and decay class transition matrix.

A query is sent to the tree population to get all snags to which this behavior is applied. For each that is still standing, the new decay class is calculated and the value is placed in the "SnagDecayClass" int tree data member. Snags that fall are removed by calling clTreePopulation::KillTree()

Reimplemented from clBehaviorBase.

◆ CalcGridValues()

void clSnagDecomp::CalcGridValues ( )

Calculates live and cut basal area on a grid.

Grid cell size is a multiple of the tree population grid that approximates 20 x 20 m. Cut basal area is calculated if there was harvesting in the current timestep (behavior Disturbance). These values are later used in the tree and snag fall models.

◆ GetData()

void clSnagDecomp::GetData ( xercesc::DOMDocument *  p_oDoc)
virtual

Does setup for this behavior.

Steps:

  1. Reads values from the parameter file and validates them.
  2. Formats the query string, which is used to do tree searches
Parameters
p_oDocDOM tree of parsed input file.
Exceptions
modelErrif:
  • Any value in the transition matrix is less than 0.
  • The sum of values for each transition matrix column do not add up to 1.

Implements clWorkerBase.

◆ RegisterTreeDataMembers()

void clSnagDecomp::RegisterTreeDataMembers ( )
virtual

Registers the "SnagDecayClass" int data member.

The return codes are captured in the mp_iSnagDCCodes array.

Exceptions
modelErrif this behavior is being applied to any tree type except snags.

Reimplemented from clBehaviorBase.

Member Data Documentation

◆ m_cQuery

char* clSnagDecomp::m_cQuery
protected

String to pass to clTreePopulation::Find() in order to get the trees for which to run snag dynamics.

This will instigate a species search for all the species to which this behavior applies.

◆ m_fGridCellLength

float clSnagDecomp::m_fGridCellLength
protected

◆ m_fMaxBreakHeight

double clSnagDecomp::m_fMaxBreakHeight
protected

The maximum snag break height.

◆ m_fMinBreakHeight

double clSnagDecomp::m_fMinBreakHeight
protected

The minimum snag break height.

Actually break height is a height between min and max drawn from a uniform distribution.

◆ m_fSnagfallAlpha

double clSnagDecomp::m_fSnagfallAlpha
protected

◆ m_fSnagfallEta

double clSnagDecomp::m_fSnagfallEta
protected

◆ m_fSnagfallKappa

double clSnagDecomp::m_fSnagfallKappa
protected

◆ m_fSnagfallZeta

double clSnagDecomp::m_fSnagfallZeta
protected

◆ m_fTreefallAlpha

double clSnagDecomp::m_fTreefallAlpha
protected

Parameters used in treefall and snag fall models.

◆ m_fTreefallDelta

double clSnagDecomp::m_fTreefallDelta
protected

◆ m_fTreefallIota

double clSnagDecomp::m_fTreefallIota
protected

◆ m_fTreefallLamda

double clSnagDecomp::m_fTreefallLamda
protected

◆ m_fTreefallTheta

double clSnagDecomp::m_fTreefallTheta
protected

◆ m_iCutBACode

short int clSnagDecomp::m_iCutBACode
protected

◆ m_iLiveBACode

short int clSnagDecomp::m_iLiveBACode
protected

◆ m_iNumSpecies

int clSnagDecomp::m_iNumSpecies
protected

Keep a copy of this for the destructor.

◆ mp_fSnagfallBeta

double* clSnagDecomp::mp_fSnagfallBeta
protected

◆ mp_fSnagfallGamma

double* clSnagDecomp::mp_fSnagfallGamma
protected

◆ mp_fSnagTransProb

double clSnagDecomp::mp_fSnagTransProb[6][6]
protected

Species-specific matrices of transition probabilities.

Array size is 6 x 6.

◆ mp_fTreefallBeta

double* clSnagDecomp::mp_fTreefallBeta
protected

◆ mp_iAdultFallCode

short int* clSnagDecomp::mp_iAdultFallCode
protected

◆ mp_iDeadCodes

short int** clSnagDecomp::mp_iDeadCodes
protected

◆ mp_iIndexes

short int* clSnagDecomp::mp_iIndexes
protected

◆ mp_iNewBreakCode

short int** clSnagDecomp::mp_iNewBreakCode
protected

◆ mp_iOldBreakCode

short int* clSnagDecomp::mp_iOldBreakCode
protected

◆ mp_iSnagDCCode

short int** clSnagDecomp::mp_iSnagDCCode
protected

Holds relevant data member codes.

First array index is # species and second, if present, is type (adult or snag).

◆ mp_oBasalAreaGrid

clGrid* clSnagDecomp::mp_oBasalAreaGrid
protected

Grid to hold live and cut basal area in local cells.


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