Subversion Repositories public iLand

Rev

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

Rev 697 Rev 720
Line 272... Line 272...
272
    double ru_lai = leafAreaIndex();
272
    double ru_lai = leafAreaIndex();
273
    if (ru_lai < 1.)
273
    if (ru_lai < 1.)
274
        ru_lai = 1.;
274
        ru_lai = 1.;
275
    // note: LAIFactors are only 1 if sum of LAI is > 1. (see WaterCycle)
275
    // note: LAIFactors are only 1 if sum of LAI is > 1. (see WaterCycle)
276
    for (i=mRUSpecies.constBegin(); i!=iend; ++i) {
276
    for (i=mRUSpecies.constBegin(); i!=iend; ++i) {
277
         (*i)->setLAIfactor((*i)->statistics().leafAreaIndex() / ru_lai);
-
 
-
 
277
        double lai_factor = (*i)->statistics().leafAreaIndex() / ru_lai;
-
 
278
        DBGMODE(
-
 
279
        if (lai_factor > 1.)
-
 
280
            qDebug() << "LAI factor > 1";
-
 
281
        );
-
 
282
        (*i)->setLAIfactor( lai_factor );
278
    }
283
    }
279
284
280
    // soil water model - this determines soil water contents needed for response calculations
285
    // soil water model - this determines soil water contents needed for response calculations
281
    {
286
    {
282
    mWater->run();
287
    mWater->run();
Line 369... Line 374...
369
    }
374
    }
370
    mStatistics.calculate();
375
    mStatistics.calculate();
371
    mAverageAging = mStatistics.leafAreaIndex()>0.?mAverageAging / (mStatistics.leafAreaIndex()*stockableArea()):0.;
376
    mAverageAging = mStatistics.leafAreaIndex()>0.?mAverageAging / (mStatistics.leafAreaIndex()*stockableArea()):0.;
372
    if (mAverageAging<0. || mAverageAging>1.)
377
    if (mAverageAging<0. || mAverageAging>1.)
373
        qDebug() << "Average aging invalid: (RU, LAI):" << index() << mStatistics.leafAreaIndex();
378
        qDebug() << "Average aging invalid: (RU, LAI):" << index() << mStatistics.leafAreaIndex();
-
 
379
}
-
 
380
-
 
381
/** recreate statistics. This is necessary after events that changed the structure
-
 
382
    of the stand *after* the growth of trees (where stand statistics are updated).
-
 
383
    An example is after disturbances.  */
-
 
384
void ResourceUnit::recreateStandStatistics()
-
 
385
{
-
 
386
    for (int i=0;i<mRUSpecies.count();i++) {
-
 
387
        mRUSpecies[i]->statistics().clear();
-
 
388
    }
-
 
389
    foreach(const Tree &t, mTrees) {
-
 
390
        resourceUnitSpecies(t.species()).statistics().add(&t, 0);
-
 
391
    }
-
 
392
374
}
393
}
375
394
376
void ResourceUnit::setMaxSaplingHeightAt(const QPoint &position, const float height)
395
void ResourceUnit::setMaxSaplingHeightAt(const QPoint &position, const float height)
377
{
396
{
378
    Q_ASSERT(mSaplingHeightMap);
397
    Q_ASSERT(mSaplingHeightMap);