Subversion Repositories public iLand

Rev

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

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