clSpatialDispersal Class Reference

Spatial dispersal - Version 1.0. More...

#include <SpatialDisperse.h>

Inheritance diagram for clSpatialDispersal:

clDisperseBase clBehaviorBase clWorkerBase

List of all members.

Public Member Functions

 clSpatialDispersal (clSimManager *p_oSimManager)
 Constructor.
 ~clSpatialDispersal ()
 Destructor.
void SetNameData (char *cNameString)
 Captures the behavior name passed from the parameter file.

Protected Member Functions

void DoShellSetup (xercesc::DOMDocument *p_oDoc)
 Reads in values from the parameter file.
float CalculateFunctionValue (float fDistance, int iSpecies, function iFunction, cover iCover)
 Calculates the function value at a particular point.
void DeclareArrays ()
 Declares the arrays.
void GapDisperse (clTree *p_oTree, clTreePopulation *p_oPop, clPlot *p_oPlot, float fDbh)
 Performs dispersal of seeds for one tree according to gap disperse.
void NonGapDisperse (clTree *p_oTree, clTreePopulation *p_oPop, clPlot *p_oPlot, float fDbh)
 Performs dispersal of seeds for one tree according to non-gap disperse.
void GetParameterFileData (xercesc::DOMDocument *p_oDoc)
 Extracts needed parameter file data.
void CalcFecAndFunctions ()
 Calculates fecundity and the probability distribution functions.
void PopulateUsedTable (clTreePopulation *p_oPop)
 Declares and populates the mp_bIsUsed array.
void CalculateGapStatus (clTreePopulation *p_oPop)
 Updates the gap status of the seed grid, if this is "gap disperse".
void CalculateProbabilityDistribution (float *p_fProbArray, int iMaxDistance, int iSpecies, function iFunction, cover iCover)
 Calculates the normalized probability distribution for a function for one species.
void AddSeeds ()
 Performs dispersal.
float GetNumberOfSeeds (float fDbh, short int iSp, int iCover, int iFunc)
 Gets the number of seeds to disperse for a tree, corrected for the number of years per timestep.

Protected Attributes

float *** mp_fDispersalX0
 For testing.
float *** mp_fThetaXb
 Theta (weibull) or Xb (lognormal) parameter.
float *** mp_fStr
 STR parameter.
float *** mp_fBeta
 Beta parameter.
float *** mp_fFecundity
 Fecundity for 30 cm dbh tree for each species.
float * mp_fStumpBeta
 Beta parameter for stumps.
float * mp_fStumpStr
 STR parameter for stumps.
float * mp_fStumpFecundity
 Fecundity for stumps.
float **** mp_fCumProb
 Cumulative probability array for gap and canopy cover.
float m_fNumYearsPerTimestep
 Number of years per timestep.
int m_iMaxDistance
 Maximum distance, in meters, a seed can disperse.
int m_iMaxGapDensity
 Maximum number of reproductively mature trees allowed in a grid cell for the grid cell to retain gap status.
short int * mp_iIndexes
 This will speed access to the other arrays by storing each species' array index so the other arrays only have to be as big as the number of unique species for this behavior.
short int m_iNumFunctions
 How many functions there are - 2.
short int m_iNumCovers
 How many cover types there are - 2.
function ** mp_iWhatFunction
 Which function is used - array indexes are cover by species.
char * m_cQuery
 Query to perform to search for trees.
bool ** mp_bIsUsed
 Whether this behavior is used by a species/type combo.
bool m_bIsGap
 True if this is gap disperse; false if not.
bool m_bStumps
 True if this behavior applies to stumps.


Detailed Description

Spatial dispersal - Version 1.0.

This class creates and disperses seeds according to the spatially-explicit model. Parent trees of greater than the minimum reproductive DBH have the number of seeds calculated. The seeds are dispersed around the plot according to either the Weibull or Lognormal probability distribution functions.

Forest cover can be taken into account during seed distribution (gap) or ignored (non-gap).

This behavior can also be used for suckering of stumps. If this is desired, apply this to the species which sucker, tree type stump. If this is gap disperse, stumps reproduce pretending they're always in gap conditions. They use the probability distribution function of their species' gap function. If this is non-gap disperse, they reproduce like other adults of their species.

The "seeds" are actually tallies by species in a grid. This behavior does not produce any seedlings. A separate recruitment behavior must "germinate" the seeds into seedlings according to its own rules.

To call this as gap disperse in the parameter file, use the string "gap disperse". To call this as non-gap disperse, use the string "non-gap disperse". There is a place in the parameters for indicating which probability distribution function should be used under each cover type. The namestring for this class is "spatialdisperse".

Copyright 2003 Charles D. Canham.

Author:
Lora E. Murphy

Edit history:
-----------------
April 28, 2004 - Submitted as beta (LEM)
January 5, 2005 - Added more checking to reduce the number of possible pow overflows (LEM)

Constructor & Destructor Documentation

clSpatialDispersal::clSpatialDispersal ( clSimManager p_oSimManager  ) 

Constructor.

Parameters:
p_oSimManager Sim Manager object.

clSpatialDispersal::~clSpatialDispersal (  ) 

Destructor.


Member Function Documentation

void clSpatialDispersal::SetNameData ( char *  cNameString  )  [virtual]

Captures the behavior name passed from the parameter file.

This is useful since this class can produce a few different kinds of behaviors.

Parameters:
cNameString Behavior name from parameter file.

Reimplemented from clBehaviorBase.

void clSpatialDispersal::DoShellSetup ( xercesc::DOMDocument *  p_oDoc  )  [protected, virtual]

Reads in values from the parameter file.

Parameters:
p_oDoc DOM tree of parsed input file.

Implements clDisperseBase.

float clSpatialDispersal::CalculateFunctionValue ( float  fDistance,
int  iSpecies,
function  iFunction,
cover  iCover 
) [protected]

Calculates the function value at a particular point.

Parameters:
fDistance Distance at which to calculate function value.
iSpecies Species for which to calculate function value.
iFunction Which function to calculate (weibull or lognormal).
iCover Cover for which to calculate function value.
Returns:
Value of function.

void clSpatialDispersal::DeclareArrays (  )  [protected]

Declares the arrays.

void clSpatialDispersal::GapDisperse ( clTree p_oTree,
clTreePopulation p_oPop,
clPlot p_oPlot,
float  fDbh 
) [protected]

Performs dispersal of seeds for one tree according to gap disperse.

The number of seeds for a tree is calculated with the higher of gap or canopy STR.

Each seed is given a random azimuth angle. It is then given a random distance that conforms to the probability distribution function of the current forest cover of the parent. (This distance is gotten by comparing a random value to successive values in the appropriate cumulative probability array until the first array bucket that has a greater value than the random number.) Once the seed has an azimuth and a distance, the function determines which grid cell it should drop in.

Once the seed has a target grid cell, that cell's cover is checked. Then the seed's survival is evaluated. If the seed is in the cover type with the higher STR, it automatically survives. Otherwise, a random number is compared to the ratio of the lower STR to the higher STR to determine if it survives.

If the seed survives, it may need to be repositioned. If both parent and seed are under closed canopy, the seed is dropped where it is. If the parent is in gap and seedling is in canopy, a new distance is calculated as though the parent was also in canopy. The shortest of the two distances is used to determine where the seed lands. If the seed lands in a gap cell, the function "walks out" the line of the seed's path from parent to target landing cell, checking each intermediate grid cell's cover along the way. If any of the grid cells in the line are under canopy cover, the seed drops in the first canopy cell it reaches.

Parameters:
p_oTree Tree for which to perform dispersal.
fDbh DBH of the tree, in cm.
p_oPlot Plot object
p_oPop Tree Population object

void clSpatialDispersal::NonGapDisperse ( clTree p_oTree,
clTreePopulation p_oPop,
clPlot p_oPlot,
float  fDbh 
) [protected]

Performs dispersal of seeds for one tree according to non-gap disperse.

The number of seeds is calculated. Each seed is given a random azimuth direction from the parent. Then each seed is given a random distance from the parent that conforms to the chosen probability distribution function. This is done by comparing a random value to successive values in the cumulative probability array until the first array bucket that has a greater value than the random number. Once the seed has an azimuth direction and a distance, it is added to the species total in the appropriate grid cell.

Parameters:
p_oTree Tree for which to perform dispersal.
fDbh DBH of the tree, in cm.
p_oPlot Plot object
p_oPop Tree Population object

void clSpatialDispersal::GetParameterFileData ( xercesc::DOMDocument *  p_oDoc  )  [protected]

Extracts needed parameter file data.

This function takes into account whether or not this is gap.

The minimum reproductive DBH array is pre-loaded with the minimum adult DBH values, so if there is a species that is not used by this behavior, CalculateGapStatus() still has something to use.

Parameters:
p_oDoc Parsed parameter file document.
Exceptions:
stcErr if:
  • A weibull theta value is not less than 50 (to prevent pow overflows)
  • The function codes are not valid enums
  • A beta value is greater than 25 (to prevent pow overflows)

void clSpatialDispersal::CalcFecAndFunctions (  )  [protected]

Calculates fecundity and the probability distribution functions.

Fecundity is calculated as

fec = STR/30beta

void clSpatialDispersal::PopulateUsedTable ( clTreePopulation p_oPop  )  [protected]

Declares and populates the mp_bIsUsed array.

Parameters:
p_oPop Tree Population object

void clSpatialDispersal::CalculateGapStatus ( clTreePopulation p_oPop  )  [protected]

Updates the gap status of the seed grid, if this is "gap disperse".

It counts all parent trees present in each grid cell (those that have a DBH of at least the minimum reproductive age for their species). The counts are placed in each grid cell and when the count is higher than the cutoff for gap status, the grid is under canopy; otherwise, it is under gap.

This counts all species, not just the ones to which this behavior applies. However, for those species that do not use this behavior, their minimum adult DBH will be used as the cutoff for counting, even if they have a minimum reproductive DBH listed. That's because I haven't bothered with the logistics of figuring out if a species uses another disperse behavior.

Parameters:
p_oPop Tree population object.

void clSpatialDispersal::CalculateProbabilityDistribution ( float *  p_fProbArray,
int  iMaxDistance,
int  iSpecies,
function  iFunction,
cover  iCover 
) [protected]

Calculates the normalized probability distribution for a function for one species.

Parameters:
p_fProbArray The array into which to put the normalized values.
iMaxDistance The maximum distance out to which to calculate the function - which must equal the size of p_fProbArray.
iSpecies Species for which we're calculating.
iFunction Function flag.
iCover Cover flag.

void clSpatialDispersal::AddSeeds (  )  [protected, virtual]

Performs dispersal.

This searches for all types to which it is applied. For trees which are of the appropriate species/type combo, either GapDisperse() or NonGapDisperse() is called.

Implements clDisperseBase.

float clSpatialDispersal::GetNumberOfSeeds ( float  fDbh,
short int  iSp,
int  iCover,
int  iFunc 
) [protected]

Gets the number of seeds to disperse for a tree, corrected for the number of years per timestep.

The equation is seeds = fecundity * DBHβ, where all parameters are appropriate for forest cover if this is gap disperse.

Parameters:
fDbh DBH of the tree, in cm
iSp Tree species number
iCover Forest cover
iFunc Disperse function used
Returns:
Number of seeds.


Member Data Documentation

For testing.

Dispersal (weibull) or X0 (lognormal) parameter. The array is 3D - first index is which disperse function is used. The second index is cover. The third index is species. This value comes from the parameter file.

float*** clSpatialDispersal::mp_fThetaXb [protected]

Theta (weibull) or Xb (lognormal) parameter.

If this is theta, this value must be less than 50 to protect against pow overflows. The array is 3D - first index is which disperse function is used. The second index is cover. The third index is species. This value comes from the parameter file.

float*** clSpatialDispersal::mp_fStr [protected]

STR parameter.

The array is 3D - first index is which disperse function is used. The second index is cover. The third index is species. This value comes from the parameter file.

float*** clSpatialDispersal::mp_fBeta [protected]

Beta parameter.

The array is 3D - first index is which disperse function is used. The second index is cover. The third index is species. This value comes from the parameter file.

float*** clSpatialDispersal::mp_fFecundity [protected]

Fecundity for 30 cm dbh tree for each species.

The array is 3D - first index is which disperse function is used. The second index is cover. The third index is species.

Beta parameter for stumps.

This matches the beta parameter for live trees for this species.

STR parameter for stumps.

This matches the STR parameter for live trees for this species.

Fecundity for stumps.

float**** clSpatialDispersal::mp_fCumProb [protected]

Cumulative probability array for gap and canopy cover.

Array size is # functions by # covers by # species by max distance.

Number of years per timestep.

Maximum distance, in meters, a seed can disperse.

Maximum number of reproductively mature trees allowed in a grid cell for the grid cell to retain gap status.

short int* clSpatialDispersal::mp_iIndexes [protected]

This will speed access to the other arrays by storing each species' array index so the other arrays only have to be as big as the number of unique species for this behavior.

short int clSpatialDispersal::m_iNumFunctions [protected]

How many functions there are - 2.

short int clSpatialDispersal::m_iNumCovers [protected]

How many cover types there are - 2.

Which function is used - array indexes are cover by species.

char* clSpatialDispersal::m_cQuery [protected]

Query to perform to search for trees.

bool** clSpatialDispersal::mp_bIsUsed [protected]

Whether this behavior is used by a species/type combo.

First array index is species, second is type.

bool clSpatialDispersal::m_bIsGap [protected]

True if this is gap disperse; false if not.

True if this behavior applies to stumps.


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

Generated on Tue Apr 19 13:56:17 2011 for SORTIE Core C++ Documentation by  doxygen 1.5.6