GCBM
|
#include <standgrowthcurve.h>
Public Member Functions | |
virtual | ~StandGrowthCurve () |
StandGrowthCurve (Int64 standGrowthCurveID, Int64 spuID) | |
Int64 | standGrowthCurveID () const |
Int64 | spuID () const |
int | standMaxAge () const |
void | addYieldTable (TreeYieldTable &yieldTable) |
void | processStandYieldTables () |
bool | hasYieldComponent (SpeciesType componentType) |
double | getStandTotalVolumeAtAge (int age) const |
double | getStandSoftwoodVolumeRatioAtAge (int age) const |
int | getStandAgeWithMaximumVolume () const |
double | getAnnualStandMaximumVolume () const |
std::shared_ptr< const PERDFactor > | getPERDFactor (SpeciesType speciesType) const |
void | setPERDFactor (std::shared_ptr< PERDFactor > value, SpeciesType) |
const ForestTypeConfiguration & | getForestTypeConfiguration (SpeciesType speciesType) const |
void | setForestTypeConfiguration (const ForestTypeConfiguration &value, SpeciesType) |
Private Member Functions | |
void | resolveStandGrowthCurveMaxAge () |
void | initStandYieldDataStorage () |
void | checkAndUpdateYieldTables () |
void | summarizeStandComponentYieldTables () |
void | updateStandMaximumVolumeAgeInfo () |
Private Attributes | |
Int64 | _standGrowthCurveID |
Int64 | _spuID |
int | _standMaxAge |
int | _standAgeForMaximumMerchVolume |
double | _standMaximumMerchVolume |
bool | _okToSmooth |
std::shared_ptr< PERDFactor > | _swPERDFactor |
std::shared_ptr< PERDFactor > | _hwPERDFactor |
ForestTypeConfiguration | _swForestTypeConfiguration |
ForestTypeConfiguration | _hwForestTypeConfiguration |
std::vector< TreeYieldTable > | _softwoodYieldTables |
std::vector< TreeYieldTable > | _hardwoodYieldTables |
std::vector< double > | _standMerchVolumeAtEachAge |
std::vector< double > | _standSoftwoodVolumeRatioAtEachAge |
|
virtual |
StandGrowthCurve | ( | Int64 | standGrowthCurveID, |
Int64 | spuID | ||
) |
Constructor
Assign StandGrowthCurve._standGrowthCurveID and StandGrowthCurve._spuID as paramters standGrowthCurveID, spuID, StandGrowthCurve._standMaxAge, StandGrowthCurve._standAgeForMaximumMerchVolume and StandGrowthCurve._standMaximumMerchVolume as 0
standGrowthCurveID | Int64 |
spuID | Int64 |
void addYieldTable | ( | TreeYieldTable & | yieldTable | ) |
If TreeYieldTable.totalVolume() on parameter yieldTable is > 0, if the forest species is SpeciesType::Softwood, append yieldTable to StandGrowthCurve._softwoodYieldTables, else to StandGrowthCurve._hardwoodYieldTables.
yieldTable | TreeYieldTable& |
|
private |
StandGrowthCurve._softwoodYieldTables and StandGrowthCurve._hardwoodYieldTables should have valid volume data for each age up to the maximum stand age
Each yield table must have the same pairs of [age, volume] and the age should be up to the maximum stand age
If one yield table has less data of volume, repeatedly append the yield data with the last available volume.Use vector.push_back(lastAvailableVolume) instead of use resize() and then assign value
double getAnnualStandMaximumVolume | ( | ) | const |
Return StandGrowthCurve._standMaximumMerchVolume
const ForestTypeConfiguration & getForestTypeConfiguration | ( | SpeciesType | speciesType | ) | const |
If parameter speciesType is SpeciesType::Softwood return StandGrowthCurve._swForestTypeConfiguration, else return StandGrowthCurve._hwForestTypeConfiguration
speciesType | SpeciesType |
std::shared_ptr< const PERDFactor > getPERDFactor | ( | SpeciesType | speciesType | ) | const |
If parameter speciesType is SpeciesType::Softwood return StandGrowthCurve._swPERDFactor, else return StandGrowthCurve._hwPERDFactor
speciesType | SpeciesType |
int getStandAgeWithMaximumVolume | ( | ) | const |
Get the stand age at which the stand has the maximum merchantable volume
Return StandGrowthCurve._standAgeForMaximumMerchVolume
double getStandSoftwoodVolumeRatioAtAge | ( | int | age | ) | const |
If parameter age > StandGrowthCurve._standMaxAge return the value of StandGrowthCurve._standMaxAge in StandGrowthCurve._standSoftwoodVolumeRatioAtEachAge, else return the value of age in StandGrowthCurve._standSoftwoodVolumeRatioAtEachAge
age | int |
double getStandTotalVolumeAtAge | ( | int | age | ) | const |
If parameter age > StandGrowthCurve._standMaxAge return the value of StandGrowthCurve._standMaxAge in StandGrowthCurve._standMerchVolumeAtEachAge, else return the value of age in StandGrowthCurve._standMerchVolumeAtEachAge
age | int |
bool hasYieldComponent | ( | SpeciesType | componentType | ) |
If the componentType is SpeciesType::Softwood return true if StandGrowthCurve._swPERDFactor is not null and size of StandGrowthCurve._softwoodYieldTables is not empty
If the componentType is SpeciesType::Hardwood return true if StandGrowthCurve._hwPERDFactor is not null and size of StandGrowthCurve._hardwoodYieldTables is not empty
componentType | SpeciesType |
|
private |
void processStandYieldTables | ( | ) |
|
private |
Set the value of StandGrowthCurve._standMaxAge to the maximum value of the yield data in StandGrowthCurve._softwoodYieldTables and StandGrowthCurve._hardwoodYieldTables
void setForestTypeConfiguration | ( | const ForestTypeConfiguration & | value, |
SpeciesType | speciesType | ||
) |
If parameter speciesType is SpeciesType::Softwood, set StandGrowthCurve._swForestTypeConfiguration to parameter value, else set StandGrowthCurve._hwForestTypeConfiguration to value
value | shared_ptr<PERDFactor> |
speciesType | Speciestype |
void setPERDFactor | ( | std::shared_ptr< PERDFactor > | value, |
SpeciesType | speciesType | ||
) |
If parameter speciesType is SpeciesType::Softwood, set StandGrowthCurve._swPERDFactor to parameter value, else set StandGrowthCurve._hwPERDFactor to value
value | shared_ptr<PERDFactor> |
speciesType | Speciestype |
Int64 spuID | ( | ) | const |
Int64 standGrowthCurveID | ( | ) | const |
int standMaxAge | ( | ) | const |
|
private |
First, try to sum up the softwood. If StandGrowthCurve._softwoodYieldTables is not empty, loop over the softwood yield tables, If the size of each yield table is > 0, loop over ages of each yield table in the range 0 to StandGrowthCurve._standMaxAge
Record the stand total volume at this age as the total softwood volume at this age, add the value of the yield to StandGrowthCurve._standMerchVolumeAtEachAge at key age
Second, try to sum up the hardwood and update the stand total volume at an age.
If StandGrowthCurve._softwoodYieldTables is empty for ages in the range 0 to StandGrowthCurve._standMaxAge, set the value of each age in StandGrowthCurve._standSoftwoodVolumeRatioAtEachAge to 1.0
Else, assign a variable hardwoodVolumeTotalAgAge as 0, loop over each of the hardwood yield tables, add up the hardwood volume at this age to hardwoodVolumeTotalAgAge
Get the stand softwood volume at this age using StandGrowthCurve._standMerchVolumeAtEachAge and assign it to variable softwoodVolumeTotalAgAge
Calculate softwoodRatioAtAge as softwoodVolumetotalAtAge / (softwoodVolumetotalAtAge + hardwoodVolumeTotalAgAge), if denominator is not 0, else set softwoodRatioAtAge to 1
Update the stand total volume at this age by adding hardwoodVolumeTotalAgAge
Set StandGrowthCurve._standSoftwoodVolumeRatioAtEachAge at the current age to softwoodRatioAtAge
|
private |
Set the maximum value of StandGrowthCurve._standMerchVolumeAtEachAge to StandGrowthCurve._standMaximumMerchVolume, and the age corresponding to the maximum value to StandGrowthCurve._standAgeForMaximumMerchVolume
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |