#include <NeighborhoodSeedPredation.h>
Public Member Functions | |
clNeighborhoodSeedPredation (clSimManager *p_oSimManager) | |
Constructor. | |
~clNeighborhoodSeedPredation () | |
Destructor. | |
void | Action () |
Performs neighborhood seed predation. | |
void | SetNameData (char *cNameString) |
Captures the behavior name passed from the parameter file. | |
Protected Member Functions | |
void | GetData (xercesc::DOMDocument *p_oDoc) |
Does setup. | |
void | DoStandalonePredation () |
Performs neighborhood seed predation for the standalone version of this behavior. | |
void | DoLinkedPredation () |
Performs neighborhood seed predation for the linked version of this behavior. | |
void | GetOfftakes (clTreePopulation *p_oPop, const float *p_fP0, float **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. | |
void | SetupGrids () |
Gets a pointer to the "Dispersed Seeds" grid, and sets up the output grid. | |
void | ReadParameterFileData (xercesc::DOMDocument *p_oDoc) |
Reads parameter file data. | |
Protected Attributes | |
clGridBase * | mp_oSeedGrid |
Pointer to the "Dispersed Seeds" grid created by disperse behaviors. | |
float * | mp_fNonMastingP0 |
Non-masting "p0" parameter. | |
float ** | mp_fNonMastingPn |
Non-masting pn. | |
float * | mp_fMastingP0 |
Masting "p0" parameter. | |
float * | mp_fMinNeighDBH |
Minimum neighbor DBH. | |
float ** | mp_fMastingPn |
Masting pn. | |
short int * | mp_iSeedGridCode |
Data member codes for seed grid for number of seeds. | |
short int * | mp_iStartSeedsCode |
Data member codes for the "startseeds_x" member of the output grid. | |
short int * | mp_iPropEatenCode |
Data member codes for the "propeaten_x" member of the output grid. | |
short int * | mp_iIndexes |
For accessing the other arrays. | |
bool * | mp_bCountInMast |
Whether or not a species counts when making masting decisions. | |
float | m_fPlotArea |
Area of the plot, in square meters. | |
float | m_fRadius |
Radius of neighborhoods. | |
float | m_fMastingThreshold |
Threshold of seeds per square meter for a masting timestep. | |
bool | m_bIsLinked |
Whether this is the linked (true) or standalone (false) version. | |
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. | |
Static Protected Attributes | |
static clGridBase * | mp_oOutputGrid |
Grid to output details of seed predation. |
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 "Neighborhood Seed Predation". If standalone, the parameter call string is also "Neighborhood Seed Predation". If linked, the parameter call string is "Linked Neighborhood Seed Predation".
Copyright 2007 Charles D. Canham.
clNeighborhoodSeedPredation::clNeighborhoodSeedPredation | ( | clSimManager * | p_oSimManager | ) |
Constructor.
p_oSimManager | Sim Manager object. |
clNeighborhoodSeedPredation::~clNeighborhoodSeedPredation | ( | ) |
Destructor.
Frees memory.
void clNeighborhoodSeedPredation::Action | ( | ) | [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.
void clNeighborhoodSeedPredation::SetNameData | ( | char * | cNameString | ) | [virtual] |
Captures the behavior name passed from the parameter file.
This is useful since this class can produce different kinds of behaviors.
cNameString | Behavior name from parameter file. |
Reimplemented from clBehaviorBase.
void clNeighborhoodSeedPredation::GetData | ( | xercesc::DOMDocument * | p_oDoc | ) | [protected, virtual] |
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.
void clNeighborhoodSeedPredation::DoStandalonePredation | ( | ) | [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.
void clNeighborhoodSeedPredation::DoLinkedPredation | ( | ) | [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.
void clNeighborhoodSeedPredation::GetOfftakes | ( | clTreePopulation * | p_oPop, | |
const float * | p_fP0, | |||
float ** | p_fPn, | |||
float * | p_fOfftake, | |||
const int & | iX, | |||
const int & | iY | |||
) | [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. |
void clNeighborhoodSeedPredation::SetupGrids | ( | ) | [protected] |
Gets a pointer to the "Dispersed Seeds" grid, and sets up the output grid.
modelErr | if the seed grid is not found |
void clNeighborhoodSeedPredation::ReadParameterFileData | ( | xercesc::DOMDocument * | p_oDoc | ) | [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 |
clGridBase* clNeighborhoodSeedPredation::mp_oSeedGrid [protected] |
Pointer to the "Dispersed Seeds" grid created by disperse behaviors.
clGridBase* clNeighborhoodSeedPredation::mp_oOutputGrid [static, protected] |
Grid to output details of seed predation.
The name of this grid is "Neighborhood Seed 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.
float* clNeighborhoodSeedPredation::mp_fNonMastingP0 [protected] |
Non-masting "p0" parameter.
Array size is number of species to which this behavior applies.
float** clNeighborhoodSeedPredation::mp_fNonMastingPn [protected] |
Non-masting pn.
Array size is number of behavior species by number of total species.
float* clNeighborhoodSeedPredation::mp_fMastingP0 [protected] |
Masting "p0" parameter.
Array size is number of species to which this behavior applies.
float* clNeighborhoodSeedPredation::mp_fMinNeighDBH [protected] |
Minimum neighbor DBH.
float** clNeighborhoodSeedPredation::mp_fMastingPn [protected] |
Masting pn.
Array size is number of behavior species by number of total species.
short int* clNeighborhoodSeedPredation::mp_iSeedGridCode [protected] |
Data member codes for seed grid for number of seeds.
Array size is number of species to which this behavior applies.
short int* clNeighborhoodSeedPredation::mp_iStartSeedsCode [protected] |
Data member codes for the "startseeds_x" member of the output grid.
Array size is total number of species.
short int* clNeighborhoodSeedPredation::mp_iPropEatenCode [protected] |
Data member codes for the "propeaten_x" member of the output grid.
Array size is total number of species.
short int* clNeighborhoodSeedPredation::mp_iIndexes [protected] |
For accessing the other arrays.
bool* clNeighborhoodSeedPredation::mp_bCountInMast [protected] |
Whether or not a species counts when making masting decisions.
Only necessary if m_bUseThresholdToDecideMast is true.
float clNeighborhoodSeedPredation::m_fPlotArea [protected] |
Area of the plot, in square meters.
float clNeighborhoodSeedPredation::m_fRadius [protected] |
Radius of neighborhoods.
float clNeighborhoodSeedPredation::m_fMastingThreshold [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.
bool clNeighborhoodSeedPredation::m_bIsLinked [protected] |
Whether this is the linked (true) or standalone (false) version.
bool clNeighborhoodSeedPredation::m_bUseThresholdToDecideMast [protected] |
Whether to use a seed density threshold (true) or ask the masting disperse behaviors (false) when deciding whether this is a masting timestep.