-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathModel.h
More file actions
118 lines (98 loc) · 3.47 KB
/
Model.h
File metadata and controls
118 lines (98 loc) · 3.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/*----------------------------------------------------------------------------
*
* Copyright (C) 2026 Greta Bocedi, Stephen C.F. Palmer, Justin M.J. Travis, Anne-Kathleen Malchow, Roslyn Henry, Théo Pannetier, Jette Wolff, Damaris Zurell
*
* This file is part of RangeShifter.
*
* RangeShifter is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* RangeShifter is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with RangeShifter. If not, see <https://www.gnu.org/licenses/>.
*
--------------------------------------------------------------------------*/
/*------------------------------------------------------------------------------
RangeShifter v2.0 Model
Implements three functions which run the model and produce output common to both
GUI and batch version.
RunModel() handles looping through replicates, years and generations
Further functions are declared here, but defined differently in main function of
GUI and batch versions.
For full details of RangeShifter, please see:
Bocedi G., Palmer S.C.F., Pe’er G., Heikkinen R.K., Matsinos Y.G., Watts K.
and Travis J.M.J. (2014). RangeShifter: a platform for modelling spatial
eco-evolutionary dynamics and species’ responses to environmental changes.
Methods in Ecology and Evolution, 5, 388-396. doi: 10.1111/2041-210X.12162
Authors: Greta Bocedi & Steve Palmer, University of Aberdeen
Last updated: 28 July 2021 by Greta Bocedi
------------------------------------------------------------------------------*/
#ifndef ModelH
#define ModelH
#include <sys/types.h>
#include <sys/stat.h>
#if RS_RCPP
#include <Rcpp.h>
#include "../Rinterface.h"
#endif // RS_RCPP
#include <chrono>
#include "Parameters.h"
#include "Landscape.h"
#include "Community.h"
#include "SubCommunity.h"
#include "Species.h"
#include "Management.h"
#if !LINUX_CLUSTER && !RS_RCPP
#include <filesystem>
using namespace std::filesystem;
#endif
#if RS_RCPP && !R_CMD
Rcpp::List RunModel(
Landscape*, // pointer to Landscape
int, // sequential simulation number
Rcpp::S4 // parameter master to read initial conditions in each replicate simulation
);
#else
int RunModel(
Landscape*, // pointer to Landscape
int // sequential simulation number
);
#endif // RS_RCPP && !R_CMD
bool CheckDirectory(const string& pathToProjDir);
void PreReproductionOutput(
Landscape*, // pointer to Landscape
Community*, // pointer to Community
int, // replicate
int, // year
int // generation
);
void RangePopOutput(
Community*, // pointer to Community
int, // replicate
int, // year
int // generation
);
void OutParameters(
Landscape* // pointer to Landscape
);
extern paramGrad *paramsGrad;
extern paramStoch *paramsStoch;
extern Species *pSpecies;
extern paramSim *paramsSim;
extern paramInit *paramsInit;
extern Community *pComm;
extern Management *pManagement;
extern string landFile;
extern RSrandom *pRandom;
#if RS_RCPP
extern std::uint32_t RS_random_seed;
extern string name_landscape, name_patch, name_costfile, name_sp_dist;
#endif
//---------------------------------------------------------------------------
#endif