Rev 469 | Rev 504 | 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 RESOURCEUNITSPECIES_H |
3 | #define RESOURCEUNITSPECIES_H |
||
115 | Werner | 4 | #include "production3pg.h" |
180 | werner | 5 | #include "standstatistics.h" |
193 | werner | 6 | #include "speciesresponse.h" |
440 | werner | 7 | #include "establishment.h" |
450 | werner | 8 | #include "sapling.h" |
453 | werner | 9 | #include "grid.h" |
475 | werner | 10 | #include "snag.h" |
111 | Werner | 11 | class Species; |
187 | iland | 12 | class ResourceUnit; |
468 | werner | 13 | class Snag; |
111 | Werner | 14 | |
187 | iland | 15 | class ResourceUnitSpecies |
111 | Werner | 16 | { |
17 | public: |
||
469 | werner | 18 | ResourceUnitSpecies() : mLAIfactor(0.), mSnag(0), mSpecies(0), mRU(0) {} |
468 | werner | 19 | ~ResourceUnitSpecies(); |
234 | werner | 20 | void setup(Species *species, ResourceUnit *ru); |
115 | Werner | 21 | |
449 | werner | 22 | // access |
209 | werner | 23 | const SpeciesResponse *speciesResponse() const { return &mResponse; } |
208 | werner | 24 | const Species *species() const { return mSpecies; } ///< return pointer to species |
25 | const ResourceUnit *ru() const { return mRU; } ///< return pointer to resource unit |
||
228 | werner | 26 | const Production3PG &prod3PG() const { return m3PG; } ///< the 3pg production model of this speies x resourceunit |
208 | werner | 27 | StandStatistics &statistics() { return mStatistics; } ///< statistics of this species on the resourceunit |
278 | werner | 28 | StandStatistics &statisticsDead() { return mStatisticsDead; } ///< statistics of died trees |
29 | StandStatistics &statisticsMgmt() { return mStatisticsMgmt; } ///< statistics of removed trees |
||
262 | werner | 30 | const StandStatistics &constStatistics() const { return mStatistics; } ///< const accessor |
31 | const StandStatistics &constStatisticsDead() const { return mStatisticsDead; } ///< const accessor |
||
278 | werner | 32 | const StandStatistics &constStatisticsMgmt() const { return mStatisticsMgmt; } ///< const accessor |
33 | |||
449 | werner | 34 | // actions |
277 | werner | 35 | void updateGWL(); |
36 | double removedVolume() const { return mRemovedGrowth; } ///< sum of volume with was remvoved because of death/management (m3) |
||
367 | werner | 37 | double LAIfactor() const { return mLAIfactor; } ///< relative fraction of LAI of this species (0..1) |
370 | werner | 38 | void setLAIfactor(const double newLAIfraction) { mLAIfactor=newLAIfraction; if (mLAIfactor<0 || mLAIfactor>1.00001) qDebug() << "invalid LAIfactor"<<mLAIfactor; } |
376 | werner | 39 | // properties |
40 | double leafArea() const; ///< total leaf area of the species on the RU (m2). |
||
115 | Werner | 41 | // action |
440 | werner | 42 | void calculate(const bool fromEstablishment=false); ///< calculate response for species, calculate actual 3PG production |
468 | werner | 43 | // establishment, sapling growth |
440 | werner | 44 | void calclulateEstablishment(); ///< perform establishment calculations |
450 | werner | 45 | void calclulateSaplingGrowth(); ///< growth of saplings |
454 | werner | 46 | void addSapling(const QPoint &position) { mSapling.addSapling(position); } ///< add a saplings on a given position |
47 | void clearSaplings(const QPoint &position) { mSapling.clearSaplings(position);} ///< clear saplings on a given position (after recruitment) |
||
462 | werner | 48 | bool hasSaplingAt(const QPoint &position) const { return mSapling.hasSapling(position); } ///< return true if a sapling of the current speices is present at 'position' |
468 | werner | 49 | // snag dynamics, soil carbon and nitrogen cycle |
50 | Snag *snag() const { return mSnag; } ///< access the snag object |
||
475 | werner | 51 | void snagNewYear() { if (snag()) snag()->newYear(); } ///< clean transfer pools |
52 | void calculateSnagDynamics(); ///< calculate snag dynamics at the end of a year |
||
453 | werner | 53 | // visualization/graphical output |
54 | void visualGrid(Grid<float> &grid) const; |
||
115 | Werner | 55 | |
111 | Werner | 56 | private: |
454 | werner | 57 | ResourceUnitSpecies(const ResourceUnitSpecies &); // no copy |
58 | ResourceUnitSpecies &operator=(const ResourceUnitSpecies &); // no copy |
||
376 | werner | 59 | double mLAIfactor; ///< relative amount of this species' LAI on this resource unit (0..1). Is calculated once a year. |
277 | werner | 60 | double mRemovedGrowth; ///< m3 volume of trees removed/managed (to calculate GWL) |
262 | werner | 61 | StandStatistics mStatistics; ///< statistics of a species on this resource unit |
62 | StandStatistics mStatisticsDead; ///< statistics of died trees (this year) of a species on this resource unit |
||
278 | werner | 63 | StandStatistics mStatisticsMgmt; ///< statistics of removed trees (this year) of a species on this resource unit |
234 | werner | 64 | Production3PG m3PG; ///< NPP prodution unit of this species |
65 | SpeciesResponse mResponse; ///< calculation and storage of species specific respones on this resource unit |
||
440 | werner | 66 | Establishment mEstablishment; ///< establishment for seedlings and sapling growth |
450 | werner | 67 | Sapling mSapling; ///< saplings storage/growth |
468 | werner | 68 | Snag *mSnag; ///< ptr to snag storage / dynamics |
69 | Species *mSpecies; ///< link to speices |
||
70 | ResourceUnit *mRU; ///< link to resource unit |
||
438 | werner | 71 | int mLastYear; |
111 | Werner | 72 | }; |
73 | |||
74 | #endif // RESSOURCEUNITSPECIES_H |