GCBM
Public Member Functions | Private Member Functions | Private Attributes | List of all members
CBMAggregatorLandUnitData Class Reference

#include <cbmaggregatorlandunitdata.h>

Inheritance diagram for CBMAggregatorLandUnitData:
Inheritance graph
Collaboration diagram for CBMAggregatorLandUnitData:
Collaboration graph

Public Member Functions

 CBMAggregatorLandUnitData (std::shared_ptr< flint::RecordAccumulatorWithMutex2< DateRow, DateRecord >> dateDimension, std::shared_ptr< flint::RecordAccumulatorWithMutex2< PoolInfoRow, PoolInfoRecord >> poolInfoDimension, std::shared_ptr< flint::RecordAccumulatorWithMutex2< ClassifierSetRow, ClassifierSetRecord >> classifierSetDimension, std::shared_ptr< flint::RecordAccumulatorWithMutex2< LandClassRow, LandClassRecord >> landClassDimension, std::shared_ptr< flint::RecordAccumulatorWithMutex2< TemporalLocationRow, TemporalLocationRecord >> locationDimension, std::shared_ptr< flint::RecordAccumulatorWithMutex2< ModuleInfoRow, ModuleInfoRecord >> moduleInfoDimension, std::shared_ptr< flint::RecordAccumulatorWithMutex2< DisturbanceTypeRow, DisturbanceTypeRecord >> disturbanceTypeDimension, std::shared_ptr< flint::RecordAccumulatorWithMutex2< DisturbanceRow, DisturbanceRecord >> disturbanceDimension, std::shared_ptr< std::vector< std::string >> classifierNames, std::shared_ptr< Poco::Mutex > classifierNamesLock, std::shared_ptr< flint::RecordAccumulatorWithMutex2< PoolRow, PoolRecord >> poolDimension, std::shared_ptr< flint::RecordAccumulatorWithMutex2< FluxRow, FluxRecord >> fluxDimension, std::shared_ptr< flint::RecordAccumulatorWithMutex2< AgeClassRow, AgeClassRecord >> AgeClassDimension, std::shared_ptr< flint::RecordAccumulatorWithMutex2< AgeAreaRow, AgeAreaRecord >> AgeAreaDimension, std::shared_ptr< flint::RecordAccumulatorWithMutex2< ErrorRow, ErrorRecord >> errorDimension, std::shared_ptr< flint::RecordAccumulatorWithMutex2< LocationErrorRow, LocationErrorRecord >> locationErrorDimension)
 
virtual ~CBMAggregatorLandUnitData ()=default
 
void configure (const DynamicObject &config) override
 
void subscribe (NotificationCenter &notificationCenter) override
 
flint::ModuleTypes moduleType () override
 
void doLocalDomainInit () override
 
void doTimingInit () override
 
void doOutputStep () override
 
void doError (std::string msg) override
 
- 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 doDisturbanceEvent (DynamicVar)
 
virtual void doPrePostDisturbanceEvent ()
 
virtual void doPostDisturbanceEvent ()
 
virtual void doPostDisturbanceEvent2 ()
 
virtual void doPostNotification (short preMessageSignal)
 

Private Member Functions

Int64 getPoolId (const flint::IPool *pool)
 
Int64 recordLocation (bool isSpinup)
 
void recordLandUnitData (bool isSpinup)
 
void recordPoolsSet (Int64 locationId)
 
void recordFluxSet (Int64 locationId)
 
void recordClassifierNames (const DynamicObject &classifierSet)
 
void recordAgeArea (Int64 locationId)
 
void recordAgeClass ()
 
bool hasDisturbanceInfo (std::shared_ptr< flint::IOperationResult > flux)
 

Private Attributes

std::shared_ptr< flint::RecordAccumulatorWithMutex2< DateRow, DateRecord > > _dateDimension
 
std::shared_ptr< flint::RecordAccumulatorWithMutex2< PoolInfoRow, PoolInfoRecord > > _poolInfoDimension
 
std::shared_ptr< flint::RecordAccumulatorWithMutex2< ClassifierSetRow, ClassifierSetRecord > > _classifierSetDimension
 
std::shared_ptr< flint::RecordAccumulatorWithMutex2< LandClassRow, LandClassRecord > > _landClassDimension
 
std::shared_ptr< flint::RecordAccumulatorWithMutex2< TemporalLocationRow, TemporalLocationRecord > > _locationDimension
 
std::shared_ptr< flint::RecordAccumulatorWithMutex2< ModuleInfoRow, ModuleInfoRecord > > _moduleInfoDimension
 
std::shared_ptr< flint::RecordAccumulatorWithMutex2< PoolRow, PoolRecord > > _poolDimension
 
std::shared_ptr< flint::RecordAccumulatorWithMutex2< FluxRow, FluxRecord > > _fluxDimension
 
std::shared_ptr< flint::RecordAccumulatorWithMutex2< AgeClassRow, AgeClassRecord > > _ageClassDimension
 
std::shared_ptr< flint::RecordAccumulatorWithMutex2< AgeAreaRow, AgeAreaRecord > > _ageAreaDimension
 
std::shared_ptr< flint::RecordAccumulatorWithMutex2< DisturbanceTypeRow, DisturbanceTypeRecord > > _disturbanceTypeDimension
 
std::shared_ptr< flint::RecordAccumulatorWithMutex2< DisturbanceRow, DisturbanceRecord > > _disturbanceDimension
 
std::shared_ptr< flint::RecordAccumulatorWithMutex2< ErrorRow, ErrorRecord > > _errorDimension
 
std::shared_ptr< flint::RecordAccumulatorWithMutex2< LocationErrorRow, LocationErrorRecord > > _locationErrorDimension
 
std::shared_ptr< std::vector< std::string > > _classifierNames
 
std::shared_ptr< Poco::Mutex > _classifierNamesLock
 
flint::IVariable * _classifierSet
 
flint::IVariable * _landClass
 
std::shared_ptr< const flint::SpatialLocationInfo > _spatialLocationInfo
 
double _landUnitArea
 
Int64 _previousLocationId
 
bool _isPrimaryAggregator
 
std::string _classifierSetVar
 
AgeClassHelper _ageClassHelper
 

Constructor & Destructor Documentation

◆ CBMAggregatorLandUnitData()

CBMAggregatorLandUnitData ( std::shared_ptr< flint::RecordAccumulatorWithMutex2< DateRow, DateRecord >>  dateDimension,
std::shared_ptr< flint::RecordAccumulatorWithMutex2< PoolInfoRow, PoolInfoRecord >>  poolInfoDimension,
std::shared_ptr< flint::RecordAccumulatorWithMutex2< ClassifierSetRow, ClassifierSetRecord >>  classifierSetDimension,
std::shared_ptr< flint::RecordAccumulatorWithMutex2< LandClassRow, LandClassRecord >>  landClassDimension,
std::shared_ptr< flint::RecordAccumulatorWithMutex2< TemporalLocationRow, TemporalLocationRecord >>  locationDimension,
std::shared_ptr< flint::RecordAccumulatorWithMutex2< ModuleInfoRow, ModuleInfoRecord >>  moduleInfoDimension,
std::shared_ptr< flint::RecordAccumulatorWithMutex2< DisturbanceTypeRow, DisturbanceTypeRecord >>  disturbanceTypeDimension,
std::shared_ptr< flint::RecordAccumulatorWithMutex2< DisturbanceRow, DisturbanceRecord >>  disturbanceDimension,
std::shared_ptr< std::vector< std::string >>  classifierNames,
std::shared_ptr< Poco::Mutex >  classifierNamesLock,
std::shared_ptr< flint::RecordAccumulatorWithMutex2< PoolRow, PoolRecord >>  poolDimension,
std::shared_ptr< flint::RecordAccumulatorWithMutex2< FluxRow, FluxRecord >>  fluxDimension,
std::shared_ptr< flint::RecordAccumulatorWithMutex2< AgeClassRow, AgeClassRecord >>  AgeClassDimension,
std::shared_ptr< flint::RecordAccumulatorWithMutex2< AgeAreaRow, AgeAreaRecord >>  AgeAreaDimension,
std::shared_ptr< flint::RecordAccumulatorWithMutex2< ErrorRow, ErrorRecord >>  errorDimension,
std::shared_ptr< flint::RecordAccumulatorWithMutex2< LocationErrorRow, LocationErrorRecord >>  locationErrorDimension 
)

◆ ~CBMAggregatorLandUnitData()

virtual ~CBMAggregatorLandUnitData ( )
virtualdefault

Member Function Documentation

◆ configure()

void configure ( const DynamicObject &  config)
override

Configuration function

Initialise CBMAggregatorLandUnitData._classifierSetVar as variable "reporting_classifier_set" in paramter config if it exists,
else to "classifier_set"

Parameters
configDynamicObject&
Returns
void

◆ doError()

void doError ( std::string  msg)
overridevirtual

doError

Detailed description here

Parameters
msgstring
Returns
void

Reimplemented from CBMModuleBase.

◆ doLocalDomainInit()

void doLocalDomainInit ( )
overridevirtual

Initiate Local Domain

Initialize spatial location info, classifier set and land class.

Returns
void

Reimplemented from CBMModuleBase.

◆ doOutputStep()

void doOutputStep ( )
overridevirtual

Invoke CBMAggregatorLandUnitData.recordLandUnitData() with argument false

Returns
void

Reimplemented from CBMModuleBase.

◆ doTimingInit()

void doTimingInit ( )
overridevirtual

initiate timing

Detailed description here

Returns
void

Reimplemented from CBMModuleBase.

◆ getPoolId()

Int64 getPoolId ( const flint::IPool *  pool)
private

Return the Pool Id.

Create an object poolInfo of class PoolInfoRecord,
Search poolInfo in CBMAggregatorLandUnitData._poolInfoDimension and return the Id

Parameters
poolIPool*
Returns
Int64

◆ hasDisturbanceInfo()

bool hasDisturbanceInfo ( std::shared_ptr< flint::IOperationResult >  flux)
private

Check for existence of disturbances

If method hasDataPackage() of parameter flux is false return false,
If paramter flux contains all the disturbance data return true, else return false

Parameters
fluxshared_ptr<IOperationResult>
Returns
bool

◆ moduleType()

flint::ModuleTypes moduleType ( )
override

◆ recordAgeArea()

void recordAgeArea ( Int64  locationId)
private

Record Age Area

Assign variable standAge the value of variable "age" in _landUnitArea,
ageClass as AgeClassHelper.toAgeClass() with argument standAge
, ageClassRange as AgeClassHelper.getAgeClass() with argument ageClass.
Instantiate object ageClassRecord of class AgeClassRecord with argument ageClassRange,
invoke the accumulate method on CBMAggregatorLandUnitData._ageClassDimension with argument ageClassRecord, assign it to ageClassId.
Instantiate object ageAreaRecord of class AgeAreaRecord with locationId, ageClassId, _landUnitArea.
Invoke accumulate method of CBMAggregatorLandUnitData._ageAreaDimension on ageAreaRecord

Parameters
locationIdInt64
Returns
void

◆ recordAgeClass()

void recordAgeClass ( )
private

Record Age Class

Instantiate object CBMAggregatorLandUnitData._ageClassHelper of class AgeClassHelper if _landUnitData has the variables "age_class_range" and "age_maximum",

For each ageClass in AgeClassHelper.getAgeClasses()

Returns
void

◆ recordClassifierNames()

void recordClassifierNames ( const DynamicObject &  classifierSet)
private

Record Classifier Names

Acquire Poco::Mutex::Scoped lock on *_classifierNamesLock
If CBMAggregatorLandUnitData._classifierNames is not empty,
for each classifier in paramter classifierSet, in the string classifier.first, replace '.' and ' '
by '_' and append it to CBMAggregatorLandUnitData._classifierNames

Parameters
classifierSetDynamicObject&
Returns
void

◆ recordFluxSet()

void recordFluxSet ( Int64  locationId)
private

Record the Flux Set

If Flux set, i.e if _landUnitData->getOperationLastAppliedIterator() is empty, return immediately.

Parameters
locationIdInt64
Returns
void

◆ recordLandUnitData()

void recordLandUnitData ( bool  isSpinup)
private

Record Land Unit Data

Assign the result of CBMAggregatorLandUnitData.recordLocation() to a variable locationId If the value of isSpinup is True, set CBMAggregatorLandUnitData._previousLocationId as locationId
invoke CBMAggregatorLandUnitData.recordPoolsSet(), CBMAggregatorLandUnitData.recordFluxSet(), CBMAggregatorLandUnitData.recordAgeArea() with parameter locationId
and set CBMAggregatorLandUnitData._previousLocationId as locationId

Parameters
isSpinupbool
Returns
void

◆ recordLocation()

Int64 recordLocation ( bool  isSpinup)
private

Record Location

If parameter isSpinup is true, instantiate an object of class DateRecord with default values, else assign it with the current time of the simulation from _landUnitData

If CBMAggregatorLandUnitData._classifierNames is empty, invoke CBMAggregatorLandUnitData.recordClassifierNames()

For each classifier in CBMAggregatorLandUnitData._classifierSet, append classifier.second to a variable classifierSet

Instantiate an object of class TemporalLocationRecord with parameters classifierSetRecordId, dateRecordId, landClassRecordId, ageClassId, _landUnitArea

Return the Id of accumulated value of locationRecord in CBMAggregatorLandUnitData._locationDimension

Parameters
isSpinupbool
Returns
Int64

◆ recordPoolsSet()

void recordPoolsSet ( Int64  locationId)
private

Record Pools Set

For each pool in _landUnitData->poolCollection(), create an object poolInfo of PoolInfoRecord with the pool name
Assign poolId the Id of poolInfo in CBMAggregatorLandUnitData._poolInfoDimension , poolValue pool->value() * CBMAggregatorLandUnitData._landUnitArea
Instantiate an object poolRecord of PoolRecord with locationId, poolId, poolValue
Invoke accumulate method of CBMAggregatorLandUnitData._poolDimension on poolRecord

Parameters
locationIdInt64
Returns
void

◆ subscribe()

void subscribe ( NotificationCenter &  notificationCenter)
override

Subcribe to the signals LocalDomainInit, TimingInit, OutputStep, Error

Parameters
notificationCenterNotificationCenter&
Returns
void

Member Data Documentation

◆ _ageAreaDimension

std::shared_ptr<flint::RecordAccumulatorWithMutex2<AgeAreaRow, AgeAreaRecord> > _ageAreaDimension
private

◆ _ageClassDimension

std::shared_ptr<flint::RecordAccumulatorWithMutex2<AgeClassRow, AgeClassRecord> > _ageClassDimension
private

◆ _ageClassHelper

AgeClassHelper _ageClassHelper
private

◆ _classifierNames

std::shared_ptr<std::vector<std::string> > _classifierNames
private

◆ _classifierNamesLock

std::shared_ptr<Poco::Mutex> _classifierNamesLock
private

◆ _classifierSet

flint::IVariable* _classifierSet
private

◆ _classifierSetDimension

std::shared_ptr<flint::RecordAccumulatorWithMutex2<ClassifierSetRow, ClassifierSetRecord> > _classifierSetDimension
private

◆ _classifierSetVar

std::string _classifierSetVar
private

◆ _dateDimension

std::shared_ptr<flint::RecordAccumulatorWithMutex2<DateRow, DateRecord> > _dateDimension
private

◆ _disturbanceDimension

std::shared_ptr<flint::RecordAccumulatorWithMutex2<DisturbanceRow, DisturbanceRecord> > _disturbanceDimension
private

◆ _disturbanceTypeDimension

std::shared_ptr<flint::RecordAccumulatorWithMutex2<DisturbanceTypeRow, DisturbanceTypeRecord> > _disturbanceTypeDimension
private

◆ _errorDimension

std::shared_ptr<flint::RecordAccumulatorWithMutex2<ErrorRow, ErrorRecord> > _errorDimension
private

◆ _fluxDimension

std::shared_ptr<flint::RecordAccumulatorWithMutex2<FluxRow, FluxRecord> > _fluxDimension
private

◆ _isPrimaryAggregator

bool _isPrimaryAggregator
private

◆ _landClass

flint::IVariable* _landClass
private

◆ _landClassDimension

std::shared_ptr<flint::RecordAccumulatorWithMutex2<LandClassRow, LandClassRecord> > _landClassDimension
private

◆ _landUnitArea

double _landUnitArea
private

◆ _locationDimension

std::shared_ptr<flint::RecordAccumulatorWithMutex2<TemporalLocationRow, TemporalLocationRecord> > _locationDimension
private

◆ _locationErrorDimension

std::shared_ptr<flint::RecordAccumulatorWithMutex2<LocationErrorRow, LocationErrorRecord> > _locationErrorDimension
private

◆ _moduleInfoDimension

std::shared_ptr<flint::RecordAccumulatorWithMutex2<ModuleInfoRow, ModuleInfoRecord> > _moduleInfoDimension
private

◆ _poolDimension

std::shared_ptr<flint::RecordAccumulatorWithMutex2<PoolRow, PoolRecord> > _poolDimension
private

◆ _poolInfoDimension

std::shared_ptr<flint::RecordAccumulatorWithMutex2<PoolInfoRow, PoolInfoRecord> > _poolInfoDimension
private

◆ _previousLocationId

Int64 _previousLocationId
private

◆ _spatialLocationInfo

std::shared_ptr<const flint::SpatialLocationInfo> _spatialLocationInfo
private

The documentation for this class was generated from the following files: