Subversion Repositories public iLand

Rev

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

Rev Author Line No. Line
1
 
187 iland 2
#ifndef RESOURCEUNIT_H
3
#define RESOURCEUNIT_H
92 Werner 4
 
5
#include "tree.h"
189 iland 6
#include "resourceunitspecies.h"
180 werner 7
#include "standstatistics.h"
92 Werner 8
 
9
class SpeciesSet;
208 werner 10
class Climate;
92 Werner 11
 
187 iland 12
class ResourceUnit
92 Werner 13
{
14
public:
187 iland 15
    ResourceUnit(const int index);
94 Werner 16
    // access
145 Werner 17
    int index() const { return mIndex; }
208 werner 18
    Climate *climate() const { return mClimate; } ///< link to the climate on this resource unit
111 Werner 19
    SpeciesSet *speciesSet() const { return  mSpeciesSet; } ///< get SpeciesSet this RU links to.
20
    /// get RU-Species-container of @p species from the RU
200 werner 21
    ResourceUnitSpecies &resourceUnitSpecies(const Species *species);
187 iland 22
    const QVector<ResourceUnitSpecies> ruSpecies() { return mRUSpecies; }
111 Werner 23
    const QRectF &boundingBox() const { return mBoundingBox; }
105 Werner 24
    QVector<Tree> &trees() { return mTrees; } ///< reference to the tree list.
143 Werner 25
    const QVector<Tree> &constTrees() const { return mTrees; } ///< reference to the tree list.
111 Werner 26
 
107 Werner 27
    // actions
111 Werner 28
    /// returns a modifiable reference to a free space inside the tree-vector. should be used for tree-init.
29
    Tree &newTree();
30
    /// addWLA() is called by each tree to aggregate the total weighted leaf area on a unit
212 werner 31
    void addWLA(const float LA, const float LRI) { mAggregatedWLA += LA*LRI; mAggregatedLA += LA; }
205 werner 32
    /// function that distributes Radiation according to LRI and LeafArea of the indivudal (@sa production())
147 werner 33
    double interceptedRadiation(const double LA, const double LRI) { return mRadiation_m2 * LA * (LRI + mLRIcorrection); }
111 Werner 34
 
35
    // model flow
107 Werner 36
    void newYear(); ///< reset values for a new simulation year
112 Werner 37
    void production(); ///< called after the LIP/LIF calc, before growth of individual trees
180 werner 38
    void yearEnd(); ///< called after the growth of individuals
107 Werner 39
 
151 iland 40
    // stocked area calculation
41
    void countStockedPixel(bool pixelIsStocked) { mPixelCount++; if (pixelIsStocked) mStockedPixelCount++; }
94 Werner 42
    // setup/maintenance
157 werner 43
    void cleanTreeList();
111 Werner 44
    void setSpeciesSet(SpeciesSet *set);
208 werner 45
    void setClimate(Climate* climate) { mClimate = climate; }
105 Werner 46
    void setBoundingBox(const QRectF &bb) { mBoundingBox = bb; }
92 Werner 47
private:
113 Werner 48
    int mIndex; // internal index
208 werner 49
    Climate *mClimate; ///< pointer to the climate object of this RU
92 Werner 50
    SpeciesSet *mSpeciesSet; ///< pointer to the species set for this RU
187 iland 51
    QVector<ResourceUnitSpecies> mRUSpecies; ///< data for this ressource unit per species
92 Werner 52
    QVector<Tree> mTrees; ///< storage container for tree individuals
105 Werner 53
    QRectF mBoundingBox; ///< bounding box (metric) of the RU
110 Werner 54
    float mAggregatedLA; ///< sum of leafArea
107 Werner 55
    float mAggregatedWLA; ///< sum of lightResponseIndex * LeafArea for all trees
147 werner 56
    double mLRIcorrection; ///< correction factor to scale LRIs to WLA
57
    double mRadiation_m2; ///< total incoming radiation per m2 and yaer
151 iland 58
    int mPixelCount; ///< count of (Heightgrid) pixels thare are inside the RU
59
    int mStockedPixelCount;  ///< count of pixels that are stocked with trees
60
    float mStockedArea; ///< size of stocked area
180 werner 61
    StandStatistics mStatistics; ///< aggregate values on stand value
92 Werner 62
 
183 werner 63
    friend class RUWrapper;
92 Werner 64
};
65
 
200 werner 66
#endif // RESOURCEUNIT_H