clSelectionHarvest Class Reference

SelectionHarvest - Version 1.0. More...

#include <SelectionHarvest.h>

Inheritance diagram for clSelectionHarvest:

clBehaviorBase clWorkerBase List of all members.

Public Types

 partial
 Partial cut.
 gap
 Gap cut.
 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.
enum  cutType { partial, gap }
 Types of harvest cuts. More...
enum  amtType { percentBA, absBA, percentDen }
 How amount to cut is defined. More...

Public Member Functions

 clSelectionHarvest (clSimManager *p_oSimManager)
 Constructor.
 ~clSelectionHarvest ()
 Destructor.
void Action ()
 Performs the selection cut setup for a timestep.
void GetTimeSinceHarvest ()
 Determines the time that has elapsed since the last harvest for each cell in the harvest results grid.

Protected Member Functions

void GetData (xercesc::DOMDocument *p_oDoc)
 Reads all the harvest events from the parameter file.
void GetBasalArea (clTreePopulation *p_oTreePop, float *p_fTotalBasalArea, float *p_fLoDbh, float *p_fHiDbh)
 Gets the basal area in a cut area for all species.
void GetBasalArea (clTreePopulation *p_oTreePop, int iSpecies, float *p_fTotalBasalArea, float *p_fLoDbh, float *p_fHiDbh)
 Gets the basal area in a cut area for a single species.
int CalculateBasalAreaDifference (float *p_fCurrentBasalArea)
 Determines the dbh to cut in each grid cell by calculating the difference between the target basal area and the actual current basal area.
void CreateMasterCutPackage (int iSpecies)
 This function will use the values extracted from the parameter file in order to create a package which will be inserted into the master cut events grid.
void EditCutEventsGrid ()
 This function will edit the cut events grid so that it holds ID and timestep values for the selection harvest created in the behaviour.
void GetHarvestGrids ()
 Obtains a pointer to the harvest grids and gets all the return codes/.
void ValidatePackages ()
 Makes sure that the data in the event harvest packages makes sense.

Protected Attributes

float * mp_fLowDBH
 the lower bound for each DBH size class
float * mp_fHighDBH
 the upper bound for each DBH size class
float * mp_fTargetBA
 to hold the target basal area for each size class, in m2/ha
float * mp_fLandscapeBasalArea
 holds the basal area for each size class for all species across the landscape
float * mp_fBasalArea
 holds the basal area of 1 species for each size class
float * mp_fTempTargetBA
 used to ensure that TargetBA does not get overwritten in the CalculateBasalAreaDifference function
float m_fPlotArea
 plot area, in hectares
float m_fTotalBasalArea [][NUM_SIZE_CLASSES]
 the array into which GetBasalArea will store the Basal area values for each size class
float m_fBasalAreaDifference [][NUM_SIZE_CLASSES]
 the array into which CalculateBasalAreaDifference will place the absolute basal area to remove from each size class
clPackagemp_oOldPackage
 for finding where to place a new package
clPackagemp_oNewPackage
 a newly created package in the grids
clTreePopulationmp_oPop
 Stashed pointer to tree population.
clGridBasemp_oMasterCutsGrid
 HARVEST MASTER CUTS.
clGridBasemp_oCutEventsGrid
 HARVEST CUT EVENTS "harvestcutevents" grid.
clGridBasemp_oResultsGrid
 RESULTS GRID.
clGridBasemp_oTimeSinceHarvestGrid
 TIME SINCE HARVEST.
int m_iInitialAge
 Initial age.
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 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
 dencut data member codes in "Harvest Results" grid.
short int ** mp_iBaCutCodes
 bacut data member codes in "Harvest Results" grid.
short int m_iNumAllowedCutRanges
 Number of cut ranges allowed.
short int m_iTime
 Data member return code for "time" data member of "timesinceharvest" grid.
short int m_iNumSpecies
 Total number of species.

Detailed Description

SelectionHarvest - Version 1.0.

In the case that the parameter file specifies a target basal area, rather than an absolute value or percentage value, this behaviour will calculate the basal area to be removed based as the difference betweent the target basal area the actual basal area (the amount present prior to harvest).(JM)

This behaviour will be able to set a target basal area for each of the 4 size classes. The behaviour will determine the target basal areas in one of two ways. First, if the user specifies their target basal area in all four size classes, the behaviour will calculate the difference, for each size class, between the actual basal area and the target basal area. That delta will be the basal area to remove from each size class. The second option is for the user to provide a 'Q-ratio' and a total target basal area for the 4 size classes combined. These values will be set in the parameter file. The combination of these two values is used to determine the target basal area in each size class based on the exponential distribution. So, regardless of the method, this behaviour will calculate an absolute amount of basal area to remove from each size class, based on the current basal area in each grid cell.(JM)

Prior to each harvest event, this behaviour will compute the actual basal in each grid cell prior to harvest. Then, based on the user input target BA values, or the Q-ratio method, the behaviour will determine how much basal area must be removed from each size class in order to meet the target basal area.(JM)

If by chance, the current basal area of the system in a size class is less than the target basal area, no trees will be harvested from that size class. Furthermore, the shortage will not be made up for by overharvesting another size class.(JM)

This behaviour will then create a set of packages for the harvest grids. Once the packages are created, the behaviour will insert them into the proper place in the harvest grids.(JM)

The namestring and parameter file call string for this behavior are both "SelectionHarvest". (LEM)

Copyright 2003 Charles D. Canham.


Member Enumeration Documentation

enum clSelectionHarvest::amtType

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.

enum clSelectionHarvest::cutType

Types of harvest cuts.

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

Enumerator:
partial  Partial cut.
gap  Gap cut.


Constructor & Destructor Documentation

clSelectionHarvest::clSelectionHarvest ( clSimManager p_oSimManager  ) 

Constructor.

Parameters:
p_oSimManager Sim Manager object.


Member Function Documentation

void clSelectionHarvest::Action (  )  [virtual]

Performs the selection cut setup for a timestep.

For a timestep, this function will call CalculateBasalAreaDifference() and TellHarvestToCutTrees() for each selection cut for this timestep.

Reimplemented from clBehaviorBase.

int clSelectionHarvest::CalculateBasalAreaDifference ( float *  p_fCurrentBasalArea  )  [protected]

Determines the dbh to cut in each grid cell by calculating the difference between the target basal area and the actual current basal area.

The difference is stored in an array whose pointer is passed to the function.(JM)

Parameters:
p_fCurrentBasalArea Pointer to array containing the basal area in each size class

void clSelectionHarvest::EditCutEventsGrid (  )  [protected]

This function will edit the cut events grid so that it holds ID and timestep values for the selection harvest created in the behaviour.

The function will traverse through every cell in the cut event grid and create a package containing the selection harvest ID and a timestep.

void clSelectionHarvest::GetBasalArea ( clTreePopulation p_oTreePop,
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_oTreePop Tree population
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.

void clSelectionHarvest::GetBasalArea ( clTreePopulation p_oTreePop,
float *  p_fTotalBasalArea,
float *  p_fLoDbh,
float *  p_fHiDbh 
) [protected]

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

This gets the basal area in each cut range and puts it in an array whose pointer was passed.

Parameters:
p_oTreePop Pointer to the tree population that will have the selection cut applied to it.
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.

void clSelectionHarvest::GetData ( xercesc::DOMDocument *  p_oDoc  )  [protected, virtual]

Reads all the harvest events from the parameter file.

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

Parameters:
p_oDoc DOM tree of parsed input file.

Implements clWorkerBase.

void clSelectionHarvest::ValidatePackages (  )  [protected]

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

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


Member Data Documentation

short int ** clSelectionHarvest::mp_iBaCutCodes [protected]

bacut data member codes in "Harvest Results" grid.

Array size is number cut ranges by number of species

short int ** clSelectionHarvest::mp_iDenCutCodes [protected]

dencut data member codes in "Harvest Results" grid.

Array size is number cut ranges by number of species

short int * clSelectionHarvest::mp_iRangeAmountCodes [protected]

rangeamtx data member codes in "harvestmastercuts" grid.

Array size is number cut ranges

short int * clSelectionHarvest::mp_iRangeMaxCodes [protected]

rangemaxx data member codes in "harvestmastercuts" grid.

Array size is number cut ranges

short int * clSelectionHarvest::mp_iRangeMinCodes [protected]

rangeminx data member codes in "harvestmastercuts" grid.

Array size is number cut ranges

short int * clSelectionHarvest::mp_iSpeciesCodes [protected]

species data member code in "harvestmastercuts" grid.

Array size is number species. Array index matches species number

clGridBase * clSelectionHarvest::mp_oCutEventsGrid [protected]

HARVEST CUT EVENTS "harvestcutevents" grid.

The grid called "harvestcutevents" will have a cell resolution that matches the tree population. This is where data about harvest cutting events is stored.

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 the "harvestmastercuts" 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

clGridBase* clSelectionHarvest::mp_oMasterCutsGrid [protected]

HARVEST MASTER CUTS.

The grid called "harvestmastercuts" will have a single cell. This is where the cut events are defined.

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 the "harvestcutevents" grid.

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:
Data member name Data 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"
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").
rangemin(x) float Range minimum 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 maximum dbh value. There are one of each of the following for m_iNumAllowedCutRanges, where x is the index, starting at 0.

clGridBase * clSelectionHarvest::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_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.

clGridBase * clSelectionHarvest::mp_oTimeSinceHarvestGrid [protected]

TIME SINCE HARVEST.

The grid called "timesinceharvest" will have a cell resolution that matches the harvest results grid. This is where the time since the last harvest is stored.

Data members - all for packages:

Data member nameData typeDescription
Time int time since last harvest


The documentation for this class was generated from the following file:
Generated on Wed Nov 29 08:42:24 2006 for SORTIE Core C++ Documentation by  doxygen 1.4.7