SORTIE Core C++ Documentation
|
Establishment with Microtopography - Version 1.0. More...
#include <MicroEstablishment.h>
Public Types | |
enum | substrateType { mound_scarsoil, mound_tipup, mound_freshlogs, mound_decayedlogs, mound_fflitter, mound_ffmoss, ground_scarsoil, ground_tipup, ground_freshlogs, ground_decayedlogs, ground_fflitter, ground_ffmoss, number_substrates } |
List of substrate types - be extremely careful when changing these! More... | |
Public Member Functions | |
clMicroEstablishment (clSimManager *p_oSimManager) | |
Constructor. More... | |
~clMicroEstablishment () | |
Destructor. More... | |
void | GetData (xercesc::DOMDocument *p_oDoc) |
Performs setup. More... | |
void | Action () |
Performs establishment. More... | |
void | TimestepCleanup () |
Zeroes out the seed grid. More... | |
void | GetSubstrateProportions (float *p_fSubstrate, const float &fFromX, const float &fFromY, const float &fToX, const float &fToY) |
Produces an array of substrate proportions. More... | |
void | GetFreshLogProportions (float *p_fLogs, const float &fFromX, const float &fFromY, const float &fToX, const float &fToY) |
Produces an array of cumulative fresh log proportions added for m_iMaxRespiteTimesteps timesteps. More... | |
void | SetMoundZAndRespite (clTree *p_oSeedling) |
Sets the rooting height of a seedling in mm if it has landed on a mound substrate that is not fresh logs. More... | |
void | SetGroundZAndRespite (clTree *p_oSeedling) |
Sets the rooting height of a seedling in mm if it has landed on a ground substrate that is not fresh logs. 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 void | SetNameData (std::string sNameString) |
Sets the string for the parameter file 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 | EndOfRunCleanup () |
Performs any necessary cleanup operations at the end of a run. More... | |
Protected Member Functions | |
void | GetParameterFileData (xercesc::DOMDocument *p_oDoc) |
Gets parameter file data. More... | |
void | SetupGrids () |
Populates required grid pointers. More... | |
void | GetTreeDataMemberCodes () |
Declares and populates the values in the mp_iCounterCodes and mp_iZCodes arrays, for the "lf_count" and "z" data members of seedlings, respectively. More... | |
void | SetFreshLogZAndRespite (clTree *p_oSeedling, float *p_fFreshLogProportions) |
Sets the rooting height of a tree in mm and a fern respite counter in years, if a seedling has landed on fresh logs. 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_oSubstrateGrid |
Pointer to "Substrate" grid, created by clSubstrate. More... | |
clGrid * | mp_oSeedGrid |
Pointer to the "Dispersed Seeds" grid created by disperse behaviors. More... | |
short int * | mp_iSeedGridCode |
Data member codes for seed grid for number of seeds. More... | |
short int * | mp_iCounterCodes |
Holds data member codes for "lf_count" for seedlings - array size is # behavior species. More... | |
short int * | mp_iZCodes |
Holds data member codes for "z" for seedlings - array size is # behavior species. More... | |
short int * | mp_iIndexes |
Speeds access to arrays. More... | |
short int * | mp_iSubstrateCodes |
Array of data member codes for the "Substrate" grid. More... | |
double | m_fMoundProportion |
Proportion of the plot that is mound. More... | |
double | m_fMoundHeightMean |
Mean mound height. More... | |
double | m_fMoundStandardDeviation |
Mound height standard deviation. More... | |
double | m_fFreshLogHeightMean |
Fresh log substrate mean height. More... | |
double | m_fFreshLogStandardDeviation |
Fresh log height standard deviation. More... | |
double | m_fFreshLogA |
Fresh log alpha decay parameter; from substrate parameters. More... | |
double | m_fFreshLogB |
Fresh log alpha decay parameter; from substrate parameters. More... | |
int | m_iMaxRespiteYears |
Maximum number of years of fern respite - from parameter file. More... | |
int | m_iMaxRespiteTimesteps |
Maximum number of timesteps of fern respite - calculated from m_iMaxRespiteYears. More... | |
short int | m_iCohFreshLogCode |
Data member code - package float - dec_flog. More... | |
short int | m_iCohAgeCode |
Data member code - package int - age. 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... | |
Friends | |
class | clTestMicroEstablishment |
My unit tester - exists in the testing application. More... | |
Establishment with Microtopography - Version 1.0.
This behavior germinates seeds cast by dispersal into seedlings. In addition, seeds are given a height above the ground due to microtopography.
All seeds are germinated into seedlings. A seed's substrate determines its rooting height. In order to seeds to substrates, the number of seeds is evenly divided as much as possible among the different substrate types. The clSubstrate class divides each grid cell of the "Substrate" grid into six substrate types; this further divides each substrate type in two, for mound and ground. Mound and ground are in fixed relative proportion to each other.
The definition of seedling rooting height comes from the clLightFilter class. Since this class makes no sense without that, that behavior is required to be in the run (as marked by the presence of the tree data members "lf_count" and "z").
Ground substrates (except fresh log) give a seed a rooting height of 0. Fresh log and mound substrates give rooting heights that are randomly drawn on normal distributions, the shape of which are controlled by means and standard deviations provided by the user.
If the seed lands on a log substrate, it also gets a respite from fern shading. The number of years of respite is set in the "lf_count" data member. The number of years is determined by the age of the log substrate on which the seedling landed (which is determined by dividing the fresh logs pool up by age and doing a random draw to determine which it is), and that age is subtracted from the maximum respite time.
Requirements for using an object of this class in a run:
The namestring and parameter file call string for this class are both "MicroEstablishment". Apply this behavior to the desired species; use any type, since type will be ignored.
Copyright 2003 Charles D. Canham.
Edit history:
--------------—
October 20, 2011 - Wiped the slate clean for SORTIE 7.0 (LEM)
List of substrate types - be extremely careful when changing these!
clMicroEstablishment::clMicroEstablishment | ( | clSimManager * | p_oSimManager | ) |
Constructor.
p_oSimManager | Sim Manager object. |
clMicroEstablishment::~clMicroEstablishment | ( | ) |
Destructor.
|
virtual |
Performs establishment.
Steps for each grid cell in Dispersed Seeds:
Reimplemented from clBehaviorBase.
|
virtual |
Performs setup.
Calls:
p_oDoc | DOM tree of parsed input file. |
Implements clWorkerBase.
void clMicroEstablishment::GetFreshLogProportions | ( | float * | p_fLogs, |
const float & | fFromX, | ||
const float & | fFromY, | ||
const float & | fToX, | ||
const float & | fToY | ||
) |
Produces an array of cumulative fresh log proportions added for m_iMaxRespiteTimesteps timesteps.
First, the amount of fresh log substrate for each timestep is placed in the appropriate array bucket. This value comes from substrate cohort packages. We have to decay the amount of fresh log by the age of the cohort; here's how:
where FL' is the amount of fresh logs left, FL is the amount of original fresh logs (the amount in the "freshlog" package data member), a is the fresh log decay alpha substrate parameter, T is the cohort's age in years, and b is the fresh log beta substrate decay parameter.
Then the values are converted to proportion of total fresh log by dividing each array bucket by the total in all buckets. Then, to each array value, the total value of all previous buckets is added so that the fresh log proportions are cumulative.
Note:This also used to collect fresh log mean DBHs. This has been commented out as not currently needed.
Areas are averaged over grid cells if seed grid cell sizes are bigger than substrate grid cell sizes.
fFromX | Origin X coordinate of the grid cell of "Dispersed Seeds" for which to get substrate proportions. |
fFromY | Origin Y coordinate of the grid cell of "Dispersed Seeds" for which to get substrate proportions. |
fToX | End X coordinate of the grid cell of "Dispersed Seeds" for which to get substrate proportions. |
fToY | End Y coordinate of the grid cell of "Dispersed Seeds" for which to get substrate proportions. |
p_fLogs | Pointer to an array, sized m_iMaxRespiteTimesteps + 1, in which to put the fresh log proportions. Each bucket will hold the cumulative proportion of fresh log of the array index's age in timesteps. The last bucket is always 1. |
|
protected |
Gets parameter file data.
p_oDoc | Parsed parameter file. |
modelErr | if m_fMoundProportion is not between 0 and 1, inclusive. |
void clMicroEstablishment::GetSubstrateProportions | ( | float * | p_fSubstrate, |
const float & | fFromX, | ||
const float & | fFromY, | ||
const float & | fToX, | ||
const float & | fToY | ||
) |
Produces an array of substrate proportions.
First, the amount of substrate for each substrate type is placed in the appropriate array bucket. Then mound substrates are multiplied by the proportion of the total area that is mound; ground substrates are multipled by 1 - that proportion. Areas are averaged over grid cells if seed grid cell sizes are bigger than substrate grid cell sizes.
fFromX | Origin X coordinate of the grid cell of "Dispersed Seeds" for which to get substrate proportions. |
fFromY | Origin Y coordinate of the grid cell of "Dispersed Seeds" for which to get substrate proportions. |
fToX | End X coordinate of the grid cell of "Dispersed Seeds" for which to get substrate proportions. |
fToY | End Y coordinate of the grid cell of "Dispersed Seeds" for which to get substrate proportions. |
p_fSubstrate | Pointer to an array, sized number_substrates, in which to put the substrate proportion for each value in substrateTypes. |
|
protected |
Declares and populates the values in the mp_iCounterCodes and mp_iZCodes arrays, for the "lf_count" and "z" data members of seedlings, respectively.
ModelErr | if there is no code for any species which uses establishment. |
|
protected |
Sets the rooting height of a tree in mm and a fern respite counter in years, if a seedling has landed on fresh logs.
A random number is compared to successive values in p_fFreshLogProportions until an array value is greater than the random value. That bucket represents the age of the fresh logs, in timesteps, onto which the seed has landed. The respite counter is m_iMaxRespite minus the age of the fresh log cohort in years.
The rooting height is a normally-distributed random number using the fresh log mean height and standard deviation from the parameter file. (Fresh logs overlie and obliterate the effects of mounds.)
p_oSeedling | The seedling for which to set rooting height and fern respite. |
p_fFreshLogProportions | An array holding the cumulative proportion of fresh logs x timesteps ago, up to m_iMaxRespiteTimesteps. |
void clMicroEstablishment::SetGroundZAndRespite | ( | clTree * | p_oSeedling | ) |
Sets the rooting height of a seedling in mm if it has landed on a ground substrate that is not fresh logs.
The rooting height and fern respite counters are always 0.
p_oSeedling | The seedling for which to set rooting height and fern respite. |
void clMicroEstablishment::SetMoundZAndRespite | ( | clTree * | p_oSeedling | ) |
Sets the rooting height of a seedling in mm if it has landed on a mound substrate that is not fresh logs.
The rooting height is a random normally-distributed value using the mound mean height (in m_fMoundHeightMean) and mound standard deviation (in m_fMoundStandardDeviation). In this non-fresh-log case, the fern respite counter is always 0.
p_oSeedling | The seedling for which to set rooting height and fern respite. |
|
protected |
Populates required grid pointers.
This gets a pointer to the "Substrate" grid and all its data members, and gets a pointer to the "Dispersed Seeds" grid and all its data members.
modelErr | if either the "Substrate" or "Dispersed Seeds" grid does not exist. |
|
virtual |
Zeroes out the seed grid.
Reimplemented from clWorkerBase.
|
friend |
My unit tester - exists in the testing application.
I didn't want to have to do this but I couldn't figure out a way to effectively unit test any other way.
|
protected |
Fresh log alpha decay parameter; from substrate parameters.
This lets this class calculate fresh log ages.
|
protected |
Fresh log alpha decay parameter; from substrate parameters.
This lets this class calculate fresh log ages.
|
protected |
Fresh log substrate mean height.
Read in in meters, then converted to mm
|
protected |
Fresh log height standard deviation.
Read in in meters, then converted to mm
|
protected |
Mean mound height.
Read in in meters, then converted to mm
|
protected |
Proportion of the plot that is mound.
|
protected |
Mound height standard deviation.
Read in in meters, then converted to mm
|
protected |
Data member code - package int - age.
|
protected |
Data member code - package float - dec_flog.
|
protected |
Maximum number of timesteps of fern respite - calculated from m_iMaxRespiteYears.
|
protected |
Maximum number of years of fern respite - from parameter file.
|
protected |
Holds data member codes for "lf_count" for seedlings - array size is # behavior species.
|
protected |
Speeds access to arrays.
|
protected |
Data member codes for seed grid for number of seeds.
Array size is
|
protected |
Array of data member codes for the "Substrate" grid.
It's sized number_substrates; repeat substrates get the same code (i.e. mound and ground fresh logs
|
protected |
Holds data member codes for "z" for seedlings - array size is # behavior species.
|
protected |
Pointer to the "Dispersed Seeds" grid created by disperse behaviors.
|
protected |
Pointer to "Substrate" grid, created by clSubstrate.