GCBM
cbmpartitioningmodule.h
Go to the documentation of this file.
1 #ifndef MOJA_MODULES_CBM_PARTITIONING_MODULE_H_
2 #define MOJA_MODULES_CBM_PARTITIONING_MODULE_H_
3 
4 #include <list>
5 
6 #include "moja/modules/cbm/_modules.cbm_exports.h"
8 
9 namespace moja {
10 namespace modules {
11 namespace cbm {
12 
13  class IRecoveryRule;
14 
15  class CBM_API CBMPartitioningModule : public CBMModuleBase {
16  public:
18  virtual ~CBMPartitioningModule() {};
19 
20  void subscribe(NotificationCenter& notificationCenter) override;
21 
22  void doLocalDomainInit() override;
23  void doTimingInit() override;
24  void doDisturbanceEvent(DynamicVar e) override;
25  void doTimingStep() override;
26 
27  private:
28  std::list<std::shared_ptr<IRecoveryRule>> _activeRecoveryRules;
29  std::list<std::shared_ptr<IRecoveryRule>> _pendingRecoveryRules;
30  double _cumulativeMortality = 0.0;
31  int _spuId;
32  std::map<std::string, std::map<int, double>> _disturbanceMortality;
33  std::map<std::string, std::string> _disturbanceCategories;
34  std::map<std::string, std::map<int, std::tuple<std::string, DynamicVar>>> _initialRecoveryRules;
35  std::map<std::string, std::map<int, std::tuple<std::string, DynamicVar>>> _recoveryRules;
36 
37  std::vector<const flint::IPool*> _agBiomassPools;
38  std::vector<const flint::IPool*> _totalBiomassPools;
39  std::vector<const flint::IPool*> _totalEcoPools;
40 
41  flint::IVariable* _partition;
42  flint::IVariable* _spinupParameters;
43  flint::IVariable* _spu;
44 
45  void fetchRecoveryRules();
46 
47  std::shared_ptr<IRecoveryRule> createInitialRecoveryRule(std::string disturbanceType);
48  std::shared_ptr<IRecoveryRule> createRecoveryRule(std::string disturbanceType);
49 
50  void doSmallDisturbanceEvent(std::string disturbanceType, double mortality);
51  void doLargeDisturbanceEvent(std::string disturbanceType);
52  };
53 }}}
54 #endif
moja::modules::cbm::CBMPartitioningModule::_agBiomassPools
std::vector< const flint::IPool * > _agBiomassPools
Definition: cbmpartitioningmodule.h:37
moja::modules::cbm::CBMPartitioningModule::_totalEcoPools
std::vector< const flint::IPool * > _totalEcoPools
Definition: cbmpartitioningmodule.h:39
moja::modules::cbm::CBMPartitioningModule::_activeRecoveryRules
std::list< std::shared_ptr< IRecoveryRule > > _activeRecoveryRules
Definition: cbmpartitioningmodule.h:28
moja::modules::cbm::CBMPartitioningModule::_disturbanceMortality
std::map< std::string, std::map< int, double > > _disturbanceMortality
Definition: cbmpartitioningmodule.h:32
moja::modules::cbm
Definition: ageclasshelper.cpp:12
moja::modules::cbm::CBMPartitioningModule::_initialRecoveryRules
std::map< std::string, std::map< int, std::tuple< std::string, DynamicVar > > > _initialRecoveryRules
Definition: cbmpartitioningmodule.h:34
moja::modules::cbm::CBMPartitioningModule::_recoveryRules
std::map< std::string, std::map< int, std::tuple< std::string, DynamicVar > > > _recoveryRules
Definition: cbmpartitioningmodule.h:35
moja::modules::cbm::CBMModuleBase
Definition: cbmmodulebase.h:22
moja::modules::cbm::CBMPartitioningModule
Definition: cbmpartitioningmodule.h:15
moja::modules::cbm::CBMPartitioningModule::_spinupParameters
flint::IVariable * _spinupParameters
Definition: cbmpartitioningmodule.h:42
moja::modules::cbm::CBMPartitioningModule::_pendingRecoveryRules
std::list< std::shared_ptr< IRecoveryRule > > _pendingRecoveryRules
Definition: cbmpartitioningmodule.h:29
moja::modules::cbm::CBMPartitioningModule::~CBMPartitioningModule
virtual ~CBMPartitioningModule()
Definition: cbmpartitioningmodule.h:18
moja::modules::cbm::CBMPartitioningModule::CBMPartitioningModule
CBMPartitioningModule()
Definition: cbmpartitioningmodule.h:17
moja::modules::cbm::CBMPartitioningModule::_totalBiomassPools
std::vector< const flint::IPool * > _totalBiomassPools
Definition: cbmpartitioningmodule.h:38
moja::modules::cbm::CBMPartitioningModule::_partition
flint::IVariable * _partition
Definition: cbmpartitioningmodule.h:41
moja::modules::cbm::CBMPartitioningModule::_spuId
int _spuId
Definition: cbmpartitioningmodule.h:31
moja::modules::cbm::CBMPartitioningModule::_spu
flint::IVariable * _spu
Definition: cbmpartitioningmodule.h:43
moja::modules::cbm::CBMPartitioningModule::_disturbanceCategories
std::map< std::string, std::string > _disturbanceCategories
Definition: cbmpartitioningmodule.h:33
moja
Definition: ageclasshelper.cpp:10
cbmmodulebase.h