SORTIE Core C++ Documentation
|
Quality Vigor Classifier version 1.0 Manages tree classification based on stem vigor, species classification, and quality. More...
#include <QualityVigorClassifier.h>
Public Member Functions | |
clQualityVigorClassifier (clSimManager *p_oSimManager) | |
Constructor. More... | |
~clQualityVigorClassifier () | |
Destructor. More... | |
void | Action () |
Does class management. More... | |
void | GetData (xercesc::DOMDocument *p_oDoc) |
Does setup by calling ReadParameterFile() and HandleInitialConditionsTrees(). More... | |
void | RegisterTreeDataMembers () |
Registers the "Biomass" float data member. More... | |
void | AssignClass (clTreePopulation *p_oPop, clTree *p_oTree) |
Assigns a class to a tree based on vigor and quality. 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 | 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 | TimestepCleanup () |
Performs any necessary cleanup operations at the end of a timestep. More... | |
virtual void | EndOfRunCleanup () |
Performs any necessary cleanup operations at the end of a run. More... | |
Private Member Functions | |
void | ReadParameterFile (xercesc::DOMDocument *p_oDoc, clTreePopulation *p_oPop) |
Reads the data from the parameter file. More... | |
void | HandleInitialConditionsTrees (xercesc::DOMDocument *p_oDoc, clTreePopulation *p_oPop) |
Handles initial conditions trees. More... | |
void | AssignVigorQuality (clTree *p_oTree) |
Assigns a vigor and quality to a tree based on the new adult probabilities. More... | |
void | EvolveVigorQuality (clTreePopulation *p_oPop, clTree *p_oTree) |
Evaluates possible transition in vigor and quality for a tree, then assigns the new values. More... | |
void | FormatQueryString (clTreePopulation *p_oPop) |
Formats the string in m_cQuery. More... | |
Private Attributes | |
char * | m_cQuery |
String to pass to clTreePopulation::Find() in order to get the trees to apply damage to. More... | |
double * | mp_fVigBeta0 |
Beta0 for vigor transition. More... | |
double * | mp_fVigBeta11 |
Beta1 for vigor transition, initial class 1. More... | |
double * | mp_fVigBeta12 |
Beta1 for vigor transition, initial class 2. More... | |
double * | mp_fVigBeta13 |
Beta1 for vigor transition, initial class 3. More... | |
double * | mp_fVigBeta14 |
Beta1 for vigor transition, initial class 4. More... | |
double * | mp_fVigBeta15 |
Beta1 for vigor transition, initial class 5. More... | |
double * | mp_fVigBeta16 |
Beta1 for vigor transition, initial class 6. More... | |
double * | mp_fVigBeta2 |
Beta2 for vigor transition. More... | |
double * | mp_fVigBeta3 |
Beta3 for vigor transition. More... | |
double * | mp_fQualBeta0 |
Beta0 for quality transition. More... | |
double * | mp_fQualBeta11 |
Beta1 for quality transition, initial class 1. More... | |
double * | mp_fQualBeta12 |
Beta1 for quality transition, initial class 2. More... | |
double * | mp_fQualBeta13 |
Beta1 for quality transition, initial class 3. More... | |
double * | mp_fQualBeta14 |
Beta1 for quality transition, initial class 4. More... | |
double * | mp_fQualBeta2 |
Beta2 for quality transition. More... | |
double * | mp_fQualBeta3 |
Beta3 for quality transition. More... | |
double * | mp_fNewAdultProbVigorous |
Probability of new adults being vigorous. More... | |
double * | mp_fNewAdultProbSawlog |
Probability of new adults being sawlog quality. More... | |
short int * | mp_iIndexes |
For array access. More... | |
short int * | mp_iVigorousInd |
Return codes for "vigorous" tree data member. More... | |
short int * | mp_iSawlogInd |
Return codes for "sawlog" tree data member. More... | |
short int * | mp_iTreeclassInd |
Return codes for "treeclass" tree data member. More... | |
bool * | mp_bDeciduous |
Whether or not a species is deciduous. More... | |
Friends | |
class | clTestQualityVigorClassifier |
Additional Inherited Members | |
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 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... | |
Quality Vigor Classifier version 1.0 Manages tree classification based on stem vigor, species classification, and quality.
Assigning a classification
The possible states of "species type" are deciduous and coniferous. The possible states of "vigor" are vigorous and not vigorous. The possible states of "quality" are sawlog potential and no sawlog potential.
Only adults can be assigned a class number.
Spp Type | Vigor | Sawlog? | DBH | Class |
---|---|---|---|---|
Deciduous | Vig | Yes | Any | 1 |
Deciduous | Vig | No | Any | 2 |
Deciduous | Not | Yes | > 23 cm | 3 |
Deciduous | Not | Yes | <= 23 cm | 4 |
Deciduous | Not | No | Any | 4 |
Coniferous | Vig | NA | Any | 5 |
Coniferous | Not | NA | Any | 6 |
Assigning a vigor and quality to new adults
For each species, there is a probability that a new adult of that species is vigorous, and for deciduous species, that it is sawlog quality. A random number is compared to these values to determine the vigor and quality of a new adult tree. Classification can then proceed according to the table above.
Initial conditions
Trees may come in with a class already assigned in a tree map. If not, the user can specify the proportion of trees vigorous and sawlog in various size classes. Any trees not covered by one of the two previous assignment methods will be assigned based on the new adult proportions.
Changes in vigor and quality
The probability of transition between vigor states and quality states is calculated with the same functional form (but different parameters). The probability of being vigorous or of being of sawlog quality is:
where β1init is a beta for the initial state.
This behavior adds three tree data members: two booleans, "vigorous" and "sawlog", and one int called "treeclass" with a possible value from 1-6.
This behavior can only be applied to adult trees.
The namestring and parameter file call string are "QualityVigorClassifier".
Copyright 2012 Charles D. Canham.
Edit history:
--------------—
January 9, 2012 - Created (LEM)
clQualityVigorClassifier::clQualityVigorClassifier | ( | clSimManager * | p_oSimManager | ) |
Constructor.
p_oSimManager | Sim Manager object. |
clQualityVigorClassifier::~clQualityVigorClassifier | ( | ) |
Destructor.
|
virtual |
Does class management.
This gets all trees that this behavior acts on. First, vigor and quality transitions are dealt with. If a tree does not already have a class, it will get assignments based on the new adult probabilities. If it does, it will get assessed for both vigor class and quality class transition.
Reimplemented from clBehaviorBase.
void clQualityVigorClassifier::AssignClass | ( | clTreePopulation * | p_oPop, |
clTree * | p_oTree | ||
) |
Assigns a class to a tree based on vigor and quality.
The class value is placed in the tree's "treeclass" data member. If vigor or quality is missing, the class value assigned is 0.
p_oPop | Tree population. |
p_oTree | Tree to assign class to. |
|
private |
Assigns a vigor and quality to a tree based on the new adult probabilities.
p_oTree | Tree to assign vigor and quality to. |
|
private |
Evaluates possible transition in vigor and quality for a tree, then assigns the new values.
p_oPop | Tree population. |
p_oTree | Tree to evaluate. |
|
private |
Formats the string in m_cQuery.
This value will be used in Action() to pass to clTreePopulation::Find() in order to get the trees to act on.
p_oPop | Tree population object. |
|
virtual |
Does setup by calling ReadParameterFile() and HandleInitialConditionsTrees().
p_oDoc | DOM tree of parsed input file. |
Implements clWorkerBase.
|
private |
Handles initial conditions trees.
This will look for initial conditions defined proportions of vigorous and sawlog info. If missing, or for any trees for which it is missing, the new adult probabilities will be used to assign vigorous and sawlog status, and then class.
p_oPop | Tree population. |
p_oDoc | DOM tree of parsed input file. |
|
private |
Reads the data from the parameter file.
p_oDoc | DOM tree of parsed input file. |
p_oPop | Tree population. |
|
virtual |
Registers the "Biomass" float data member.
The return codes are captured in the mp_iBiomassCodes array.
modelErr | if this behavior is being applied to any tree type except adults. |
Reimplemented from clBehaviorBase.
|
friend |
|
private |
String to pass to clTreePopulation::Find() in order to get the trees to apply damage to.
This will instigate a species/type search for all the species and types to which this behavior applies.
|
private |
Whether or not a species is deciduous.
(False means coniferous.) Sized number of species assigned to this behavior.
|
private |
Probability of new adults being sawlog quality.
Sized number of species assigned to this behavior. If species is coniferous, this is ignored.
|
private |
Probability of new adults being vigorous.
Sized number of species assigned to this behavior.
|
private |
Beta0 for quality transition.
Sized number of species assigned to this behavior. If species is coniferous, this is ignored.
|
private |
Beta1 for quality transition, initial class 1.
Sized number of species assigned to this behavior. If species is coniferous, this is ignored.
|
private |
Beta1 for quality transition, initial class 2.
Sized number of species assigned to this behavior. If species is coniferous, this is ignored.
|
private |
Beta1 for quality transition, initial class 3.
Sized number of species assigned to this behavior. If species is coniferous, this is ignored.
|
private |
Beta1 for quality transition, initial class 4.
Sized number of species assigned to this behavior. If species is coniferous, this is ignored.
|
private |
Beta2 for quality transition.
Sized number of species assigned to this behavior. If species is coniferous, this is ignored.
|
private |
Beta3 for quality transition.
Sized number of species assigned to this behavior. If species is coniferous, this is ignored.
|
private |
Beta0 for vigor transition.
Sized number of species assigned to this behavior.
|
private |
Beta1 for vigor transition, initial class 1.
Sized number of species assigned to this behavior. If species is coniferous, this is ignored.
|
private |
Beta1 for vigor transition, initial class 2.
Sized number of species assigned to this behavior. If species is coniferous, this is ignored.
|
private |
Beta1 for vigor transition, initial class 3.
Sized number of species assigned to this behavior. If species is coniferous, this is ignored.
|
private |
Beta1 for vigor transition, initial class 4.
Sized number of species assigned to this behavior. If species is coniferous, this is ignored.
|
private |
Beta1 for vigor transition, initial class 5.
Sized number of species assigned to this behavior. If species is deciduous, this is ignored.
|
private |
Beta1 for vigor transition, initial class 6.
Sized number of species assigned to this behavior. If species is deciduous, this is ignored.
|
private |
Beta2 for vigor transition.
Sized number of species assigned to this behavior.
|
private |
Beta3 for vigor transition.
Sized number of species assigned to this behavior.
|
private |
For array access.
|
private |
Return codes for "sawlog" tree data member.
Sized number of species assigned to this behavior.
|
private |
Return codes for "treeclass" tree data member.
Sized number of species assigned to this behavior.
|
private |
Return codes for "vigorous" tree data member.
Sized number of species assigned to this behavior.