SORTIE Core C++ Documentation
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
clQualityVigorClassifier Class Reference

Quality Vigor Classifier version 1.0 Manages tree classification based on stem vigor, species classification, and quality. More...

#include <QualityVigorClassifier.h>

Inheritance diagram for clQualityVigorClassifier:
clBehaviorBase clWorkerBase

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...
 
clSimManagerGetSimManager ()
 
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...
 
stcSpeciesTypeCombomp_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...
 
clSimManagermp_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...
 

Detailed Description

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 VigorSawlog?DBHClass
Deciduous Vig Yes Any1
Deciduous Vig No Any2
Deciduous Not Yes > 23 cm 3
Deciduous Not Yes <= 23 cm4
Deciduous Not No Any4
ConiferousVig NA Any5
ConiferousNot NA Any6

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:

prob= exp(βX)/(1+exp(βX))
where:

βX= β0 + β1init + β2sp*DBH + β3sp*ln(DBH)

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.

Author
Lora E. Murphy


Edit history:
--------------—
January 9, 2012 - Created (LEM)

Constructor & Destructor Documentation

◆ clQualityVigorClassifier()

clQualityVigorClassifier::clQualityVigorClassifier ( clSimManager p_oSimManager)

Constructor.

Parameters
p_oSimManagerSim Manager object.

◆ ~clQualityVigorClassifier()

clQualityVigorClassifier::~clQualityVigorClassifier ( )

Destructor.

Member Function Documentation

◆ Action()

void clQualityVigorClassifier::Action ( )
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.

◆ AssignClass()

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.

Parameters
p_oPopTree population.
p_oTreeTree to assign class to.

◆ AssignVigorQuality()

void clQualityVigorClassifier::AssignVigorQuality ( clTree p_oTree)
private

Assigns a vigor and quality to a tree based on the new adult probabilities.

Parameters
p_oTreeTree to assign vigor and quality to.

◆ EvolveVigorQuality()

void clQualityVigorClassifier::EvolveVigorQuality ( clTreePopulation p_oPop,
clTree p_oTree 
)
private

Evaluates possible transition in vigor and quality for a tree, then assigns the new values.

Parameters
p_oPopTree population.
p_oTreeTree to evaluate.

◆ FormatQueryString()

void clQualityVigorClassifier::FormatQueryString ( clTreePopulation p_oPop)
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.

Parameters
p_oPopTree population object.

◆ GetData()

void clQualityVigorClassifier::GetData ( xercesc::DOMDocument *  p_oDoc)
virtual

Does setup by calling ReadParameterFile() and HandleInitialConditionsTrees().

Parameters
p_oDocDOM tree of parsed input file.

Implements clWorkerBase.

◆ HandleInitialConditionsTrees()

void clQualityVigorClassifier::HandleInitialConditionsTrees ( xercesc::DOMDocument *  p_oDoc,
clTreePopulation p_oPop 
)
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.

Parameters
p_oPopTree population.
p_oDocDOM tree of parsed input file.

◆ ReadParameterFile()

void clQualityVigorClassifier::ReadParameterFile ( xercesc::DOMDocument *  p_oDoc,
clTreePopulation p_oPop 
)
private

Reads the data from the parameter file.

Parameters
p_oDocDOM tree of parsed input file.
p_oPopTree population.

◆ RegisterTreeDataMembers()

void clQualityVigorClassifier::RegisterTreeDataMembers ( )
virtual

Registers the "Biomass" float data member.

The return codes are captured in the mp_iBiomassCodes array.

Exceptions
modelErrif this behavior is being applied to any tree type except adults.

Reimplemented from clBehaviorBase.

Friends And Related Function Documentation

◆ clTestQualityVigorClassifier

friend class clTestQualityVigorClassifier
friend

Member Data Documentation

◆ m_cQuery

char* clQualityVigorClassifier::m_cQuery
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.

◆ mp_bDeciduous

bool* clQualityVigorClassifier::mp_bDeciduous
private

Whether or not a species is deciduous.

(False means coniferous.) Sized number of species assigned to this behavior.

◆ mp_fNewAdultProbSawlog

double* clQualityVigorClassifier::mp_fNewAdultProbSawlog
private

Probability of new adults being sawlog quality.

Sized number of species assigned to this behavior. If species is coniferous, this is ignored.

◆ mp_fNewAdultProbVigorous

double* clQualityVigorClassifier::mp_fNewAdultProbVigorous
private

Probability of new adults being vigorous.

Sized number of species assigned to this behavior.

◆ mp_fQualBeta0

double* clQualityVigorClassifier::mp_fQualBeta0
private

Beta0 for quality transition.

Sized number of species assigned to this behavior. If species is coniferous, this is ignored.

◆ mp_fQualBeta11

double* clQualityVigorClassifier::mp_fQualBeta11
private

Beta1 for quality transition, initial class 1.

Sized number of species assigned to this behavior. If species is coniferous, this is ignored.

◆ mp_fQualBeta12

double* clQualityVigorClassifier::mp_fQualBeta12
private

Beta1 for quality transition, initial class 2.

Sized number of species assigned to this behavior. If species is coniferous, this is ignored.

◆ mp_fQualBeta13

double* clQualityVigorClassifier::mp_fQualBeta13
private

Beta1 for quality transition, initial class 3.

Sized number of species assigned to this behavior. If species is coniferous, this is ignored.

◆ mp_fQualBeta14

double* clQualityVigorClassifier::mp_fQualBeta14
private

Beta1 for quality transition, initial class 4.

Sized number of species assigned to this behavior. If species is coniferous, this is ignored.

◆ mp_fQualBeta2

double* clQualityVigorClassifier::mp_fQualBeta2
private

Beta2 for quality transition.

Sized number of species assigned to this behavior. If species is coniferous, this is ignored.

◆ mp_fQualBeta3

double* clQualityVigorClassifier::mp_fQualBeta3
private

Beta3 for quality transition.

Sized number of species assigned to this behavior. If species is coniferous, this is ignored.

◆ mp_fVigBeta0

double* clQualityVigorClassifier::mp_fVigBeta0
private

Beta0 for vigor transition.

Sized number of species assigned to this behavior.

◆ mp_fVigBeta11

double* clQualityVigorClassifier::mp_fVigBeta11
private

Beta1 for vigor transition, initial class 1.

Sized number of species assigned to this behavior. If species is coniferous, this is ignored.

◆ mp_fVigBeta12

double* clQualityVigorClassifier::mp_fVigBeta12
private

Beta1 for vigor transition, initial class 2.

Sized number of species assigned to this behavior. If species is coniferous, this is ignored.

◆ mp_fVigBeta13

double* clQualityVigorClassifier::mp_fVigBeta13
private

Beta1 for vigor transition, initial class 3.

Sized number of species assigned to this behavior. If species is coniferous, this is ignored.

◆ mp_fVigBeta14

double* clQualityVigorClassifier::mp_fVigBeta14
private

Beta1 for vigor transition, initial class 4.

Sized number of species assigned to this behavior. If species is coniferous, this is ignored.

◆ mp_fVigBeta15

double* clQualityVigorClassifier::mp_fVigBeta15
private

Beta1 for vigor transition, initial class 5.

Sized number of species assigned to this behavior. If species is deciduous, this is ignored.

◆ mp_fVigBeta16

double* clQualityVigorClassifier::mp_fVigBeta16
private

Beta1 for vigor transition, initial class 6.

Sized number of species assigned to this behavior. If species is deciduous, this is ignored.

◆ mp_fVigBeta2

double* clQualityVigorClassifier::mp_fVigBeta2
private

Beta2 for vigor transition.

Sized number of species assigned to this behavior.

◆ mp_fVigBeta3

double* clQualityVigorClassifier::mp_fVigBeta3
private

Beta3 for vigor transition.

Sized number of species assigned to this behavior.

◆ mp_iIndexes

short int* clQualityVigorClassifier::mp_iIndexes
private

For array access.

◆ mp_iSawlogInd

short int* clQualityVigorClassifier::mp_iSawlogInd
private

Return codes for "sawlog" tree data member.

Sized number of species assigned to this behavior.

◆ mp_iTreeclassInd

short int* clQualityVigorClassifier::mp_iTreeclassInd
private

Return codes for "treeclass" tree data member.

Sized number of species assigned to this behavior.

◆ mp_iVigorousInd

short int* clQualityVigorClassifier::mp_iVigorousInd
private

Return codes for "vigorous" tree data member.

Sized number of species assigned to this behavior.


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