Subversion Repositories public iLand

Rev

Rev 1008 | Rev 1033 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1
 
964 werner 2
#ifndef BBGENERATIONS_H
3
#define BBGENERATIONS_H
4
 
1008 werner 5
#include <QVector>
6
 
7
class ResourceUnit; // forward
8
 
964 werner 9
class BBGenerations
10
{
11
public:
12
    BBGenerations();
1010 werner 13
    /// calculate the number of barbeetle generations for the given resource unit.
1008 werner 14
    double calculateGenerations(const ResourceUnit *ru);
1010 werner 15
 
16
    /// number of sister broods (reaching at least 60% of thermal development)
17
    int sisterBroods() const { return mNSisterBroods; }
18
    /// number consecutive broods (reaching at least 60% of thermal development)
19
    int filialBroods() const { return mNFilialBroods; }
20
 
21
    /// returns true, if the sister broods of the same generation were also developed
22
    /// (e.g. 2 gen + 2 sister -> true, 2 gen + 1 sister -> false)
23
    bool hasSisterBrood() const { return mNSisterBroods == mNFilialBroods && mNSisterBroods>0; }
24
 
25
    /// number of cold days (tmin < -15 degrees) in the first half of the year
26
    int frostDaysEarly() const { return mFrostDaysEarly; }
27
    /// number of cold days (tmin < -15 degrees) in the second half of the year
28
    int frostDaysLate() const { return mFrostDaysLate; }
29
 
1007 werner 30
private:
31
    void calculateBarkTemperature(const ResourceUnit *ru);
1008 werner 32
    struct BBGeneration {
1010 werner 33
        BBGeneration(): start_day(-1), gen(0), is_sister_brood(false), value(0.) {}
34
        BBGeneration(int start, bool is_filial, int generation) { start_day=start; is_sister_brood=is_filial; value=0.; gen=generation; }
1008 werner 35
        int start_day;
36
        int gen;
1010 werner 37
        bool is_sister_brood;
1008 werner 38
        double value;
39
    };
40
    QVector<BBGeneration> mGenerations;
1010 werner 41
    int mNSisterBroods; ///< number of sister broods (reaching at least 60% of thermal development)
42
    int mNFilialBroods; ///< number consecutive broods (reaching at least 60% of thermal development)
43
    int mFrostDaysEarly; ///< frost days (tmin<-15) from Jan 1 to summer
44
    int mFrostDaysLate; ///< frost days from summer to Dec 31
1008 werner 45
 
46
    double mEffectiveBarkTemp[366];
964 werner 47
};
48
 
49
#endif // BBGENERATIONS_H