Go to the documentation of this file. 1 #ifndef MOJA_MODULES_SAWTOOTH_SAWTOOTHMODULE_H_
2 #define MOJA_MODULES_SAWTOOTH_SAWTOOTHMODULE_H_
3 #include "moja/modules/sawtooth/_modules.sawtooth_exports.h"
6 #include "sawtooth/exports.h"
7 #include <moja/timeseries.h>
8 #include <unordered_map>
9 #include <unordered_set>
45 template <
class TMat,
class TElem>
48 std::shared_ptr<TMat>
Mat;
55 Mat = std::make_shared<TMat>();
56 Values = std::shared_ptr<TElem>(
new TElem[nrow*ncol]);
57 std::fill_n(
Values.get(), nrow*ncol, defaultValue);
68 return Get()->GetValue(row, col);
71 void SetValue(
size_t row,
size_t col, TElem value) {
72 Get()->SetValue(row, col, value);
81 void configure(
const DynamicObject& config)
override;
82 void subscribe(NotificationCenter& notificationCenter)
override;
84 void doLocalDomainInit()
override;
85 void doTimingInit()
override;
86 void doTimingStep()
override;
87 void doTimingShutdown()
override;
88 void doSystemShutdown()
override;
89 void onDisturbanceEvent(DynamicVar e)
override;
95 void LoadEnvironmentData();
113 void Step(
long plot_id,
int year,
int disturbance_type_id);
118 std::unordered_set<const moja::flint::IPool*>
bioPools;
202 bool shouldRun()
const;
203 Sawtooth_ModelMeta InitializeModelMeta(
const DynamicObject& config);
204 void AllocateSpecies(
int* species,
size_t max_density,
const Site_data& site_data);
205 void SawtoothModule::adjustPartialMatrix(DynamicVar e,
206 const Sawtooth_CBMBiomassPools& disturbanceLosses);
const flint::IPool * _hardwoodStemSnag
Definition: sawtoothmodule.h:176
std::shared_ptr< TElem > Values
Definition: sawtoothmodule.h:49
std::vector< Environment_data > environmentData
Definition: sawtoothmodule.h:97
SawtoothMatrixWrapper< Sawtooth_Matrix_Int, int > speciesList
Definition: sawtoothmodule.h:120
SawtoothMatrixWrapper< Sawtooth_Matrix_Int, int > RegionId_mat
Definition: sawtoothmodule.h:156
SawtoothMatrixWrapper< Sawtooth_Matrix, double > ws_gs_z_mat
Definition: sawtoothmodule.h:131
const flint::IPool * _atmosphere
Definition: sawtoothmodule.h:179
SawtoothMatrixWrapper< Sawtooth_Matrix, double > tmean_gs_mat
Definition: sawtoothmodule.h:124
SawtoothMatrixWrapper< Sawtooth_Matrix_Int, int > StumpParmeterId_mat
Definition: sawtoothmodule.h:153
double _otherToBranchSnagSplit
Definition: sawtoothmodule.h:194
double _softwoodFoliageFallRate
Definition: sawtoothmodule.h:189
const flint::IPool * _softwoodOther
Definition: sawtoothmodule.h:159
SawtoothMatrixWrapper< Sawtooth_Matrix, double > TotalBiomassCarbon_mat
Definition: sawtoothmodule.h:143
Definition: ageclasshelper.cpp:12
flint::IVariable * _standSPUID
Definition: sawtoothmodule.h:187
double ca
Definition: sawtoothmodule.h:27
const flint::IPool * _hardwoodMerch
Definition: sawtoothmodule.h:164
SawtoothMatrixWrapper< Sawtooth_Matrix, double > MeanBiomassCarbon_mat
Definition: sawtoothmodule.h:145
double _coarseRootTurnProp
Definition: sawtoothmodule.h:198
Sawtooth_Spatial_Variable spatialVar
Definition: sawtoothmodule.h:104
bool WasDisturbed
Definition: sawtoothmodule.h:112
const flint::IPool * _softwoodFineRoots
Definition: sawtoothmodule.h:162
double _stemSnagTurnoverRate
Definition: sawtoothmodule.h:195
double _fineRootTurnProp
Definition: sawtoothmodule.h:200
const flint::IPool * _hardwoodBranchSnag
Definition: sawtoothmodule.h:177
double _softwoodBranchTurnOverRate
Definition: sawtoothmodule.h:192
SawtoothMatrixWrapper< Sawtooth_Matrix_Int, int > TurnoverParameterId_mat
Definition: sawtoothmodule.h:155
SawtoothMatrixWrapper< Sawtooth_Matrix, double > DisturbanceMortalityRate_mat
Definition: sawtoothmodule.h:150
flint::IVariable * _age
Definition: sawtoothmodule.h:181
SawtoothMatrixWrapper< Sawtooth_Matrix, double > vpd_mat
Definition: sawtoothmodule.h:125
Definition: cbmmodulebase.h:22
double _fineRootAGSplit
Definition: sawtoothmodule.h:199
int environmentDataBaseYear
Definition: sawtoothmodule.h:96
SawtoothMatrixWrapper< Sawtooth_Matrix, double > eeq_mat
Definition: sawtoothmodule.h:127
double Frac_Spc1
Definition: sawtoothmodule.h:36
int GCM_Id
Definition: sawtoothmodule.h:117
std::default_random_engine generator
Definition: sawtoothmodule.h:101
SawtoothMatrixWrapper< Sawtooth_Matrix, double > aspect_mat
Definition: sawtoothmodule.h:138
Definition: sawtoothmodule.h:31
SawtoothMatrixWrapper< Sawtooth_Matrix, double > ca_mat
Definition: sawtoothmodule.h:129
SawtoothMatrixWrapper< Sawtooth_Matrix_Int, int > disturbance_mat
Definition: sawtoothmodule.h:135
double etp_gs
Definition: sawtoothmodule.h:21
flint::IVariable * _regenDelay
Definition: sawtoothmodule.h:183
const flint::IPool * _softwoodFoliage
Definition: sawtoothmodule.h:160
SawtoothMatrixWrapper< Sawtooth_Matrix, double > StandDensity_mat
Definition: sawtoothmodule.h:142
Definition: sawtoothmodule.h:16
double tmean_ann
Definition: sawtoothmodule.h:18
std::shared_ptr< TMat > Mat
Definition: sawtoothmodule.h:48
const flint::IPool * _aboveGroundVeryFastSoil
Definition: sawtoothmodule.h:170
double etp_gs_z
Definition: sawtoothmodule.h:23
double Frac_Spc2
Definition: sawtoothmodule.h:37
SawtoothMatrixWrapper< Sawtooth_Matrix, double > DisturbanceMortalityCarbon_mat
Definition: sawtoothmodule.h:151
SawtoothMatrixWrapper< Sawtooth_Matrix, double > ndep_mat
Definition: sawtoothmodule.h:130
SawtoothMatrixWrapper< Sawtooth_Matrix, double > twi_mat
Definition: sawtoothmodule.h:137
double tmean_gs
Definition: sawtoothmodule.h:20
std::shared_ptr< Sawtooth_CBMAnnualProcesses > annualProcess
Definition: sawtoothmodule.h:111
double ws_gs_n
Definition: sawtoothmodule.h:26
SawtoothMatrixWrapper< Sawtooth_Matrix, double > tmean_ann_mat
Definition: sawtoothmodule.h:122
int Aspect
Definition: sawtoothmodule.h:41
int ID_Spc4
Definition: sawtoothmodule.h:35
Sawtooth_CBMResult cbmResult
Definition: sawtoothmodule.h:110
const flint::IPool * _hardwoodFineRoots
Definition: sawtoothmodule.h:168
SawtoothMatrixWrapper< Sawtooth_Matrix, double > ws_gs_n_mat
Definition: sawtoothmodule.h:132
Definition: sawtoothmodule.h:76
void SetValue(size_t row, size_t col, TElem value)
Definition: sawtoothmodule.h:71
int TWI
Definition: sawtoothmodule.h:42
flint::IVariable * PlotId
Definition: sawtoothmodule.h:115
SawtoothMatrixWrapper< Sawtooth_Matrix, double > slope_mat
Definition: sawtoothmodule.h:136
double Frac_Spc4
Definition: sawtoothmodule.h:39
double _branchSnagTurnoverRate
Definition: sawtoothmodule.h:196
SawtoothMatrixWrapper< Sawtooth_Matrix, double > TotalBiomassCarbonGrowth_mat
Definition: sawtoothmodule.h:144
SawtoothMatrixWrapper< Sawtooth_Matrix_Int, int > RootParameterId_mat
Definition: sawtoothmodule.h:154
const flint::IPool * _mediumSoil
Definition: sawtoothmodule.h:178
std::unordered_set< const moja::flint::IPool * > bioPools
Definition: sawtoothmodule.h:118
const flint::IPool * _hardwoodCoarseRoots
Definition: sawtoothmodule.h:167
SawtoothMatrixWrapper< Sawtooth_Matrix, double > ws_gs_mat
Definition: sawtoothmodule.h:128
SawtoothMatrixWrapper< Sawtooth_Matrix, double > MortalityCarbon_mat
Definition: sawtoothmodule.h:148
double ws_gs
Definition: sawtoothmodule.h:22
const flint::IPool * _softwoodStemSnag
Definition: sawtoothmodule.h:174
Sawtooth_StandLevelResult standLevelResult
Definition: sawtoothmodule.h:109
const flint::IPool * _hardwoodOther
Definition: sawtoothmodule.h:165
double _hardwoodBranchTurnOverRate
Definition: sawtoothmodule.h:193
const flint::IPool * _softwoodCoarseRoots
Definition: sawtoothmodule.h:161
flint::IVariable * _turnoverRates
Definition: sawtoothmodule.h:182
double etp_gs_n
Definition: sawtoothmodule.h:25
Definition: sawtoothmodule.h:46
size_t Sawtooth_Max_Density
Definition: sawtoothmodule.h:100
SawtoothMatrixWrapper< Sawtooth_Matrix, double > tmin_ann_mat
Definition: sawtoothmodule.h:123
SawtoothMatrixWrapper< Sawtooth_Matrix, double > MortalityRate_mat
Definition: sawtoothmodule.h:147
double ndep
Definition: sawtoothmodule.h:28
SawtoothMatrixWrapper< Sawtooth_Matrix, double > DisturbanceType_mat
Definition: sawtoothmodule.h:149
SawtoothModule()
Definition: sawtoothmodule.h:78
TMat * Get()
Definition: sawtoothmodule.h:62
const flint::IPool * _softwoodBranchSnag
Definition: sawtoothmodule.h:175
int ID_Spc3
Definition: sawtoothmodule.h:34
SawtoothMatrixWrapper< Sawtooth_Matrix, double > etp_gs_mat
Definition: sawtoothmodule.h:126
const flint::IPool * _hardwoodFoliage
Definition: sawtoothmodule.h:166
int ID_Spc2
Definition: sawtoothmodule.h:33
Sawtooth_Error sawtooth_error
Definition: sawtoothmodule.h:103
int RCP_Id
Definition: sawtoothmodule.h:116
const flint::IPool * _softwoodMerch
Definition: sawtoothmodule.h:158
SawtoothMatrixWrapper< Sawtooth_Matrix, double > MeanHeight_mat
Definition: sawtoothmodule.h:141
Sawtooth_CBM_Variable cbmVariables
Definition: sawtoothmodule.h:107
double _stemAnnualTurnOverRate
Definition: sawtoothmodule.h:191
int Slope
Definition: sawtoothmodule.h:40
SawtoothMatrixWrapper< Sawtooth_Matrix, double > RecruitmentRate_mat
Definition: sawtoothmodule.h:146
double Frac_Spc3
Definition: sawtoothmodule.h:38
const flint::IPool * _belowGroundVeryFastSoil
Definition: sawtoothmodule.h:172
const flint::IPool * _aboveGroundFastSoil
Definition: sawtoothmodule.h:171
SawtoothMatrixWrapper()
Definition: sawtoothmodule.h:53
SawtoothMatrixWrapper(size_t nrow, size_t ncol, TElem defaultValue=(TElem) 0)
Definition: sawtoothmodule.h:54
Definition: ageclasshelper.cpp:10
double _coarseRootSplit
Definition: sawtoothmodule.h:197
double ws_gs_z
Definition: sawtoothmodule.h:24
double GetValue(size_t row, size_t col)
Definition: sawtoothmodule.h:67
SawtoothMatrixWrapper< Sawtooth_Matrix, double > MeanAge_mat
Definition: sawtoothmodule.h:140
SawtoothMatrixWrapper< Sawtooth_Matrix, double > etp_gs_z_mat
Definition: sawtoothmodule.h:133
const flint::IPool * _belowGroundFastSoil
Definition: sawtoothmodule.h:173
SawtoothMatrixWrapper< Sawtooth_Matrix, double > etp_gs_n_mat
Definition: sawtoothmodule.h:134
int ID_Spc1
Definition: sawtoothmodule.h:32
double _hardwoodFoliageFallRate
Definition: sawtoothmodule.h:190
flint::IVariable * _isForest
Definition: sawtoothmodule.h:185
double tmin_ann
Definition: sawtoothmodule.h:19