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