Subversion Repositories public iLand

Rev

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

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