Subversion Repositories public iLand

Rev

Rev 136 | Rev 139 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 136 Rev 137
1
Redirecting to URL 'https://iland.boku.ac.at/svn/iland/tags/release_1.0/src/core/tree.h':
1
Redirecting to URL 'https://iland.boku.ac.at/svn/iland/tags/release_1.0/src/core/tree.h':
2
#ifndef TREE_H
2
#ifndef TREE_H
3
#define TREE_H
3
#define TREE_H
4
#include <QPointF>
4
#include <QPointF>
5
5
6
#include "grid.h"
6
#include "grid.h"
7
7
8
class Species;
8
class Species;
9
class Stamp;
9
class Stamp;
10
class RessourceUnit;
10
class RessourceUnit;
11
11
12
class Tree
12
class Tree
13
{
13
{
14
public:
14
public:
15
    Tree();
15
    Tree();
16
    const int id() const { return mId; }
16
    const int id() const { return mId; }
17
    void setNewId() { mId = m_nextId++; }
17
    void setNewId() { mId = m_nextId++; }
18
    void setPosition(const QPointF pos) { mPosition=pos; }
18
    void setPosition(const QPointF pos) { mPosition=pos; }
19
    const QPointF position() const { return mPosition; }
19
    const QPointF position() const { return mPosition; }
20
20
21
    void setDbh(const float dbh) { mDbh=dbh; }
21
    void setDbh(const float dbh) { mDbh=dbh; }
22
    const float dbh() const { return mDbh; }
22
    const float dbh() const { return mDbh; }
23
23
24
    void setHeight(const float height) { mHeight=height; }
24
    void setHeight(const float height) { mHeight=height; }
25
    const float height() const { return mHeight; }
25
    const float height() const { return mHeight; }
26
26
27
    const float lightRessourceIndex() const { return mLRI; }
27
    const float lightRessourceIndex() const { return mLRI; }
28
28
29
    const Species* species() const { return mSpecies; }
29
    const Species* species() const { return mSpecies; }
30
    void setSpecies(Species *ts) { mSpecies=ts; }
30
    void setSpecies(Species *ts) { mSpecies=ts; }
31
    const RessourceUnit *ru() const { return mRU; }
31
    const RessourceUnit *ru() const { return mRU; }
32
    void setRU(RessourceUnit *ru) { mRU = ru; }
32
    void setRU(RessourceUnit *ru) { mRU = ru; }
33
33
34
    void setup();
34
    void setup();
35
35
36
    void enableDebugging() { mDebugid = mId; }
-
 
-
 
36
    void enableDebugging(const bool enable=true) { mDebugging = enable; }
37
37
38
38
39
    // grid based light-concurrency functions
39
    // grid based light-concurrency functions
40
    void applyStamp(); ///< apply LightInfluencePattern onto the global grid
40
    void applyStamp(); ///< apply LightInfluencePattern onto the global grid
41
    double readStamp();
41
    double readStamp();
42
    void readStampMul(); ///< calculate the lightRessourceIndex
42
    void readStampMul(); ///< calculate the lightRessourceIndex
43
    void heightGrid(); ///< calculate the height grid
43
    void heightGrid(); ///< calculate the height grid
44
44
45
    // growth, etc.
45
    // growth, etc.
46
    void grow();
46
    void grow();
47
    void grow_diameter(const double &net_stem_npp);
47
    void grow_diameter(const double &net_stem_npp);
48
    double relative_height_growth();
48
    double relative_height_growth();
49
49
50
    // static functions
50
    // static functions
51
    static void setGrid(FloatGrid* gridToStamp, FloatGrid *dominanceGrid) { mGrid = gridToStamp; mHeightGrid = dominanceGrid; }
51
    static void setGrid(FloatGrid* gridToStamp, FloatGrid *dominanceGrid) { mGrid = gridToStamp; mHeightGrid = dominanceGrid; }
52
    // statistics
52
    // statistics
53
    static void resetStatistics();
53
    static void resetStatistics();
54
    static const int statPrints() { return m_statPrint; }
54
    static const int statPrints() { return m_statPrint; }
55
    static const int statCreated() { return m_statCreated; }
55
    static const int statCreated() { return m_statCreated; }
56
56
57
    static float lafactor;
57
    static float lafactor;
58
58
59
    QString dump();
59
    QString dump();
60
60
61
private:
61
private:
62
    // helping functions
62
    // helping functions
63
    void calcBiomassCompartments();
-
 
64
    void partitioning(double npp);
63
    void partitioning(double npp);
65
    // state variables
64
    // state variables
66
    int mId;
65
    int mId;
67
    float mDbh; ///< diameter at breast height [cm]
66
    float mDbh; ///< diameter at breast height [cm]
68
    float mHeight; ///< tree height [m]
67
    float mHeight; ///< tree height [m]
69
    QPointF mPosition;
68
    QPointF mPosition;
70
    // biomass compartements
69
    // biomass compartements
71
    float mLeafArea; ///< m2 leaf area??
70
    float mLeafArea; ///< m2 leaf area??
72
71
73
    float mFoliageMass; // kg
72
    float mFoliageMass; // kg
74
    float mWoodyMass; // kg
73
    float mWoodyMass; // kg
75
    float mRootMass; // kg
74
    float mRootMass; // kg
76
    // production relevant
75
    // production relevant
77
    float mNPPReserve; // kg
76
    float mNPPReserve; // kg
78
77
79
    float mDbhDelta; ///< diameter growth [cm]
78
    float mDbhDelta; ///< diameter growth [cm]
80
79
81
    float mLRI; ///< resulting lightRessourceIndex
80
    float mLRI; ///< resulting lightRessourceIndex
82
    // Stamp, Species, Ressource Unit
81
    // Stamp, Species, Ressource Unit
83
    const Stamp *mStamp;
82
    const Stamp *mStamp;
84
83
85
    Species *mSpecies;
84
    Species *mSpecies;
86
    RessourceUnit *mRU;
85
    RessourceUnit *mRU;
87
86
88
    // special functions
87
    // special functions
89
    bool isDebugging() { return mId == mDebugid; }
-
 
-
 
88
    bool isDebugging() { return mDebugging; }
90
89
91
    void dumpList(DebugList &rTargetList);
90
    void dumpList(DebugList &rTargetList);
92
    // static data
91
    // static data
93
    static FloatGrid *mGrid;
92
    static FloatGrid *mGrid;
94
    static FloatGrid *mHeightGrid;
93
    static FloatGrid *mHeightGrid;
95
    // debugging
94
    // debugging
96
    static int mDebugid;
-
 
-
 
95
    bool mDebugging;
97
96
98
    // statistics
97
    // statistics
99
    static int m_statPrint;
98
    static int m_statPrint;
100
    static int m_statAboveZ;
99
    static int m_statAboveZ;
101
    static int m_statCreated;
100
    static int m_statCreated;
102
    static int m_nextId;
101
    static int m_nextId;
103
};
102
};
104
103
105
104
106
#endif // TREE_H
105
#endif // TREE_H
107
 
106