19#ifndef BARKBEETLEMODULE_H
20#define BARKBEETLEMODULE_H
107 const QVector<LayeredGridBase::LayerElement> &
names();
108 bool onClick(
const QPointF &world_coord)
const;
110 QVector<LayeredGridBase::LayerElement> mNames;
117 const QVector<LayeredGridBase::LayerElement> &
names();
118 bool onClick(
const QPointF &world_coord)
const;
120 QVector<LayeredGridBase::LayerElement> mNames;
148 void run(
int iteration=0);
161 void setEnabled(
bool do_set_enabled) { mEnabled = do_set_enabled; }
164 void calculateGenerations();
165 void calculateOutbreakFactor();
167 int clumpedBackgroundActivation(QPoint start_idx);
168 void prepareInteractions(
bool update_interaction=
false);
169 void barkbeetleSpread();
170 void barkbeetleKill();
171 void scanResourceUnitTrees(
const QPointF &position);
172 bool sanitationTreatment(QPointF coord)
const;
175 QString mAfterExecEvent;
177 SBBParams(): minDbh(10.f), cohortsPerGeneration(30), cohortsPerSisterbrood(50),
178 spreadKernelMaxDistance(100.), backgroundInfestationProbability(0.0001), initialInfestationProbability(0.),
179 stormInfestationProbability(1.), winterMortalityBaseLevel(0.),
180 outbreakDurationMin(0.), outbreakDurationMax(0.), deadTreeSelectivity(1.), sanitationTreatmentProb(0.) {}
182 int cohortsPerGeneration;
183 int cohortsPerSisterbrood;
184 QString spreadKernelFormula;
185 double spreadKernelMaxDistance;
186 double backgroundInfestationProbability;
187 double initialInfestationProbability;
188 double stormInfestationProbability;
189 double winterMortalityBaseLevel;
190 double outbreakDurationMin;
191 double outbreakDurationMax;
192 double deadTreeSelectivity;
193 double sanitationTreatmentProb;
197 void clear() { infestedStart=0;infestedBackground=0; infestedStorm=0; maxGenerations=0;NCohortsLanded=0;NPixelsLanded=0;NCohortsSpread=0;NInfested=0;NWinterMortality=0;NAreaKilled=0;NTreesKilled=0;BasalAreaKilled=0.; VolumeKilled=0.;}
199 int infestedBackground;
206 int NWinterMortality;
209 double BasalAreaKilled;
223 Expression mOutbreakClimateSensitivityFormula;
230 QVector<double> mRefClimateAverages;
231 double *mClimateVariables[8];
BBGenerations calculates potential bark beetle generations based on climate data (including bark temp...
Definition: bbgenerations.h:28
The BarkBeetleCell is the basic unit (10m pixels) of the bark beetle module.
Definition: barkbeetlemodule.h:37
void setInfested(bool is_infested)
sets the 'infested' state (true: the cell is newly infested, false: the cell stops being infested,...
Definition: barkbeetlemodule.h:46
float sum_volume_killed
Definition: barkbeetlemodule.h:62
int killedYear
Definition: barkbeetlemodule.h:58
int n_total
Definition: barkbeetlemodule.h:57
static int total_infested
Definition: barkbeetlemodule.h:69
DeadTrees deadtrees
Definition: barkbeetlemodule.h:64
bool isHost() const
Definition: barkbeetlemodule.h:43
float outbreakYear
Definition: barkbeetlemodule.h:59
bool infested
Definition: barkbeetlemodule.h:51
bool killed
Definition: barkbeetlemodule.h:52
BarkBeetleCell()
Definition: barkbeetlemodule.h:39
static int max_iteration
Definition: barkbeetlemodule.h:70
float dbh
Definition: barkbeetlemodule.h:53
bool isPotentialHost() const
Definition: barkbeetlemodule.h:44
float tree_stress
Definition: barkbeetlemodule.h:54
void finishedSpread(int iteration)
called after beetles spread out from the cell. The cell is marked as 'killed', and trees will be kill...
Definition: barkbeetlemodule.h:48
int n_events
Definition: barkbeetlemodule.h:61
static void resetCounters()
Definition: barkbeetlemodule.h:68
float backgroundInfestationProbability
background prob. of infestation per 10m cell
Definition: barkbeetlemodule.h:49
DeadTrees
Definition: barkbeetlemodule.h:63
@ BeetleTrapTree
Definition: barkbeetlemodule.h:63
@ SinkInVicinity
Definition: barkbeetlemodule.h:63
@ StormDamage
Definition: barkbeetlemodule.h:63
@ NoDeadTrees
Definition: barkbeetlemodule.h:63
void clear()
Definition: barkbeetlemodule.h:40
bool isNeutralized() const
return true if either storm damaged trees or trap trees are on the pixel or in the Moore neighborhood...
Definition: barkbeetlemodule.h:66
int n
Definition: barkbeetlemodule.h:56
void reset()
full reset of the pixel
Definition: barkbeetlemodule.h:42
float packageOutbreakYear
Definition: barkbeetlemodule.h:60
float p_colonize
Definition: barkbeetlemodule.h:55
Helper class manage and visualize data layers related to the barkbeetle module.
Definition: barkbeetlemodule.h:103
const QVector< LayeredGridBase::LayerElement > & names()
list of stored layers
Definition: barkbeetlemodule.cpp:767
bool onClick(const QPointF &world_coord) const
Definition: barkbeetlemodule.cpp:787
double value(const BarkBeetleCell &data, const int index) const
Definition: barkbeetlemodule.cpp:741
void setGrid(const Grid< BarkBeetleCell > &grid)
Definition: barkbeetlemodule.h:105
The BarkBeetleModule class is the main class of the bark beetle module.
Definition: barkbeetlemodule.h:135
void clearGrids()
reset the state of the internal grids (used for javascript based tests)
Definition: barkbeetlemodule.cpp:191
static double cellsize()
Definition: barkbeetlemodule.h:139
bool enabled() const
Definition: barkbeetlemodule.h:162
void run(int iteration=0)
main function to execute the bark beetle module (iteration can be non-0 when called from Javascript)
Definition: barkbeetlemodule.cpp:222
~BarkBeetleModule()
Definition: barkbeetlemodule.cpp:65
void setSimulate(bool do_simulate)
Definition: barkbeetlemodule.h:158
void setup()
general setup
Definition: barkbeetlemodule.cpp:69
void loadAllVegetation()
scan the state of the vegetation of the full landscape
Definition: barkbeetlemodule.cpp:206
void yearBegin()
called automatically
Definition: barkbeetlemodule.cpp:362
void setEnabled(bool do_set_enabled)
Definition: barkbeetlemodule.h:161
BarkBeetleModule()
Definition: barkbeetlemodule.cpp:55
bool simulate() const
Definition: barkbeetlemodule.h:159
int internalYear() const
Definition: barkbeetlemodule.h:156
int manualYearBegin()
call from script (from script)
Definition: barkbeetlemodule.h:155
void treeDeath(const Tree *tree)
function that is called whenever a tree dies somewhere in iLand
Definition: barkbeetlemodule.cpp:265
void loadParameters(bool do_reset=true)
load params from XML
Definition: barkbeetlemodule.cpp:106
BarkBeetleOut handles the database output of the bark beetle module.
Definition: barkbeetleout.h:28
The BarkBeetleRUCell class collects information on resource unit (100m pixel) level.
Definition: barkbeetlemodule.h:80
int host_pixels
Definition: barkbeetlemodule.h:95
int killed_pixels
Definition: barkbeetlemodule.h:94
double currentDamageFraction()
relative damage: fraction of host pixels that died in the current or the last year
Definition: barkbeetlemodule.h:87
BarkBeetleRUCell()
Definition: barkbeetlemodule.h:82
double generations
Definition: barkbeetlemodule.h:89
bool add_sister
Definition: barkbeetlemodule.h:90
int infested
Definition: barkbeetlemodule.h:96
int cold_days_late
Definition: barkbeetlemodule.h:92
int cold_days
Definition: barkbeetlemodule.h:91
bool scanned
Definition: barkbeetlemodule.h:88
bool killed_trees
Definition: barkbeetlemodule.h:93
Definition: barkbeetlemodule.h:113
const QVector< LayeredGridBase::LayerElement > & names()
list of stored layers
Definition: barkbeetlemodule.cpp:803
double value(const BarkBeetleRUCell &data, const int index) const
Definition: barkbeetlemodule.cpp:794
void setGrid(const Grid< BarkBeetleRUCell > &grid)
Definition: barkbeetlemodule.h:115
bool onClick(const QPointF &world_coord) const
Definition: barkbeetlemodule.cpp:811
BarkBeetleScript is the scripting shell for the bark beetle module.
Definition: barkbeetlescript.h:31
Climate handles climate input data and performs some basic related calculations on that data.
Definition: climate.h:66
An expression engine for mathematical expressions provided as strings.
Definition: expression.h:29
Grid class (template).
Definition: grid.h:44
This is the base class for multi-layer grids in iLand.
Definition: layeredgrid.h:95
const Grid< BarkBeetleCell > * mGrid
Definition: layeredgrid.h:130
numbers with a user defined probaility density function.
Definition: random.h:62
ResourceUnit is the spatial unit that encapsulates a forest stand and links to several environmental ...
Definition: resourceunit.h:49
A tree is the basic simulation entity of iLand and represents a single tree.
Definition: tree.h:44