SORTIE Core C++ Documentation
|
Planting - Version 1.0. More...
#include <Planting.h>
Classes | |
struct | stcGridList |
Holds a linked list of grid cells. More... | |
Public Types | |
enum | spaceType { gridded, random } |
Type of plant spacing. More... | |
Public Member Functions | |
clPlant (clSimManager *p_oSimManager) | |
Constructor. More... | |
~clPlant () | |
Destructor. More... | |
void | TimestepCleanup () |
Resets the values in the plantresults grid to 0. More... | |
void | Action () |
Performs the planting for a timestep. 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 | GetData (xercesc::DOMDocument *p_oDoc) |
Reads all the plant events from the parameter file. More... | |
void | SetupPlantGrids () |
Sets up the plant grids and gets all the return codes. More... | |
void | ValidatePackages () |
Makes sure that the data in the plant master packages makes sense. More... | |
void | PlantTrees (clPackage *p_oMasterPackage) |
Performs the tree planting for a master plant package. More... | |
int | AssemblePlantArea (clPackage *p_oMasterPackage, const int &iNumXCells, const int &iNumYCells, stcGridList *&p_plantArea) |
Finds the planting area for a planting event. 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 | |
clTreePopulation * | mp_oPop |
Stashed pointer to tree population. More... | |
clGrid * | mp_oPlantMasterGrid |
PLANTING MASTER. More... | |
clGrid * | mp_oPlantEventsGrid |
PLANT EVENTS. More... | |
clGrid * | mp_oPlantResultsGrid |
PLANT RESULTS. More... | |
float * | mp_fInitialDiam10 |
Size of seedlings to plant. More... | |
short int | m_iMasterTimestepCode |
timestep data member code in "planttmaster" grid More... | |
short int | m_iMasterIDCode |
id code in "planttmaster" grid More... | |
short int * | mp_iAmtPlantCodes |
amtPlant code in "planttmaster" grid. More... | |
short int | m_iSpaceTypeCode |
spacetype code in "planttmaster" grid More... | |
short int | m_iSpacingOrDensityCode |
spcorden code in "planttmaster" grid More... | |
short int | m_iPlantTimestepCode |
timestep code in "plantevents" grid More... | |
short int | m_iPlantIDCode |
id code in "plantevents" grid More... | |
short int * | mp_iPlantedCodes |
planted codes in "plantresults" grid. 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... | |
Planting - Version 1.0.
Planting events can be defined on a grid cell level for each timestep for each species. If more than one event is defined for a species for a single grid cell and timestep, the user takes a chance on what happens. Cells with common planting criteria are grouped by the user into groups which will be evaluated together.
Seedlings to be planted can be placed either randomly around the planting cells or in a gridded fashion. When random, each seedling is placed randomly within the entire chunk being planted. When gridded, each seedling is placed within a given grid cell. This means that gridded plantings are likely to be suboptimal unless they divide nicely into the length of a grid cell. I have not figured out a better way to do gridded plantings.
The size of new seedlings can be left as the standard new seedling size or it can be changed.
The relative amounts of each species are in the parameter file. When reading the file, this behavior expects values as percentages.
The planting data is stored in a grid. Each plant event, defined as the planting to be done for one species for one timestep for one grid cell, is stored in a grid package. These packages are sorted in timestep order. Each timestep, all the planting events that are defined for that timestep are executed, then those packages are removed.
A word on planting grids: It is possible for there to be grid maps for these grids in the parameter file. These will be ignored, and any grids created with these maps will be replaced.
The namestring and parameter file call string for this behavior is "Plant."
Copyright 2011 Charles D. Canham.
Edit history:
--------------—
October 20, 2011 - Wiped the slate clean for SORTIE 7.0 (LEM)
enum clPlant::spaceType |
clPlant::clPlant | ( | clSimManager * | p_oSimManager | ) |
Constructor.
p_oSimManager | Sim Manager object. |
clPlant::~clPlant | ( | ) |
Destructor.
|
virtual |
Performs the planting for a timestep.
For a timestep, this goes through the master package lists in plantmaster and calls PlantTrees() for each one that is for this timestep.
Reimplemented from clBehaviorBase.
|
protected |
Finds the planting area for a planting event.
For a master plant package, this finds all the grid cells affected by this planting by matching ID numbers on packages in the plantevents grid. The plant area cells are assembled into a linked list. All packages which went into the linked list are then deleted.
p_oMasterPackage | The master package for which the plant area list is being assembled. (This package will NOT be deleted.) |
iNumXCells | mp_oPlantEventsGrid's number of cells in the X direction. |
iNumYCells | mp_oPlantEventsGrid's number of cells in the Y direction. |
p_plantArea | Pointer in which to place the linked list of grid cells. |
|
protectedvirtual |
Reads all the plant events from the parameter file.
It doesn't perform validation on them other than basic data types - more in-depth logical validation is left to ValidatePackages().
p_oDoc | DOM tree of parsed input file. |
Implements clWorkerBase.
|
protected |
Performs the tree planting for a master plant package.
It starts by getting a linked list of cells to plant from the package. When planting randomly, for each tree being planted, a cell is selected at random and then a point within that cell is selected at random. For gridded plantings, each cell is evaluated separately. For a location in the cell, one of the species is picked based on a random number compared to the desired relative amounts of each species.
p_oMasterPackage | The master package to plant |
|
protected |
Sets up the plant grids and gets all the return codes.
|
virtual |
Resets the values in the plantresults grid to 0.
Reimplemented from clWorkerBase.
|
protected |
Makes sure that the data in the plant master packages makes sense.
For each one this checks the following:
|
protected |
id code in "planttmaster" grid
|
protected |
timestep data member code in "planttmaster" grid
|
protected |
id code in "plantevents" grid
|
protected |
timestep code in "plantevents" grid
|
protected |
spacetype code in "planttmaster" grid
|
protected |
spcorden code in "planttmaster" grid
|
protected |
Size of seedlings to plant.
Actual values are randomized slightly around these values. Array size is number of species.
|
protected |
amtPlant code in "planttmaster" grid.
Array size is number of species - array index matches species number
|
protected |
planted codes in "plantresults" grid.
Array size is number of species.
|
protected |
PLANT EVENTS.
The grid called "plantevents" will have a cell resolution that matches the tree population. This is where data about planting events is stored.
The need to plant a grid cell is signaled by the presence of a package. The package has an ID number which matches a package in the "plantmaster" grid, which contains the information about how the planting is actually to be performed. Packages are in timestep order, earliest first.
Data members - all for packages:
Data member | Type | Description |
---|---|---|
id | int | ID number matching master package in "plantmaster" |
timestep | int | Timestep at which to apply the plant |
|
protected |
PLANTING MASTER.
The grid called "plantmaster" will have a single cell. This is where the plant events are defined.
Each plant event is one package and is applied to a list of species. It has a unique ID number. The grid cells to which it is applied are in the "plantevents" grid.
The packages are in timestep order, earliest first.
Data members - all for packages:
Data member | Type | Description |
---|---|---|
id | int | ID number of plant event |
timestep | int | Timestep to plant |
spacetype | int | Matches a value of the enum "spaceType" |
spcorden | float | If spacetype = gridded, spacing of trees, in m. If spacetype = random, total density/ha for all species. |
amtPlant(x) | float | One of each of these for each species (species # = x). This is the percentage, between 0 and 100, of each species desired. If a species is not to be planted, its value is 0. |
|
protected |
PLANT RESULTS.
The grid called "Planting Results" will have a grid cell resolution matching that of "plantevents". This is where data on planting results is stored. The data is stored raw - no conversion to per-hectare amounts.
Data member | Type | Description |
---|---|---|
planted(x) | int | Number of trees planted in the current timestep - one of these for each species (x = species number) |
|
protected |
Stashed pointer to tree population.