GCBM
volumetobiomasscarbongrowth.h
Go to the documentation of this file.
1 #ifndef MOJA_MODULES_CBM_VOLUMETOBIOMASSCARBONGROWTH_H_
2 #define MOJA_MODULES_CBM_VOLUMETOBIOMASSCARBONGROWTH_H_
3 
4 #include "moja/modules/cbm/_modules.cbm_exports.h"
5 #include "moja/flint/modulebase.h"
6 #include "moja/hash.h"
13 
14 #include <Poco/LRUCache.h>
15 
16 namespace moja {
17 namespace modules {
18 namespace cbm {
19 
21  public:
22  VolumeToBiomassCarbonGrowth(bool smootherEnabled = true) {
23  getConverter().setSmoothing(smootherEnabled);
24  };
25 
27 
28  // Process a CBM stand growth curve to generate the biomass carbon curve.
29  void generateBiomassCarbonCurve(StandGrowthCurve& standGrowthCurve);
30 
31  // Get the above ground biomass growth increment based on a yield growth curve ID and age.
32  std::unordered_map<std::string, double> getBiomassCarbonIncrements(flint::ILandUnitDataWrapper* landUnitData, Int64 growthCurveID, Int64 spuID);
33 
34  // Get the total above ground biomass based on a yield growth curve ID and SPU.
35  std::vector<double> getAboveGroundCarbonCurve(Int64 growthCurveID, Int64 spuID);
36 
37  // Get the total foliage curve based on a yield growth curve ID and SPU.
38  std::vector<double> getFoliageCarbonCurve(Int64 growthCurveID, Int64 spuID);
39 
40  // Check if there is a biomass carbon growth curve for a stand yield growth curve.
41  bool isBiomassCarbonCurveAvailable(Int64 growthCurveID, Int64 spuID);
42 
43  void setSmoothing(bool enabled) { getConverter().setSmoothing(enabled); }
44 
45  Poco::SharedPtr<StandBiomassCarbonCurve> getBiomassCarbonCurve(Int64 growthCurveID, Int64 spuID);
46 
47  private:
49  thread_local VolumeToBiomassConverter converter;
50  return converter;
51  }
52 
53  Poco::LRUCache<std::tuple<Int64, Int64>, StandBiomassCarbonCurve>& getCache() {
54  thread_local Poco::LRUCache<std::tuple<Int64, Int64>, StandBiomassCarbonCurve> cache;
55  return cache;
56  }
57 
58  };
59 
60 }}}
61 #endif
foresttypeconfiguration.h
moja::modules::cbm::VolumeToBiomassCarbonGrowth::VolumeToBiomassCarbonGrowth
VolumeToBiomassCarbonGrowth(bool smootherEnabled=true)
Definition: volumetobiomasscarbongrowth.h:22
moja::modules::cbm
Definition: ageclasshelper.cpp:12
moja::modules::cbm::VolumeToBiomassCarbonGrowth::getCache
Poco::LRUCache< std::tuple< Int64, Int64 >, StandBiomassCarbonCurve > & getCache()
Definition: volumetobiomasscarbongrowth.h:53
standbiomasscarboncurve.h
moja::modules::cbm::VolumeToBiomassConverter
Definition: volumetobiomassconverter.h:18
moja::modules::cbm::VolumeToBiomassCarbonGrowth::setSmoothing
void setSmoothing(bool enabled)
Definition: volumetobiomasscarbongrowth.h:43
moja::modules::cbm::StandGrowthCurve
Definition: standgrowthcurve.h:16
moja::modules::cbm::VolumeToBiomassCarbonGrowth
Definition: volumetobiomasscarbongrowth.h:20
rootbiomasscarbonincrement.h
volumetobiomassconverter.h
moja::modules::cbm::StandBiomassCarbonCurve
Definition: standbiomasscarboncurve.h:14
standgrowthcurve.h
moja
Definition: ageclasshelper.cpp:10
moja::modules::cbm::VolumeToBiomassCarbonGrowth::~VolumeToBiomassCarbonGrowth
virtual ~VolumeToBiomassCarbonGrowth()
Definition: volumetobiomasscarbongrowth.h:26
abovegroundbiomasscarbonincrement.h
moja::modules::cbm::VolumeToBiomassCarbonGrowth::getConverter
VolumeToBiomassConverter & getConverter()
Definition: volumetobiomasscarbongrowth.h:48