-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
In the Fortran version of the VolumeLibrary there is existing hierarchy of abstraction to the logic
For example the Profile method calculate volume for all profile volume calculation. The Profile method then call specific taper functions based on the model being used.
When moving to C++ we want to take hierarchy of logic and transform it to a form more appropriate for a object orientated language.
- abstract VolumeCalculator base class: This abstract class will allow us to create sub-classes which can define the various core volume calculation types:
- ProfileVolumeCalculator
- DveVolumeCalculator
- FiaVolumeCalculator
- abstract TaperModel base class: when performing a profile volume calculation there are various different taper models that define the profile of the tree. Each one with different logic and internal parameters use for the calculation, but all essential seek the same answer: getting dbh at a height, or getting the height of a dbh. Sub-classes of the TaperModel will allow for us to define the different logic for each model as well as encapsulate the internal parameters for that logic. These sub-classes will be defined as we migrate logic from the old code-base. However functions that implemented this logic were named based on the region that used the model rather than the name of the model. In the new code base we will name the TaperModel sub-class after the model being used.
- VolumeCalculatorFactory: this class will handle the orchestration of all the various bits of logic that are required to get VolumeCalculator instance that can be used to calculate a final tree volume. This can include: resolving a volume equation number, resolving default merch rules, selecting and creating a TaperModel instance to use, initializing volume calculation coefficients, and the returning the desired volume calculator type. As well this class can implement a form of internal caching to reduce work needed to create volume calculator instances, since in many cases we will be calculating many trees with the same volume equation. Since this class will be solely responsible for creating volume calculator instances, it can also manage the destruction of all volume calculator instances it creates.
- VolumeEquationResolver: this class will define a single public function that will be responsible for resolving what volume equation should be used based on VolumeCalculationOptions (region, forest, district, fiaCode, ...)
- DefaultMerchRulesResolver: this class will define a single public function that will be responsible for resolving what merch rule values should be used based on VolumeCalculationOptions (region, forest, district, fiaCode, ...)
VolumeCalculator types
Base Volume Calculator
classDiagram
class VolumeCalculatorBase {
string volumeEquationNumber_
virtual VolumeOutput CalculateVolume(TreeMeasurments tree, MerchRules merchRules)
}
Profile Volume Calculator
classDiagram
class ProfileVolumeCalculator {
TaperModel taperModel_
VolumeOutput CalculateVolume(TreeMeasurments treeMeasurments, MerchRules merchRules)
}
DVE Volume Calculator
classDiagram
class DveVolumeCalculator {
DveModel devModels
VolumeOutput CalculateVolume(TreeMeasurments treeMeasurments)
}
class DveModel{
TreeVolume GetWholeTreeVolume(TreeMeasurments tree)
}
FIA Volume Calculator
classDiagram
class FiaVolumeCalculator {
TaperModel taperModel_
DveModel[] devModels_
VolumeOutput CalculateVolume(TreeMeasurments treeMeasurments, MerchRules merchRules)
}
Metadata
Metadata
Assignees
Labels
No labels