Rev 475 | Rev 484 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 475 | Rev 482 | ||
---|---|---|---|
Line 31... | Line 31... | ||
31 | mPixelCount=0; |
31 | mPixelCount=0; |
32 | mStockedArea = 0; |
32 | mStockedArea = 0; |
33 | mStockedPixelCount = 0; |
33 | mStockedPixelCount = 0; |
34 | mIndex = index; |
34 | mIndex = index; |
35 | mSaplingHeightMap = 0; |
35 | mSaplingHeightMap = 0; |
- | 36 | mEffectiveArea_perWLA = 0.; |
|
36 | mWater = new WaterCycle(); |
37 | mWater = new WaterCycle(); |
37 | 38 | ||
38 | mTrees.reserve(100); // start with space for 100 trees. |
39 | mTrees.reserve(100); // start with space for 100 trees. |
39 | }
|
40 | }
|
40 | 41 | ||
Line 133... | Line 134... | ||
133 | {
|
134 | {
|
134 | mAggregatedWLA = 0.; |
135 | mAggregatedWLA = 0.; |
135 | mAggregatedLA = 0.; |
136 | mAggregatedLA = 0.; |
136 | mAggregatedLR = 0.; |
137 | mAggregatedLR = 0.; |
137 | mEffectiveArea = 0.; |
138 | mEffectiveArea = 0.; |
- | 139 | mAverageAging = 0.; |
|
138 | mPixelCount = mStockedPixelCount = 0; |
140 | mPixelCount = mStockedPixelCount = 0; |
139 | // clear statistics global and per species...
|
141 | // clear statistics global and per species...
|
140 | QList<ResourceUnitSpecies*>::const_iterator i; |
142 | QList<ResourceUnitSpecies*>::const_iterator i; |
141 | QList<ResourceUnitSpecies*>::const_iterator iend = mRUSpecies.constEnd(); |
143 | QList<ResourceUnitSpecies*>::const_iterator iend = mRUSpecies.constEnd(); |
142 | mStatistics.clear(); |
144 | mStatistics.clear(); |
Line 230... | Line 232... | ||
230 | void ResourceUnit::afterGrow() |
232 | void ResourceUnit::afterGrow() |
231 | {
|
233 | {
|
232 | mAverageAging = leafArea()>0.?mAverageAging/leafArea():0; // calculate aging value (calls to addAverageAging() by individual trees) |
234 | mAverageAging = leafArea()>0.?mAverageAging/leafArea():0; // calculate aging value (calls to addAverageAging() by individual trees) |
233 | if (mAverageAging>0. && mAverageAging<0.00001) |
235 | if (mAverageAging>0. && mAverageAging<0.00001) |
234 | qDebug() << "ru" << mIndex << "aging <0.00001"; |
236 | qDebug() << "ru" << mIndex << "aging <0.00001"; |
- | 237 | if (mAverageAging<0. || mAverageAging>1.) |
|
- | 238 | qDebug() << "Average aging invalid: (RU, LAI):" << index() << mStatistics.leafAreaIndex(); |
|
235 | }
|
239 | }
|
236 | 240 | ||
237 | void ResourceUnit::yearEnd() |
241 | void ResourceUnit::yearEnd() |
238 | {
|
242 | {
|
239 | // calculate statistics for all tree species of the ressource unit
|
243 | // calculate statistics for all tree species of the ressource unit
|
Line 244... | Line 248... | ||
244 | mRUSpecies[i]->updateGWL(); // get sum of dead trees (died + removed) |
248 | mRUSpecies[i]->updateGWL(); // get sum of dead trees (died + removed) |
245 | mRUSpecies[i]->statistics().calculate(); // calculate the living (and add removed volume to gwl) |
249 | mRUSpecies[i]->statistics().calculate(); // calculate the living (and add removed volume to gwl) |
246 | mStatistics.add(mRUSpecies[i]->statistics()); |
250 | mStatistics.add(mRUSpecies[i]->statistics()); |
247 | }
|
251 | }
|
248 | mStatistics.calculate(); // aggreagte on stand level |
252 | mStatistics.calculate(); // aggreagte on stand level |
- | 253 | ||
- | 254 | }
|
|
- | 255 | ||
- | 256 | void ResourceUnit::addTreeAgingForAllTrees() |
|
- | 257 | {
|
|
- | 258 | mAverageAging = 0.; |
|
- | 259 | foreach(const Tree &t, mTrees) { |
|
- | 260 | addTreeAging(t.leafArea(), t.species()->aging(t.height(), t.age())); |
|
- | 261 | }
|
|
- | 262 | ||
249 | }
|
263 | }
|
250 | 264 | ||
251 | /// refresh of tree based statistics.
|
265 | /// refresh of tree based statistics.
|
- | 266 | /// WARNING: this function is only called once (during startup).
|
|
- | 267 | /// see function "yearEnd()" above!!!
|
|
252 | void ResourceUnit::createStandStatistics() |
268 | void ResourceUnit::createStandStatistics() |
253 | {
|
269 | {
|
254 | // clear statistics (ru-level and ru-species level)
|
270 | // clear statistics (ru-level and ru-species level)
|
255 | mStatistics.clear(); |
271 | mStatistics.clear(); |
256 | for (int i=0;i<mRUSpecies.count();i++) { |
272 | for (int i=0;i<mRUSpecies.count();i++) { |
Line 269... | Line 285... | ||
269 | mRUSpecies[i]->statistics().calculate(); |
285 | mRUSpecies[i]->statistics().calculate(); |
270 | mStatistics.add(mRUSpecies[i]->statistics()); |
286 | mStatistics.add(mRUSpecies[i]->statistics()); |
271 | }
|
287 | }
|
272 | mStatistics.calculate(); |
288 | mStatistics.calculate(); |
273 | mAverageAging = mStatistics.leafAreaIndex()>0.?mAverageAging / (mStatistics.leafAreaIndex()*area()):0.; |
289 | mAverageAging = mStatistics.leafAreaIndex()>0.?mAverageAging / (mStatistics.leafAreaIndex()*area()):0.; |
- | 290 | if (mAverageAging<0. || mAverageAging>1.) |
|
- | 291 | qDebug() << "Average aging invalid: (RU, LAI):" << index() << mStatistics.leafAreaIndex(); |
|
274 | }
|
292 | }
|
275 | 293 | ||
276 | void ResourceUnit::setMaxSaplingHeightAt(const QPoint &position, const float height) |
294 | void ResourceUnit::setMaxSaplingHeightAt(const QPoint &position, const float height) |
277 | {
|
295 | {
|
278 | Q_ASSERT(mSaplingHeightMap); |
296 | Q_ASSERT(mSaplingHeightMap); |