Rev 255 | Rev 280 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 255 | Rev 269 | ||
---|---|---|---|
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 | 33 | ||
34 | // actions
|
34 | // actions
|
35 | /// 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.
|
36 | Tree &newTree(); |
36 | Tree &newTree(); |
37 | /// 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
|
38 | 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; } |
39 | void addLR(const float LA, const float LightResponse) { mAggregatedLR += LA*LightResponse; } |
39 | 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())
|
40 | /// 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; } |
41 | double interceptedArea(const double LA, const double LightResponse) { return mEffectiveArea_perWLA * LA * LightResponse; } |
42 | void calculateInterceptedArea(); |
42 | void calculateInterceptedArea(); |
43 | const double &LRImodifier() const { return mLRI_modification; } |
43 | const double &LRImodifier() const { return mLRI_modification; } |
44 | 44 | ||
45 | // model flow
|
45 | // model flow
|
46 | void newYear(); ///< reset values for a new simulation year |
46 | void newYear(); ///< reset values for a new simulation year |
47 | 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 |
48 | void yearEnd(); ///< called after the growth of individuals |
48 | void yearEnd(); ///< called after the growth of individuals |
49 | 49 | ||
50 | // stocked area calculation
|
50 | // stocked area calculation
|
51 | void countStockedPixel(bool pixelIsStocked) { mPixelCount++; if (pixelIsStocked) mStockedPixelCount++; } |
51 | void countStockedPixel(bool pixelIsStocked) { mPixelCount++; if (pixelIsStocked) mStockedPixelCount++; } |
52 | void createStandStatistics(); |
52 | void createStandStatistics(); |
53 | // setup/maintenance
|
53 | // setup/maintenance
|
54 | void cleanTreeList(); |
- | |
55 | void setSpeciesSet(SpeciesSet *set); |
- | |
- | 54 | void cleanTreeList(); ///< remove dead trees from the tree storage. |
|
56 | void setup(); ///< setup operations after the creation of the model space. |
55 | void setup(); ///< setup operations after the creation of the model space. |
- | 56 | void setSpeciesSet(SpeciesSet *set); |
|
57 | void setClimate(Climate* climate) { mClimate = climate; } |
57 | void setClimate(Climate* climate) { mClimate = climate; } |
58 | void setBoundingBox(const QRectF &bb) { mBoundingBox = bb; } |
58 | void setBoundingBox(const QRectF &bb) { mBoundingBox = bb; } |
59 | private: |
59 | private: |
60 | int mIndex; // internal index |
60 | int mIndex; // internal index |
61 | Climate *mClimate; ///< pointer to the climate object of this RU |
61 | Climate *mClimate; ///< pointer to the climate object of this RU |
62 | SpeciesSet *mSpeciesSet; ///< pointer to the species set for this RU |
62 | SpeciesSet *mSpeciesSet; ///< pointer to the species set for this RU |
63 | WaterCycle *mWater; ///< link to the Soil water calculation engine |
63 | WaterCycle *mWater; ///< link to the Soil water calculation engine |
64 | QVector<ResourceUnitSpecies> mRUSpecies; ///< data for this ressource unit per species |
64 | QVector<ResourceUnitSpecies> mRUSpecies; ///< data for this ressource unit per species |
65 | QVector<Tree> mTrees; ///< storage container for tree individuals |
65 | QVector<Tree> mTrees; ///< storage container for tree individuals |
66 | QRectF mBoundingBox; ///< bounding box (metric) of the RU |
66 | QRectF mBoundingBox; ///< bounding box (metric) of the RU |
67 | double mAggregatedLA; ///< sum of leafArea |
67 | double mAggregatedLA; ///< sum of leafArea |
68 | double mAggregatedWLA; ///< sum of lightResponse * LeafArea for all trees |
68 | double mAggregatedWLA; ///< sum of lightResponse * LeafArea for all trees |
69 | double mAggregatedLR; ///< sum of lightresponse*LA of the current unit |
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 |
70 | double mEffectiveArea; ///< total "effective" area per resource unit, i.e. area of RU - non-stocked - beerLambert-loss |
71 | double mEffectiveArea_perWLA; ///< |
71 | double mEffectiveArea_perWLA; ///< |
72 | double mLRI_modification; |
72 | double mLRI_modification; |
73 | 73 | ||
74 | int mPixelCount; ///< count of (Heightgrid) pixels thare are inside the RU |
74 | int mPixelCount; ///< count of (Heightgrid) pixels thare are inside the RU |
75 | int mStockedPixelCount; ///< count of pixels that are stocked with trees |
75 | int mStockedPixelCount; ///< count of pixels that are stocked with trees |
76 | double mStockedArea; ///< size of stocked area |
76 | double mStockedArea; ///< size of stocked area |
77 | StandStatistics mStatistics; ///< aggregate values on stand value |
77 | StandStatistics mStatistics; ///< aggregate values on stand value |
78 | 78 | ||
79 | friend class RUWrapper; |
79 | friend class RUWrapper; |
80 | }; |
80 | }; |
81 | 81 | ||
82 | #endif // RESOURCEUNIT_H
|
82 | #endif // RESOURCEUNIT_H
|
83 | 83 |