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

Disturbance - Version 2.1. More...

#include <Disturbance.h>

Inheritance diagram for clDisturbance:
clBehaviorBase clWorkerBase

Classes

struct  stcGridList
 Holds a linked list of grid cells. More...
 

Public Types

enum  cutType { partial, gap, clear }
 Types of harvest cuts. More...
 
enum  amtType { percentBA, absBA, percentDen, absDen }
 How amount to cut is defined. More...
 
enum  priorityDataType { intType, floatType, boolType }
 Tree data member type for priority. More...
 

Public Member Functions

 clDisturbance (clSimManager *p_oSimManager)
 Constructor.
 
 ~clDisturbance ()
 Destructor.
 
void Action ()
 Performs the harvest or mortality episode for a timestep.
 
void SetNameData (char *cNameString)
 Captures the parameter file behavior string passed to this behavior.
 
- Public Member Functions inherited from clBehaviorBase
virtual float GetBehaviorVersion ()
 Gets the behavior version number.
 
 clBehaviorBase (clSimManager *p_oSimManager)
 Constructor.
 
virtual ~clBehaviorBase ()
 Destructor.
 
virtual short int ValidateVersionNumber (float fTestVersion)
 Makes sure that the version number of a file passed is between the minimum and current version numbers.
 
virtual void RegisterTreeDataMembers ()
 Registers tree data members.
 
virtual void SetSpeciesTypeCombos (short int iNumCombos, stcSpeciesTypeCombo *p_whatCombos)
 Sets the species/type combos for a behavior.
 
virtual short int GetNewTreeInts ()
 Gets the number of new tree integer data members this behavior wants to register.
 
virtual short int GetNewTreeFloats ()
 Gets the number of new tree float data members this behavior wants to register.
 
virtual short int GetNewTreeChars ()
 Gets the number of new tree character data members this behavior wants to register.
 
virtual short int GetNewTreeBools ()
 Gets the number of new tree bool data members this behavior wants to register.
 
virtual short int GetNumSpeciesTypeCombos ()
 Gets the number of species/type combos to which this behavior applies.
 
virtual short int GetNumBehaviorSpecies ()
 Gets the number of unique tree species to which this behavior applies.
 
struct stcSpeciesTypeCombo GetSpeciesTypeCombo (short int iIndex)
 Gets one of this behavior's type/species combos.
 
virtual short int GetBehaviorSpecies (short int iIndex)
 Gets one of the behavior's species.
 
short int GetBehaviorListNumber ()
 Gets the behavior list number for this behavior, which differentiates between multiple copies of the behavior in the behavior list.
 
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.
 
virtual DOMElement * GetParentParametersElement (xercesc::DOMDocument *p_oDoc)
 Formats the string for species/types query.
 
- Public Member Functions inherited from clWorkerBase
 clWorkerBase (clSimManager *p_oSimManager)
 Constructor.
 
virtual ~clWorkerBase ()
 Destructor.
 
char * GetName ()
 Gets the object's namestring.
 
void DoObjectSetup (xercesc::DOMDocument *p_oDoc, fileType iFileType)
 Triggers the setup process.
 
virtual void TimestepCleanup ()
 Performs any necessary cleanup operations at the end of a timestep.
 
virtual void EndOfRunCleanup ()
 Performs any necessary cleanup operations at the end of a run.
 
virtual void DoCommand (char *cCommand, char *cArguments)
 If a behavior has registered a command line command with the sim manager, this allows it to be called.
 

Static Public Member Functions

static int GetNumberOfCutRanges ()
 Gets the number of total allowed cut ranges.
 

Protected Member Functions

void ResetResultsGrid ()
 Resets all the values in the Harvest Results or Episodic Mortality Results grid.
 
void GetData (xercesc::DOMDocument *p_oDoc)
 Performs setup.
 
void ReadHarvestParameterFileData (xercesc::DOMDocument *p_oDoc)
 Reads harvest data from the parameter file.
 
void ReadMortEpParameterFileData (xercesc::DOMDocument *p_oDoc)
 Reads episodic mortality data from the parameter file.
 
void SetupGrids ()
 Sets up the harvest or mortality episode grids and gets all the return codes.
 
void ValidatePackages ()
 Makes sure that the data in the event harvest packages makes sense.
 
void CutTrees (clPackage *p_oMasterPackage)
 Performs the tree cutting for a master cut package.
 
void CutSpeciesAbsDen (int iSp, stcGridList *&p_cutArea, float *p_fLoDbh, float *p_fHiDbh, float *p_fAmountToRemove, float *p_fAmountRemoved)
 Cut trees for a species - absolute density.
 
void CutSpeciesAbsDenPriority (int iSp, stcGridList *&p_cutArea, float *p_fLoDbh, float *p_fHiDbh, float *p_fAmountToRemove, float *p_fAmountRemoved, char *cPriorityName, int &iPriorityType, float &fPriorityMin, float &fPriorityMax)
 Cut trees for a species with a priority - absolute density.
 
void CutSpeciesAbsBA (int iSp, stcGridList *&p_cutArea, float *p_fLoDbh, float *p_fHiDbh, float *p_fAmountToRemove, float *p_fAmountRemoved)
 Cut trees for a species - absolute basal area.
 
void CutSpeciesAbsBAPriority (int iSp, stcGridList *&p_cutArea, float *p_fLoDbh, float *p_fHiDbh, float *p_fAmountToRemove, float *p_fAmountRemoved, char *cPriorityName, int &iPriorityType, float &fPriorityMin, float &fPriorityMax)
 Cut trees for a species with a priority - absolute basal area.
 
void CutSpeciesPercentDen (int iSp, stcGridList *&p_cutArea, float *p_fLoDbh, float *p_fHiDbh, float *p_fAmountToRemove, float *p_fAmountRemoved)
 Cut trees for a species - percent density.
 
void CutSpeciesPercentBA (int iSp, stcGridList *&p_cutArea, float *p_fLoDbh, float *p_fHiDbh, float *p_fAmountToRemove, float *p_fAmountRemoved, float *p_fTotalBasalArea)
 Cut trees for a species - percent basal area.
 
void CutSpeciesPercentBAPriority (int iSp, stcGridList *&p_cutArea, float *p_fLoDbh, float *p_fHiDbh, float *p_fAmountToRemove, float *p_fAmountRemoved, float *p_fTotalBasalArea, char *cPriorityName, int &iPriorityType, float &fPriorityMin, float &fPriorityMax)
 Cut trees for a species with a priority - percent basal area.
 
void AddTreeStatsToResults (clTree *p_oTree, float *p_fLoDbh, float *p_fHiDbh, float &fDbh)
 Add tree to results grid.
 
int AssembleCutArea (clPackage *p_oMasterPackage, const int &iNumXCells, const int &iNumYCells, stcGridList *&p_cutArea, float *p_fLoDbh, float *p_fHiDbh, float *p_fAmountToRemove, bool *p_bSpeciesCut)
 Finds all the grid cells affected by a given cut.
 
void GetBasalArea (stcGridList *p_cutArea, const short int &iSpecies, float *p_fTotalBasalArea, float *p_fLoDbh, float *p_fHiDbh)
 Gets the basal area in a cut area for a single species.
 
void KillSeedlings (stcGridList *p_cutArea, float *p_fKillProb)
 Kills seedlings for a harvest or mortality episode event.
 
clTreeGetTallestTreeInCutArea (stcGridList *&p_cutArea, const short int &iSpecies)
 Finds the tallest tree of a species within a cut area.
 
clTreeGetNextTreeInCutArea (stcGridList *&p_cutArea, const short int &iSpecies)
 Gets the next tallest tree of a species within a cut area.
 
void SetCutFlags (stcGridList *p_cutArea, const int &iCutType)
 Sets the Harvest Type data member of the Harvest Results grid.
 
bool IsTreeInCell (clTree *p_oTree, int iX, int iY)
 Figures out whether or not a tree falls in a disturbance grid cell.
 

Protected Attributes

clTreePopulationmp_oPop
 Stashed pointer to tree population.
 
clGridmp_oMasterCutsGrid
 MASTER CUTS GRID.
 
clGridmp_oCutEventsGrid
 CUT EVENTS GRID.
 
clGridmp_oResultsGrid
 RESULTS GRID.
 
short int m_iMasterTimestepCode
 Timestep data member code in "harvestmastercuts" grid.
 
short int m_iMasterIDCode
 ID data member code in "harvestmastercuts" grid.
 
short int * mp_iSpeciesCodes
 Species data member code in "harvestmastercuts" grid.
 
short int m_iCutTypeCode
 cuttype data member code in "harvestmastercuts" grid
 
short int m_iAmountTypeCode
 amttype data member code in "harvestmastercuts" grid
 
short int * mp_iRangeMinCodes
 rangeminx data member codes in "harvestmastercuts" grid.
 
short int * mp_iRangeMaxCodes
 rangemaxx data member codes in "harvestmastercuts" grid.
 
short int * mp_iRangeAmountCodes
 rangeamtx data member codes in "harvestmastercuts" grid.
 
short int * mp_iSeedlingCodes
 Seedlings to cut data member code in "harvestmastercuts" grid.
 
short int * mp_iPriorityNameCodes
 prioritynamex data member codes in "harvestmastercuts" grid.
 
short int * mp_iPriorityTypeCodes
 prioritytypex data member codes in "harvestmastercuts" grid.
 
short int * mp_iPriorityMinCodes
 priorityminx data member codes in "harvestmastercuts" grid.
 
short int * mp_iPriorityMaxCodes
 prioritymaxx data member codes in "harvestmastercuts" grid.
 
short int m_iCutTimestepCode
 timestep data member code in "harvestcutevents" grid
 
short int m_iCutIDCode
 id data member code in "harvestcutevents" grid
 
short int m_iHarvestTypeCode
 Harvest Type data member code in "Harvest Results" grid.
 
short int ** mp_iDenCutCodes
 Cut Density data member codes in "Harvest Results" grid.
 
short int ** mp_iBaCutCodes
 Cut Basal Area data member codes in "Harvest Results" grid.
 
short int * mp_iSeedlingCutCodes
 Cut Seedlings data member codes in "Harvest Results" grid.
 
float m_fDistXCellLen
 Disturbance grid cell X length.
 
float m_fDistYCellLen
 Disturbance grid cell Y length.
 
float m_fPopCellLen
 Tree population grid cell length.
 
deadCode m_iReasonCode
 Reason code to pass to the tree population when trees are killed.
 
bool m_bIsHarvest
 What kind of behavior this is.
 
- Protected Attributes inherited from clBehaviorBase
short int m_iNumSpeciesTypeCombos
 How many type/species combos a behavior will act on.
 
short int m_iNumBehaviorSpecies
 How many distinct species are in the combo list - important for filling species-specific values from parameter file.
 
short int * mp_iWhatSpecies
 List of distinct species - for filling species-specific values from parameter file.
 
stcSpeciesTypeCombomp_whatSpeciesTypeCombos
 Array of species/type combos that the behavior will act on.
 
short int m_iNewTreeInts
 The number of new tree integer data members this behavior wants to add.
 
short int m_iNewTreeFloats
 The number of new tree float data members this behavior wants to add.
 
short int m_iNewTreeChars
 The number of new tree character data members this behavior wants to add.
 
short int m_iNewTreeBools
 The number of new tree boolean data members this behavior wants to add.
 
short int m_iBehaviorListNumber
 The number of this behavior in the behavior list, to differentiate between possible multiple copies of this behavior.
 
float m_fVersionNumber
 Version number - this will be rounded to 2 digits after the decimal place.
 
std::string m_sXMLRoot
 XML root that encloses the parameters for this behavior.
 
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.
 
- Protected Attributes inherited from clWorkerBase
char m_cNameString [MAX_NAMESTRING_SIZE]
 Object's identifying namestring.
 
int * mp_iAllowedFileTypes
 List of the input file types this object can handle.
 
int m_iNumAllowedTypes
 Number of input file types this object can handle.
 

Static Protected Attributes

static short int m_iNumAllowedCutRanges
 Number of cut ranges allowed.
 
static short int m_iNumAllowedPriorities
 Number of allowed priorities.
 

Detailed Description

Disturbance - Version 2.1.

This class allows for highly specific disturbance events. Two kinds of disturbance can be performed: harvest or episodic mortality (disease, insect outbreaks, etc). They work the exact same way, differing only in the reason code passed to the tree population when killing the tree (Harvest in the case of harvest, and disease in the case of episodic mortality).

Harvest/mortality episodes can be defined on a grid cell level for each timestep for each species. If more than one event is defined for a species for a single grid cell and timestep, the user takes a chance on what happens. Cells with common disturbance criteria are grouped by the user into groups which will be evaluated together.

If the disturbance is harvest, there are three kinds of harvests that can be performed: gap cut, partial cut, and clear cut. Partial cuts may remove only a portion of the trees, but otherwise, there is no difference in how the trees are removed for each cut type. The type of cut is recorded for the benefit of other behaviors for whom this might be important. The user can define different ranges of dbh values to cut, and each can have a portion of the trees removed, as defined by percentage of basal area, percentage of density, absolute amount of basal area (in square meters per hectare), or absolute amount of density (in stems per hectare). For gap cut and clear cut, for all species affected, all trees are removed. Any attempt to define cut ranges etc. for gap and clear cuts will cause an error to be thrown (the cut ranges could be ignored but throwing an error alerts the user in case they didn't know, so they could amend the parameter file to get what they meant to get).

Trees can be prioritized by any tree data member. Trees meeting the criterion will be cut before any others. There can be up to three priorities. The trees meeting each priority will be exhausted before moving to the next priority. If a priority does not apply to a tree or cut, it will be ignored. Prioritizing data members cannot be of type char. Priorities are not allowed in percent of density cut types because they would be nonsensical.

Harvests can affect seedlings as well, by randomly killing a proportion of those found in the cut area. The kill rate is species specific and does not have to be the same as the species being harvested.

Episodic mortality events are processed like harvest partial cuts.

The disturbance event data is stored in a grid. Each cut event, defined as the killing to be done for one species for one timestep for one grid cell, is stored in a grid package. These packages are sorted in timestep order. Each timestep, all the cut events that are defined for that timestep are executed, then those packages are removed.

Seedlings are always ignored by this behavior.

This behavior can be called from the parameter file by either "Harvest" or "EpisodicMortality". The namestring is "harvest".

Copyright 2003 Charles D. Canham.

Author
Lora E. Murphy


Edit history:
--------------—
October 20, 2011 - Wiped the slate clean for SORTIE 7.0 (LEM)
February 23, 2012 - Added priorities (LEM)

Member Enumeration Documentation

How amount to cut is defined.

Enumerator:
percentBA 

As a percentage of total basal area in cut range.

absBA 

As an amount of BA in sq m in that cut range.

percentDen 

As a percentage of total density in that cut range.

absDen 

As a total number of trees in that cut range.

Types of harvest cuts.

These are listed in increasing order of severity (that's important!)

Enumerator:
partial 

Partial cut.

gap 

Gap cut.

clear 

Clear cut.

Tree data member type for priority.

Enumerator:
intType 
floatType 
boolType 

Constructor & Destructor Documentation

clDisturbance::clDisturbance ( clSimManager p_oSimManager)

Constructor.

Parameters
p_oSimManagerSim Manager object.
clDisturbance::~clDisturbance ( )

Destructor.

Member Function Documentation

void clDisturbance::Action ( )
virtual

Performs the harvest or mortality episode for a timestep.

This goes through the master package lists in either the harvestmastercuts or mortepisodemastercuts grid and calls CutTrees() for each one that is for this timestep.

Reimplemented from clBehaviorBase.

void clDisturbance::AddTreeStatsToResults ( clTree p_oTree,
float *  p_fLoDbh,
float *  p_fHiDbh,
float &  fDbh 
)
protected

Add tree to results grid.

Parameters
p_oTreeTree to add.
p_fLoDbhArray (sized m_iNumAllowedCutRanges) into which to put the low dbhs of the package's cut ranges.
p_fHiDbhArray (sized m_iNumAllowedCutRanges) into which to put the high dbhs of the package's cut ranges.
fDbhDBH.
int clDisturbance::AssembleCutArea ( clPackage p_oMasterPackage,
const int &  iNumXCells,
const int &  iNumYCells,
stcGridList *&  p_cutArea,
float *  p_fLoDbh,
float *  p_fHiDbh,
float *  p_fAmountToRemove,
bool *  p_bSpeciesCut 
)
protected

Finds all the grid cells affected by a given cut.

The cut in question is found in one master cut package. The grid cells are identified by matching ID numbers on packages in the "harvestcutevents" / "mortepisodecutevents" grid. The cut area cells are assembled into a linked list. All packages which went into the linked list are then deleted. This also extracts the cut range data and cut amount data.

Parameters
p_oMasterPackageThe master package for which the cut area list is being assembled. (This package will be deleted.)
iNumXCellsNumber of X cells in mp_oCutEventsGrid.
iNumYCellsNumber of Y cells in mp_oCutEventsGrid.
p_cutAreaPointer in which to start the linked list.
p_fLoDbhArray (sized m_iNumAllowedCutRanges) into which to put the low dbhs of the package's cut ranges.
p_fHiDbhArray (sized m_iNumAllowedCutRanges) into which to put the high dbhs of the package's cut ranges.
p_fAmountToRemoveArray (sized m_iNumAllowedCutRanges) into which to put the amount of basal area to remove for each of the package's cut ranges.
p_bSpeciesCutArray of all species for whether or not a species is affected by this cut.
Returns
The number of the cells in the cut area.
void clDisturbance::CutSpeciesAbsBA ( int  iSp,
stcGridList *&  p_cutArea,
float *  p_fLoDbh,
float *  p_fHiDbh,
float *  p_fAmountToRemove,
float *  p_fAmountRemoved 
)
protected

Cut trees for a species - absolute basal area.

Parameters
iSpSpecies
p_cutAreaCut area
p_fLoDbhArray of the low dbhs of the package's cut ranges.
p_fHiDbhArray of the high dbhs of the package's cut ranges.
p_fAmountToRemoveAmount to remove in each cut range.
p_fAmountRemovedAmount already removed.
void clDisturbance::CutSpeciesAbsBAPriority ( int  iSp,
stcGridList *&  p_cutArea,
float *  p_fLoDbh,
float *  p_fHiDbh,
float *  p_fAmountToRemove,
float *  p_fAmountRemoved,
char *  cPriorityName,
int &  iPriorityType,
float &  fPriorityMin,
float &  fPriorityMax 
)
protected

Cut trees for a species with a priority - absolute basal area.

Parameters
iSpSpecies
p_cutAreaCut area
p_fLoDbhArray of the low dbhs of the package's cut ranges.
p_fHiDbhArray of the high dbhs of the package's cut ranges.
p_fAmountToRemoveAmount to remove in each cut range.
p_fAmountRemovedAmount already removed.
cPriorityNameName of priority data member.
iPriorityTypePriority type.
fPriorityMinPriority minimum value.
fPriorityMaxPriority maximum value.
void clDisturbance::CutSpeciesAbsDen ( int  iSp,
stcGridList *&  p_cutArea,
float *  p_fLoDbh,
float *  p_fHiDbh,
float *  p_fAmountToRemove,
float *  p_fAmountRemoved 
)
protected

Cut trees for a species - absolute density.

Parameters
iSpSpecies
p_cutAreaCut area
p_fLoDbhArray of the low dbhs of the package's cut ranges.
p_fHiDbhArray of the high dbhs of the package's cut ranges.
p_fAmountToRemoveAmount to remove in each cut range.
p_fAmountRemovedAmount already removed.
void clDisturbance::CutSpeciesAbsDenPriority ( int  iSp,
stcGridList *&  p_cutArea,
float *  p_fLoDbh,
float *  p_fHiDbh,
float *  p_fAmountToRemove,
float *  p_fAmountRemoved,
char *  cPriorityName,
int &  iPriorityType,
float &  fPriorityMin,
float &  fPriorityMax 
)
protected

Cut trees for a species with a priority - absolute density.

Parameters
iSpSpecies
p_cutAreaCut area
p_fLoDbhArray of the low dbhs of the package's cut ranges.
p_fHiDbhArray of the high dbhs of the package's cut ranges.
p_fAmountToRemoveAmount to remove in each cut range.
p_fAmountRemovedAmount already removed.
cPriorityNameName of priority data member.
iPriorityTypePriority type.
fPriorityMinPriority minimum value.
fPriorityMaxPriority maximum value.
void clDisturbance::CutSpeciesPercentBA ( int  iSp,
stcGridList *&  p_cutArea,
float *  p_fLoDbh,
float *  p_fHiDbh,
float *  p_fAmountToRemove,
float *  p_fAmountRemoved,
float *  p_fTotalBasalArea 
)
protected

Cut trees for a species - percent basal area.

Parameters
iSpSpecies
p_cutAreaCut area
p_fLoDbhArray of the low dbhs of the package's cut ranges.
p_fHiDbhArray of the high dbhs of the package's cut ranges.
p_fAmountToRemoveAmount to remove in each cut range.
p_fAmountRemovedAmount already removed.
p_fTotalBasalAreaTotal basal area.
void clDisturbance::CutSpeciesPercentBAPriority ( int  iSp,
stcGridList *&  p_cutArea,
float *  p_fLoDbh,
float *  p_fHiDbh,
float *  p_fAmountToRemove,
float *  p_fAmountRemoved,
float *  p_fTotalBasalArea,
char *  cPriorityName,
int &  iPriorityType,
float &  fPriorityMin,
float &  fPriorityMax 
)
protected

Cut trees for a species with a priority - percent basal area.

Parameters
iSpSpecies
p_cutAreaCut area
p_fLoDbhArray of the low dbhs of the package's cut ranges.
p_fHiDbhArray of the high dbhs of the package's cut ranges.
p_fAmountToRemoveAmount to remove in each cut range.
p_fAmountRemovedAmount already removed.
p_fTotalBasalAreaTotal basal area.
cPriorityNameName of priority data member.
iPriorityTypePriority type.
fPriorityMinPriority minimum value.
fPriorityMaxPriority maximum value.
void clDisturbance::CutSpeciesPercentDen ( int  iSp,
stcGridList *&  p_cutArea,
float *  p_fLoDbh,
float *  p_fHiDbh,
float *  p_fAmountToRemove,
float *  p_fAmountRemoved 
)
protected

Cut trees for a species - percent density.

Parameters
iSpSpecies
p_cutAreaCut area
p_fLoDbhArray of the low dbhs of the package's cut ranges.
p_fHiDbhArray of the high dbhs of the package's cut ranges.
p_fAmountToRemoveAmount to remove in each cut range.
p_fAmountRemovedAmount already removed.
void clDisturbance::CutTrees ( clPackage p_oMasterPackage)
protected

Performs the tree cutting for a master cut package.

It starts by getting a linked list of cells to cut and their tallest trees of a given species, then selects trees to cut according to the cut type.

Parameters
p_oMasterPackageThe master package to cut
void clDisturbance::GetBasalArea ( stcGridList p_cutArea,
const short int &  iSpecies,
float *  p_fTotalBasalArea,
float *  p_fLoDbh,
float *  p_fHiDbh 
)
protected

Gets the basal area in a cut area for a single species.

The cut area is defined by a linked list of grid cells. This gets the basal area in each cut range and puts it in an array whose pointer was passed.

Parameters
p_cutAreaPointer to the linked list.
iSpeciesSpecies of tree for which to calculate basal area.
p_fTotalBasalAreaArray (size m_iNumAllowedCutRanges) in which to put the total basal area calculation.
p_fLoDbhArray (size m_iNumAllowedCutRanges) of lower-limit dbhs for the cut ranges that have been defined.
p_fHiDbhArray (size m_iNumAllowedCutRanges) of upper-limit dbhs for the cut ranges that have been defined.
void clDisturbance::GetData ( xercesc::DOMDocument *  p_oDoc)
protectedvirtual

Performs setup.

First, SetUpGrids() is called to create our grids. Then, if this is harvest, ReadHarvestParameterFileData() is called; if episodic mortality, ReadEpMortParameterFileData() is called. Then ValidatePackages() is called to validate data from the parameter file.

Parameters
p_oDocDOM tree of parsed input file.

Implements clWorkerBase.

clTree* clDisturbance::GetNextTreeInCutArea ( stcGridList *&  p_cutArea,
const short int &  iSpecies 
)
protected

Gets the next tallest tree of a species within a cut area.

The cut area is defined by a linked list of grid cells. This assumes that the pointers to the tallest trees for each grid cell are populated, and that the current tallest tree is no longer wanted (although if it is to be killed it hasn't been killed yet). The current tallest tree could still be alive; but it will be ignored for further consideration.

Parameters
p_cutAreaPointer to the linked list.
iSpeciesSpecies being cut.
Returns
Next tallest tree in the area, or NULL if there are no trees of the desired species.
static int clDisturbance::GetNumberOfCutRanges ( )
inlinestatic

Gets the number of total allowed cut ranges.

Returns
Number of total allowed cut ranges.
clTree* clDisturbance::GetTallestTreeInCutArea ( stcGridList *&  p_cutArea,
const short int &  iSpecies 
)
protected

Finds the tallest tree of a species within a cut area.

The cut area is defined by a linked list of grid cells. This assumes that the tallest tree pointers for each grid cell in the linked list is not populated. This will populate and sort them. Which means that the pointer p_cutArea could be changed.

Parameters
p_cutAreaPointer to the linked list.
iSpeciesSpecies of tree to populate.
Returns
Tallest tree in the area, or NULL if there are no trees of the desired species.
bool clDisturbance::IsTreeInCell ( clTree p_oTree,
int  iX,
int  iY 
)
protected

Figures out whether or not a tree falls in a disturbance grid cell.

Parameters
p_oTreeTree to check
iXGrid cell X number
iYGrid cell Y number
Returns
True if the tree falls in the cell, false if not
void clDisturbance::KillSeedlings ( stcGridList p_cutArea,
float *  p_fKillProb 
)
protected

Kills seedlings for a harvest or mortality episode event.

Unlike with larger trees, all species are done at the same time. Each seedling found within the affected area gets a random number comparison to the kill probability for its species.

Parameters
p_cutAreaPointer to the linked list.
p_fKillProbKill probability for each species.
void clDisturbance::ReadHarvestParameterFileData ( xercesc::DOMDocument *  p_oDoc)
protected

Reads harvest data from the parameter file.

It doesn't perform validation other than basic data types - more in-depth logical validation is left to ValidatePackages().

Parameters
p_oDocDOM tree of parsed input file.
void clDisturbance::ReadMortEpParameterFileData ( xercesc::DOMDocument *  p_oDoc)
protected

Reads episodic mortality data from the parameter file.

It doesn't perform validation other than basic data types - more in-depth logical validation is left to ValidatePackages().

Parameters
p_oDocDOM tree of parsed input file.
void clDisturbance::ResetResultsGrid ( )
protected

Resets all the values in the Harvest Results or Episodic Mortality Results grid.

If Harvest, Harvest Type becomes -1; all others are 0.

void clDisturbance::SetCutFlags ( stcGridList p_cutArea,
const int &  iCutType 
)
protected

Sets the Harvest Type data member of the Harvest Results grid.

For each grid cell in the cut area, this makes sure that the data member is set to the most severe cut type that occurred in a timestep.

Parameters
p_cutAreaPointer to the linked list of the cut area.
iCutTypeMost severe cut type from this cut area.
void clDisturbance::SetNameData ( char *  cNameString)
virtual

Captures the parameter file behavior string 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
cNameStringBehavior's parameter file names.
Exceptions
modelErrif the name is not recognized.

Reimplemented from clBehaviorBase.

void clDisturbance::SetupGrids ( )
protected

Sets up the harvest or mortality episode grids and gets all the return codes.

void clDisturbance::ValidatePackages ( )
protected

Makes sure that the data in the event harvest packages makes sense.

For each cut event (each package) - this checks the following:

  • No negative values in cut ranges
  • Cut ranges do not overlap
  • Cut amounts expressed in percentages do not have values over 100
  • There are no cut ranges defined for gap and clear cuts

For harvest gap and clear cuts, this will set up one cut range so the cut happens correctly. The cut range will cover dbhs from 0 to 3000, removing 100% of density.

Member Data Documentation

bool clDisturbance::m_bIsHarvest
protected

What kind of behavior this is.

If true, it's a harvest. If false, it's episodic mortality.

float clDisturbance::m_fDistXCellLen
protected

Disturbance grid cell X length.

float clDisturbance::m_fDistYCellLen
protected

Disturbance grid cell Y length.

float clDisturbance::m_fPopCellLen
protected

Tree population grid cell length.

short int clDisturbance::m_iAmountTypeCode
protected

amttype data member code in "harvestmastercuts" grid

short int clDisturbance::m_iCutIDCode
protected

id data member code in "harvestcutevents" grid

short int clDisturbance::m_iCutTimestepCode
protected

timestep data member code in "harvestcutevents" grid

short int clDisturbance::m_iCutTypeCode
protected

cuttype data member code in "harvestmastercuts" grid

short int clDisturbance::m_iHarvestTypeCode
protected

Harvest Type data member code in "Harvest Results" grid.

short int clDisturbance::m_iMasterIDCode
protected

ID data member code in "harvestmastercuts" grid.

short int clDisturbance::m_iMasterTimestepCode
protected

Timestep data member code in "harvestmastercuts" grid.

short int clDisturbance::m_iNumAllowedCutRanges
staticprotected

Number of cut ranges allowed.

short int clDisturbance::m_iNumAllowedPriorities
staticprotected

Number of allowed priorities.

deadCode clDisturbance::m_iReasonCode
protected

Reason code to pass to the tree population when trees are killed.

This is HARVEST in the case of harvest, and DISEASE in the case of episodic mortality.

short int** clDisturbance::mp_iBaCutCodes
protected

Cut Basal Area data member codes in "Harvest Results" grid.

Array size is number cut ranges by number of species

short int** clDisturbance::mp_iDenCutCodes
protected

Cut Density data member codes in "Harvest Results" grid.

Array size is number of cut ranges by number of species

short int* clDisturbance::mp_iPriorityMaxCodes
protected

prioritymaxx data member codes in "harvestmastercuts" grid.

Array size is number priorities

short int* clDisturbance::mp_iPriorityMinCodes
protected

priorityminx data member codes in "harvestmastercuts" grid.

Array size is number priorities

short int* clDisturbance::mp_iPriorityNameCodes
protected

prioritynamex data member codes in "harvestmastercuts" grid.

Array size is number priorities

short int* clDisturbance::mp_iPriorityTypeCodes
protected

prioritytypex data member codes in "harvestmastercuts" grid.

Array size is number priorities

short int* clDisturbance::mp_iRangeAmountCodes
protected

rangeamtx data member codes in "harvestmastercuts" grid.

Array size is number cut ranges

short int* clDisturbance::mp_iRangeMaxCodes
protected

rangemaxx data member codes in "harvestmastercuts" grid.

Array size is number cut ranges

short int* clDisturbance::mp_iRangeMinCodes
protected

rangeminx data member codes in "harvestmastercuts" grid.

Array size is number cut ranges

short int* clDisturbance::mp_iSeedlingCodes
protected

Seedlings to cut data member code in "harvestmastercuts" grid.

Array size is number species. Array index matches species number

short int* clDisturbance::mp_iSeedlingCutCodes
protected

Cut Seedlings data member codes in "Harvest Results" grid.

Array size is number of species.

short int* clDisturbance::mp_iSpeciesCodes
protected

Species data member code in "harvestmastercuts" grid.

Array size is number species. Array index matches species number

clGrid* clDisturbance::mp_oCutEventsGrid
protected

CUT EVENTS GRID.

If this behavior is harvesting, the grid is called "harvestcutevents"; if it is episodic mortality, the grid is called "mortepisodecutevents". This is where data about cutting events is stored.

Grid cell size matches the master cuts grid.

The need to cut a grid cell is signaled by the presence of a package. The package has an ID number which matches a package in either the "harvestmastercuts" or "mortepisodemastercuts" grid, which contains the information about how the cut is actually to be performed. Packages are in timestep order, earliest first.

It is possible that a grid map will have been read in for this grid; it will be ignored, and any grid created with such a map will be overwritten.

Data members - all for packages:

Data member nameData typeDescription
id int ID number matching master package in "harvestmastercuts"
timestep int Timestep at which to apply the cut
clGrid* clDisturbance::mp_oMasterCutsGrid
protected

MASTER CUTS GRID.

If this behavior is harvesting, the grid is called "harvestmastercuts"; if it is episodic mortality, the grid is called "mortepisodemastercuts". The grid has a single cell. This is where the cut events are defined.

Grid cell size defaults to match the tree population. A map is allowed only to set cell size.

Each cut event is one package and is applied to a list of species. It has a timestep, cut amount, cut type, and number of cut ranges defined. It also has a unique ID number. The grid cells to which it is applied are in either the "harvestcutevents" or "mortepisodecutevents" grid, depending on what this behavior is.

Species are treated individually. A cut event removing 20% of three species removes 20% of each species individually; one that removes 5 sq.m/ha of basal area removes 5 from each species.

For the cut ranges, four dbh ranges can be defined to which the cuts will be applied. The ranges are ordered as 1 is the smallest minimum dbh. Ranges cannot overlap.

The packages are in timestep order, earliest first.

It is possible that a grid map will have been read in for this grid; it will be ignored, and any grid created with such a map will be overwritten.

Data members - all for packages:

Name Type Description
id int ID number of cut
timestep int Timestep at which to apply the cut
cuttype int Matches a value of the enum "cutType"
amttype int Matches a value of the enum "amtType". Not used if episodic mortality
species(x) bool One of each of these for each species. If true, this species is being cut.
rangeamt(x) floatRange amount to cut. There are one of each of the following for m_iNumAllowedCutRanges, where x is the index, starting at 0 (thus "rangemin0" and "rangeamt2"). Units depend on amttype and are either % BA, % density, absolute amount BA (in square m/ha), or absolute amount of density (in stems per ha)
rangemin(x) floatRange min dbh value. There are one of each of the following for m_iNumAllowedCutRanges, where x is the index, starting at 0.
rangemax(x) floatRange max dbh value. There are one of each of the following for m_iNumAllowedCutRanges, where x is the index, starting at 0.
priorityname(x)char The name of the tree data member for priority X.
prioritytype(x)int The tree data member type for priority X. Matches one of the values in enum priorityDataType.
prioritymin(x) floatMin value. A boolean should be 0 or 1.
prioritymax(x) floatMax value. Can equal min value if only a single value is acceptable.
seedling(x) floatProportion (0-1) of seedlings of each species to destroy.
clTreePopulation* clDisturbance::mp_oPop
protected

Stashed pointer to tree population.

clGrid* clDisturbance::mp_oResultsGrid
protected

RESULTS GRID.

If this behavior is harvesting, the grid is called "Harvest Results"; if it is episodic mortality, the grid is called "Mortality Episode Results". The grid has a cell resolution matching that of "harvestcutevents/ mortepisodecutevents". This is where data on actual cut/kill results is stored. The data is stored raw - no conversion to per-hectare amounts.

It is possible that a grid map will have been read in for this grid; it will be ignored, and any grid created with such a map will be overwritten.

Data member name Data type Description
Harvest Type int Type of harvest that occurred in the current timestep - -1 if none has occurred. This data member is not registered if this grid is "Mortality Episode Results".
Cut Density_x_sp int Number of trees cut in the current timestep. There are one of each of the following for m_iNumAllowedCutRanges times number of species, where x is the cut range index, starting at 0, and sp is the species number.
Cut Basal Area_x_spfloat Total basal area cut in the current timestep. There are one of each of the following for m_iNumAllowedCutRanges times number of species, where x is the cut range index, starting at 0, and sp is the species number.
Cut Seedlings_sp int Number of seedlings cut in the current timestep.

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