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