SORTIE Core C++ Documentation
|
Neighborhood Seed Predationon - version 1.1. More...
#include <NeighborhoodSeedPredation.h>
Public Member Functions | |
clNeighborhoodSeedPredation (clSimManager *p_oSimManager) | |
Constructor. More... | |
~clNeighborhoodSeedPredation () | |
Destructor. More... | |
void | Action () |
Performs neighborhood seed predation. More... | |
void | SetNameData (std::string sNameString) |
Captures the behavior name passed from the parameter file. 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... | |
Protected Member Functions | |
void | GetData (xercesc::DOMDocument *p_oDoc) |
Does setup. More... | |
void | DoStandalonePredation () |
Performs neighborhood seed predation for the standalone version of this behavior. More... | |
void | DoLinkedPredation () |
Performs neighborhood seed predation for the linked version of this behavior. More... | |
void | GetOfftakes (clTreePopulation *p_oPop, const double *p_fP0, double **p_fPn, float *p_fOfftake, const int &iX, const int &iY) |
Gets the offtake (Y) values for all behavior species for a given grid cell. More... | |
void | SetupGrids () |
Gets a pointer to the "Dispersed Seeds" grid, and sets up the output grid. More... | |
void | ReadParameterFileData (xercesc::DOMDocument *p_oDoc) |
Reads parameter file data. 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 | |
clGrid * | mp_oSeedGrid |
Pointer to the "Dispersed Seeds" grid created by disperse behaviors. More... | |
double * | mp_fNonMastingP0 |
Non-masting "p0" parameter. More... | |
double ** | mp_fNonMastingPn |
Non-masting pn. More... | |
double * | mp_fMastingP0 |
Masting "p0" parameter. More... | |
double * | mp_fMinNeighDBH |
Minimum neighbor DBH. More... | |
double ** | mp_fMastingPn |
Masting pn. More... | |
short int * | mp_iSeedGridCode |
Data member codes for seed grid for number of seeds. More... | |
short int * | mp_iStartSeedsCode |
Data member codes for the "startseeds_x" member of the output grid. More... | |
short int * | mp_iPropEatenCode |
Data member codes for the "propeaten_x" member of the output grid. More... | |
short int * | mp_iIndexes |
For accessing the other arrays. More... | |
bool * | mp_bCountInMast |
Whether or not a species counts when making masting decisions. More... | |
float | m_fPlotArea |
Area of the plot, in square meters. More... | |
double | m_fRadius |
Radius of neighborhoods. More... | |
double | m_fMastingThreshold |
Threshold of seeds per square meter for a masting timestep. More... | |
bool | m_bIsLinked |
Whether this is the linked (true) or standalone (false) version. More... | |
bool | m_bUseThresholdToDecideMast |
Whether to use a seed density threshold (true) or ask the masting disperse behaviors (false) when deciding whether this is a masting timestep. 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 clGrid * | mp_oOutputGrid |
Grid to output details of seed predation. More... | |
Neighborhood Seed Predationon - version 1.1.
This behavior reduces the number of seeds by simulating seed predation. Rate of offtake is a function of neighborhood composition.
This can be used in two forms. In the standalone form, masting is also used to determine offtake. In the linked form, the clFuncResponseSeedPredation class determines the offtake rate, and this class figures out where seeds get eaten. In this case, masting is ignored.
In the standalone version, there are two choices for assessing masting: in the first, masting is assessed by counting the seeds to which this behavior applies and which participate in masting (two different things - the latter is controlled by a boolean parameter ) and comparing it to a density per timestep threshold. Above the threshold is masting; below is not. The second choice is to ask the masting disperse behaviors if any species has masted; if any have, then it is a masting event. (If masting disperse behaviors are not used, then masting never occurs.) The only difference between masting and non-masting timesteps is the parameters used.
For both versions, the proportion of seed removed is calculated as:
In the standalone version, this is used directly as the amount of seed removed. In the linked version, it is used to distribute the offtake rate from the functional response seed predation behavior. Conceptually, the local offtake rate is adjusted by a correction factor, calculated by dividing the FR offtake Z by the mean off the local offtakes, so the plot-level offtake remains the same. Mathematically it is a little more complicated:
A fatal error is thrown if a disperse behavior is not also defined for the run, and additionally if this is linked and the clFuncResponseSeedPredation class is missing.
This class's namestring is "NeighborhoodSeedPredation". If standalone, the parameter call string is "NeighborhoodSeedPredation". If linked, the parameter call string is "LinkedNeighborhoodSeedPredation".
Copyright 2011 Charles D. Canham.
Edit history:
--------------—
October 20, 2011 - Wiped the slate clean for SORTIE 7.0 (LEM)
clNeighborhoodSeedPredation::clNeighborhoodSeedPredation | ( | clSimManager * | p_oSimManager | ) |
Constructor.
p_oSimManager | Sim Manager object. |
clNeighborhoodSeedPredation::~clNeighborhoodSeedPredation | ( | ) |
Destructor.
Frees memory.
|
virtual |
Performs neighborhood seed predation.
If the behavior is in linked mode, this calls DoLinkedPredation. If not, this calls DoStandalonePredation. Before the appropriate predation function is called, this copies the values from the "Dispersed Seeds" grid to the "startseeds_x" data members of the output grid; after the function is called, this calculates and posts the values of the "propeaten_x" data members.
Reimplemented from clBehaviorBase.
|
protected |
Performs neighborhood seed predation for the linked version of this behavior.
This calculates all offtakes, then adjusts them according to the offtake calculated by clFuncResponseSeedPredation. A random round is used to take care of fractional parts of seeds.
|
protected |
Performs neighborhood seed predation for the standalone version of this behavior.
First, for the whole plot, this assesses whether masting has occurred by comparing the density of seeds of species to which this behavior applies to the threshold. Then for each cell, the neighborhood relative BAs and the proportion to remove is calculated. A random round is used to take care of fractional parts of seeds. This also checks plot adult tree density; if it is zero, it is automatically not a masting time step.
|
protectedvirtual |
Does setup.
This reads in values from the parameter file, gets the pointer to the dispersed seeds grid, and sets up the output grid.
p_oDoc | DOM tree of parsed input file. |
modelErr | if this is linked and there is no functional response seed predation. |
Implements clWorkerBase.
|
protected |
Gets the offtake (Y) values for all behavior species for a given grid cell.
p_oPop | Tree population object. |
p_fP0 | p0 values to use, as an array sized m_iNumBehaviorSpecies. |
p_fPn | pn values to use, as an array sized m_iNumBehaviorSpecies by the total number of species. |
p_fOfftake | Place to put offtake values, as an array sized m_iNumBehaviorSpecies. |
iX | Seed grid X cell number. |
iY | Seed grid Y cell number. |
|
protected |
Reads parameter file data.
p_oDoc | DOM tree of parsed input file. |
modelErr | if any of the following are negative: neighborhood radius, min neighbor DBH, masting threshold |
|
virtual |
Captures the behavior name passed from the parameter file.
This is useful since this class can produce different kinds of behaviors.
sNameString | Behavior name from parameter file. |
Reimplemented from clBehaviorBase.
|
protected |
Gets a pointer to the "Dispersed Seeds" grid, and sets up the output grid.
modelErr | if the seed grid is not found |
|
protected |
Whether this is the linked (true) or standalone (false) version.
|
protected |
Whether to use a seed density threshold (true) or ask the masting disperse behaviors (false) when deciding whether this is a masting timestep.
|
protected |
Threshold of seeds per square meter for a masting timestep.
This comes as an annual amount in the parameter file and is converted to a timestep amount. Only necessary if m_bUseThresholdToDecideMast is true.
|
protected |
Area of the plot, in square meters.
|
protected |
Radius of neighborhoods.
|
protected |
Whether or not a species counts when making masting decisions.
Only necessary if m_bUseThresholdToDecideMast is true.
|
protected |
Masting "p0" parameter.
Array size is number of species to which this behavior applies.
|
protected |
Masting pn.
Array size is number of behavior species by number of total species.
|
protected |
Minimum neighbor DBH.
|
protected |
Non-masting "p0" parameter.
Array size is number of species to which this behavior applies.
|
protected |
Non-masting pn.
Array size is number of behavior species by number of total species.
|
protected |
For accessing the other arrays.
|
protected |
Data member codes for the "propeaten_x" member of the output grid.
Array size is total number of species.
|
protected |
Data member codes for seed grid for number of seeds.
Array size is number of species to which this behavior applies.
|
protected |
Data member codes for the "startseeds_x" member of the output grid.
Array size is total number of species.
|
staticprotected |
Grid to output details of seed predation.
The name of this grid Seed Predation Predation". Its cell size matches that of the "Dispersed Seeds" grid. For each species there are two data members: "startseeds_x" and "propeaten_x" for the pre-predation seed numbers and proportion eaten, respectively, where X is the species number. Both of the data members are float. Initial conditions maps of this grid are not respected.
|
protected |
Pointer to the "Dispersed Seeds" grid created by disperse behaviors.