clPlant Class Reference

Planting - Version 1.0. More...

#include <Planting.h>

Inheritance diagram for clPlant:

clBehaviorBase clWorkerBase List of all members.

Public Types

enum  spaceType { gridded }
 Type of plant spacing. More...

Public Member Functions

 clPlant (clSimManager *p_oSimManager)
 Constructor.
 ~clPlant ()
 Destructor.
void TimestepCleanup ()
 Resets the values in the plantresults grid to 0.
void Action ()
 Performs the planting for a timestep.

Protected Member Functions

void GetData (xercesc::DOMDocument *p_oDoc)
 Reads all the plant events from the parameter file.
void SetupPlantGrids ()
 Sets up the plant grids and gets all the return codes.
void ValidatePackages ()
 Makes sure that the data in the plant master packages makes sense.
void PlantTrees (clPackage *p_oMasterPackage)
 Performs the tree planting for a master plant package.
int AssemblePlantArea (clPackage *p_oMasterPackage, const int &iNumXCells, const int &iNumYCells, stcGridList *&p_plantArea)
 Finds the planting area for a planting event.

Protected Attributes

clTreePopulationmp_oPop
 Stashed pointer to tree population.
clGridBasemp_oPlantMasterGrid
 PLANTING MASTER.
clGridBasemp_oPlantEventsGrid
 PLANT EVENTS.
clGridBasemp_oPlantResultsGrid
 PLANT RESULTS.
float * mp_fInitialDiam10
 Size of seedlings to plant.
short int m_iMasterTimestepCode
 timestep data member code in "planttmaster" grid
short int m_iMasterIDCode
 id code in "planttmaster" grid
short int * mp_iAmtPlantCodes
 amtPlant code in "planttmaster" grid.
short int m_iSpaceTypeCode
 spacetype code in "planttmaster" grid
short int m_iSpacingOrDensityCode
 spcorden code in "planttmaster" grid
short int m_iPlantTimestepCode
 timestep code in "plantevents" grid
short int m_iPlantIDCode
 id code in "plantevents" grid
short int * mp_iPlantedCodes
 planted codes in "plantresults" grid.

Classes

struct  stcGridList
 Holds a linked list of grid cells. More...

Detailed Description

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 for this behavior is "plant."

Copyright 2003 Charles D. Canham.

Author:
Lora E. Murphy

Edit history:
-----------------
April 28, 2004 - Submitted as beta (LEM)


Member Enumeration Documentation

enum clPlant::spaceType
 

Type of plant spacing.

Enumerator:
gridded  Plants are spaced on a grid.


Constructor & Destructor Documentation

clPlant::clPlant clSimManager p_oSimManager  ) 
 

Constructor.

Parameters:
p_oSimManager Sim Manager object.


Member Function Documentation

void clPlant::Action  )  [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.

int clPlant::AssemblePlantArea clPackage p_oMasterPackage,
const int &  iNumXCells,
const int &  iNumYCells,
stcGridList *&  p_plantArea
[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.

Parameters:
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.
Returns:
The number of the cells in the planting area.

void clPlant::GetData xercesc::DOMDocument *  p_oDoc  )  [protected, virtual]
 

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().

Parameters:
p_oDoc DOM tree of parsed input file.

Implements clWorkerBase.

void clPlant::PlantTrees clPackage p_oMasterPackage  )  [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.

Parameters:
p_oMasterPackage The master package to plant

void clPlant::ValidatePackages  )  [protected]
 

Makes sure that the data in the plant master packages makes sense.

For each one this checks the following:

  • No negative values
  • Relative amounts in percentages add up to 100
  • For gridded plantings - grid spacing is less than the grid length


Member Data Documentation

float* clPlant::mp_fInitialDiam10 [protected]
 

Size of seedlings to plant.

Actual values are randomized slightly around these values. Array size is number of species.

short int* clPlant::mp_iAmtPlantCodes [protected]
 

amtPlant code in "planttmaster" grid.

Array size is number of species - array index matches species number

short int* clPlant::mp_iPlantedCodes [protected]
 

planted codes in "plantresults" grid.

Array size is number of species.

clGridBase* clPlant::mp_oPlantEventsGrid [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 name Data type Description
id int ID number matching master package in "plantmaster"
timestep int Timestep at which to apply the plant

clGridBase* clPlant::mp_oPlantMasterGrid [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 name Data 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.

clGridBase* clPlant::mp_oPlantResultsGrid [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 name Data type Description
planted(x) int Number of trees planted in the current timestep - one of these for each species (x = species number)


The documentation for this class was generated from the following file:
Generated on Mon Mar 27 12:51:19 2006 for SORTIE Core C++ Documentation by  doxygen 1.4.6-NO