Subversion Repositories public iLand

Rev

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

Rev 125 Rev 129
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() { mDebugid = mId; }
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
private:
59
private:
60
    // helping functions
60
    // helping functions
61
    void calcBiomassCompartments();
61
    void calcBiomassCompartments();
62
    void partitioning(double npp);
62
    void partitioning(double npp);
63
    // state variables
63
    // state variables
64
    int mId;
64
    int mId;
65
    float mDbh; ///< diameter at breast height [cm]
65
    float mDbh; ///< diameter at breast height [cm]
66
    float mHeight; ///< tree height [m]
66
    float mHeight; ///< tree height [m]
67
    QPointF mPosition;
67
    QPointF mPosition;
68
    // biomass compartements
68
    // biomass compartements
69
    float mLeafArea; ///< m2 leaf area??
69
    float mLeafArea; ///< m2 leaf area??
70
70
71
    float mLeafMass; // kg
71
    float mLeafMass; // kg
72
    float mStemMass; // kg
72
    float mStemMass; // kg
73
    float mRootMass; // kg
73
    float mRootMass; // kg
74
    // production relevant
74
    // production relevant
75
    float mNPPReserve; // kg
75
    float mNPPReserve; // kg
76
76
77
    float mDbhDelta; ///< diameter growth [cm]
77
    float mDbhDelta; ///< diameter growth [cm]
78
78
79
    float mLRI; ///< resulting lightRessourceIndex
79
    float mLRI; ///< resulting lightRessourceIndex
80
    // Stamp, Species, Ressource Unit
80
    // Stamp, Species, Ressource Unit
81
    const Stamp *mStamp;
81
    const Stamp *mStamp;
82
82
83
    Species *mSpecies;
83
    Species *mSpecies;
84
    RessourceUnit *mRU;
84
    RessourceUnit *mRU;
85
85
86
    // special functions
86
    // special functions
87
    bool isDebugging() { return mId == mDebugid; }
87
    bool isDebugging() { return mId == mDebugid; }
88
    QString dump();
88
    QString dump();
-
 
89
    void dumpList(DebugList &rTargetList);
89
    // static data
90
    // static data
90
    static FloatGrid *mGrid;
91
    static FloatGrid *mGrid;
91
    static FloatGrid *mHeightGrid;
92
    static FloatGrid *mHeightGrid;
92
    // debugging
93
    // debugging
93
    static int mDebugid;
94
    static int mDebugid;
94
95
95
    // statistics
96
    // statistics
96
    static int m_statPrint;
97
    static int m_statPrint;
97
    static int m_statAboveZ;
98
    static int m_statAboveZ;
98
    static int m_statCreated;
99
    static int m_statCreated;
99
    static int m_nextId;
100
    static int m_nextId;
100
};
101
};
101
102
102
/** a struct that contains details about a single tree
-
 
103
  */
-
 
104
struct SingleTreeStatistics
-
 
105
{
-
 
106
// growth
-
 
107
};
-
 
-
 
103
108
#endif // TREE_H
104
#endif // TREE_H
109
 
105