Log In | Get Help   
Home My Page Projects Code Snippets Project Openings Mareframe
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files
[mareframe] Diff of /trunk/gadget/gadget.cc
[mareframe] / trunk / gadget / gadget.cc Repository:
ViewVC logotype

Diff of /trunk/gadget/gadget.cc

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1, Mon Feb 10 17:09:07 2014 UTC revision 17, Mon Nov 9 10:22:57 2015 UTC
# Line 6  Line 6 
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    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    
23    MainInfo main;    MainInfo main;
24    StochasticData* data = 0;  
25    //  omp_set_num_threads(4);
26    
27    int check = 0;    int check = 0;
28    
29    //Initialise random number generator with system time [MNAA 02.02.26]    //Initialise random number generator with system time [MNAA 02.02.26]
# Line 53  Line 63 
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)
# Line 133  Line 143 
143    
144        EcoSystem->Update(data);        EcoSystem->Update(data);
145        EcoSystem->checkBounds();        EcoSystem->checkBounds();
       delete data;  
146      } else      } else
147        handle.logMessage(LOGFAIL, "Error - no parameter input file specified");        handle.logMessage(LOGFAIL, "Error - no parameter input file specified");
148    
# Line 143  Line 152 
152        EcoSystem->writeStatus(main.getPrintInitialFile());        EcoSystem->writeStatus(main.getPrintInitialFile());
153      }      }
154    
155    #ifdef _OPENMP
156              int numThr = omp_get_max_threads ( );
157              EcoSystems = new Ecosystem*[numThr];
158              int i;
159              for (i=0; i<numThr; i++)
160              {
161                      EcoSystems[i] = new Ecosystem(main);
162                      EcoSystems[i]->Update(data);
163                      EcoSystems[i]->Initialise();
164              }
165    #endif
166      EcoSystem->Optimise();      EcoSystem->Optimise();
167              delete data;
168      if (main.getForcePrint())      if (main.getForcePrint())
169        EcoSystem->Simulate(main.getForcePrint());        EcoSystem->Simulate(main.getForcePrint());
170    }    }

Legend:
Removed from v.1  
changed lines
  Added in v.17

root@forge.cesga.es
ViewVC Help
Powered by ViewVC 1.0.0  

Powered By FusionForge