SORTIE Core C++ Documentation
|
Disperse org - Version 1.0. More...
#include <DisperseOrg.h>
Public Member Functions | |
~clDisperseOrg () | |
Destructor. More... | |
clDisperseOrg (clDisperseBase *p_oHookedShell) | |
Constructor. More... | |
void | DoDisperse () |
Performs dispersal. More... | |
void | DoSetup (clSimManager *p_oSimManager, xercesc::DOMDocument *p_oDoc) |
Does the setup for this object. More... | |
Protected Member Functions | |
void | GetDisperseObjects (clSimManager *p_oSimManager) |
Declares and populates the mp_oDispObjects array. More... | |
void | GetParameterFileData (clSimManager *p_oSimManager, xercesc::DOMDocument *p_oDoc) |
Reads values out of the parameter file. More... | |
void | GetSeedGridObject (clSimManager *p_oSimManager) |
Gets the seed grid and populates the mp_iCodes array. More... | |
void | AdjustSeedNumbers () |
Adjusts seed numbers depending on the type of seedling distribution, stochastic or deterministic. More... | |
float | DeterministicAdjust (float fNumber, int iSpecies) |
Performs a deterministic adjustment of seed number. More... | |
float | NormalAdjust (float fNumber, int iSpecies) |
Performs a stochastic adjustment of seed number according to a normal distribution. More... | |
float | LognormalAdjust (float fNumber, int iSpecies) |
Performs a stochastic adjustment of seed number according to a lognormal distribution. More... | |
float | PoissonAdjust (float fNumber, int iSpecies) |
Performs a stochastic adjustment of seed number according to a Poisson distribution. More... | |
float | NegativeBinomialAdjust (float fNumber, int iSpecies) |
Performs a stochastic adjustment of seed number according to a negative binomial distribution. More... | |
void | SetFunctionPointer () |
Sets the Adjust function pointer according to the value of m_iSeedDistributionMethod. More... | |
Protected Attributes | |
clGrid * | mp_oSeedsGrid |
Dispersed Seeds grid. More... | |
clDisperseBase ** | mp_oDispObjects |
List of all disperse objects - those with "disperse" somewhere in their namestrings. More... | |
double * | mp_fRandParameter |
Standard deviation if normal or lognormal distribution is desired, or clumping parameter if lognormal. More... | |
short int * | mp_iCodes |
Number of seeds code in the seed grid for each species. More... | |
int | m_iNumDispObjects |
Number of disperse objects in mp_oDispObjects. More... | |
int | m_iTotalSpecies |
Number of total species for the run. More... | |
m_iSeedDistributionMethod | |
What seed adjustment type applies to this run. More... | |
float(clDisperseOrg::* | Adjust )(float fNumber, int iSpecies) |
Function pointer for the appropriate Adjust function. More... | |
Disperse org - Version 1.0.
This class coordinates a common task for all dispersal functions: the determination of the correct number of seeds per grid cell of each species. The number of seeds in a cell can be either deterministic, meaning that the number of seeds that is calculated by each disperse object is the number that ends up in the cell, or stochastic, meaning the calculated number of seeds is used to get a random value from a particular probability distribution function.
Disperse objects organized by this function should add the number of seeds to each grid cell that they calculate, even if they are not integers. If the number of seeds is deterministic, this class uses a RandomRound() for each species to make sure the final number of seeds is an integer. If the number of seeds is stochastic, the number of seeds for each species is used as the mean for a random draw on one of the following probability distribution functions: Poisson, normal, lognormal, or negative binomial.
This class hooks into a disperse shell object and is triggered by that object when the shell is triggered by the behavior manager. This class calls the "Action" functions of all disperse objects in its care, then adjusts the number of seeds accordingly. All behaviors with "disperse" in their namestrings will be brought under the organization of this object.
Copyright 2003 Charles D. Canham.
Edit history:
--------------—
April 28, 2004 - Submitted as beta (LEM)
July 8, 2009 - Allowed fractional seeds (LEM)
clDisperseOrg::~clDisperseOrg | ( | ) |
Destructor.
clDisperseOrg::clDisperseOrg | ( | clDisperseBase * | p_oHookedShell | ) |
Constructor.
p_oHookedShell | A clDisperseBase object which then becomes the hooked disperse shell object. |
|
protected |
Adjusts seed numbers depending on the type of seedling distribution, stochastic or deterministic.
|
protected |
Performs a deterministic adjustment of seed number.
fNumber | Number of seeds to adjust. |
iSpecies | Species of seed. |
void clDisperseOrg::DoDisperse | ( | ) |
Performs dispersal.
Each object in mp_oDispObjects gets its AddSeeds() function called. Then the final seed tally is adjusted by calling AdjustSeedNumbers(). This should be called each timestep by the hooked shell's Action() function.
void clDisperseOrg::DoSetup | ( | clSimManager * | p_oSimManager, |
xercesc::DOMDocument * | p_oDoc | ||
) |
Does the setup for this object.
This function calls GetDisperseObjects() and GetParameterFileData().
DoSetup() is called by the hooked shell's GetData() function.
p_oSimManager | Pointer to the simulation manager. Since this object is not descended from clWorkerBase, it does not already have its own pointer. |
p_oDoc | Pointer to parsed parameter file. |
modelErr | if either object passed is NULL. |
|
protected |
Declares and populates the mp_oDispObjects array.
It does this by going through the behaviors and looking for the ones with "disperse" in their names.
p_oSimManager | Sim Manager object. |
|
protected |
Reads values out of the parameter file.
This gets whether the seedling distribution is stochastic or deterministic, and if stochastic, the type of prbability distribution function and any additional values needed by that function.
p_oSimManager | Sim Manager object. |
p_oDoc | DOM tree from parsed parameter file. |
modelErr | if the seed distribution method value from the parameter file is invalid. |
|
protected |
Gets the seed grid and populates the mp_iCodes array.
p_oSimManager | Sim Manager object. |
modelErr | if the grid is not present or the codes are invalid. |
|
protected |
Performs a stochastic adjustment of seed number according to a lognormal distribution.
fNumber | Number of seeds to adjust. |
iSpecies | Species of seed. |
|
protected |
Performs a stochastic adjustment of seed number according to a negative binomial distribution.
fNumber | Number of seeds to adjust. |
iSpecies | Species of seed. |
|
protected |
Performs a stochastic adjustment of seed number according to a normal distribution.
fNumber | Number of seeds to adjust. |
iSpecies | Species of seed. |
|
protected |
Performs a stochastic adjustment of seed number according to a Poisson distribution.
fNumber | Number of seeds to adjust. |
iSpecies | Species of seed. |
|
protected |
Sets the Adjust function pointer according to the value of m_iSeedDistributionMethod.
|
protected |
Function pointer for the appropriate Adjust function.
|
protected |
Number of disperse objects in mp_oDispObjects.
|
protected |
What seed adjustment type applies to this run.
|
protected |
Number of total species for the run.
|
protected |
Standard deviation if normal or lognormal distribution is desired, or clumping parameter if lognormal.
One for each species. Those that don't use disperse won't have a value filled in.
|
protected |
Number of seeds code in the seed grid for each species.
|
protected |
List of all disperse objects - those with "disperse" somewhere in their namestrings.
These will be in the same order that the behavior manager has them.
|
protected |
Dispersed Seeds grid.
This grid is created by the clDisperseBase class.