iLand
standstatistics.h
Go to the documentation of this file.
1/********************************************************************************************
2** iLand - an individual based forest landscape and disturbance model
3** http://iland-model.org
4** Copyright (C) 2009- Werner Rammer, Rupert Seidl
5**
6** This program is free software: you can redistribute it and/or modify
7** it under the terms of the GNU General Public License as published by
8** the Free Software Foundation, either version 3 of the License, or
9** (at your option) any later version.
10**
11** This program is distributed in the hope that it will be useful,
12** but WITHOUT ANY WARRANTY; without even the implied warranty of
13** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14** GNU General Public License for more details.
15**
16** You should have received a copy of the GNU General Public License
17** along with this program. If not, see <http://www.gnu.org/licenses/>.
18********************************************************************************************/
19
20#ifndef STANDSTATISTICS_H
21#define STANDSTATISTICS_H
22class Tree;
23struct TreeGrowthData;
25class SaplingStat;
26
28{
29public:
30 StandStatistics() { mRUS=0; clear();}
31 void setResourceUnitSpecies(const ResourceUnitSpecies *rus) { mRUS=rus; }
32
33 void add(const StandStatistics &stat);
34 void addAreaWeighted(const StandStatistics &stat, const double weight);
35 void add(const Tree *tree, const TreeGrowthData *tgd);
36 void addNPP(const TreeGrowthData *tgd);
37
38 void add(const SaplingStat *sapling);
39 void clear();
40 void clearOnlyTrees();
41 void calculate();
43 // getters
44 double count() const { return mCount; }
45 double dbh_avg() const { return mAverageDbh; }
46 double height_avg() const { return mAverageHeight; }
47 double volume() const { return mSumVolume; }
48 double gwl() const { return mGWL;}
49 double basalArea() const { return mSumBasalArea; }
50 double leafAreaIndex() const { return mLeafAreaIndex; }
51 double leafAreaIndexSaplings() const { return mLAISaplings; }
52 double npp() const { return mNPP; }
53 double nppAbove() const { return mNPPabove; }
54 double nppSaplings() const { return mNPPsaplings; }
55 int cohortCount() const { return static_cast<int>(mCohortCount); }
56 int saplingCount() const { return static_cast<int>(mSaplingCount); }
57 double saplingAge() const { return mAverageSaplingAge; }
58 double saplingBasalArea() const { return mBasalAreaSaplings; }
59 // carbon/nitrogen cycle
60 double cStem() const { return mCStem; }
61 double nStem() const { return mNStem; }
62 double cBranch() const { return mCBranch; }
63 double nBranch() const { return mNBranch; }
64 double cFoliage() const { return mCFoliage; }
65 double nFoliage() const { return mNFoliage; }
66 double cCoarseRoot() const { return mCCoarseRoot; }
67 double nCoarseRoot() const { return mNCoarseRoot; }
68 double cFineRoot() const { return mCFineRoot; }
69 double nFineRoot() const { return mNFineRoot; }
70 double cRegeneration() const { return mCRegeneration; }
71 double nRegeneration() const { return mNRegeneration; }
73 double totalCarbon() const { return mCStem + mCBranch + mCFoliage + mCFineRoot + mCCoarseRoot + mCRegeneration; }
74
75private:
76 inline void addBiomass(const double biomass, const double CNRatio, double *C, double *N);
77 const ResourceUnitSpecies *mRUS;
78 double mCount;
79 double mSumDbh;
80 double mSumHeight;
81 double mSumBasalArea;
82 double mSumVolume;
83 double mGWL;
84 double mAverageDbh;
85 double mAverageHeight;
86 double mLeafAreaIndex;
87 double mNPP;
88 double mNPPabove;
89 double mNPPsaplings; // carbon gain of saplings (kg Biomass)
90 // regeneration layer
91 double mCohortCount;
92 double mSaplingCount;
93 double mSumSaplingAge;
94 double mAverageSaplingAge;
95 double mLAISaplings;
96 double mBasalAreaSaplings;
97 // carbon and nitrogen pools
98 double mCStem, mCFoliage, mCBranch, mCCoarseRoot, mCFineRoot;
99 double mNStem, mNFoliage, mNBranch, mNCoarseRoot, mNFineRoot;
100 double mCRegeneration, mNRegeneration;
101};
102
103
107{
108public:
113 void writeOutput();
114 // the system counters
118 // timings
124 double tSapling;
129
130};
131
132#endif // STANDSTATISTICS_H
The class contains data available at ResourceUnit x Species scale.
Definition: resourceunitspecies.h:34
The SaplingStat class stores statistics on the resource unit x species level.
Definition: saplings.h:132
Collects information on stand level for each tree species.
Definition: standstatistics.h:28
void calculate()
call after all trees are processed (postprocessing)
Definition: standstatistics.cpp:112
double basalArea() const
sum of basal area of all trees (m2/ha)
Definition: standstatistics.h:49
void add(const StandStatistics &stat)
add aggregates of stat to own aggregates
Definition: standstatistics.cpp:169
double nStem() const
Definition: standstatistics.h:61
double nBranch() const
Definition: standstatistics.h:63
double cBranch() const
Definition: standstatistics.h:62
void clearOnlyTrees()
clear the statistics only for tree biomass (keep NPP, regen, ...)
Definition: standstatistics.cpp:59
double count() const
Definition: standstatistics.h:44
double nRegeneration() const
Definition: standstatistics.h:71
double nppSaplings() const
carbon gain of saplings (kg Biomass increment)/ha
Definition: standstatistics.h:54
double cRegeneration() const
Definition: standstatistics.h:70
double cCoarseRoot() const
Definition: standstatistics.h:66
double totalCarbon() const
total carbon stock: sum of carbon of all living trees + regeneration layer
Definition: standstatistics.h:73
double height_avg() const
average tree height (m)
Definition: standstatistics.h:46
double gwl() const
total increment (m3/ha)
Definition: standstatistics.h:48
double nFoliage() const
Definition: standstatistics.h:65
double cFoliage() const
Definition: standstatistics.h:64
void addNPP(const TreeGrowthData *tgd)
add only the NPP
Definition: standstatistics.cpp:103
double nppAbove() const
above ground NPP (kg Biomass increment)/ha
Definition: standstatistics.h:53
void calculateAreaWeighted()
call after a series of addAreaWeighted
Definition: standstatistics.cpp:153
int saplingCount() const
number individuals in regeneration layer (represented by "cohortCount" cohorts) N/ha
Definition: standstatistics.h:56
void addAreaWeighted(const StandStatistics &stat, const double weight)
add aggregates of stat to this aggregate and scale using the weight (e.g. stockable area)
Definition: standstatistics.cpp:197
double nCoarseRoot() const
Definition: standstatistics.h:67
double saplingAge() const
average age of sapling (currenty not weighted with represented sapling numbers...)
Definition: standstatistics.h:57
double cStem() const
Definition: standstatistics.h:60
StandStatistics()
Definition: standstatistics.h:30
int cohortCount() const
number of cohorts of saplings / ha
Definition: standstatistics.h:55
void setResourceUnitSpecies(const ResourceUnitSpecies *rus)
Definition: standstatistics.h:31
double leafAreaIndex() const
[m2/m2]/ha stocked area (trees > 4m)
Definition: standstatistics.h:50
double cFineRoot() const
Definition: standstatistics.h:68
double saplingBasalArea() const
total basal area (m2) of saplings (>1.3m)
Definition: standstatistics.h:58
double nFineRoot() const
Definition: standstatistics.h:69
double volume() const
sum of tree volume (m3/ha)
Definition: standstatistics.h:47
double leafAreaIndexSaplings() const
m2/m2 LAI of sapling layer
Definition: standstatistics.h:51
double npp() const
sum. of NPP (kg Biomass increment, above+belowground, trees >4m)/ha
Definition: standstatistics.h:52
double dbh_avg() const
average dbh (cm)
Definition: standstatistics.h:45
void clear()
call before trees are aggregated
Definition: standstatistics.cpp:39
holds a couple of system statistics primarily aimed for performance and memory analyis.
Definition: standstatistics.h:107
int treeCount
Definition: standstatistics.h:115
double tEstablishment
Definition: standstatistics.h:125
int saplingCount
Definition: standstatistics.h:116
int newSaplings
Definition: standstatistics.h:117
double tWriteOutput
Definition: standstatistics.h:127
double tTreeGrowth
Definition: standstatistics.h:122
void writeOutput()
Definition: standstatistics.cpp:251
double tReadPattern
Definition: standstatistics.h:121
void reset()
Definition: standstatistics.h:110
double tSapling
Definition: standstatistics.h:124
double tSeedDistribution
Definition: standstatistics.h:123
double tApplyPattern
Definition: standstatistics.h:120
SystemStatistics()
Definition: standstatistics.h:109
double tTotalYear
Definition: standstatistics.h:128
double tManagement
Definition: standstatistics.h:119
double tCarbonCycle
Definition: standstatistics.h:126
A tree is the basic simulation entity of iLand and represents a single tree.
Definition: tree.h:44
internal data structure which is passed between function and to statistics
Definition: tree.h:257