GCBM
Public Member Functions | Private Member Functions | Private Attributes | List of all members
StandGrowthCurve Class Reference

#include <standgrowthcurve.h>

Collaboration diagram for StandGrowthCurve:
Collaboration graph

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 PERDFactorgetPERDFactor (SpeciesType speciesType) const
 
void setPERDFactor (std::shared_ptr< PERDFactor > value, SpeciesType)
 
const ForestTypeConfigurationgetForestTypeConfiguration (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
 

Constructor & Destructor Documentation

◆ ~StandGrowthCurve()

virtual ~StandGrowthCurve ( )
virtual

◆ StandGrowthCurve()

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

Parameters
standGrowthCurveIDInt64
spuIDInt64

Member Function Documentation

◆ addYieldTable()

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.

Parameters
yieldTableTreeYieldTable&
Returns
void

◆ checkAndUpdateYieldTables()

void checkAndUpdateYieldTables ( )
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

Returns
void

◆ getAnnualStandMaximumVolume()

double getAnnualStandMaximumVolume ( ) const

◆ getForestTypeConfiguration()

const ForestTypeConfiguration & getForestTypeConfiguration ( SpeciesType  speciesType) const

If parameter speciesType is SpeciesType::Softwood return StandGrowthCurve._swForestTypeConfiguration, else return StandGrowthCurve._hwForestTypeConfiguration

Parameters
speciesTypeSpeciesType
Returns
const ForestTypeConfiguration&

◆ getPERDFactor()

std::shared_ptr< const PERDFactor > getPERDFactor ( SpeciesType  speciesType) const

If parameter speciesType is SpeciesType::Softwood return StandGrowthCurve._swPERDFactor, else return StandGrowthCurve._hwPERDFactor

Parameters
speciesTypeSpeciesType
Returns
shared_ptr<const PERDFactor>

◆ getStandAgeWithMaximumVolume()

int getStandAgeWithMaximumVolume ( ) const

Get the stand age at which the stand has the maximum merchantable volume

Return StandGrowthCurve._standAgeForMaximumMerchVolume

Returns
int

◆ getStandSoftwoodVolumeRatioAtAge()

double getStandSoftwoodVolumeRatioAtAge ( int  age) const

◆ getStandTotalVolumeAtAge()

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

Parameters
ageint

◆ hasYieldComponent()

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

Parameters
componentTypeSpeciesType
Returns
bool

◆ initStandYieldDataStorage()

void initStandYieldDataStorage ( )
private

◆ processStandYieldTables()

void processStandYieldTables ( )

◆ resolveStandGrowthCurveMaxAge()

void resolveStandGrowthCurveMaxAge ( )
private

Set the value of StandGrowthCurve._standMaxAge to the maximum value of the yield data in StandGrowthCurve._softwoodYieldTables and StandGrowthCurve._hardwoodYieldTables

Returns
void

◆ setForestTypeConfiguration()

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

Parameters
valueshared_ptr<PERDFactor>
speciesTypeSpeciestype

◆ setPERDFactor()

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

Parameters
valueshared_ptr<PERDFactor>
speciesTypeSpeciestype

◆ spuID()

Int64 spuID ( ) const

◆ standGrowthCurveID()

Int64 standGrowthCurveID ( ) const

◆ standMaxAge()

int standMaxAge ( ) const

◆ summarizeStandComponentYieldTables()

void summarizeStandComponentYieldTables ( )
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

Returns
void

◆ updateStandMaximumVolumeAgeInfo()

void updateStandMaximumVolumeAgeInfo ( )
private

Set the maximum value of StandGrowthCurve._standMerchVolumeAtEachAge to StandGrowthCurve._standMaximumMerchVolume, and the age corresponding to the maximum value to StandGrowthCurve._standAgeForMaximumMerchVolume

Returns
void

Member Data Documentation

◆ _hardwoodYieldTables

std::vector<TreeYieldTable> _hardwoodYieldTables
private

◆ _hwForestTypeConfiguration

ForestTypeConfiguration _hwForestTypeConfiguration
private

◆ _hwPERDFactor

std::shared_ptr<PERDFactor> _hwPERDFactor
private

◆ _okToSmooth

bool _okToSmooth
private

◆ _softwoodYieldTables

std::vector<TreeYieldTable> _softwoodYieldTables
private

◆ _spuID

Int64 _spuID
private

◆ _standAgeForMaximumMerchVolume

int _standAgeForMaximumMerchVolume
private

◆ _standGrowthCurveID

Int64 _standGrowthCurveID
private

◆ _standMaxAge

int _standMaxAge
private

◆ _standMaximumMerchVolume

double _standMaximumMerchVolume
private

◆ _standMerchVolumeAtEachAge

std::vector<double> _standMerchVolumeAtEachAge
private

◆ _standSoftwoodVolumeRatioAtEachAge

std::vector<double> _standSoftwoodVolumeRatioAtEachAge
private

◆ _swForestTypeConfiguration

ForestTypeConfiguration _swForestTypeConfiguration
private

◆ _swPERDFactor

std::shared_ptr<PERDFactor> _swPERDFactor
private

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