GCBM
smoother.h
Go to the documentation of this file.
1 #ifndef MOJA_MODULES_CBM_SMOOTHER_H_
2 #define MOJA_MODULES_CBM_SMOOTHER_H_
3 
4 #include "moja/modules/cbm/_modules.cbm_exports.h"
5 #include "moja/flint/modulebase.h"
6 #include "standgrowthcurve.h"
8 
9 namespace moja {
10 namespace modules {
11 namespace cbm {
12 
13  class CBM_API Smoother {
14  public:
16  virtual ~Smoother() {};
17 
18  const int extendedRegionSize = 15;
19  const int smoothSampleSize = 50;
20  const int numerOfParameters = 2;
21 
22  void smooth(const StandGrowthCurve& standGrowthCurve,
23  ComponentBiomassCarbonCurve* carbonCurve,
24  SpeciesType speciesType);
25 
26  int getComponentSmoothingSubstitutionRegionPoint(
27  const StandGrowthCurve& standGrowthCurve,
28  SpeciesType speciesType);
29 
30  void prepareSmoothingInputData(const ComponentBiomassCarbonCurve& carbonCurve,
31  int substitutionPoint,
32  int standMaxAge);
33 
34  void clearAndReserveDataSpace(int workingFitingRange);
35 
36  void minimize(double yValues[], double startingVals[]);
37 
38  // To be passed as a function pointer.
39  static double weibull_2Parameter(double t, double* p);
40 
41  int getFinalFittingRegionAndReplaceData(
42  ComponentBiomassCarbonCurve& carbonCurve,
43  int substitutionPoint,
44  double merchCWeibullParameters[],
45  double foliageCWeibullParameters[],
46  double totalAGBioCWeibullParameters[]);
47 
48  std::vector<double>& smoothingMerchC() { return _smoothingMerchC; };
49  std::vector<double>& smoothingFoliageC() { return _smoothingFoliageC; };
50  std::vector<double>& smoothingOtherC() { return _smoothingOtherC; };
51  std::vector<double>& smoothingTotalAGBioC() { return _smoothingTotalAGBioC; };
52  std::vector<double>& smoothingAageSerials() { return _smoothingAageSerials; };
53 
54  private:
55  // Smoother uses following data vectors as working space to generate
56  // the data to add/replace the original data.
57  std::vector<double> _smoothingMerchC;
58  std::vector<double> _smoothingFoliageC;
59  std::vector<double> _smoothingOtherC;
60  std::vector<double> _smoothingTotalAGBioC;
61  std::vector<double> _smoothingAageSerials;
62 
63  double _smoothingMaxMerchC = 0;
64  double _smoothingMaxFoliageC = 0;
65  double _smoothingMaxOtherC = 0;
66  double _smoothingMaxTotalAGC = 0;
67  double _smoothingMaxAge = 0;
68  };
69 
70 }}}
71 #endif
componentbiomasscarboncurve.h
moja::modules::cbm::Smoother::smoothingOtherC
std::vector< double > & smoothingOtherC()
Definition: smoother.h:50
moja::modules::cbm::Smoother::smoothingMerchC
std::vector< double > & smoothingMerchC()
Definition: smoother.h:48
moja::modules::cbm
Definition: ageclasshelper.cpp:12
moja::modules::cbm::Smoother::Smoother
Smoother()
Definition: smoother.h:15
moja::modules::cbm::Smoother::smoothingFoliageC
std::vector< double > & smoothingFoliageC()
Definition: smoother.h:49
moja::modules::cbm::Smoother::~Smoother
virtual ~Smoother()
Definition: smoother.h:16
moja::modules::cbm::ComponentBiomassCarbonCurve
Definition: componentbiomasscarboncurve.h:14
moja::modules::cbm::SpeciesType
SpeciesType
Enumeration of tree species type, softwood or hardwood.
Definition: treespecies.h:14
moja::modules::cbm::Smoother::_smoothingAageSerials
std::vector< double > _smoothingAageSerials
Definition: smoother.h:61
moja::modules::cbm::Smoother
Definition: smoother.h:13
moja::modules::cbm::StandGrowthCurve
Definition: standgrowthcurve.h:16
moja::modules::cbm::Smoother::_smoothingOtherC
std::vector< double > _smoothingOtherC
Definition: smoother.h:59
moja::modules::cbm::Smoother::_smoothingFoliageC
std::vector< double > _smoothingFoliageC
Definition: smoother.h:58
moja::modules::cbm::Smoother::smoothingAageSerials
std::vector< double > & smoothingAageSerials()
Definition: smoother.h:52
moja::modules::cbm::Smoother::_smoothingTotalAGBioC
std::vector< double > _smoothingTotalAGBioC
Definition: smoother.h:60
standgrowthcurve.h
moja
Definition: ageclasshelper.cpp:10
moja::modules::cbm::Smoother::smoothingTotalAGBioC
std::vector< double > & smoothingTotalAGBioC()
Definition: smoother.h:51