SORTIE Core C++ Documentation
|
Disturbance - Version 2.1. More...
#include <Disturbance.h>
Classes | |
struct | stcGridList |
Holds a linked list of grid cells. More... | |
struct | stcTreeGridList |
Holds a linked list of tree grid cells that correspond to the harvest area. 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. More... | |
~clDisturbance () | |
Destructor. More... | |
void | Action () |
Performs the harvest or mortality episode for a timestep. More... | |
void | SetNameData (std::string sNameString) |
Captures the parameter file behavior string passed to this behavior. 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 | RegisterTreeDataMembers () |
Registers tree data members. 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... | |
clSimManager * | GetSimManager () |
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... | |
Static Public Member Functions | |
static int | GetNumberOfCutRanges () |
Gets the number of total allowed cut ranges. More... | |
Protected Member Functions | |
void | ResetResultsGrid () |
Resets all the values in the Harvest Results or Episodic Mortality Results grid. More... | |
void | GetData (xercesc::DOMDocument *p_oDoc) |
Performs setup. More... | |
void | ReadHarvestParameterFileData (xercesc::DOMDocument *p_oDoc) |
Reads harvest data from the parameter file. More... | |
void | ReadMortEpParameterFileData (xercesc::DOMDocument *p_oDoc) |
Reads episodic mortality data from the parameter file. More... | |
void | SetupGrids () |
Sets up the harvest or mortality episode grids and gets all the return codes. More... | |
void | ValidatePackages () |
Makes sure that the data in the event harvest packages makes sense. More... | |
void | CutTrees (clPackage *p_oMasterPackage) |
Performs the tree cutting for a master cut package. More... | |
void | CutSpeciesAbsDen (int iSp, stcGridList *&p_cutArea, stcTreeGridList *&p_treeArea, float *p_fLoDbh, float *p_fHiDbh, float *p_fAmountToRemove, float *p_fAmountRemoved, bool bTallestFirst) |
Cut trees for a species - absolute density. More... | |
void | CutSpeciesAbsDenPriority (int iSp, stcGridList *&p_cutArea, stcTreeGridList *&p_treeArea, float *p_fLoDbh, float *p_fHiDbh, float *p_fAmountToRemove, float *p_fAmountRemoved, std::string sPriorityName, int &iPriorityType, float &fPriorityMin, float &fPriorityMax, bool bTallestFirst) |
Cut trees for a species with a priority - absolute density. More... | |
void | CutSpeciesAbsBA (int iSp, stcGridList *&p_cutArea, stcTreeGridList *&p_treeArea, float *p_fLoDbh, float *p_fHiDbh, float *p_fAmountToRemove, float *p_fAmountRemoved, bool bTallestFirst) |
Cut trees for a species - absolute basal area. More... | |
bool | CutSpeciesAbsBAPriority (int iSp, stcGridList *&p_cutArea, stcTreeGridList *&p_treeArea, float *p_fLoDbh, float *p_fHiDbh, float *p_fAmountToRemove, float *p_fAmountRemoved, std::string sPriorityName, int &iPriorityType, float &fPriorityMin, float &fPriorityMax, bool bTallestFirst) |
Cut trees for a species with a priority - absolute basal area. More... | |
void | CutSpeciesPercentDen (int iSp, stcGridList *&p_cutArea, stcTreeGridList *&p_treeArea, float *p_fLoDbh, float *p_fHiDbh, float *p_fAmountToRemove, float *p_fAmountRemoved) |
Cut trees for a species - percent density. More... | |
void | CutSpeciesPercentBA (int iSp, stcGridList *&p_cutArea, stcTreeGridList *&p_treeArea, float *p_fLoDbh, float *p_fHiDbh, float *p_fAmountToRemove, float *p_fAmountRemoved, float *p_fTotalBasalArea, bool bTallestFirst) |
Cut trees for a species - percent basal area. More... | |
bool | CutSpeciesPercentBAPriority (int iSp, stcGridList *&p_cutArea, stcTreeGridList *&p_treeArea, float *p_fLoDbh, float *p_fHiDbh, float *p_fAmountToRemove, float *p_fAmountRemoved, float *p_fTotalBasalArea, std::string sPriorityName, int &iPriorityType, float &fPriorityMin, float &fPriorityMax, bool bTallestFirst) |
Cut trees for a species with a priority - percent basal area. More... | |
void | AddTreeStatsToResults (clTree *p_oTree, float *p_fLoDbh, float *p_fHiDbh, float &fDbh) |
Add tree to results grid. More... | |
int | AssembleCutArea (clPackage *p_oMasterPackage, const int &iNumXCells, const int &iNumYCells, stcGridList *&p_cutArea, stcTreeGridList *&p_treeArea, float *p_fLoDbh, float *p_fHiDbh, float *p_fAmountToRemove, bool *p_bSpeciesCut) |
Finds all the grid cells affected by a given cut. More... | |
void | GetBasalArea (stcGridList *p_cutArea, stcTreeGridList *&p_treeArea, 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. More... | |
void | KillSeedlings (stcGridList *p_cutArea, stcTreeGridList *&p_treeArea, float *p_fKillProb) |
Kills seedlings for a harvest or mortality episode event. More... | |
clTree * | GetFirstTreeInCutArea (stcGridList *&p_cutArea, stcTreeGridList *&p_treeArea, const short int &iSpecies, const bool bTallestFirst) |
Finds the first tree of a species within a cut area to cut, based on bTallestFirst. More... | |
clTree * | GetTallestTreeInCutArea (stcGridList *&p_cutArea, stcTreeGridList *&p_treeArea, const short int &iSpecies) |
Finds the tallest tree of a species within a cut area. More... | |
clTree * | GetShortestTreeInCutArea (stcGridList *&p_cutArea, stcTreeGridList *&p_treeArea, const short int &iSpecies) |
Finds the shortest tree of a species within a cut area. More... | |
clTree * | GetNextTreeInCutArea (stcGridList *&p_cutArea, stcTreeGridList *&p_treeArea, const short int &iSpecies, const bool bTallestFirst) |
Finds the next tree of a species within a cut area to cut, based on bTallestFirst. More... | |
clTree * | GetNextTallestTreeInCutArea (stcGridList *&p_cutArea, stcTreeGridList *&p_treeArea, const short int &iSpecies) |
Gets the next tallest tree of a species within a cut area. More... | |
clTree * | GetNextShortestTreeInCutArea (stcGridList *&p_cutArea, stcTreeGridList *&p_treeArea, const short int &iSpecies) |
Gets the next shortest tree of a species within a cut area. More... | |
void | SetCutFlags (stcGridList *p_cutArea, const int &iCutType) |
Sets the Harvest Type data member of the Harvest Results grid. More... | |
bool | IsTreeInCutArea (clTree *p_oTree, stcGridList *p_cutArea) |
Figures out whether or not a tree falls in a disturbance cut area. 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 | |
clTreePopulation * | mp_oPop |
Stashed pointer to tree population. More... | |
clGrid * | mp_oMasterCutsGrid |
MASTER CUTS GRID. More... | |
clGrid * | mp_oCutEventsGrid |
CUT EVENTS GRID. More... | |
clGrid * | mp_oResultsGrid |
RESULTS GRID. More... | |
short int | m_iMasterTimestepCode |
Timestep data member code in "harvestmastercuts" grid. More... | |
short int | m_iMasterIDCode |
ID data member code in "harvestmastercuts" grid. More... | |
short int * | mp_iSpeciesCodes |
Species data member code in "harvestmastercuts" grid. More... | |
short int | m_iCutTypeCode |
cuttype data member code in "harvestmastercuts" grid More... | |
short int | m_iAmountTypeCode |
amttype data member code in "harvestmastercuts" grid More... | |
short int | m_iTallestFirstCode |
tallestfirst data member code in "harvestmastercuts" grid More... | |
short int * | mp_iRangeMinCodes |
rangeminx data member codes in "harvestmastercuts" grid. More... | |
short int * | mp_iRangeMaxCodes |
rangemaxx data member codes in "harvestmastercuts" grid. More... | |
short int * | mp_iRangeAmountCodes |
rangeamtx data member codes in "harvestmastercuts" grid. More... | |
short int * | mp_iSeedlingCodes |
Seedlings to cut data member code in "harvestmastercuts" grid. More... | |
short int * | mp_iPriorityNameCodes |
prioritynamex data member codes in "harvestmastercuts" grid. More... | |
short int * | mp_iPriorityTypeCodes |
prioritytypex data member codes in "harvestmastercuts" grid. More... | |
short int * | mp_iPriorityMinCodes |
priorityminx data member codes in "harvestmastercuts" grid. More... | |
short int * | mp_iPriorityMaxCodes |
prioritymaxx data member codes in "harvestmastercuts" grid. More... | |
short int | m_iCutTimestepCode |
timestep data member code in "harvestcutevents" grid More... | |
short int | m_iCutIDCode |
id data member code in "harvestcutevents" grid More... | |
short int | m_iHarvestTypeCode |
Harvest Type data member code in "Harvest Results" grid. More... | |
short int ** | mp_iDenCutCodes |
Cut Density data member codes in "Harvest Results" grid. More... | |
short int ** | mp_iBaCutCodes |
Cut Basal Area data member codes in "Harvest Results" grid. More... | |
short int * | mp_iSeedlingCutCodes |
Cut Seedlings data member codes in "Harvest Results" grid. More... | |
float | m_fDistXCellLen |
Disturbance grid cell X length. More... | |
float | m_fDistYCellLen |
Disturbance grid cell Y length. More... | |
float | m_fPopCellLen |
Tree population grid cell length. More... | |
deadCode | m_iReasonCode |
Reason code to pass to the tree population when trees are killed. More... | |
bool | m_bIsHarvest |
What kind of behavior this is. 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... | |
stcSpeciesTypeCombo * | mp_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... | |
clSimManager * | mp_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 short int | m_iNumAllowedCutRanges |
Number of cut ranges allowed. More... | |
static short int | m_iNumAllowedPriorities |
Number of allowed priorities. More... | |
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 cut either largest to smallest or smallest to largest.
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.
This behavior can be called from the parameter file by either "Harvest" or "EpisodicMortality". The namestring is "harvest".
Copyright 2003 Charles D. Canham.
Edit history:
--------------—
October 20, 2011 - Wiped the slate clean for SORTIE 7.0 (LEM)
February 23, 2012 - Added priorities (LEM)
April 18, 2017 - Allowed reverse cut order (LEM)
clDisturbance::clDisturbance | ( | clSimManager * | p_oSimManager | ) |
Constructor.
p_oSimManager | Sim Manager object. |
clDisturbance::~clDisturbance | ( | ) |
Destructor.
|
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.
|
protected |
Add tree to results grid.
p_oTree | Tree to add. |
p_fLoDbh | Array (sized m_iNumAllowedCutRanges) into which to put the low dbhs of the package's cut ranges. |
p_fHiDbh | Array (sized m_iNumAllowedCutRanges) into which to put the high dbhs of the package's cut ranges. |
fDbh | DBH. |
|
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.
p_oMasterPackage | The master package for which the cut area list is being assembled. (This package will be deleted.) |
iNumXCells | Number of X cells in mp_oCutEventsGrid. |
iNumYCells | Number of Y cells in mp_oCutEventsGrid. |
p_cutArea | Pointer in which to start the linked list. |
p_treeArea | Tree cell linked list. Helps resolve cell size differences between disturbance and tree grid cell sizes. |
p_fLoDbh | Array (sized m_iNumAllowedCutRanges) into which to put the low dbhs of the package's cut ranges. |
p_fHiDbh | Array (sized m_iNumAllowedCutRanges) into which to put the high dbhs of the package's cut ranges. |
p_fAmountToRemove | Array (sized m_iNumAllowedCutRanges) into which to put the amount of basal area to remove for each of the package's cut ranges. |
p_bSpeciesCut | Array of all species for whether or not a species is affected by this cut. |
|
protected |
Cut trees for a species - absolute basal area.
iSp | Species |
p_cutArea | Pointer to the linked list of cut grid cells. |
p_treeArea | Pointer to the linked list of tree grid cells. |
p_fLoDbh | Array of the low dbhs of the package's cut ranges. |
p_fHiDbh | Array of the high dbhs of the package's cut ranges. |
p_fAmountToRemove | Amount to remove in each cut range. |
p_fAmountRemoved | Amount already removed. |
bTallestFirst | Whether to cut the tallest trees first (true) or shortest first (false). |
|
protected |
Cut trees for a species with a priority - absolute basal area.
iSp | Species |
p_cutArea | Pointer to the linked list of cut grid cells. |
p_treeArea | Pointer to the linked list of tree grid cells. |
p_fLoDbh | Array of the low dbhs of the package's cut ranges. |
p_fHiDbh | Array of the high dbhs of the package's cut ranges. |
p_fAmountToRemove | Amount to remove in each cut range. |
p_fAmountRemoved | Amount already removed. |
sPriorityName | Name of priority data member. |
iPriorityType | Priority type. |
fPriorityMin | Priority minimum value. |
fPriorityMax | Priority maximum value. |
bTallestFirst | Whether to cut the tallest trees first (true) or shortest first (false). |
|
protected |
Cut trees for a species - absolute density.
iSp | Species |
p_cutArea | Pointer to the linked list of cut grid cells. |
p_treeArea | Pointer to the linked list of tree grid cells. |
p_fLoDbh | Array of the low dbhs of the package's cut ranges. |
p_fHiDbh | Array of the high dbhs of the package's cut ranges. |
p_fAmountToRemove | Amount to remove in each cut range. |
p_fAmountRemoved | Amount already removed. |
bTallestFirst | Whether to cut the tallest trees first (true) or shortest first (false). |
|
protected |
Cut trees for a species with a priority - absolute density.
iSp | Species |
p_cutArea | Pointer to the linked list of cut grid cells. |
p_treeArea | Pointer to the linked list of tree grid cells. |
p_fLoDbh | Array of the low dbhs of the package's cut ranges. |
p_fHiDbh | Array of the high dbhs of the package's cut ranges. |
p_fAmountToRemove | Amount to remove in each cut range. |
p_fAmountRemoved | Amount already removed. |
sPriorityName | Name of priority data member. |
iPriorityType | Priority type. |
fPriorityMin | Priority minimum value. |
fPriorityMax | Priority maximum value. |
bTallestFirst | Whether to cut the tallest trees first (true) or shortest first (false). |
|
protected |
Cut trees for a species - percent basal area.
iSp | Species |
p_cutArea | Pointer to the linked list of cut grid cells. |
p_treeArea | Pointer to the linked list of tree grid cells. |
p_fLoDbh | Array of the low dbhs of the package's cut ranges. |
p_fHiDbh | Array of the high dbhs of the package's cut ranges. |
p_fAmountToRemove | Amount to remove in each cut range. |
p_fAmountRemoved | Amount already removed. |
p_fTotalBasalArea | Total basal area. |
bTallestFirst | Whether to cut the tallest trees first (true) or shortest first (false). |
|
protected |
Cut trees for a species with a priority - percent basal area.
iSp | Species |
p_cutArea | Pointer to the linked list of cut grid cells. |
p_treeArea | Pointer to the linked list of tree grid cells. |
p_fLoDbh | Array of the low dbhs of the package's cut ranges. |
p_fHiDbh | Array of the high dbhs of the package's cut ranges. |
p_fAmountToRemove | Amount to remove in each cut range. |
p_fAmountRemoved | Amount already removed. |
p_fTotalBasalArea | Total basal area. |
sPriorityName | Name of priority data member. |
iPriorityType | Priority type. |
fPriorityMin | Priority minimum value. |
fPriorityMax | Priority maximum value. |
bTallestFirst | Whether to cut the tallest trees first (true) or shortest first (false). |
|
protected |
Cut trees for a species - percent density.
iSp | Species |
p_cutArea | Pointer to the linked list of cut grid cells. |
p_treeArea | Pointer to the linked list of tree grid cells. |
p_fLoDbh | Array of the low dbhs of the package's cut ranges. |
p_fHiDbh | Array of the high dbhs of the package's cut ranges. |
p_fAmountToRemove | Amount to remove in each cut range. |
p_fAmountRemoved | Amount already removed. |
|
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.
p_oMasterPackage | The master package to cut |
|
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.
p_cutArea | Pointer to the linked list. |
p_treeArea | Pointer to the linked list of tree grid cells. |
iSpecies | Species of tree for which to calculate basal area. |
p_fTotalBasalArea | Array (size m_iNumAllowedCutRanges) in which to put the total basal area calculation. |
p_fLoDbh | Array (size m_iNumAllowedCutRanges) of lower-limit dbhs for the cut ranges that have been defined. |
p_fHiDbh | Array (size m_iNumAllowedCutRanges) of upper-limit dbhs for the cut ranges that have been defined. |
|
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.
p_oDoc | DOM tree of parsed input file. |
Implements clWorkerBase.
|
protected |
Finds the first tree of a species within a cut area to cut, based on bTallestFirst.
This is a convenience function that will call either GetTallestTreeInCutArea or GetShortestTreeInCutArea.
p_cutArea | Pointer to the linked list of cut grid cells. |
p_treeArea | Pointer to the linked list of tree grid cells. |
iSpecies | Species of tree to populate. |
bTallestFirst | Whether to cut trees from tallest to shortest (true) or the reverse (false). |
|
protected |
Gets the next shortest 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 shortest trees for each grid cell are populated, and that the current shortest tree is no longer wanted (although if it is to be killed it hasn't been killed yet). The current shortest tree could still be alive; but it will be ignored for further consideration.
p_cutArea | Pointer to the linked list of cut grid cells. |
p_treeArea | Pointer to the linked list of tree grid cells. |
iSpecies | Species being cut. |
|
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.
p_cutArea | Pointer to the linked list of cut grid cells. |
p_treeArea | Pointer to the linked list of tree grid cells. |
iSpecies | Species being cut. |
|
protected |
Finds the next tree of a species within a cut area to cut, based on bTallestFirst.
This is a convenience function that will call either GetNextTallestTreeInCutArea or GetNextShortestTreeInCutArea.
p_cutArea | Pointer to the linked list of cut grid cells. |
p_treeArea | Pointer to the linked list of tree grid cells. |
iSpecies | Species being cut. |
bTallestFirst | Whether to cut trees from tallest to shortest (true) or the reverse (false). |
|
inlinestatic |
Gets the number of total allowed cut ranges.
|
protected |
Finds the shortest tree of a species within a cut area.
The cut area is defined by a linked list of grid cells. This assumes that the shortest 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_treeArea could be changed.
p_cutArea | Pointer to the linked list of cut grid cells. |
p_treeArea | Pointer to the linked list of tree grid cells. |
iSpecies | Species of tree to populate. |
|
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_treeArea could be changed.
p_cutArea | Pointer to the linked list of cut grid cells. |
p_treeArea | Pointer to the linked list of tree grid cells. |
iSpecies | Species of tree to populate. |
|
protected |
Figures out whether or not a tree falls in a disturbance cut area.
p_oTree | Tree to check |
p_cutArea | Cut area to check |
|
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.
p_cutArea | Pointer to the linked list of cut grid cells. |
p_treeArea | Pointer to the linked list of tree grid cells. |
p_fKillProb | Kill probability for each species. |
|
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().
p_oDoc | DOM tree of parsed input file. |
|
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().
p_oDoc | DOM tree of parsed input file. |
|
protected |
Resets all the values in the Harvest Results or Episodic Mortality Results grid.
If Harvest, Harvest Type becomes -1; all others are 0.
|
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.
p_cutArea | Pointer to the linked list of the cut area. |
iCutType | Most severe cut type from this cut area. |
|
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.
sNameString | Behavior's parameter file names. |
modelErr | if the name is not recognized. |
Reimplemented from clBehaviorBase.
|
protected |
Sets up the harvest or mortality episode grids and gets all the return codes.
|
protected |
Makes sure that the data in the event harvest packages makes sense.
For each cut event (each package) - this checks the following:
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.
|
protected |
What kind of behavior this is.
If true, it's a harvest. If false, it's episodic mortality.
|
protected |
Disturbance grid cell X length.
|
protected |
Disturbance grid cell Y length.
|
protected |
Tree population grid cell length.
|
protected |
amttype data member code in "harvestmastercuts" grid
|
protected |
id data member code in "harvestcutevents" grid
|
protected |
timestep data member code in "harvestcutevents" grid
|
protected |
cuttype data member code in "harvestmastercuts" grid
|
protected |
Harvest Type data member code in "Harvest Results" grid.
|
protected |
ID data member code in "harvestmastercuts" grid.
|
protected |
Timestep data member code in "harvestmastercuts" grid.
|
staticprotected |
Number of cut ranges allowed.
|
staticprotected |
Number of allowed priorities.
|
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.
|
protected |
tallestfirst data member code in "harvestmastercuts" grid
|
protected |
Cut Basal Area data member codes in "Harvest Results" grid.
Array size is number cut ranges by number of species
|
protected |
Cut Density data member codes in "Harvest Results" grid.
Array size is number of cut ranges by number of species
|
protected |
prioritymaxx data member codes in "harvestmastercuts" grid.
Array size is number priorities
|
protected |
priorityminx data member codes in "harvestmastercuts" grid.
Array size is number priorities
|
protected |
prioritynamex data member codes in "harvestmastercuts" grid.
Array size is number priorities
|
protected |
prioritytypex data member codes in "harvestmastercuts" grid.
Array size is number priorities
|
protected |
rangeamtx data member codes in "harvestmastercuts" grid.
Array size is number cut ranges
|
protected |
rangemaxx data member codes in "harvestmastercuts" grid.
Array size is number cut ranges
|
protected |
rangeminx data member codes in "harvestmastercuts" grid.
Array size is number cut ranges
|
protected |
Seedlings to cut data member code in "harvestmastercuts" grid.
Array size is number species. Array index matches species number
|
protected |
Cut Seedlings data member codes in "Harvest Results" grid.
Array size is number of species.
|
protected |
Species data member code in "harvestmastercuts" grid.
Array size is number species. Array index matches species number
|
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 name | Data type | Description |
---|---|---|
id | int | ID number matching master package in "harvestmastercuts" |
timestep | int | Timestep at which to apply the cut |
|
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 |
tallestfirst | bool | Whether to cut the tallest trees first (true) or shortest (false) |
species(x) | bool | One of each of these for each species. If true, this species is being cut. |
rangeamt(x) | float | Range 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) | float | Range min dbh value. There are one of each of the following for m_iNumAllowedCutRanges, where x is the index, starting at 0. |
rangemax(x) | float | Range 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) | float | Min value. A boolean should be 0 or 1. |
prioritymax(x) | float | Max value. Can equal min value if only a single value is acceptable. |
seedling(x) | float | Proportion (0-1) of seedlings of each species to destroy. |
|
protected |
Stashed pointer to tree population.
|
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_sp | float | 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. |