Subversion Repositories public iLand

Rev

Rev 779 | Rev 911 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 779 Rev 863
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
13
14
class ResourceUnitSpecies
14
class ResourceUnitSpecies
15
{
15
{
16
public:
16
public:
17
    ResourceUnitSpecies() : mLAIfactor(0.), mSpecies(0), mRU(0) {}
17
    ResourceUnitSpecies() : mLAIfactor(0.), mSpecies(0), mRU(0) {}
18
    ~ResourceUnitSpecies();
18
    ~ResourceUnitSpecies();
19
    void setup(Species *species, ResourceUnit *ru);
19
    void setup(Species *species, ResourceUnit *ru);
20
20
21
    // access
21
    // access
22
    const SpeciesResponse *speciesResponse() const { return &mResponse; }
22
    const SpeciesResponse *speciesResponse() const { return &mResponse; }
23
    const Species *species() const { return mSpecies; } ///< return pointer to species
23
    const Species *species() const { return mSpecies; } ///< return pointer to species
24
    const ResourceUnit *ru() const { return mRU; } ///< return pointer to resource unit
24
    const ResourceUnit *ru() const { return mRU; } ///< return pointer to resource unit
25
    const Production3PG &prod3PG() const { return m3PG; } ///< the 3pg production model of this speies x resourceunit
25
    const Production3PG &prod3PG() const { return m3PG; } ///< the 3pg production model of this speies x resourceunit
26
    const Sapling &sapling() const { return mSapling; } ///< sapling growth submodel
26
    const Sapling &sapling() const { return mSapling; } ///< sapling growth submodel
27
    Sapling &changeSapling() { return mSapling; } ///< sapling growth submodel (non-const access)
27
    Sapling &changeSapling() { return mSapling; } ///< sapling growth submodel (non-const access)
28
    StandStatistics &statistics() { return mStatistics; } ///< statistics of this species on the resourceunit
28
    StandStatistics &statistics() { return mStatistics; } ///< statistics of this species on the resourceunit
29
    StandStatistics &statisticsDead() { return mStatisticsDead; } ///< statistics of died trees
29
    StandStatistics &statisticsDead() { return mStatisticsDead; } ///< statistics of died trees
30
    StandStatistics &statisticsMgmt() { return mStatisticsMgmt; } ///< statistics of removed trees
30
    StandStatistics &statisticsMgmt() { return mStatisticsMgmt; } ///< statistics of removed trees
31
    const StandStatistics &constStatistics() const { return mStatistics; } ///< const accessor
31
    const StandStatistics &constStatistics() const { return mStatistics; } ///< const accessor
32
    const StandStatistics &constStatisticsDead() const { return mStatisticsDead; } ///< const accessor
32
    const StandStatistics &constStatisticsDead() const { return mStatisticsDead; } ///< const accessor
33
    const StandStatistics &constStatisticsMgmt() const { return mStatisticsMgmt; } ///< const accessor
33
    const StandStatistics &constStatisticsMgmt() const { return mStatisticsMgmt; } ///< const accessor
34
34
35
   // actions
35
   // actions
36
    void updateGWL();
36
    void updateGWL();
37
    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)
38
    /// relative fraction of LAI of this species (0..1) (if total LAI on resource unit is >= 1, then the sum of all LAIfactors of all species = 1)
38
    /// relative fraction of LAI of this species (0..1) (if total LAI on resource unit is >= 1, then the sum of all LAIfactors of all species = 1)
39
    double LAIfactor() const { return mLAIfactor; }
39
    double LAIfactor() const { return mLAIfactor; }
40
    void setLAIfactor(const double newLAIfraction) { mLAIfactor=newLAIfraction; if (mLAIfactor<0 || mLAIfactor>1.00001) qDebug() << "invalid LAIfactor"<<mLAIfactor; }
40
    void setLAIfactor(const double newLAIfraction) { mLAIfactor=newLAIfraction; if (mLAIfactor<0 || mLAIfactor>1.00001) qDebug() << "invalid LAIfactor"<<mLAIfactor; }
41
    // properties
41
    // properties
42
    double leafArea() const; ///< total leaf area of the species on the RU (m2).
42
    double leafArea() const; ///< total leaf area of the species on the RU (m2).
43
    // action
43
    // action
44
    void calculate(const bool fromEstablishment=false); ///< calculate response for species, calculate actual 3PG production
44
    void calculate(const bool fromEstablishment=false); ///< calculate response for species, calculate actual 3PG production
45
    // establishment, sapling growth
45
    // establishment, sapling growth
46
    void calclulateEstablishment(); ///< perform establishment calculations
46
    void calculateEstablishment(); ///< perform establishment calculations
47
    void calclulateSaplingGrowth(); ///< growth of saplings
47
    void calclulateSaplingGrowth(); ///< growth of saplings
48
    void addSapling(const QPoint &position) { mSapling.addSapling(position); } ///< add a saplings on a given position
48
    void addSapling(const QPoint &position) { mSapling.addSapling(position); } ///< add a saplings on a given position
49
    void clearSaplings(const QPoint &position) { mSapling.clearSaplings(position);} ///< clear saplings on a given position (after recruitment)
49
    void clearSaplings(const QPoint &position) { mSapling.clearSaplings(position);} ///< clear saplings on a given position (after recruitment)
50
    bool hasSaplingAt(const QPoint &position) const { return mSapling.hasSapling(position); } ///< return true if a sapling of the current speices is present at 'position'
50
    bool hasSaplingAt(const QPoint &position) const { return mSapling.hasSapling(position); } ///< return true if a sapling of the current speices is present at 'position'
51
    // visualization/graphical output
51
    // visualization/graphical output
52
    void visualGrid(Grid<float> &grid) const;
52
    void visualGrid(Grid<float> &grid) const;
53
53
54
private:
54
private:
55
    ResourceUnitSpecies(const ResourceUnitSpecies &); // no copy
55
    ResourceUnitSpecies(const ResourceUnitSpecies &); // no copy
56
    ResourceUnitSpecies &operator=(const ResourceUnitSpecies &); // no copy
56
    ResourceUnitSpecies &operator=(const ResourceUnitSpecies &); // no copy
57
    double mLAIfactor; ///< relative amount of this species' LAI on this resource unit (0..1). Is calculated once a year.
57
    double mLAIfactor; ///< relative amount of this species' LAI on this resource unit (0..1). Is calculated once a year.
58
    double mRemovedGrowth; ///< m3 volume of trees removed/managed (to calculate GWL)
58
    double mRemovedGrowth; ///< m3 volume of trees removed/managed (to calculate GWL)
59
    StandStatistics mStatistics; ///< statistics of a species on this resource unit
59
    StandStatistics mStatistics; ///< statistics of a species on this resource unit
60
    StandStatistics mStatisticsDead; ///< statistics of died trees (this year) of a species on this resource unit
60
    StandStatistics mStatisticsDead; ///< statistics of died trees (this year) of a species on this resource unit
61
    StandStatistics mStatisticsMgmt; ///< statistics of removed trees (this year) of a species on this resource unit
61
    StandStatistics mStatisticsMgmt; ///< statistics of removed trees (this year) of a species on this resource unit
62
    Production3PG m3PG; ///< NPP prodution unit of this species
62
    Production3PG m3PG; ///< NPP prodution unit of this species
63
    SpeciesResponse mResponse; ///< calculation and storage of species specific respones on this resource unit
63
    SpeciesResponse mResponse; ///< calculation and storage of species specific respones on this resource unit
64
    Establishment mEstablishment; ///< establishment for seedlings and sapling growth
64
    Establishment mEstablishment; ///< establishment for seedlings and sapling growth
65
    Sapling mSapling; ///< saplings storage/growth
65
    Sapling mSapling; ///< saplings storage/growth
66
    Species *mSpecies; ///< link to speices
66
    Species *mSpecies; ///< link to speices
67
    ResourceUnit *mRU; ///< link to resource unit
67
    ResourceUnit *mRU; ///< link to resource unit
68
    int mLastYear;
68
    int mLastYear;
69
};
69
};
70
70
71
#endif // RESSOURCEUNITSPECIES_H
71
#endif // RESSOURCEUNITSPECIES_H
72
 
72