Subversion Repositories public iLand

Rev

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

Rev 949 Rev 975
Line 68... Line 68...
68
    mRU = 0; mSpecies = 0;
68
    mRU = 0; mSpecies = 0;
69
    mFlags = mAge = 0;
69
    mFlags = mAge = 0;
70
    mOpacity=mFoliageMass=mWoodyMass=mCoarseRootMass=mFineRootMass=mLeafArea=0.;
70
    mOpacity=mFoliageMass=mWoodyMass=mCoarseRootMass=mFineRootMass=mLeafArea=0.;
71
    mDbhDelta=mNPPReserve=mLRI=mStressIndex=0.;
71
    mDbhDelta=mNPPReserve=mLRI=mStressIndex=0.;
72
    mLightResponse = 0.;
72
    mLightResponse = 0.;
-
 
73
    mStamp=0;
73
    mId = m_nextId++;
74
    mId = m_nextId++;
74
    m_statCreated++;
75
    m_statCreated++;
75
}
76
}
76
77
77
float Tree::crownRadius() const
78
float Tree::crownRadius() const
Line 112... Line 113...
112
                << mWoodyMass << mCoarseRootMass << mFoliageMass << mLeafArea;
113
                << mWoodyMass << mCoarseRootMass << mFoliageMass << mLeafArea;
113
}
114
}
114
115
115
void Tree::setup()
116
void Tree::setup()
116
{
117
{
117
    if (mDbh<=0 || mHeight<=0)
-
 
118
        return;
-
 
-
 
118
    if (mDbh<=0 || mHeight<=0) {
-
 
119
        throw IException(QString("Error: trying to set up a tree with invalid dimensions: dbh: %1 height: %2 id: %3 RU-index: %4").arg(mDbh).arg(mHeight).arg(mId).arg(mRU->index()));
-
 
120
    }
119
    // check stamp
121
    // check stamp
120
    Q_ASSERT_X(species()!=0, "Tree::setup()", "species is NULL");
122
    Q_ASSERT_X(species()!=0, "Tree::setup()", "species is NULL");
121
    mStamp = species()->stamp(mDbh, mHeight);
123
    mStamp = species()->stamp(mDbh, mHeight);
122
    if (!mStamp) {
124
    if (!mStamp) {
123
        throw IException("Tree::setup() with invalid stamp!");
125
        throw IException("Tree::setup() with invalid stamp!");
Line 935... Line 937...
935
{
937
{
936
    mFoliageMass *= 1. - removeFoliageFraction;
938
    mFoliageMass *= 1. - removeFoliageFraction;
937
    mWoodyMass *= (1. - removeStemFraction);
939
    mWoodyMass *= (1. - removeStemFraction);
938
    // we have a problem with the branches: this currently cannot be done properly!
940
    // we have a problem with the branches: this currently cannot be done properly!
939
    (void) removeBranchFraction; // silence warning
941
    (void) removeBranchFraction; // silence warning
-
 
942
}
-
 
943
-
 
944
void Tree::setHeight(const float height)
-
 
945
{
-
 
946
    if (height<=0. || height>150.)
-
 
947
        qWarning() << "trying to set tree height to invalid value:" << height << " for tree on RU:" << (mRU?mRU->boundingBox():QRect());
-
 
948
    mHeight=height;
940
}
949
}
941
950
942
void Tree::mortality(TreeGrowthData &d)
951
void Tree::mortality(TreeGrowthData &d)
943
{
952
{
944
    // death if leaf area is 0
953
    // death if leaf area is 0