iLand
bitecell.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#ifndef BCELL_H
20#define BCELL_H
21
22class ResourceUnit;
23class Tree;
24#include <QPointF>
25
26#include "biteclimate.h"
27
28namespace ABE {
29class FMTreeList; // forward
30class FMSaplingList; // forward
31}
32
33namespace BITE {
34
35class BiteAgent;
36
38{
39public:
40 BiteCell() : mRU(nullptr), mIsActive(false), mIsSpreading(false), mIndex(-1), mYearsLiving(0), mCumYearsLiving(0), mTreesLoaded(false), mSaplingsLoaded(false), mArea(0.f) {}
41 void setup(int cellidx, QPointF pos, BiteAgent *agent);
43 int index() const {return mIndex;}
44 BiteAgent *agent() const { return mAgent; }
45 QString info();
46
47 bool isValid() const { return mRU!=nullptr; }
48
49 bool isActive() const {return mIsActive; }
50 void setActive(bool activate) { mIsActive = activate; }
51
52 bool isSpreading() const {return mIsSpreading; }
53 void setSpreading(bool activate) { mIsSpreading = activate; }
54
55 void setTreesLoaded(bool loaded) { mTreesLoaded = loaded; }
56 void setSaplingsLoaded(bool loaded) { mSaplingsLoaded = loaded; }
57 void checkTreesLoaded(ABE::FMTreeList *treelist);
59 bool areTreesLoaded() const { return mTreesLoaded; }
60 bool areSaplingsLoaded() const { return mSaplingsLoaded; }
61
62 int yearsLiving() const { return mYearsLiving; }
63 int yearLastSpread() const { return mLastSpread; }
64 int cumYearsLiving() const { return mCumYearsLiving; }
65
66 // climate vars
67 double climateVar(int var_index) const;
68 // actions
69 void die();
70 void finalize();
72 void notify(ENotification what);
73
74 int loadTrees(ABE::FMTreeList *treelist);
75 int loadSaplings(ABE::FMSaplingList *saplinglist);
76private:
77 void largeCellSetup(QPointF pos);
78 ResourceUnit *mRU;
79 BiteAgent *mAgent;
80 bool mIsActive;
81 bool mIsSpreading;
82 int mIndex;
83 int mYearsLiving;
84 int mLastSpread;
85 int mCumYearsLiving;
86
87 bool mTreesLoaded;
88 bool mSaplingsLoaded;
89
90 float mArea;
91};
92
93} // end namespace
94#endif // BCELL_H
Definition: fmsaplinglist.h:12
The FMTreeList class implements low-level functionality for selecting and harvesting of trees.
Definition: fmtreelist.h:34
Definition: biteagent.h:71
Definition: bitecell.h:38
void setSaplingsLoaded(bool loaded)
Definition: bitecell.h:56
void setActive(bool activate)
Definition: bitecell.h:50
BiteCell()
Definition: bitecell.h:40
BiteAgent * agent() const
Definition: bitecell.h:44
void finalize()
Definition: bitecell.cpp:87
ENotification
Definition: bitecell.h:71
@ CellColonized
Definition: bitecell.h:71
@ CellDied
Definition: bitecell.h:71
@ CellImpacted
Definition: bitecell.h:71
@ CellSpread
Definition: bitecell.h:71
int yearLastSpread() const
Definition: bitecell.h:63
bool areSaplingsLoaded() const
Definition: bitecell.h:60
int loadSaplings(ABE::FMSaplingList *saplinglist)
Definition: bitecell.cpp:128
void notify(ENotification what)
Definition: bitecell.cpp:99
int index() const
index within the agent grid
Definition: bitecell.h:43
void setTreesLoaded(bool loaded)
Definition: bitecell.h:55
int yearsLiving() const
Definition: bitecell.h:62
void checkSaplingsLoaded(ABE::FMSaplingList *saplist)
Definition: bitecell.cpp:63
double climateVar(int var_index) const
Definition: bitecell.cpp:71
bool isActive() const
Definition: bitecell.h:49
void checkTreesLoaded(ABE::FMTreeList *treelist)
Definition: bitecell.cpp:54
bool areTreesLoaded() const
Definition: bitecell.h:59
int cumYearsLiving() const
Definition: bitecell.h:64
bool isValid() const
Definition: bitecell.h:47
void setSpreading(bool activate)
Definition: bitecell.h:53
bool isSpreading() const
Definition: bitecell.h:52
void die()
Definition: bitecell.cpp:79
void setup(int cellidx, QPointF pos, BiteAgent *agent)
Definition: bitecell.cpp:33
QString info()
Definition: bitecell.cpp:49
int loadTrees(ABE::FMTreeList *treelist)
Definition: bitecell.cpp:110
ResourceUnit is the spatial unit that encapsulates a forest stand and links to several environmental ...
Definition: resourceunit.h:49
A tree is the basic simulation entity of iLand and represents a single tree.
Definition: tree.h:44
Definition: abegrid.h:22
Definition: biteagent.cpp:32