Rev 189 | Rev 205 | 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; |
||
10 | |||
187 | iland | 11 | class ResourceUnit |
92 | Werner | 12 | { |
13 | public: |
||
187 | iland | 14 | ResourceUnit(const int index); |
94 | Werner | 15 | // access |
145 | Werner | 16 | int index() const { return mIndex; } |
111 | Werner | 17 | SpeciesSet *speciesSet() const { return mSpeciesSet; } ///< get SpeciesSet this RU links to. |
18 | /// get RU-Species-container of @p species from the RU |
||
200 | werner | 19 | ResourceUnitSpecies &resourceUnitSpecies(const Species *species); |
187 | iland | 20 | const QVector<ResourceUnitSpecies> ruSpecies() { return mRUSpecies; } |
111 | Werner | 21 | const QRectF &boundingBox() const { return mBoundingBox; } |
105 | Werner | 22 | QVector<Tree> &trees() { return mTrees; } ///< reference to the tree list. |
143 | Werner | 23 | const QVector<Tree> &constTrees() const { return mTrees; } ///< reference to the tree list. |
111 | Werner | 24 | |
107 | Werner | 25 | // actions |
111 | Werner | 26 | /// returns a modifiable reference to a free space inside the tree-vector. should be used for tree-init. |
27 | Tree &newTree(); |
||
28 | /// addWLA() is called by each tree to aggregate the total weighted leaf area on a unit |
||
29 | void addWLA(const float WLA, const float LA) { mAggregatedWLA += WLA; mAggregatedLA += LA; } |
||
147 | werner | 30 | double interceptedRadiation(const double LA, const double LRI) { return mRadiation_m2 * LA * (LRI + mLRIcorrection); } |
111 | Werner | 31 | |
32 | // model flow |
||
107 | Werner | 33 | void newYear(); ///< reset values for a new simulation year |
112 | Werner | 34 | void production(); ///< called after the LIP/LIF calc, before growth of individual trees |
180 | werner | 35 | void yearEnd(); ///< called after the growth of individuals |
107 | Werner | 36 | |
151 | iland | 37 | // stocked area calculation |
38 | void countStockedPixel(bool pixelIsStocked) { mPixelCount++; if (pixelIsStocked) mStockedPixelCount++; } |
||
94 | Werner | 39 | // setup/maintenance |
157 | werner | 40 | void cleanTreeList(); |
111 | Werner | 41 | void setSpeciesSet(SpeciesSet *set); |
105 | Werner | 42 | void setBoundingBox(const QRectF &bb) { mBoundingBox = bb; } |
92 | Werner | 43 | private: |
113 | Werner | 44 | int mIndex; // internal index |
92 | Werner | 45 | SpeciesSet *mSpeciesSet; ///< pointer to the species set for this RU |
187 | iland | 46 | QVector<ResourceUnitSpecies> mRUSpecies; ///< data for this ressource unit per species |
92 | Werner | 47 | QVector<Tree> mTrees; ///< storage container for tree individuals |
105 | Werner | 48 | QRectF mBoundingBox; ///< bounding box (metric) of the RU |
110 | Werner | 49 | float mAggregatedLA; ///< sum of leafArea |
107 | Werner | 50 | float mAggregatedWLA; ///< sum of lightResponseIndex * LeafArea for all trees |
147 | werner | 51 | double mLRIcorrection; ///< correction factor to scale LRIs to WLA |
52 | double mRadiation_m2; ///< total incoming radiation per m2 and yaer |
||
151 | iland | 53 | int mPixelCount; ///< count of (Heightgrid) pixels thare are inside the RU |
54 | int mStockedPixelCount; ///< count of pixels that are stocked with trees |
||
55 | float mStockedArea; ///< size of stocked area |
||
180 | werner | 56 | StandStatistics mStatistics; ///< aggregate values on stand value |
92 | Werner | 57 | |
183 | werner | 58 | friend class RUWrapper; |
92 | Werner | 59 | }; |
60 | |||
200 | werner | 61 | #endif // RESOURCEUNIT_H |