Subversion Repositories public iLand

Rev

Rev 951 | Rev 1104 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1
 
1033 werner 2
/********************************************************************************************
3
**    iLand - an individual based forest landscape and disturbance model
4
**    http://iland.boku.ac.at
5
**    Copyright (C) 2009-  Werner Rammer, Rupert Seidl
6
**
7
**    This program is free software: you can redistribute it and/or modify
8
**    it under the terms of the GNU General Public License as published by
9
**    the Free Software Foundation, either version 3 of the License, or
10
**    (at your option) any later version.
11
**
12
**    This program is distributed in the hope that it will be useful,
13
**    but WITHOUT ANY WARRANTY; without even the implied warranty of
14
**    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
**    GNU General Public License for more details.
16
**
17
**    You should have received a copy of the GNU General Public License
18
**    along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
********************************************************************************************/
20
 
187 iland 21
#ifndef RESOURCEUNITSPECIES_H
22
#define RESOURCEUNITSPECIES_H
115 Werner 23
#include "production3pg.h"
180 werner 24
#include "standstatistics.h"
193 werner 25
#include "speciesresponse.h"
440 werner 26
#include "establishment.h"
450 werner 27
#include "sapling.h"
453 werner 28
#include "grid.h"
475 werner 29
#include "snag.h"
111 Werner 30
class Species;
187 iland 31
class ResourceUnit;
111 Werner 32
 
187 iland 33
class ResourceUnitSpecies
111 Werner 34
{
35
public:
521 werner 36
    ResourceUnitSpecies() : mLAIfactor(0.), mSpecies(0), mRU(0) {}
468 werner 37
    ~ResourceUnitSpecies();
234 werner 38
    void setup(Species *species, ResourceUnit *ru);
115 Werner 39
 
449 werner 40
    // access
209 werner 41
    const SpeciesResponse *speciesResponse() const { return &mResponse; }
208 werner 42
    const Species *species() const { return mSpecies; } ///< return pointer to species
43
    const ResourceUnit *ru() const { return mRU; } ///< return pointer to resource unit
228 werner 44
    const Production3PG &prod3PG() const { return m3PG; } ///< the 3pg production model of this speies x resourceunit
504 werner 45
    const Sapling &sapling() const { return mSapling; } ///< sapling growth submodel
600 werner 46
    Sapling &changeSapling() { return mSapling; } ///< sapling growth submodel (non-const access)
208 werner 47
    StandStatistics &statistics() { return mStatistics; } ///< statistics of this species on the resourceunit
278 werner 48
    StandStatistics &statisticsDead() { return mStatisticsDead; } ///< statistics of died trees
49
    StandStatistics &statisticsMgmt() { return mStatisticsMgmt; } ///< statistics of removed trees
262 werner 50
    const StandStatistics &constStatistics() const { return mStatistics; } ///< const accessor
51
    const StandStatistics &constStatisticsDead() const { return mStatisticsDead; } ///< const accessor
278 werner 52
    const StandStatistics &constStatisticsMgmt() const { return mStatisticsMgmt; } ///< const accessor
53
 
449 werner 54
   // actions
277 werner 55
    void updateGWL();
936 werner 56
    double removedVolume() const { return mRemovedGrowth; } ///< sum of volume with was remvoved because of death/management (m3/ha)
720 werner 57
    /// 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)
58
    double LAIfactor() const { return mLAIfactor; }
937 werner 59
    void setLAIfactor(const double newLAIfraction) { mLAIfactor=newLAIfraction;
60
                                                     if (mLAIfactor<0 || mLAIfactor>1.00001)
61
                                                           qDebug() << "invalid LAIfactor"<<mLAIfactor; }
376 werner 62
    // properties
63
    double leafArea() const; ///< total leaf area of the species on the RU (m2).
115 Werner 64
    // action
440 werner 65
    void calculate(const bool fromEstablishment=false); ///< calculate response for species, calculate actual 3PG production
468 werner 66
    // establishment, sapling growth
863 werner 67
    void calculateEstablishment(); ///< perform establishment calculations
450 werner 68
    void calclulateSaplingGrowth(); ///< growth of saplings
951 werner 69
    int addSapling(const QPoint &position, const float height=0.05f, const int age=1) { return mSapling.addSapling(position, height, age); } ///< add a saplings on a given position
454 werner 70
    void clearSaplings(const QPoint &position) { mSapling.clearSaplings(position);} ///< clear saplings on a given position (after recruitment)
462 werner 71
    bool hasSaplingAt(const QPoint &position) const { return mSapling.hasSapling(position); } ///< return true if a sapling of the current speices is present at 'position'
453 werner 72
    // visualization/graphical output
73
    void visualGrid(Grid<float> &grid) const;
115 Werner 74
 
111 Werner 75
private:
454 werner 76
    ResourceUnitSpecies(const ResourceUnitSpecies &); // no copy
77
    ResourceUnitSpecies &operator=(const ResourceUnitSpecies &); // no copy
376 werner 78
    double mLAIfactor; ///< relative amount of this species' LAI on this resource unit (0..1). Is calculated once a year.
936 werner 79
    double mRemovedGrowth; ///< m3 volume of trees removed/managed (to calculate GWL) (m3/ha)
262 werner 80
    StandStatistics mStatistics; ///< statistics of a species on this resource unit
81
    StandStatistics mStatisticsDead; ///< statistics of died trees (this year) of a species on this resource unit
278 werner 82
    StandStatistics mStatisticsMgmt; ///< statistics of removed trees (this year) of a species on this resource unit
234 werner 83
    Production3PG m3PG; ///< NPP prodution unit of this species
84
    SpeciesResponse mResponse; ///< calculation and storage of species specific respones on this resource unit
440 werner 85
    Establishment mEstablishment; ///< establishment for seedlings and sapling growth
450 werner 86
    Sapling mSapling; ///< saplings storage/growth
468 werner 87
    Species *mSpecies; ///< link to speices
88
    ResourceUnit *mRU; ///< link to resource unit
438 werner 89
    int mLastYear;
111 Werner 90
};
91
 
92
#endif // RESSOURCEUNITSPECIES_H