Subversion Repositories public iLand

Rev

Rev 241 | Rev 255 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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