-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.cpp
More file actions
104 lines (94 loc) · 2.63 KB
/
Main.cpp
File metadata and controls
104 lines (94 loc) · 2.63 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
/*----------------------------------------------------------------------------
*
* 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/>.
*
--------------------------------------------------------------------------*/
#if LINUX_CLUSTER || R_CMD
#include <unistd.h>
#else
#include <tchar.h>
#endif
#include <stdlib.h>
#include <string>
#include <iostream>
#include <cassert>
#include "Individual.h"
#include "Community.h"
#include "RSrandom.h"
#include "Utils.h"
#include "Parameters.h"
#include "Population.h"
#include "Landscape.h"
#include "Species.h"
#include "SubCommunity.h"
#include "Management.h"
using namespace std;
#ifdef UNIT_TESTS
void testIndividual();
void testNeutralStats();
void testPopulation();
void run_unit_tests() {
cout << "******* Unit test output *******" << endl;
testRSrandom();
testLandscape();
testIndividual();
testPopulation();
testNeutralStats();
cout << endl << "************************" << endl;
}
#endif // UNIT_TESTS
// Global vars
string landFile;
paramGrad* paramsGrad;
paramStoch* paramsStoch;
paramInit* paramsInit;
paramSim* paramsSim;
RSrandom* pRandom;
Management* pManagement; // pointer to management routines
Species* pSpecies;
Community* pComm;
short nDSlayer=gMaxNbLayers;
#if LINUX_CLUSTER || RS_RCPP
int main(int argc, char* argv[])
#else
int _tmain(int argc, _TCHAR* argv[])
#endif
{
#ifndef UNIT_TESTS
cout << "This version is only for running unit tests." << endl;
return 1;
#else
// Initialise globals
paramsGrad = new paramGrad;
paramsStoch = new paramStoch;
paramsInit = new paramInit;
paramsSim = new paramSim;
pRandom = new RSrandom;
assert(0.1 > 0.0); // assert does run correctly
try
{
run_unit_tests();
}
catch (const std::exception& e)
{
cerr << endl << "Error: " << e.what() << endl;
}
cout << "All tests have completed." << endl;
return 0; // if tests succeed, we are happy
# endif // NDEBUG
}