GCBM
cbmflataggregatorlandunitdata.h
Go to the documentation of this file.
1 #ifndef MOJA_MODULES_CBM_CBMFLATAGGREGATORLANDUNITDATA_H_
2 #define MOJA_MODULES_CBM_CBMFLATAGGREGATORLANDUNITDATA_H_
3 
4 #include "moja/modules/cbm/_modules.cbm_exports.h"
8 #include "moja/flint/spatiallocationinfo.h"
9 
10 #include <Poco/Mutex.h>
11 
12 #include <vector>
13 #include <optional>
14 
15 namespace moja {
16 namespace flint {
17  template<class TPersistable, class TRecord>
18  class RecordAccumulatorWithMutex2;
19 }
20 
21 namespace modules {
22 namespace cbm {
23 
25  public:
32  std::shared_ptr<std::vector<std::string>> classifierNames,
33  std::shared_ptr<Poco::Mutex> classifierNamesLock)
34  : CBMModuleBase(),
35  _fluxDimension(fluxDimension),
36  _poolDimension(poolDimension),
37  _errorDimension(errorDimension),
38  _ageDimension(ageDimension),
39  _disturbanceDimension(disturbanceDimension),
40  _classifierNames(classifierNames),
41  _classifierNamesLock(classifierNamesLock),
42  _landUnitArea(0),
43  _previousAttributes() {}
44 
45  virtual ~CBMFlatAggregatorLandUnitData() = default;
46 
47  void configure(const DynamicObject& config) override;
48  void subscribe(NotificationCenter& notificationCenter) override;
49 
50  flint::ModuleTypes moduleType() override { return flint::ModuleTypes::System; };
51 
52  void doLocalDomainInit() override;
53  void doTimingInit() override;
54  void doOutputStep() override;
55  void doError(std::string msg) override;
56 
57  private:
58  std::shared_ptr<flint::RecordAccumulatorWithMutex2<std::string, FlatFluxRecord>> _fluxDimension;
59  std::shared_ptr<flint::RecordAccumulatorWithMutex2<std::string, FlatPoolRecord>> _poolDimension;
60  std::shared_ptr<flint::RecordAccumulatorWithMutex2<std::string, FlatErrorRecord>> _errorDimension;
61  std::shared_ptr<flint::RecordAccumulatorWithMutex2<std::string, FlatAgeAreaRecord>> _ageDimension;
62  std::shared_ptr<flint::RecordAccumulatorWithMutex2<std::string, FlatDisturbanceRecord>> _disturbanceDimension;
63  std::shared_ptr<std::vector<std::string>> _classifierNames;
64  std::shared_ptr<Poco::Mutex> _classifierNamesLock;
65 
66  flint::IVariable* _classifierSet;
67  flint::IVariable* _landClass;
68 
69  std::shared_ptr<const flint::SpatialLocationInfo> _spatialLocationInfo;
70  double _landUnitArea;
71  std::optional<FlatAgeAreaRecord> _previousAttributes;
73  std::string _classifierSetVar;
75 
76  FlatAgeAreaRecord recordLocation(bool isSpinup);
77  void recordLandUnitData(bool isSpinup);
78  void recordPoolsSet(const FlatAgeAreaRecord& location);
79  void recordFluxSet(const FlatAgeAreaRecord& location);
80  void recordClassifierNames(const DynamicObject& classifierSet);
81  bool hasDisturbanceInfo(std::shared_ptr<flint::IOperationResult> flux);
82  };
83 
84 }}} // namespace moja::modules::cbm
85 
86 #endif // MOJA_MODULES_CBM_CBMFLATAGGREGATORLANDUNITDATA_H_
moja::modules::cbm::FlatAgeAreaRecord
Definition: flatrecord.h:119
moja::modules::cbm
Definition: ageclasshelper.cpp:12
flatrecord.h
moja::modules::cbm::CBMFlatAggregatorLandUnitData::_isPrimaryAggregator
bool _isPrimaryAggregator
Definition: cbmflataggregatorlandunitdata.h:72
moja::modules::cbm::CBMFlatAggregatorLandUnitData::_fluxDimension
std::shared_ptr< flint::RecordAccumulatorWithMutex2< std::string, FlatFluxRecord > > _fluxDimension
Definition: cbmflataggregatorlandunitdata.h:58
moja::flint::RecordAccumulatorWithMutex2
Definition: cbmaggregatorcsvwriter.h:21
moja::modules::cbm::CBMFlatAggregatorLandUnitData
Definition: cbmflataggregatorlandunitdata.h:24
moja::modules::cbm::CBMModuleBase
Definition: cbmmodulebase.h:22
moja::modules::cbm::CBMFlatAggregatorLandUnitData::_ageClassHelper
AgeClassHelper _ageClassHelper
Definition: cbmflataggregatorlandunitdata.h:74
moja::modules::cbm::CBMFlatAggregatorLandUnitData::_landClass
flint::IVariable * _landClass
Definition: cbmflataggregatorlandunitdata.h:67
moja::modules::cbm::CBMFlatAggregatorLandUnitData::_spatialLocationInfo
std::shared_ptr< const flint::SpatialLocationInfo > _spatialLocationInfo
Definition: cbmflataggregatorlandunitdata.h:69
moja::modules::cbm::CBMFlatAggregatorLandUnitData::_classifierSetVar
std::string _classifierSetVar
Definition: cbmflataggregatorlandunitdata.h:73
moja::modules::cbm::CBMFlatAggregatorLandUnitData::_ageDimension
std::shared_ptr< flint::RecordAccumulatorWithMutex2< std::string, FlatAgeAreaRecord > > _ageDimension
Definition: cbmflataggregatorlandunitdata.h:61
moja::modules::cbm::CBMFlatAggregatorLandUnitData::_errorDimension
std::shared_ptr< flint::RecordAccumulatorWithMutex2< std::string, FlatErrorRecord > > _errorDimension
Definition: cbmflataggregatorlandunitdata.h:60
moja::flint
Definition: cbmaggregatorcsvwriter.h:19
moja::modules::cbm::CBMFlatAggregatorLandUnitData::_previousAttributes
std::optional< FlatAgeAreaRecord > _previousAttributes
Definition: cbmflataggregatorlandunitdata.h:71
moja::modules::cbm::CBMFlatAggregatorLandUnitData::moduleType
flint::ModuleTypes moduleType() override
Definition: cbmflataggregatorlandunitdata.h:50
moja::modules::cbm::CBMFlatAggregatorLandUnitData::_poolDimension
std::shared_ptr< flint::RecordAccumulatorWithMutex2< std::string, FlatPoolRecord > > _poolDimension
Definition: cbmflataggregatorlandunitdata.h:59
moja::modules::cbm::CBMFlatAggregatorLandUnitData::_disturbanceDimension
std::shared_ptr< flint::RecordAccumulatorWithMutex2< std::string, FlatDisturbanceRecord > > _disturbanceDimension
Definition: cbmflataggregatorlandunitdata.h:62
moja::modules::cbm::AgeClassHelper
Definition: ageclasshelper.h:11
moja::modules::cbm::CBMFlatAggregatorLandUnitData::_classifierNames
std::shared_ptr< std::vector< std::string > > _classifierNames
Definition: cbmflataggregatorlandunitdata.h:63
moja::modules::cbm::CBMFlatAggregatorLandUnitData::_classifierNamesLock
std::shared_ptr< Poco::Mutex > _classifierNamesLock
Definition: cbmflataggregatorlandunitdata.h:64
moja::modules::cbm::CBMFlatAggregatorLandUnitData::_classifierSet
flint::IVariable * _classifierSet
Definition: cbmflataggregatorlandunitdata.h:66
ageclasshelper.h
moja
Definition: ageclasshelper.cpp:10
cbmmodulebase.h
moja::modules::cbm::CBMFlatAggregatorLandUnitData::_landUnitArea
double _landUnitArea
Definition: cbmflataggregatorlandunitdata.h:70
moja::modules::cbm::CBMFlatAggregatorLandUnitData::CBMFlatAggregatorLandUnitData
CBMFlatAggregatorLandUnitData(std::shared_ptr< flint::RecordAccumulatorWithMutex2< std::string, FlatFluxRecord >> fluxDimension, std::shared_ptr< flint::RecordAccumulatorWithMutex2< std::string, FlatPoolRecord >> poolDimension, std::shared_ptr< flint::RecordAccumulatorWithMutex2< std::string, FlatErrorRecord >> errorDimension, std::shared_ptr< flint::RecordAccumulatorWithMutex2< std::string, FlatAgeAreaRecord >> ageDimension, std::shared_ptr< flint::RecordAccumulatorWithMutex2< std::string, FlatDisturbanceRecord >> disturbanceDimension, std::shared_ptr< std::vector< std::string >> classifierNames, std::shared_ptr< Poco::Mutex > classifierNamesLock)
Definition: cbmflataggregatorlandunitdata.h:26