Rev 117 | Rev 125 | 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 | const int id() const { return mId; } |
117 | Werner | 17 | void setNewId() { mId = m_nextId++; } |
106 | Werner | 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(); |
||
119 | Werner | 47 | void grow_diameter(const double &net_stem_npp); |
48 | double relative_height_growth(); |
||
107 | Werner | 49 | |
50 | // static functions |
||
51 | static void setGrid(FloatGrid* gridToStamp, FloatGrid *dominanceGrid) { mGrid = gridToStamp; mHeightGrid = dominanceGrid; } |
||
40 | Werner | 52 | // statistics |
53 | static void resetStatistics(); |
||
54 | static const int statPrints() { return m_statPrint; } |
||
106 | Werner | 55 | static const int statCreated() { return m_statCreated; } |
40 | Werner | 56 | |
53 | Werner | 57 | static float lafactor; |
58 | Werner | 58 | |
3 | Werner | 59 | private: |
110 | Werner | 60 | // helping functions |
61 | void calcBiomassCompartments(); |
||
116 | Werner | 62 | void partitioning(double npp); |
107 | Werner | 63 | // state variables |
106 | Werner | 64 | int mId; |
65 | float mDbh; |
||
66 | float mHeight; |
||
67 | QPointF mPosition; |
||
107 | Werner | 68 | // biomass compartements |
69 | float mLeafArea; // m2 |
||
70 | |||
71 | float mLeafMass; // kg |
||
72 | float mStemMass; // kg |
||
73 | float mRootMass; // kg |
||
116 | Werner | 74 | // production relevant |
75 | float mNPPReserve; // kg |
||
107 | Werner | 76 | |
77 | |||
78 | float mLRI; // resulting lightRessourceIndex |
||
79 | // Stamp, Species, Ressource Unit |
||
106 | Werner | 80 | const Stamp *mStamp; |
111 | Werner | 81 | |
106 | Werner | 82 | Species *mSpecies; |
83 | RessourceUnit *mRU; |
||
107 | Werner | 84 | |
117 | Werner | 85 | // special functions |
107 | Werner | 86 | bool isDebugging() { return mId == mDebugid; } |
87 | // static data |
||
106 | Werner | 88 | static FloatGrid *mGrid; |
89 | static FloatGrid *mHeightGrid; |
||
58 | Werner | 90 | // debugging |
106 | Werner | 91 | static int mDebugid; |
53 | Werner | 92 | |
40 | Werner | 93 | // statistics |
94 | static int m_statPrint; |
||
48 | Werner | 95 | static int m_statAboveZ; |
105 | Werner | 96 | static int m_statCreated; |
40 | Werner | 97 | static int m_nextId; |
3 | Werner | 98 | }; |
99 | |||
100 | #endif // TREE_H |