Rev 1174 | Rev 1176 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1174 | Rev 1175 | ||
---|---|---|---|
Line 48... | Line 48... | ||
48 | for (int i=0;i<NSAPCELLS;++i) |
48 | for (int i=0;i<NSAPCELLS;++i) |
49 | if (!saplings[i].is_occupied()) |
49 | if (!saplings[i].is_occupied()) |
50 | return i; |
50 | return i; |
51 | return -1; |
51 | return -1; |
52 | }
|
52 | }
|
- | 53 | /// count the number of occupied slots on the pixel
|
|
- | 54 | int n_occupied() { |
|
- | 55 | int n=0; |
|
- | 56 | for (int i=0;i<NSAPCELLS;++i) |
|
- | 57 | n+=saplings[i].is_occupied(); |
|
- | 58 | return n; |
|
- | 59 | }
|
|
- | 60 | ||
53 | /// add a sapling to this cell, return a pointer to the tree on success, or 0 otherwise
|
61 | /// add a sapling to this cell, return a pointer to the tree on success, or 0 otherwise
|
54 | SaplingTree *addSapling(const float h_m, const int age_yrs, const int species_idx) { |
62 | SaplingTree *addSapling(const float h_m, const int age_yrs, const int species_idx) { |
55 | int idx = free_index(); |
63 | int idx = free_index(); |
56 | if (idx==-1) |
64 | if (idx==-1) |
57 | return 0; |
65 | return 0; |
Line 82... | Line 90... | ||
82 | class SaplingStat
|
90 | class SaplingStat
|
83 | {
|
91 | {
|
84 | public: |
92 | public: |
85 | SaplingStat() { clearStatistics(); } |
93 | SaplingStat() { clearStatistics(); } |
86 | void clearStatistics(); |
94 | void clearStatistics(); |
87 | void calculate(const Species *species, ResourceUnit *ru); |
- | |
- | 95 | void calculate(const Species *species, ResourceUnit *ru, double cohorts_per_area); |
|
88 | // actions
|
96 | // actions
|
89 | void addCarbonOfDeadSapling(float dbh) { mDied++; mSumDbhDied+=dbh; } |
97 | void addCarbonOfDeadSapling(float dbh) { mDied++; mSumDbhDied+=dbh; } |
90 | 98 | ||
91 | // access to statistics
|
99 | // access to statistics
|
92 | int newSaplings() const { return mAdded; } |
100 | int newSaplings() const { return mAdded; } |
Line 108... | Line 116... | ||
108 | int mAdded; ///< number of trees added |
116 | int mAdded; ///< number of trees added |
109 | int mRecruited; ///< number recruited (i.e. grown out of regeneration layer) |
117 | int mRecruited; ///< number recruited (i.e. grown out of regeneration layer) |
110 | int mDied; ///< number of trees died |
118 | int mDied; ///< number of trees died |
111 | double mSumDbhDied; ///< running sum of dbh of died trees (used to calculate detritus) |
119 | double mSumDbhDied; ///< running sum of dbh of died trees (used to calculate detritus) |
112 | int mLiving; ///< number of trees (cohorts!!!) currently in the regeneration layer |
120 | int mLiving; ///< number of trees (cohorts!!!) currently in the regeneration layer |
- | 121 | double mLivingSaplings; ///< number of individual trees in the regen layer (using Reinekes R) |
|
113 | double mAvgHeight; ///< average height of saplings (m) |
122 | double mAvgHeight; ///< average height of saplings (m) |
114 | double mAvgAge; ///< average age of saplings (years) |
123 | double mAvgAge; ///< average age of saplings (years) |
115 | double mAvgDeltaHPot; ///< average height increment potential (m) |
124 | double mAvgDeltaHPot; ///< average height increment potential (m) |
116 | double mAvgHRealized; ///< average realized height increment |
125 | double mAvgHRealized; ///< average realized height increment |
117 | CNPair mCarbonLiving;
|
- | |
- | 126 | CNPair mCarbonLiving; ///< kg Carbon (kg/ru) of saplings |
|
118 | CNPair mCarbonGain; ///< net growth (kg / ru) of saplings |
127 | CNPair mCarbonGain; ///< net growth (kg / ru) of saplings |
119 | 128 | ||
120 | friend class Saplings; |
129 | friend class Saplings; |
121 | 130 | ||
122 | }; |
131 | }; |