Rev 1220 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1 | |||
1033 | werner | 2 | /******************************************************************************************** |
3 | ** iLand - an individual based forest landscape and disturbance model |
||
4 | ** http://iland.boku.ac.at |
||
5 | ** Copyright (C) 2009- Werner Rammer, Rupert Seidl |
||
6 | ** |
||
7 | ** This program is free software: you can redistribute it and/or modify |
||
8 | ** it under the terms of the GNU General Public License as published by |
||
9 | ** the Free Software Foundation, either version 3 of the License, or |
||
10 | ** (at your option) any later version. |
||
11 | ** |
||
12 | ** This program is distributed in the hope that it will be useful, |
||
13 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
14 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
15 | ** GNU General Public License for more details. |
||
16 | ** |
||
17 | ** You should have received a copy of the GNU General Public License |
||
18 | ** along with this program. If not, see <http://www.gnu.org/licenses/>. |
||
19 | ********************************************************************************************/ |
||
20 | |||
964 | werner | 21 | #ifndef BBGENERATIONS_H |
22 | #define BBGENERATIONS_H |
||
23 | |||
1008 | werner | 24 | #include <QVector> |
25 | |||
26 | class ResourceUnit; // forward |
||
27 | |||
964 | werner | 28 | class BBGenerations |
29 | { |
||
30 | public: |
||
31 | BBGenerations(); |
||
1010 | werner | 32 | /// calculate the number of barbeetle generations for the given resource unit. |
1008 | werner | 33 | double calculateGenerations(const ResourceUnit *ru); |
1010 | werner | 34 | |
35 | /// number of sister broods (reaching at least 60% of thermal development) |
||
36 | int sisterBroods() const { return mNSisterBroods; } |
||
37 | /// number consecutive broods (reaching at least 60% of thermal development) |
||
38 | int filialBroods() const { return mNFilialBroods; } |
||
39 | |||
40 | /// returns true, if the sister broods of the same generation were also developed |
||
41 | /// (e.g. 2 gen + 2 sister -> true, 2 gen + 1 sister -> false) |
||
42 | bool hasSisterBrood() const { return mNSisterBroods == mNFilialBroods && mNSisterBroods>0; } |
||
43 | |||
44 | /// number of cold days (tmin < -15 degrees) in the first half of the year |
||
45 | int frostDaysEarly() const { return mFrostDaysEarly; } |
||
46 | /// number of cold days (tmin < -15 degrees) in the second half of the year |
||
47 | int frostDaysLate() const { return mFrostDaysLate; } |
||
48 | |||
1007 | werner | 49 | private: |
50 | void calculateBarkTemperature(const ResourceUnit *ru); |
||
1008 | werner | 51 | struct BBGeneration { |
1010 | werner | 52 | BBGeneration(): start_day(-1), gen(0), is_sister_brood(false), value(0.) {} |
1082 | werner | 53 | BBGeneration(int start, bool is_sister, int generation) { start_day=start; is_sister_brood=is_sister; value=0.; gen=generation; } |
1008 | werner | 54 | int start_day; |
55 | int gen; |
||
1010 | werner | 56 | bool is_sister_brood; |
1008 | werner | 57 | double value; |
58 | }; |
||
59 | QVector<BBGeneration> mGenerations; |
||
1010 | werner | 60 | int mNSisterBroods; ///< number of sister broods (reaching at least 60% of thermal development) |
61 | int mNFilialBroods; ///< number consecutive broods (reaching at least 60% of thermal development) |
||
62 | int mFrostDaysEarly; ///< frost days (tmin<-15) from Jan 1 to summer |
||
63 | int mFrostDaysLate; ///< frost days from summer to Dec 31 |
||
1008 | werner | 64 | |
65 | double mEffectiveBarkTemp[366]; |
||
964 | werner | 66 | }; |
67 | |||
68 | #endif // BBGENERATIONS_H |