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 10, Wed Jun 10 13:01:42 2015 UTC revision 11, Thu Jul 23 19:00:38 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 GADGET_OPENMP
10    #include <omp.h>
11    #endif
12    
13  Ecosystem* EcoSystem;  Ecosystem* EcoSystem;
14    //FIXME need?
15    StochasticData* data = 0;
16    Ecosystem** EcoSystems;
17    
18    
19  int main(int aNumber, char* const aVector[]) {  int main(int aNumber, char* const aVector[]) {
20    
21    MainInfo main;    MainInfo main;
22    StochasticData* data = 0;  
23    //  omp_set_num_threads(4);
24    
25    int check = 0;    int check = 0;
26    
27    //Initialise random number generator with system time [MNAA 02.02.26]    //Initialise random number generator with system time [MNAA 02.02.26]
# Line 133  Line 141 
141    
142        EcoSystem->Update(data);        EcoSystem->Update(data);
143        EcoSystem->checkBounds();        EcoSystem->checkBounds();
       delete data;  
144      } else      } else
145        handle.logMessage(LOGFAIL, "Error - no parameter input file specified");        handle.logMessage(LOGFAIL, "Error - no parameter input file specified");
146    
# Line 143  Line 150 
150        EcoSystem->writeStatus(main.getPrintInitialFile());        EcoSystem->writeStatus(main.getPrintInitialFile());
151      }      }
152    
153              if (main.runOmp())
154              {
155    #ifdef GADGET_OPENMP
156                      int numThr = omp_get_max_threads ( );
157                      //FIXME OJO! ml
158                      EcoSystems = new Ecosystem*[numThr];
159                      int i;
160                      //EcoSystems[0] = EcoSystem;
161                      for (i=0; i<numThr; i++)
162                      {
163                              EcoSystems[i] = new Ecosystem(main);
164                              EcoSystems[i]->Update(data);
165                              EcoSystems[i]->Initialise();
166                      }
167                      EcoSystem->OptimiseOMP();
168                      //////optimiseOMP main.runPrint()
169    #endif
170    
171              } else {
172    #ifndef NO_OPENMP
173                      int numThr = omp_get_max_threads ( );
174                      //FIXME OJO! ml
175                      EcoSystems = new Ecosystem*[numThr];
176                      int i;
177                      //EcoSystems[0] = EcoSystem;
178                      for (i=0; i<numThr; i++)
179                      {
180                              EcoSystems[i] = new Ecosystem(main);
181                              EcoSystems[i]->Update(data);
182                              EcoSystems[i]->Initialise();
183                      }
184    #endif
185      EcoSystem->Optimise();      EcoSystem->Optimise();
186              }
187              delete data;
188      if (main.getForcePrint())      if (main.getForcePrint())
189        EcoSystem->Simulate(main.getForcePrint());        EcoSystem->Simulate(main.getForcePrint());
190    }    }

Legend:
Removed from v.10  
changed lines
  Added in v.11

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

Powered By FusionForge