Subversion Repositories public iLand

Rev

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

Rev Author Line No. Line
1
 
671 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
 
434 werner 21
#ifndef ESTABLISHMENT_H
22
#define ESTABLISHMENT_H
439 werner 23
#include <QtCore/QPoint>
434 werner 24
class Climate;
25
class ResourceUnitSpecies;
443 werner 26
 
434 werner 27
class Establishment
28
{
29
public:
440 werner 30
    Establishment();
434 werner 31
    Establishment(const Climate *climate, const ResourceUnitSpecies *rus);
440 werner 32
    /// setup function that links to a climate and the resource unit / species
33
    void setup(const Climate *climate, const ResourceUnitSpecies *rus);
34
    /// main function "calculate()": process the establishment routine
434 werner 35
    void calculate();
1168 werner 36
    void clear();
1111 werner 37
    void calculateAbioticEnvironment(); ///< calculate the abiotic environment (TACA model)
1168 werner 38
    void writeDebugOutputs();
440 werner 39
    // some informations after execution
40
    double avgSeedDensity() const { return mPxDensity;} ///< average seed density on the RU
41
    double abioticEnvironment() const {return mPAbiotic; } ///< integrated value of abiotic environment (i.e.: TACA-climate + total iLand environment)
42
    int numberEstablished() const { return mNumberEstablished; } ///< return number of newly established trees in the current year
442 werner 43
    bool TACAminTemp() const { return mTACA_min_temp;} ///< TACA flag for minimum temperature
44
    bool TACAchill() const { return mTACA_chill;} ///< TACA flag chilling requirement
45
    bool TACgdd() const { return mTACA_gdd;} ///< TACA flag for growing degree days
46
    bool TACAfrostFree() const { return mTACA_frostfree;} ///< TACA flag for number of frost free days
47
    int TACAfrostDaysAfterBudBirst() const { return mTACA_frostAfterBuds; } ///< number of frost days after bud birst
48
    double avgLIFValue() const { return mLIFcount>0?mSumLIFvalue/double(mLIFcount):0.; } ///< average LIF value of LIF pixels where establishment is tested
1168 werner 49
    double waterLimitation() const { return mWaterLimitation; } ///< scalar value between 0 and 1 (1: no limitation, 0: no establishment)
440 werner 50
 
1068 werner 51
    static void debugInfo();
434 werner 52
private:
53
    double mPAbiotic; ///< abiotic probability for establishment (climate)
1160 werner 54
    double calculateWaterLimitation(const int veg_period_start, const int veg_period_end); ///< calculate effect of water limitation on establishment, returns scalar [0..1]
685 werner 55
    inline bool establishTree(const QPoint &pos_lif, const float lif_value, const float seed_value); ///< do the final check whether a seedling can establish at given location
1002 werner 56
    // 2 different approaches for calculating the establishment
57
    void calculatePerSeedPixel(); ///< function that checks seed pixels first
58
    void calculatePerRU(); ///< function that starts with 2m LIF pixels
434 werner 59
    const Climate *mClimate; ///< link to the current climate
60
    const ResourceUnitSpecies *mRUS; ///< link to the resource unit species (links to production data and species respones)
440 werner 61
    // some statistics
62
    double mPxDensity;
442 werner 63
    int mNumberEstablished; // number of established trees in the current year
64
    // TACA switches
65
    bool mTACA_min_temp; // minimum temperature threshold
66
    bool mTACA_chill;  // (total) chilling requirement
67
    bool mTACA_gdd;   // gdd-thresholds
68
    bool mTACA_frostfree; // frost free days in vegetation period
69
    int mTACA_frostAfterBuds; // frost days after bud birst
70
    double mSumLIFvalue;
1168 werner 71
    double mWaterLimitation; // scalar 0..1 signifying the drought limitation of establishment
442 werner 72
    int mLIFcount;
73
 
434 werner 74
};
75
 
76
#endif // ESTABLISHMENT_H