Subversion Repositories public iLand

Rev

Rev 125 | Rev 142 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1
 
90 Werner 2
#ifndef SPECIES_H
3
#define SPECIES_H
38 Werner 4
 
103 Werner 5
 
91 Werner 6
#include "expression.h"
7
 
103 Werner 8
#include "speciesset.h"
102 Werner 9
 
91 Werner 10
class StampContainer; // forwards
38 Werner 11
class Stamp;
91 Werner 12
 
103 Werner 13
 
90 Werner 14
class Species
38 Werner 15
{
16
public:
111 Werner 17
    Species(SpeciesSet *set) { mSet = set; mIndex=set->count(); }
91 Werner 18
    // properties
19
    /// @property id 4-character unique identification of the tree species
111 Werner 20
    const QString &id() const { return mId; }
91 Werner 21
    /// the full name (e.g. Picea Abies) of the species
111 Werner 22
    const QString &name() const { return mName; }
23
    const int index() const { return mIndex; } ///< unique index of species within current set
136 Werner 24
 
91 Werner 25
    // calculations: allometries
136 Werner 26
    const double biomassFoliage(const double dbh) const;
27
    const double biomassWoody(const double dbh) const;
28
    const double biomassRoot(const double dbh) const;
29
    const double allometricRatio_wf() const { return mWoody_b / mFoliage_b; }
30
    const double allometricFractionStem(const double dbh) const;
31
 
116 Werner 32
    // turnover rates
33
    const double turnoverLeaf() const { return mTurnoverLeaf; }
34
    const double turnoverRoot() const { return mTurnoverRoot; }
119 Werner 35
    // hd-values
36
    void hdRange(const double dbh, double &rMinHD, double &rMaxHD);
125 Werner 37
    // growth
38
    const double volumeFactor() const { return mVolumeFactor; } ///< factor for volume calculation: V = factor * D^2*H (incorporates density and the form of the bole)
110 Werner 39
    const double specificLeafArea() const { return mSpecificLeafArea; }
40
 
136 Werner 41
    const Stamp* stamp(const float dbh, const float height) const { return mLIPs.stamp(dbh, height);}
39 Werner 42
    // maintenance
91 Werner 43
    void setup();
38 Werner 44
private:
90 Werner 45
    Q_DISABLE_COPY(Species);
136 Werner 46
    // helpers during setup
47
    double doubleVar(const QString s) { return mSet->var(s).toDouble(); }///< during setup: get value of variable @p s as a double.
48
    double intVar(const QString s) { return mSet->var(s).toInt(); } ///< during setup: get value of variable @p s as an integer.
49
    QString stringVar(const QString s) { return mSet->var(s).toString(); } ///< during setup: get value of variable @p s as a string.
50
 
91 Werner 51
    SpeciesSet *mSet; ///< ptr. to the "parent" set
136 Werner 52
    StampContainer mLIPs; ///< ptr to the container of the LIP-pattern
91 Werner 53
    QString mId;
54
    QString mName;
111 Werner 55
    int mIndex; ///< internal index within the SpeciesSet
136 Werner 56
    // biomass allometries:
57
    double mFoliage_a, mFoliage_b;  ///< allometry (biomass = a * dbh^b) for foliage
58
    double mWoody_a, mWoody_b; ///< allometry (biomass = a * dbh^b) for woody compartments aboveground
59
    double mRoot_a, mRoot_b; ///< allometry (biomass = a * dbh^b) for roots (compound, fine and coarse roots as one pool)
60
    double mBranch_a, mBranch_b; ///< allometry (biomass = a * dbh^b) for branches
61
 
110 Werner 62
    double mSpecificLeafArea; ///< conversion factor from kg OTS to m2 LeafArea
136 Werner 63
 
116 Werner 64
    // turnover rates
65
    double mTurnoverLeaf; ///< yearly turnover rate leafs
66
    double mTurnoverRoot; ///< yearly turnover rate root
119 Werner 67
    // height-diameter-relationships
68
    Expression mHDlow; ///< minimum HD-relation as f(d) (open grown tree)
69
    Expression mHDhigh; ///< maximum HD-relation as f(d)
125 Werner 70
    // stem density and taper
71
    double mWoodDensity; ///< density of the wood [kg/m3]
72
    double mFormFactor; ///< taper form factor of the stem [-] used for volume / stem-mass calculation calculation
73
    double mVolumeFactor; ///< factor for volume calculation
38 Werner 74
};
75
 
40 Werner 76
 
119 Werner 77
// inlined functions...
78
inline void Species::hdRange(const double dbh, double &rLowHD, double &rHighHD)
79
{
80
    rLowHD = mHDlow.calculate(dbh);
81
    rHighHD = mHDhigh.calculate(dbh);
82
}
83
 
90 Werner 84
#endif // SPECIES_H