GCBM
|
#include <peatlanddisturbancemodule.h>
Public Member Functions | |
PeatlandDisturbanceModule () | |
virtual | ~PeatlandDisturbanceModule () |
void | configure (const DynamicObject &config) override |
void | subscribe (NotificationCenter ¬ificationCenter) override |
void | doDisturbanceEvent (DynamicVar) override |
void | doLocalDomainInit () override |
void | doTimingInit () override |
void | fetchPeatlandDistMatrices () |
void | fetchPeatlandDMAssociations () |
void | fetchPeatlandDistModifiers () |
Public Member Functions inherited from CBMModuleBase | |
virtual | ~CBMModuleBase ()=default |
void | onSystemInit () override |
void | onSystemShutdown () override |
void | onLocalDomainInit () override |
void | onLocalDomainShutdown () override |
void | onLocalDomainProcessingUnitInit () override |
void | onLocalDomainProcessingUnitShutdown () override |
void | onPreTimingSequence () override |
void | onTimingInit () override |
void | onTimingPrePostInit () override |
void | onTimingPostInit () override |
void | onTimingPostInit2 () override |
void | onTimingShutdown () override |
void | onTimingStep () override |
void | onTimingPreEndStep () override |
void | onTimingEndStep () override |
void | onTimingPostStep () override |
void | onOutputStep () override |
void | onPrePostDisturbanceEvent () override |
void | onPostDisturbanceEvent () override |
void | onPostDisturbanceEvent2 () override |
void | onError (std::string msg) override |
void | onDisturbanceEvent (DynamicVar e) override |
void | onPostNotification (short preMessageSignal) override |
virtual void | doSystemInit () |
virtual void | doSystemShutdown () |
virtual void | doLocalDomainShutdown () |
virtual void | doLocalDomainProcessingUnitInit () |
virtual void | doLocalDomainProcessingUnitShutdown () |
virtual void | doPreTimingSequence () |
virtual void | doTimingPrePostInit () |
virtual void | doTimingPostInit () |
virtual void | doTimingPostInit2 () |
virtual void | doTimingShutdown () |
virtual void | doTimingStep () |
virtual void | doTimingPreEndStep () |
virtual void | doTimingEndStep () |
virtual void | doTimingPostStep () |
virtual void | doOutputStep () |
virtual void | doError (std::string msg) |
virtual void | doPrePostDisturbanceEvent () |
virtual void | doPostDisturbanceEvent () |
virtual void | doPostDisturbanceEvent2 () |
virtual void | doPostNotification (short preMessageSignal) |
Public Attributes | |
std::string | fireEvent = "fire" |
Private Types | |
typedef std::vector< CBMDistEventTransfer > | EventVector |
typedef std::unordered_map< int, EventVector > | EventMap |
typedef std::vector< std::string > | modifierVector |
Private Attributes | |
EventMap | _matrices |
std::unordered_map< std::pair< int, std::string >, std::pair< int, int > > | _dmAssociations |
std::unordered_map< int, modifierVector > | _modifiers |
flint::IVariable * | _wtdModifier |
int | _peatlandId { -1 } |
bool | _runPeatland { false } |
|
private |
|
private |
|
private |
|
virtual |
|
override |
Configuration function
config | DynamicObject& |
|
overridevirtual |
Assign string variable disturbanceType as "disturbance" in parameter n.
Find the disturbance module using PeatlandDisturbanceModule._peatlandId and disturbanceType in PeatlandDisturbanceModule._dmAssociations.
If the disturbance module is not equal to the last value of PeatlandDisturbanceModule._dmAssociations,
Initialise variables distMatrix as "transfers" in parameter n,
dmIDandWtdModifer as the second value of the disturbance module, dmId as the first value of dmIDandWtdModifer,
wtdModifierId as the second value of dmIDandWtdModifier.Find wtdModifierId in PeatlandDisturbanceModule._modifiers and assign the second value to modifierVector variable vec.
Join vec by "," and assign the value to string variable modifiers. apply the modifier(WTD) up to years. If years is greater than 0, set PeatlandDisturbanceModule._wtdModifier value as modifiers.
find dmId in PeatlandDisturbanceModule._matrices and assign the value to a constant variable it.
if it is not equal to the last value of PeatlandDisturbanceModule._matrices
for each transfer in the second value of it, invoke CBMDistEventTransfer() using transfer and add to distMatrix.
else print out a log.
n | DynamicVar |
Reimplemented from CBMModuleBase.
|
overridevirtual |
Invoke fetchPeatlandDistMatrices(),fetchPeatlandDMAssociations() and fetchPeatlandDistModifiers().
Assign PeatlandDisturbanceModule._wtdModifier as "peatland_annual_wtd_modifiers" in _landUnitData.
Reimplemented from CBMModuleBase.
|
overridevirtual |
Assign PeatlandDisturbanceModule._peatlandId as "peatland_class" in _landUnitData,if not empty else assign it as 1.
Assign PeatlandDisturbanceModule._runPeatland as PeatlandDisturbanceModule._peatlandId greater than 0.
Reset PeatlandDisturbanceModule._wtdModifier value.
Reimplemented from CBMModuleBase.
void fetchPeatlandDistMatrices | ( | ) |
Clear PeatlandDisturbanceModule._matrices
For each transfer in variable "peatland_disturbance_matrices" in _landUnitData, create an object of CBMDistEventTransfer with *_landUnitData, transfer, and check if the disturbance matrix id, is present in PeatlandDisturbanceModule._matrices
If it is present, add the value of the disturbance matrix id, transfer to PeatlandDisturbanceModule._matrices, else the transfer to the iterator resulting from the value of disturbanceId in PeatlandDisturbanceModule._matrices
void fetchPeatlandDistModifiers | ( | ) |
Clear PeatlandDisturbanceModule._modifiers
For each modifier in "peatland_wtd_modifiers" in _landUnitData, get the value of "id", "year" and "modifier" and set it to variables modifierId, year and modifier.
If the modifierId is not in PeatlandDisturbanceModule._modifiers, each modifier will be recorded as "year_modifier" and added into PeatlandDisturbanceModule._modifiers, else add it to the iterator resulting from the value of modifierId in PeatlandDisturbanceModule._modifiers.
void fetchPeatlandDMAssociations | ( | ) |
Clear PeatlandDisturbanceModule._dmAssociations.
For each dmAssociation in "peatland_dm_associations" in _landUnitData, Initialise variables peatlandId as "peatland_id" in dmAssociation,
distType as "disturbance_type" in dmAssociation, dmId as "peatland_dm_id" in dmAssociation and wtdModifierId as "wtd_modifier_id" in dmAssociation.
Insert peatlandId,distType,dmId and wtdModifierId into PeatlandDisturbanceModule._dmAssociations.
|
override |
Subscribe signals LocalDomainInit,DisturbanceEvent and TimingInit
notificationCenter | NotificationCenter& |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
std::string fireEvent = "fire" |