6 |
#include "stochasticdata.h" |
#include "stochasticdata.h" |
7 |
#include "interrupthandler.h" |
#include "interrupthandler.h" |
8 |
#include "global.h" |
#include "global.h" |
9 |
|
#ifdef _OPENMP |
10 |
|
#include <omp.h> |
11 |
|
#endif |
12 |
|
|
13 |
Ecosystem* EcoSystem; |
Ecosystem* EcoSystem; |
14 |
|
StochasticData* data = 0; |
15 |
|
Ecosystem** EcoSystems; |
16 |
|
|
17 |
|
|
18 |
int main(int aNumber, char* const aVector[]) { |
int main(int aNumber, char* const aVector[]) { |
19 |
|
|
20 |
MainInfo main; |
MainInfo main; |
21 |
StochasticData* data = 0; |
|
22 |
|
// omp_set_num_threads(4); |
23 |
|
|
24 |
int check = 0; |
int check = 0; |
25 |
|
|
26 |
//Initialise random number generator with system time [MNAA 02.02.26] |
//Initialise random number generator with system time [MNAA 02.02.26] |
140 |
|
|
141 |
EcoSystem->Update(data); |
EcoSystem->Update(data); |
142 |
EcoSystem->checkBounds(); |
EcoSystem->checkBounds(); |
|
delete data; |
|
143 |
} else |
} else |
144 |
handle.logMessage(LOGFAIL, "Error - no parameter input file specified"); |
handle.logMessage(LOGFAIL, "Error - no parameter input file specified"); |
145 |
|
|
149 |
EcoSystem->writeStatus(main.getPrintInitialFile()); |
EcoSystem->writeStatus(main.getPrintInitialFile()); |
150 |
} |
} |
151 |
|
|
152 |
|
#ifdef _OPENMP |
153 |
|
int numThr = omp_get_max_threads ( ); |
154 |
|
EcoSystems = new Ecosystem*[numThr]; |
155 |
|
int i; |
156 |
|
for (i=0; i<numThr; i++) |
157 |
|
{ |
158 |
|
EcoSystems[i] = new Ecosystem(main); |
159 |
|
EcoSystems[i]->Update(data); |
160 |
|
EcoSystems[i]->Initialise(); |
161 |
|
} |
162 |
|
#endif |
163 |
EcoSystem->Optimise(); |
EcoSystem->Optimise(); |
164 |
|
delete data; |
165 |
if (main.getForcePrint()) |
if (main.getForcePrint()) |
166 |
EcoSystem->Simulate(main.getForcePrint()); |
EcoSystem->Simulate(main.getForcePrint()); |
167 |
} |
} |