GCBM
componentbiomasscarboncurve.h
Go to the documentation of this file.
1 #ifndef MOJA_MODULES_CBM_COMPONENTBIOMASSCARBONCURVE_H_
2 #define MOJA_MODULES_CBM_COMPONENTBIOMASSCARBONCURVE_H_
3 
4 #include "moja/modules/cbm/_modules.cbm_exports.h"
5 #include "moja/flint/modulebase.h"
6 
7 namespace moja {
8 namespace modules {
9 namespace cbm {
10 
11  /*
12  * ADT - component carbon curve (softwood and hardwood components)
13  */
15  public:
17  virtual ~ComponentBiomassCarbonCurve() = default;
18 
19  ComponentBiomassCarbonCurve(int maxAge);
20 
21  double getMerchCarbonIncrement(int age) const;
22  double getFoliageCarbonIncrement(int age) const;
23  double getOtherCarbonIncrement(int age) const;
24 
25  double getMerchCarbonAtAge(int age) const;
26  double getFoliageCarbonAtAge(int age) const;
27  double getOtherCarbonAtAge(int age) const;
28 
29  std::vector<double> getAboveGroundCarbonCurve() const;
30 
31  const std::vector<double>& getMerchCarbonCurve() const;
32  const std::vector<double>& getFoliageCarbonCurve() const;
33  const std::vector<double>& getOtherCarbonCurve() const;
34 
35  void setMerchCarbonAtAge(int age, double value);
36  void setFoliageCarbonAtAge(int age, double value);
37  void setOtherCarbonAtAge(int age, double value);
38 
39  private:
40  int _maxAge = 1;
41  std::vector<double> _merchCarbonIncrements;
42  std::vector<double> _foliageCarbonIncrements;
43  std::vector<double> _otherCarbonIncrements;
44  };
45 
47  if (age >= _merchCarbonIncrements.size() - 1) {
48  return 0;
49  }
50 
51  int nextAge = age + 1;
52  return _merchCarbonIncrements[nextAge] - _merchCarbonIncrements[age];
53  }
54 
56  if (age >= _foliageCarbonIncrements.size() - 1) {
57  return 0;
58  }
59 
60  int nextAge = age + 1;
62  }
63 
65  if (age >= _otherCarbonIncrements.size() - 1) {
66  return 0;
67  }
68 
69  int nextAge = age + 1;
70  return _otherCarbonIncrements[nextAge] - _otherCarbonIncrements[age];
71  }
72 
73  inline void ComponentBiomassCarbonCurve::setMerchCarbonAtAge(int age, double value) {
74  if (_merchCarbonIncrements.size() < age + 1) {
75  _merchCarbonIncrements.resize(age + 1, 0);
76  }
77 
78  _merchCarbonIncrements[age] = value;
79  };
80 
81  inline void ComponentBiomassCarbonCurve::setFoliageCarbonAtAge(int age, double value) {
82  if (_foliageCarbonIncrements.size() < age + 1) {
83  _foliageCarbonIncrements.resize(age + 1, 0);
84  }
85 
86  _foliageCarbonIncrements[age] = value;
87  };
88 
89  inline void ComponentBiomassCarbonCurve::setOtherCarbonAtAge(int age, double value) {
90  if (_otherCarbonIncrements.size() < age + 1) {
91  _otherCarbonIncrements.resize(age + 1, 0);
92  }
93 
94  _otherCarbonIncrements[age] = value;
95  };
96 
97  inline double ComponentBiomassCarbonCurve::getMerchCarbonAtAge(int age) const {
100  };
101 
105  };
106 
109  : _otherCarbonIncrements[age];
110  };
111 
112  inline std::vector<double> ComponentBiomassCarbonCurve::getAboveGroundCarbonCurve() const {
113  std::vector<double> agCarbon;
114  for (int i = 0; i < _maxAge; i++) {
115  agCarbon.push_back(
119  }
120 
121  return agCarbon;
122  }
123 
124  inline const std::vector<double>& ComponentBiomassCarbonCurve::getMerchCarbonCurve() const {
125  return _merchCarbonIncrements;
126  }
127 
128  inline const std::vector<double>& ComponentBiomassCarbonCurve::getFoliageCarbonCurve() const {
130  }
131 
132  inline const std::vector<double>& ComponentBiomassCarbonCurve::getOtherCarbonCurve() const {
133  return _otherCarbonIncrements;
134  }
135 
136 }}}
137 #endif
moja::modules::cbm::ComponentBiomassCarbonCurve::_foliageCarbonIncrements
std::vector< double > _foliageCarbonIncrements
Definition: componentbiomasscarboncurve.h:42
moja::modules::cbm::ComponentBiomassCarbonCurve::getOtherCarbonAtAge
double getOtherCarbonAtAge(int age) const
Definition: componentbiomasscarboncurve.h:107
moja::modules::cbm
Definition: ageclasshelper.cpp:12
moja::modules::cbm::ComponentBiomassCarbonCurve::getFoliageCarbonAtAge
double getFoliageCarbonAtAge(int age) const
Definition: componentbiomasscarboncurve.h:102
moja::modules::cbm::ComponentBiomassCarbonCurve::_otherCarbonIncrements
std::vector< double > _otherCarbonIncrements
Definition: componentbiomasscarboncurve.h:43
moja::modules::cbm::ComponentBiomassCarbonCurve::getMerchCarbonCurve
const std::vector< double > & getMerchCarbonCurve() const
Definition: componentbiomasscarboncurve.h:124
moja::modules::cbm::ComponentBiomassCarbonCurve::ComponentBiomassCarbonCurve
ComponentBiomassCarbonCurve()
Definition: componentbiomasscarboncurve.h:16
moja::modules::cbm::ComponentBiomassCarbonCurve::getAboveGroundCarbonCurve
std::vector< double > getAboveGroundCarbonCurve() const
Definition: componentbiomasscarboncurve.h:112
moja::modules::cbm::ComponentBiomassCarbonCurve
Definition: componentbiomasscarboncurve.h:14
moja::modules::cbm::ComponentBiomassCarbonCurve::getFoliageCarbonIncrement
double getFoliageCarbonIncrement(int age) const
Definition: componentbiomasscarboncurve.h:55
moja::modules::cbm::ComponentBiomassCarbonCurve::getFoliageCarbonCurve
const std::vector< double > & getFoliageCarbonCurve() const
Definition: componentbiomasscarboncurve.h:128
moja::modules::cbm::ComponentBiomassCarbonCurve::getOtherCarbonCurve
const std::vector< double > & getOtherCarbonCurve() const
Definition: componentbiomasscarboncurve.h:132
moja::modules::cbm::ComponentBiomassCarbonCurve::getMerchCarbonAtAge
double getMerchCarbonAtAge(int age) const
Definition: componentbiomasscarboncurve.h:97
moja::modules::cbm::ComponentBiomassCarbonCurve::setMerchCarbonAtAge
void setMerchCarbonAtAge(int age, double value)
Definition: componentbiomasscarboncurve.h:73
moja::modules::cbm::ComponentBiomassCarbonCurve::setOtherCarbonAtAge
void setOtherCarbonAtAge(int age, double value)
Definition: componentbiomasscarboncurve.h:89
moja::modules::cbm::ComponentBiomassCarbonCurve::getMerchCarbonIncrement
double getMerchCarbonIncrement(int age) const
Definition: componentbiomasscarboncurve.h:46
moja::modules::cbm::ComponentBiomassCarbonCurve::_merchCarbonIncrements
std::vector< double > _merchCarbonIncrements
Definition: componentbiomasscarboncurve.h:41
moja::modules::cbm::ComponentBiomassCarbonCurve::setFoliageCarbonAtAge
void setFoliageCarbonAtAge(int age, double value)
Definition: componentbiomasscarboncurve.h:81
moja::modules::cbm::ComponentBiomassCarbonCurve::getOtherCarbonIncrement
double getOtherCarbonIncrement(int age) const
Definition: componentbiomasscarboncurve.h:64
moja
Definition: ageclasshelper.cpp:10
moja::modules::cbm::ComponentBiomassCarbonCurve::_maxAge
int _maxAge
Definition: componentbiomasscarboncurve.h:40