14 |
StochasticData* data = 0; |
StochasticData* data = 0; |
15 |
Ecosystem** EcoSystems; |
Ecosystem** EcoSystems; |
16 |
|
|
17 |
|
volatile int interrupted = 0; |
18 |
|
volatile int interrupted_print = 0; |
19 |
|
|
20 |
|
|
21 |
int main(int aNumber, char* const aVector[]) { |
int main(int aNumber, char* const aVector[]) { |
22 |
|
|
63 |
#ifdef INTERRUPT_HANDLER |
#ifdef INTERRUPT_HANDLER |
64 |
//JMB dont register interrupt if doing a network run |
//JMB dont register interrupt if doing a network run |
65 |
if (!(main.runNetwork())) |
if (!(main.runNetwork())) |
66 |
registerInterrupts(&EcoSystem->interrupted); |
registerInterrupts(&interrupted); |
67 |
#endif |
#endif |
68 |
|
|
69 |
if (chdir(workingdir) != 0) |
if (chdir(workingdir) != 0) |
153 |
} |
} |
154 |
|
|
155 |
#ifdef _OPENMP |
#ifdef _OPENMP |
156 |
|
if (main.runParallel()){ |
157 |
int numThr = omp_get_max_threads ( ); |
int numThr = omp_get_max_threads ( ); |
158 |
|
handle.logMessage(LOGINFO, "Info - initialise ", numThr," EcoSystems "); |
159 |
EcoSystems = new Ecosystem*[numThr]; |
EcoSystems = new Ecosystem*[numThr]; |
160 |
int i; |
int i; |
161 |
|
#pragma omp parallel for shared(EcoSystems,main,data,handle) |
162 |
for (i=0; i<numThr; i++) |
for (i=0; i<numThr; i++) |
163 |
{ |
{ |
164 |
|
handle.logMessage(LOGINFO, "Info - Ecosystem ", i); |
165 |
|
if (main.getInitialParamGiven()) { |
166 |
EcoSystems[i] = new Ecosystem(main); |
EcoSystems[i] = new Ecosystem(main); |
167 |
EcoSystems[i]->Update(data); |
EcoSystems[i]->Update(data); |
168 |
|
EcoSystems[i]->checkBounds(); |
169 |
|
} |
170 |
EcoSystems[i]->Initialise(); |
EcoSystems[i]->Initialise(); |
171 |
} |
} |
172 |
|
} |
173 |
#endif |
#endif |
174 |
EcoSystem->Optimise(); |
EcoSystem->Optimise(); |
175 |
delete data; |
delete data; |