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

#include <cbmpeatlandspinupoutput.h>

Inheritance diagram for CBMPeatlandSpinupOutput:
Inheritance graph
Collaboration diagram for CBMPeatlandSpinupOutput:
Collaboration graph

Public Member Functions

 CBMPeatlandSpinupOutput ()
 
virtual ~CBMPeatlandSpinupOutput ()
 
void configure (const DynamicObject &config) override
 
void subscribe (NotificationCenter &notificationCenter) override
 
void doLocalDomainInit () override
 
void doTimingInit () override
 
void doLocalDomainShutdown () override
 
void doTimingStep () override
 
void doDisturbanceEvent (DynamicVar) override
 
void doPrePostDisturbanceEvent () 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 doLocalDomainProcessingUnitInit ()
 
virtual void doLocalDomainProcessingUnitShutdown ()
 
virtual void doPreTimingSequence ()
 
virtual void doTimingPrePostInit ()
 
virtual void doTimingPostInit ()
 
virtual void doTimingPostInit2 ()
 
virtual void doTimingShutdown ()
 
virtual void doTimingPreEndStep ()
 
virtual void doTimingEndStep ()
 
virtual void doTimingPostStep ()
 
virtual void doOutputStep ()
 
virtual void doError (std::string msg)
 
virtual void doPostDisturbanceEvent ()
 
virtual void doPostDisturbanceEvent2 ()
 
virtual void doPostNotification (short preMessageSignal)
 

Private Member Functions

std::string getTimeStamp ()
 
void outputPoolValues ()
 

Private Attributes

flint::IVariable * _peatland_spinup_rotation
 
flint::IVariable * _stand_age
 
flint::IVariable * _tree_age
 
flint::IVariable * _shrub_age
 
bool _runPeatland { false }
 
bool _isOutputLog { false }
 
bool _isSpinupFileCreated { false }
 
std::ofstream timeStepOutputFile
 
int _peatlandId { -1 }
 
int _fireReturnIntervalValue { -1 }
 
std::string _fileName
 
std::string _testRunId
 
std::string fileNameFixed
 

Constructor & Destructor Documentation

◆ CBMPeatlandSpinupOutput()

◆ ~CBMPeatlandSpinupOutput()

virtual ~CBMPeatlandSpinupOutput ( )
virtual

Member Function Documentation

◆ configure()

void configure ( const DynamicObject &  config)
override

Configuration function

Assign values of "spinup_output_file", "test_run_id", "log_output" in parameter config to CBMPeatlandSpinupOutput._fileName, CBMPeatlandSpinupOutput._testRunId and CBMPeatlandSpinupOutput._isOutputLog

Parameters
configDynamicObject&
Returns
void

◆ doDisturbanceEvent()

void doDisturbanceEvent ( DynamicVar  n)
overridevirtual

If CBMPeatlandSpinupOutput._isOutputLog,CBMPeatlandSpinupOutput._isSpinupFileCreated are true and
value of variable "peat_pool_cached" in _landUnitData is false, invoke CBMPeatlandSpinupOutput.outputPoolValues().

Parameters
DynamicVarn
Returns
void

Reimplemented from CBMModuleBase.

◆ doLocalDomainInit()

void doLocalDomainInit ( )
overridevirtual

Assign CBMPeatlandSpinupOutput._peatland_spinup_rotation as variable "peatland_spinup_rotation"
, CBMPeatlandSpinupOutput._tree_age as variable "peatland_smalltree_age" ,CBMPeatlandSpinupOutput._shrub_age as
variable "peatland_shrub_age", CBMPeatlandSpinupOutput._stand_age as variable "age" from _landUnitData
if CBMPeatlandSpinupOutput._isSpinupFileCreated is false and _landUnitData has variable "spinup_output_file"
Assign a variable fileName (string) the value of variable "spinup_output_file" in _landUnitData
If value of variable "fire_return_interval" in _landUnitData is not empty and has a value > 0,
value of variable "fire_return_interval" in _landUnitData is appended to variable fileName
else, the variable fileName is assigned the current timestamp

If a file with fileName does not exist, open the file using CBMPeatlandSpinupOutput._timeStepOutputFile and add each pool (from the second pool onwards) returned from poolCollection() in _landUnitData
else open the file using CBMPeatlandSpinupOutput._timeStepOutputFile.
Assign CBMPeatlandSpinupOutput._isOutputLog and CBMPeatlandSpinupOutput._isSpinupFileCreated to true.

Returns
void

Reimplemented from CBMModuleBase.

◆ doLocalDomainShutdown()

void doLocalDomainShutdown ( )
overridevirtual

If CBMPeatlandSpinupOutput.isSpinUpFileCreated, invoke CBMPeatlandSpinupOutput.timeStepOutputFile.flush() and CBMPeatlandSpinupOutput.timeStepOutputFile.close()

Returns
void

Reimplemented from CBMModuleBase.

◆ doPrePostDisturbanceEvent()

void doPrePostDisturbanceEvent ( )
overridevirtual

If CBMPeatlandSpinupOutput._isOutputLog,CBMPeatlandSpinupOutput._isSpinupFileCreated are true and
value of variable "peat_pool_cached" in _landUnitData is false, invoke CBMPeatlandSpinupOutput.outputPoolValues().

Returns
void

Reimplemented from CBMModuleBase.

◆ doTimingInit()

void doTimingInit ( )
overridevirtual

If the value of the variable "peatland_class" in _landUnitData is not empty and greater than 0,
Assign CBMPeatlandSpinupOutput._runPeatland to true and CBMPeatlandSpinupOutput._fireReturnIntervalValue the value of the variable "fire_return_interval" (integer),
if it is not empty, else a value of -1

Returns
void

Reimplemented from CBMModuleBase.

◆ doTimingStep()

void doTimingStep ( )
overridevirtual

If CBMPeatlandSpinupOutput._isOutputLog,CBMPeatlandSpinupOutput._isSpinupFileCreated are true and
value of variable "peat_pool_cached" in _landUnitData is false, invoke CBMPeatlandSpinupOutput.outputPoolValues().

Returns
void

Reimplemented from CBMModuleBase.

◆ getTimeStamp()

std::string getTimeStamp ( )
private

Get the timeStamp using Poco::LocalDateTime()

Returns
string

◆ outputPoolValues()

void outputPoolValues ( )
private

Print Pool Values.

If CBMPeatlandSpinupOutput._runPeatland and CBMPeatlandSpinupOutput._isOutputLog are true, Write into CBMPeatlandSpinupOutput.timeStepOutputFile the values CBMPeatlandSpinupOutput._peatlandId,
CBMPeatlandSpinupOutput._fireReturnIntervalValue, CBMPeatlandSpinupOutput._peatland_spinup_rotation,
and CBMPeatlandSpinupOutput._shrub_age
Add each pool (from the second pool onwards) returned from poolCollection() in _landUnitData and open the file using CBMPeatlandSpinupOutput._timeStepOutputFile.

Returns
void

◆ subscribe()

void subscribe ( NotificationCenter &  notificationCenter)
override

Subscribe to the signals LocalDomianInit,TimingInit,TimigEndStep,TimingStep, LocalDomainShutDown,DisturbanceEvent and PrePostDisturbanceEvent.

Parameters
notificationCenterNotificationCenter&
Returns
void

Member Data Documentation

◆ _fileName

std::string _fileName
private

◆ _fireReturnIntervalValue

int _fireReturnIntervalValue { -1 }
private

◆ _isOutputLog

bool _isOutputLog { false }
private

◆ _isSpinupFileCreated

bool _isSpinupFileCreated { false }
private

◆ _peatland_spinup_rotation

flint::IVariable* _peatland_spinup_rotation
private

◆ _peatlandId

int _peatlandId { -1 }
private

◆ _runPeatland

bool _runPeatland { false }
private

◆ _shrub_age

flint::IVariable* _shrub_age
private

◆ _stand_age

flint::IVariable* _stand_age
private

◆ _testRunId

std::string _testRunId
private

◆ _tree_age

flint::IVariable* _tree_age
private

◆ fileNameFixed

std::string fileNameFixed
private

◆ timeStepOutputFile

std::ofstream timeStepOutputFile
private

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