Subversion Repositories public iLand

Rev

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

Rev Author Line No. Line
1
 
3 Werner 2
#ifndef TREE_H
3
#define TREE_H
4
#include <QPointF>
5
 
83 Werner 6
#include "grid.h"
3 Werner 7
 
90 Werner 8
class Species;
38 Werner 9
class Stamp;
106 Werner 10
class RessourceUnit;
3 Werner 11
 
12
class Tree
13
{
14
public:
15
    Tree();
106 Werner 16
    void setId(const int id) { mId=id;}
17
    const int id() const { return mId; }
18
    void setPosition(const QPointF pos) { mPosition=pos; }
19
    const QPointF position() const { return mPosition; }
3 Werner 20
 
106 Werner 21
    void setDbh(const float dbh) { mDbh=dbh; }
22
    const float dbh() const { return mDbh; }
3 Werner 23
 
106 Werner 24
    void setHeight(const float height) { mHeight=height; }
25
    const float height() const { return mHeight; }
3 Werner 26
 
106 Werner 27
    const float lightRessourceIndex() const { return mLRI; }
3 Werner 28
 
106 Werner 29
    const Species* species() const { return mSpecies; }
30
    void setSpecies(Species *ts) { mSpecies=ts; }
31
    const RessourceUnit *ru() const { return mRU; }
32
    void setRU(RessourceUnit *ru) { mRU = ru; }
39 Werner 33
 
38 Werner 34
    void setup();
35
 
106 Werner 36
    void enableDebugging() { mDebugid = mId; }
58 Werner 37
 
3 Werner 38
 
107 Werner 39
    // grid based light-concurrency functions
40
    void applyStamp(); ///< apply LightInfluencePattern onto the global grid
40 Werner 41
    double readStamp();
107 Werner 42
    void readStampMul(); ///< calculate the lightRessourceIndex
43
    void heightGrid(); ///< calculate the height grid
39 Werner 44
 
107 Werner 45
    // growth, etc.
46
    void grow();
47
 
48
    // static functions
49
    static void setGrid(FloatGrid* gridToStamp, FloatGrid *dominanceGrid) { mGrid = gridToStamp; mHeightGrid = dominanceGrid; }
40 Werner 50
    // statistics
51
    static void resetStatistics();
52
    static const int statPrints() { return m_statPrint; }
106 Werner 53
    static const int statCreated() { return m_statCreated; }
40 Werner 54
 
53 Werner 55
    static float lafactor;
58 Werner 56
 
3 Werner 57
private:
110 Werner 58
    // helping functions
59
    void calcBiomassCompartments();
107 Werner 60
    // state variables
106 Werner 61
    int mId;
62
    float mDbh;
63
    float mHeight;
64
    QPointF mPosition;
107 Werner 65
    // biomass compartements
66
    float mLeafArea; // m2
67
 
68
    float mLeafMass; // kg
69
    float mStemMass; // kg
70
    float mRootMass; // kg
71
 
72
 
73
    float mLRI; // resulting lightRessourceIndex
74
    // Stamp, Species, Ressource Unit
106 Werner 75
    const Stamp *mStamp;
76
    Species *mSpecies;
77
    RessourceUnit *mRU;
107 Werner 78
 
79
    bool isDebugging() { return mId == mDebugid; }
80
    // static data
106 Werner 81
    static FloatGrid *mGrid;
82
    static FloatGrid *mHeightGrid;
58 Werner 83
    // debugging
106 Werner 84
    static int mDebugid;
53 Werner 85
 
40 Werner 86
    // statistics
87
    static int m_statPrint;
48 Werner 88
    static int m_statAboveZ;
105 Werner 89
    static int m_statCreated;
40 Werner 90
    static int m_nextId;
3 Werner 91
};
92
 
93
#endif // TREE_H