SORTIE Core C++ Documentation
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
clDisperseOrg Class Reference

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

clGridmp_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...
 
pdf 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...
 

Detailed Description

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.

Author
Lora E. Murphy


Edit history:
--------------—
April 28, 2004 - Submitted as beta (LEM)
July 8, 2009 - Allowed fractional seeds (LEM)

Constructor & Destructor Documentation

◆ ~clDisperseOrg()

clDisperseOrg::~clDisperseOrg ( )

Destructor.

◆ clDisperseOrg()

clDisperseOrg::clDisperseOrg ( clDisperseBase p_oHookedShell)

Constructor.

Parameters
p_oHookedShellA clDisperseBase object which then becomes the hooked disperse shell object.

Member Function Documentation

◆ AdjustSeedNumbers()

void clDisperseOrg::AdjustSeedNumbers ( )
protected

Adjusts seed numbers depending on the type of seedling distribution, stochastic or deterministic.

◆ DeterministicAdjust()

float clDisperseOrg::DeterministicAdjust ( float  fNumber,
int  iSpecies 
)
protected

Performs a deterministic adjustment of seed number.

Parameters
fNumberNumber of seeds to adjust.
iSpeciesSpecies of seed.
Returns
Number of adjusted seeds.

◆ DoDisperse()

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.

◆ DoSetup()

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.

Parameters
p_oSimManagerPointer to the simulation manager. Since this object is not descended from clWorkerBase, it does not already have its own pointer.
p_oDocPointer to parsed parameter file.
Exceptions
modelErrif either object passed is NULL.

◆ GetDisperseObjects()

void clDisperseOrg::GetDisperseObjects ( clSimManager p_oSimManager)
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.

Parameters
p_oSimManagerSim Manager object.

◆ GetParameterFileData()

void clDisperseOrg::GetParameterFileData ( clSimManager p_oSimManager,
xercesc::DOMDocument *  p_oDoc 
)
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.

Parameters
p_oSimManagerSim Manager object.
p_oDocDOM tree from parsed parameter file.
Exceptions
modelErrif the seed distribution method value from the parameter file is invalid.

◆ GetSeedGridObject()

void clDisperseOrg::GetSeedGridObject ( clSimManager p_oSimManager)
protected

Gets the seed grid and populates the mp_iCodes array.

Parameters
p_oSimManagerSim Manager object.
Exceptions
modelErrif the grid is not present or the codes are invalid.

◆ LognormalAdjust()

float clDisperseOrg::LognormalAdjust ( float  fNumber,
int  iSpecies 
)
protected

Performs a stochastic adjustment of seed number according to a lognormal distribution.

Parameters
fNumberNumber of seeds to adjust.
iSpeciesSpecies of seed.
Returns
Number of adjusted seeds.

◆ NegativeBinomialAdjust()

float clDisperseOrg::NegativeBinomialAdjust ( float  fNumber,
int  iSpecies 
)
protected

Performs a stochastic adjustment of seed number according to a negative binomial distribution.

Parameters
fNumberNumber of seeds to adjust.
iSpeciesSpecies of seed.
Returns
Number of adjusted seeds.

◆ NormalAdjust()

float clDisperseOrg::NormalAdjust ( float  fNumber,
int  iSpecies 
)
protected

Performs a stochastic adjustment of seed number according to a normal distribution.

Parameters
fNumberNumber of seeds to adjust.
iSpeciesSpecies of seed.
Returns
Number of adjusted seeds.

◆ PoissonAdjust()

float clDisperseOrg::PoissonAdjust ( float  fNumber,
int  iSpecies 
)
protected

Performs a stochastic adjustment of seed number according to a Poisson distribution.

Parameters
fNumberNumber of seeds to adjust.
iSpeciesSpecies of seed.
Returns
Number of adjusted seeds.

◆ SetFunctionPointer()

void clDisperseOrg::SetFunctionPointer ( )
protected

Sets the Adjust function pointer according to the value of m_iSeedDistributionMethod.

Member Data Documentation

◆ Adjust

float(clDisperseOrg::* clDisperseOrg::Adjust) (float fNumber, int iSpecies)
protected

Function pointer for the appropriate Adjust function.

◆ m_iNumDispObjects

int clDisperseOrg::m_iNumDispObjects
protected

Number of disperse objects in mp_oDispObjects.

◆ m_iSeedDistributionMethod

pdf clDisperseOrg::m_iSeedDistributionMethod
protected

What seed adjustment type applies to this run.

◆ m_iTotalSpecies

int clDisperseOrg::m_iTotalSpecies
protected

Number of total species for the run.

◆ mp_fRandParameter

double* clDisperseOrg::mp_fRandParameter
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.

◆ mp_iCodes

short int* clDisperseOrg::mp_iCodes
protected

Number of seeds code in the seed grid for each species.

◆ mp_oDispObjects

clDisperseBase** clDisperseOrg::mp_oDispObjects
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.

◆ mp_oSeedsGrid

clGrid* clDisperseOrg::mp_oSeedsGrid
protected

Dispersed Seeds grid.

This grid is created by the clDisperseBase class.


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