Subversion Repositories public iLand

Rev

Rev 180 | Rev 212 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 180 Rev 187
Line 5... Line 5...
5
5
6
#include "grid.h"
6
#include "grid.h"
7
// forwards
7
// forwards
8
class Species;
8
class Species;
9
class Stamp;
9
class Stamp;
10
class RessourceUnit;
-
 
-
 
10
class ResourceUnit;
11
struct HeightGridValue;
11
struct HeightGridValue;
12
struct TreeGrowthData;
12
struct TreeGrowthData;
13
13
14
class Tree
14
class Tree
15
{
15
{
Line 24... Line 24...
24
    /// @property position The tree does not store the floating point coordinates but only the index of pixel on the LIF grid
24
    /// @property position The tree does not store the floating point coordinates but only the index of pixel on the LIF grid
25
    const QPointF position() const { Q_ASSERT(mGrid!=0); return mGrid->cellCenterPoint(mPositionIndex); }
25
    const QPointF position() const { Q_ASSERT(mGrid!=0); return mGrid->cellCenterPoint(mPositionIndex); }
26
    float dbh() const { return mDbh; }
26
    float dbh() const { return mDbh; }
27
    float height() const { return mHeight; }
27
    float height() const { return mHeight; }
28
    const Species* species() const { Q_ASSERT(mRU!=0); return mSpecies; } ///< pointer to the tree species of the tree.
28
    const Species* species() const { Q_ASSERT(mRU!=0); return mSpecies; } ///< pointer to the tree species of the tree.
29
    const RessourceUnit *ru() const { Q_ASSERT(mRU!=0); return mRU; } ///< pointer to the ressource unit the tree belongs to.
-
 
-
 
29
    const ResourceUnit *ru() const { Q_ASSERT(mRU!=0); return mRU; } ///< pointer to the ressource unit the tree belongs to.
30
30
31
    float lightRessourceIndex() const { return mLRI; } ///< LRI of the tree (update during readStamp())
-
 
-
 
31
    float lightResourceIndex() const { return mLRI; } ///< LRI of the tree (update during readStamp())
32
    double volume() const; ///< volume (m3) of stem volume based on geometry and density calculated on the fly.
32
    double volume() const; ///< volume (m3) of stem volume based on geometry and density calculated on the fly.
33
    double basalArea() const; ///< basal area of the tree at breast height in m2
33
    double basalArea() const; ///< basal area of the tree at breast height in m2
34
    bool isDead() const { return flag(Tree::TreeDead); } ///< returns true if the tree is already dead.
34
    bool isDead() const { return flag(Tree::TreeDead); } ///< returns true if the tree is already dead.
35
    // actions
35
    // actions
36
    void die() { setFlag(Tree::TreeDead, true); } ///< kills the tree.
36
    void die() { setFlag(Tree::TreeDead, true); } ///< kills the tree.
Line 40... Line 40...
40
    void setNewId() { mId = m_nextId++; } ///< force a new id for this object (after copying trees)
40
    void setNewId() { mId = m_nextId++; } ///< force a new id for this object (after copying trees)
41
    void setPosition(const QPointF pos) { Q_ASSERT(mGrid!=0); mPositionIndex = mGrid->indexAt(pos); }
41
    void setPosition(const QPointF pos) { Q_ASSERT(mGrid!=0); mPositionIndex = mGrid->indexAt(pos); }
42
    void setDbh(const float dbh) { mDbh=dbh; }
42
    void setDbh(const float dbh) { mDbh=dbh; }
43
    void setHeight(const float height) { mHeight=height; }
43
    void setHeight(const float height) { mHeight=height; }
44
    void setSpecies(Species *ts) { mSpecies=ts; }
44
    void setSpecies(Species *ts) { mSpecies=ts; }
45
    void setRU(RessourceUnit *ru) { mRU = ru; }
-
 
-
 
45
    void setRU(ResourceUnit *ru) { mRU = ru; }
46
    void setAge(const int age) { mAge = age; }
46
    void setAge(const int age) { mAge = age; }
47
47
48
    // grid based light-concurrency functions
48
    // grid based light-concurrency functions
49
    void applyLIP(); ///< apply LightInfluencePattern onto the global grid
49
    void applyLIP(); ///< apply LightInfluencePattern onto the global grid
50
    void readLIF(); ///< calculate the lightRessourceIndex with multiplicative approach
-
 
-
 
50
    void readLIF(); ///< calculate the lightResourceIndex with multiplicative approach
51
    void heightGrid(); ///< calculate the height grid
51
    void heightGrid(); ///< calculate the height grid
52
52
53
    void applyLIP_torus(); ///< apply LightInfluencePattern on a closed 1ha area
53
    void applyLIP_torus(); ///< apply LightInfluencePattern on a closed 1ha area
54
    void readLIF_torus(); ///< calculate LRI from a closed 1ha area
54
    void readLIF_torus(); ///< calculate LRI from a closed 1ha area
55
    void heightGrid_torus(); ///< calculate the height grid
55
    void heightGrid_torus(); ///< calculate the height grid
Line 86... Line 86...
86
    float mFoliageMass; // kg
86
    float mFoliageMass; // kg
87
    float mWoodyMass; // kg
87
    float mWoodyMass; // kg
88
    float mRootMass; // kg
88
    float mRootMass; // kg
89
    // production relevant
89
    // production relevant
90
    float mNPPReserve; // kg
90
    float mNPPReserve; // kg
91
    float mLRI; ///< resulting lightRessourceIndex
-
 
-
 
91
    float mLRI; ///< resulting lightResourceIndex
92
    // auxiliary
92
    // auxiliary
93
    float mDbhDelta; ///< diameter growth [cm]
93
    float mDbhDelta; ///< diameter growth [cm]
94
    float mStressIndex; ///< stress index (used for mortality)
94
    float mStressIndex; ///< stress index (used for mortality)
95
95
96
    // Stamp, Species, Ressource Unit
-
 
-
 
96
    // Stamp, Species, Resource Unit
97
    const Stamp *mStamp;
97
    const Stamp *mStamp;
98
    Species *mSpecies;
98
    Species *mSpecies;
99
    RessourceUnit *mRU;
-
 
-
 
99
    ResourceUnit *mRU;
100
100
101
    // various flags
101
    // various flags
102
    int mFlags;
102
    int mFlags;
103
    enum Flags { TreeDead=1, TreeDebugging=2 };
103
    enum Flags { TreeDead=1, TreeDebugging=2 };
104
    void setFlag(const Tree::Flags flag, const bool value) { if (value) mFlags |= flag; else mFlags &= (flag ^ 0xffffff );}
104
    void setFlag(const Tree::Flags flag, const bool value) { if (value) mFlags |= flag; else mFlags &= (flag ^ 0xffffff );}