Subversion Repositories public iLand

Rev

Rev 1221 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1033 werner 1
/********************************************************************************************
2
**    iLand - an individual based forest landscape and disturbance model
3
**    http://iland.boku.ac.at
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
 
964 werner 20
#ifndef BBGENERATIONS_H
21
#define BBGENERATIONS_H
22
 
1008 werner 23
#include <QVector>
24
 
25
class ResourceUnit; // forward
26
 
964 werner 27
class BBGenerations
28
{
29
public:
30
    BBGenerations();
1010 werner 31
    /// calculate the number of barbeetle generations for the given resource unit.
1008 werner 32
    double calculateGenerations(const ResourceUnit *ru);
1010 werner 33
 
34
    /// number of sister broods (reaching at least 60% of thermal development)
35
    int sisterBroods() const { return mNSisterBroods; }
36
    /// number consecutive broods (reaching at least 60% of thermal development)
37
    int filialBroods() const { return mNFilialBroods; }
38
 
39
    /// returns true, if the sister broods of the same generation were also developed
40
    /// (e.g. 2 gen + 2 sister -> true, 2 gen + 1 sister -> false)
41
    bool hasSisterBrood() const { return mNSisterBroods == mNFilialBroods && mNSisterBroods>0; }
42
 
43
    /// number of cold days (tmin < -15 degrees) in the first half of the year
44
    int frostDaysEarly() const { return mFrostDaysEarly; }
45
    /// number of cold days (tmin < -15 degrees) in the second half of the year
46
    int frostDaysLate() const { return mFrostDaysLate; }
47
 
1007 werner 48
private:
49
    void calculateBarkTemperature(const ResourceUnit *ru);
1008 werner 50
    struct BBGeneration {
1010 werner 51
        BBGeneration(): start_day(-1), gen(0), is_sister_brood(false), value(0.) {}
1082 werner 52
        BBGeneration(int start, bool is_sister, int generation) { start_day=start; is_sister_brood=is_sister; value=0.; gen=generation; }
1008 werner 53
        int start_day;
54
        int gen;
1010 werner 55
        bool is_sister_brood;
1008 werner 56
        double value;
57
    };
58
    QVector<BBGeneration> mGenerations;
1010 werner 59
    int mNSisterBroods; ///< number of sister broods (reaching at least 60% of thermal development)
60
    int mNFilialBroods; ///< number consecutive broods (reaching at least 60% of thermal development)
61
    int mFrostDaysEarly; ///< frost days (tmin<-15) from Jan 1 to summer
62
    int mFrostDaysLate; ///< frost days from summer to Dec 31
1008 werner 63
 
64
    double mEffectiveBarkTemp[366];
964 werner 65
};
66
 
67
#endif // BBGENERATIONS_H