iLand
seeddispersal.h
Go to the documentation of this file.
1/********************************************************************************************
2** iLand - an individual based forest landscape and disturbance model
3** http://iland-model.org
4** Copyright (C) 2009- Werner Rammer, Rupert Seidl
5**
6** This program is free software: you can redistribute it and/or modify
7** it under the terms of the GNU General Public License as published by
8** the Free Software Foundation, either version 3 of the License, or
9** (at your option) any later version.
10**
11** This program is distributed in the hope that it will be useful,
12** but WITHOUT ANY WARRANTY; without even the implied warranty of
13** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14** GNU General Public License for more details.
15**
16** You should have received a copy of the GNU General Public License
17** along with this program. If not, see <http://www.gnu.org/licenses/>.
18********************************************************************************************/
19
20#ifndef SEEDDISPERSAL_H
21#define SEEDDISPERSAL_H
22#include <QHash>
23#include "grid.h"
24class Species;
25class Tree;
26
28{
29public:
30 SeedDispersal(Species *species=0): mIndexFactor(10), mSaplingMapCreated(false), mSetup(false), mSpecies(species) {}
32 bool isSetup() const { return mSetup; }
33 void setup();
34 //
35 static void setupExternalSeeds();
36 static void finalizeExternalSeeds();
37 // access
38 const Grid<float> &seedMap() const { return mSeedMap; }
39 const Species *species() const {return mSpecies; }
40
42 void setMatureTree(const QPoint &lip_index, double leaf_area) {
43 mSourceMap.valueAtIndex(lip_index.x()/mIndexFactor, lip_index.y()/mIndexFactor) += leaf_area;
44 }
45
47 void setSaplingTree(const QPoint &lip_index, float leaf_area);
48
50 void seedProductionSerotiny(const Tree *tree);
51
52 // operations
53 void newYear();
54 void clearSaplingMap();
55
56 void execute();
57
58 // debug and helpers
59 void loadFromImage(const QString &fileName);
60 void dumpMapNextYear(QString file_name) { mDumpNextYearFileName = file_name; }
61private:
62 void createKernel(Grid<float> &kernel, const float scale_area);
63 double setupLDD();
64 double treemig(const double &distance);
65 // numerical integration of the treemig function up to a radius 'max_distance'
66 double treemig_centercell(const double &max_distance);
67 double treemig_distanceTo(const double value);
68
70 void distributeSeeds(Grid<float> *seed_map=0);
71
72
73 double mTM_as1, mTM_as2, mTM_ks;
74 double mTM_fecundity_cell;
75 double mTM_occupancy;
76 double mNonSeedYearFraction;
77 double mKernelThresholdArea, mKernelThresholdLDD;
78 int mIndexFactor;
79 Grid<float> mSeedMap;
80 Grid<float> mSourceMap;
81 Grid<float> mKernelSeedYear;
82 Grid<float> mKernelNonSeedYear;
83 Grid<float> mKernelSerotiny;
84 Grid<float> mSeedMapSerotiny;
85 Grid<float> mSaplingSourceMap;
86 bool mSaplingMapCreated;
87 QVector<double> mLDDDistance;
88 QVector<double> mLDDDensity;
89 int mLDDRings;
90 float mLDDSeedlings;
91 bool mHasPendingSerotiny;
92 bool mSetup;
93 Species *mSpecies;
94 bool mDumpSeedMaps;
95 bool mHasExternalSeedInput;
96 QString mDumpNextYearFileName;
97 unsigned int mExternalSeedDirection;
98 int mExternalSeedBuffer;
99 double mExternalSeedBackgroundInput;
100 // external seeds
101 Grid<float> mExternalSeedMap;
102 void setupExternalSeedsForSpecies(Species *species);
103 static Grid<float> *mExternalSeedBaseMap;
104 static QHash<QString, QVector<double> > mExtSeedData;
105 static int mExtSeedSizeX, mExtSeedSizeY;
106};
107
108#endif // SEEDDISPERSAL_H
T & valueAtIndex(const QPoint &pos)
value at position defined by a QPoint defining the two indices (x,y)
Definition: grid.h:103
The class encapsulates the dispersal of seeds of one species over the whole landscape.
Definition: seeddispersal.h:28
void dumpMapNextYear(QString file_name)
Definition: seeddispersal.h:60
void setup()
setup of the seedmaps.
Definition: seeddispersal.cpp:58
void loadFromImage(const QString &fileName)
debug function...
Definition: seeddispersal.cpp:542
void setMatureTree(const QPoint &lip_index, double leaf_area)
setMatureTree is called by individual (mature) trees. This actually fills the initial state of the se...
Definition: seeddispersal.h:42
bool isSetup() const
Definition: seeddispersal.h:32
void setSaplingTree(const QPoint &lip_index, float leaf_area)
flags pixel at 'lip_index' that seeds should be produced. Called by saplings in the regeneration laye...
Definition: seeddispersal.cpp:325
const Grid< float > & seedMap() const
access to the seedMap
Definition: seeddispersal.h:38
SeedDispersal(Species *species=0)
Definition: seeddispersal.h:30
static void finalizeExternalSeeds()
Definition: seeddispersal.cpp:317
~SeedDispersal()
Definition: seeddispersal.cpp:46
void clearSaplingMap()
clear
Definition: seeddispersal.cpp:617
void newYear()
initial values at the beginning of the year for the grid
Definition: seeddispersal.cpp:551
void execute()
run the seed dispersal
Definition: seeddispersal.cpp:624
const Species * species() const
Definition: seeddispersal.h:39
static void setupExternalSeeds()
Definition: seeddispersal.cpp:172
void seedProductionSerotiny(const Tree *tree)
extra seed rain of serotinous species at 'position_index'
Definition: seeddispersal.cpp:343
The behavior and general properties of tree species.
Definition: species.h:75
A tree is the basic simulation entity of iLand and represents a single tree.
Definition: tree.h:44
double distance(const QPointF &a, const QPointF &b)
Definition: mainwindow.cpp:30