Go to the documentation of this file. 1 #ifndef MOJA_MODULES_CBM_CBMGROWTHMULTIPLIERMODULE_H_
2 #define MOJA_MODULES_CBM_CBMGROWTHMULTIPLIERMODULE_H_
7 #include <boost/format.hpp>
8 #include <boost/algorithm/string/join.hpp>
9 #include <boost/algorithm/string.hpp>
11 #include <unordered_map>
28 void add(
int timestep,
double multiplier) {
33 return end() ? 1.0 :
pos++->second;
41 std::vector<std::string> multipliers;
43 multipliers.push_back((
44 boost::format(
"%1%: %2%") % growthMultiplier.first % growthMultiplier.second
48 return boost::algorithm::join(multipliers,
", ");
53 std::map<int, double>::iterator
pos;
58 void add(std::string forestType,
int timestep,
double multiplier) {
61 it->second.add(timestep, multiplier);
68 std::unordered_map<std::string, double>
next() {
69 std::unordered_map<std::string, double> currentMultipliers;
71 currentMultipliers[series.first] = series.second.next();
74 return currentMultipliers;
79 if (!series.second.end()) {
89 std::vector<std::string> multiplierComponents;
91 multiplierComponents.push_back((
92 boost::format(
"[%1%: %2%]") % series.first % series.second.toString()
96 return boost::algorithm::join(multiplierComponents,
", ");
108 void configure(
const DynamicObject& config)
override;
109 void subscribe(NotificationCenter& notificationCenter)
override;
111 flint::ModuleTypes
moduleType() {
return flint::ModuleTypes::DisturbanceEvent; };
131 #endif // MOJA_MODULES_CBM_CBMGROWTHMULTIPLIERMODULE_H_
void advanceMultipliers()
Definition: growthmultipliermodule.cpp:153
std::string toString()
Definition: growthmultipliermodule.h:40
bool _debuggingEnabled
Definition: growthmultipliermodule.h:124
double next()
Definition: growthmultipliermodule.h:32
Definition: ageclasshelper.cpp:12
Definition: growthmultipliermodule.h:103
Definition: cbmmodulebase.h:22
std::map< int, double > multipliersByTimestep
Definition: growthmultipliermodule.h:52
void subscribe(NotificationCenter ¬ificationCenter) override
Definition: growthmultipliermodule.cpp:39
void add(std::string forestType, int timestep, double multiplier)
Definition: growthmultipliermodule.h:58
Definition: growthmultipliermodule.h:56
flint::ModuleTypes moduleType()
Definition: growthmultipliermodule.h:111
std::map< int, double >::iterator pos
Definition: growthmultipliermodule.h:53
GrowthMultiplierModule()
Definition: growthmultipliermodule.h:105
virtual void doLocalDomainInit() override
Definition: growthmultipliermodule.cpp:57
virtual void doTimingStep() override
Definition: growthmultipliermodule.cpp:136
GrowthMultiplierSeries()
Definition: growthmultipliermodule.h:19
void configure(const DynamicObject &config) override
Definition: growthmultipliermodule.cpp:27
void clearMultipliers()
Definition: growthmultipliermodule.cpp:121
void add(int timestep, double multiplier)
Definition: growthmultipliermodule.h:28
flint::IVariable * _currentGrowthMultipliers
Definition: growthmultipliermodule.h:125
virtual void doDisturbanceEvent(DynamicVar) override
Definition: growthmultipliermodule.cpp:173
bool _moduleEnabled
Definition: growthmultipliermodule.h:123
std::string toString()
Definition: growthmultipliermodule.h:88
virtual ~GrowthMultiplierModule()=default
virtual void doTimingShutdown() override
Definition: growthmultipliermodule.cpp:111
GrowthMultiplierSeries(const GrowthMultiplierSeries &rhs)
Definition: growthmultipliermodule.h:23
GrowthMultiplierSet _activeMultiplierSet
Definition: growthmultipliermodule.h:127
bool end()
Definition: growthmultipliermodule.h:36
bool end()
Definition: growthmultipliermodule.h:77
std::unordered_map< std::string, double > next()
Definition: growthmultipliermodule.h:68
std::unordered_map< std::string, GrowthMultiplierSeries > seriesByForestType
Definition: growthmultipliermodule.h:100
Definition: growthmultipliermodule.h:17
Definition: ageclasshelper.cpp:10
virtual void doTimingInit() override
Definition: growthmultipliermodule.cpp:102
std::unordered_map< std::string, GrowthMultiplierSet > _growthMultiplierSets
Definition: growthmultipliermodule.h:126