Subversion Repositories public iLand

Rev

Rev 255 | Rev 280 | 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;
241 werner 11
class WaterCycle;
92 Werner 12
 
187 iland 13
class ResourceUnit
92 Werner 14
{
15
public:
187 iland 16
    ResourceUnit(const int index);
241 werner 17
    ~ResourceUnit();
255 werner 18
 
234 werner 19
    // access to elements
255 werner 20
    const Climate *climate() const { return mClimate; } ///< link to the climate on this resource unit
21
    const WaterCycle *waterCycle() const { return mWater; } ///< water model of the unit
111 Werner 22
    SpeciesSet *speciesSet() const { return  mSpeciesSet; } ///< get SpeciesSet this RU links to.
255 werner 23
    ResourceUnitSpecies &resourceUnitSpecies(const Species *species); ///< get RU-Species-container of @p species from the RU
234 werner 24
    const QVector<ResourceUnitSpecies> ruSpecies() const { return mRUSpecies; }
105 Werner 25
    QVector<Tree> &trees() { return mTrees; } ///< reference to the tree list.
143 Werner 26
    const QVector<Tree> &constTrees() const { return mTrees; } ///< reference to the tree list.
255 werner 27
 
234 werner 28
    // properties
255 werner 29
    int index() const { return mIndex; }
30
    const QRectF &boundingBox() const { return mBoundingBox; }
234 werner 31
    double area() const { return mPixelCount*100; } ///< get the resuorce unit area in m2
32
    double stockedArea() const { return mStockedArea; } ///< get the stocked area in m2
255 werner 33
 
107 Werner 34
    // actions
111 Werner 35
    /// returns a modifiable reference to a free space inside the tree-vector. should be used for tree-init.
36
    Tree &newTree();
37
    /// addWLA() is called by each tree to aggregate the total weighted leaf area on a unit
212 werner 38
    void addWLA(const float LA, const float LRI) { mAggregatedWLA += LA*LRI; mAggregatedLA += LA; }
251 werner 39
    void addLR(const float LA, const float LightResponse) { mAggregatedLR += LA*LightResponse; }
230 werner 40
    /// function that distributes effective interception area according to the weight of Light response and LeafArea of the indivudal (@sa production())
251 werner 41
    double interceptedArea(const double LA, const double LightResponse) { return mEffectiveArea_perWLA * LA * LightResponse; }
42
    void calculateInterceptedArea();
43
    const double &LRImodifier() const { return mLRI_modification; }
111 Werner 44
 
45
    // model flow
107 Werner 46
    void newYear(); ///< reset values for a new simulation year
112 Werner 47
    void production(); ///< called after the LIP/LIF calc, before growth of individual trees
180 werner 48
    void yearEnd(); ///< called after the growth of individuals
107 Werner 49
 
151 iland 50
    // stocked area calculation
51
    void countStockedPixel(bool pixelIsStocked) { mPixelCount++; if (pixelIsStocked) mStockedPixelCount++; }
240 werner 52
    void createStandStatistics();
94 Werner 53
    // setup/maintenance
269 werner 54
    void cleanTreeList(); ///< remove dead trees from the tree storage.
55
    void setup(); ///< setup operations after the creation of the model space.
111 Werner 56
    void setSpeciesSet(SpeciesSet *set);
208 werner 57
    void setClimate(Climate* climate) { mClimate = climate; }
105 Werner 58
    void setBoundingBox(const QRectF &bb) { mBoundingBox = bb; }
92 Werner 59
private:
113 Werner 60
    int mIndex; // internal index
208 werner 61
    Climate *mClimate; ///< pointer to the climate object of this RU
92 Werner 62
    SpeciesSet *mSpeciesSet; ///< pointer to the species set for this RU
241 werner 63
    WaterCycle *mWater; ///< link to the Soil water calculation engine
187 iland 64
    QVector<ResourceUnitSpecies> mRUSpecies; ///< data for this ressource unit per species
92 Werner 65
    QVector<Tree> mTrees; ///< storage container for tree individuals
105 Werner 66
    QRectF mBoundingBox; ///< bounding box (metric) of the RU
251 werner 67
    double mAggregatedLA; ///< sum of leafArea
68
    double mAggregatedWLA; ///< sum of lightResponse * LeafArea for all trees
69
    double mAggregatedLR; ///< sum of lightresponse*LA of the current unit
70
    double mEffectiveArea; ///< total "effective" area per resource unit, i.e. area of RU - non-stocked - beerLambert-loss
230 werner 71
    double mEffectiveArea_perWLA; ///<
251 werner 72
    double mLRI_modification;
230 werner 73
 
151 iland 74
    int mPixelCount; ///< count of (Heightgrid) pixels thare are inside the RU
75
    int mStockedPixelCount;  ///< count of pixels that are stocked with trees
234 werner 76
    double mStockedArea; ///< size of stocked area
180 werner 77
    StandStatistics mStatistics; ///< aggregate values on stand value
92 Werner 78
 
183 werner 79
    friend class RUWrapper;
92 Werner 80
};
81
 
200 werner 82
#endif // RESOURCEUNIT_H