/[escript]/branches/split/esysUtils/src/Esys_MPI.cpp
ViewVC logotype

Diff of /branches/split/esysUtils/src/Esys_MPI.cpp

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

revision 4812 by jfenwick, Thu Mar 27 07:41:59 2014 UTC revision 4813 by jfenwick, Thu Mar 27 07:57:49 2014 UTC
# Line 24  Line 24 
24  #include "index.h"  #include "index.h"
25  #include "mem.h"  #include "mem.h"
26  #include "error.h"  #include "error.h"
27    #include "EsysException.h"
28    
29    
30  #include <iostream> // temp for debugging  #include <iostream> // temp for debugging
# Line 33  namespace esysUtils Line 34  namespace esysUtils
34        
35  JMPI makeInfo(MPI_Comm comm, bool owncom)  JMPI makeInfo(MPI_Comm comm, bool owncom)
36  {  {
37        if (esysUtils::NoCOMM_WORLD::active() && comm==MPI_COMM_WORLD)
38        {
39        throw esysUtils::EsysException("Attempt to use the MPI_COMM_WORLD communicator when it is blocked.");
40        }
41      JMPI_* p=new JMPI_(comm, owncom);      JMPI_* p=new JMPI_(comm, owncom);
42      return JMPI(p);      return JMPI(p);
43  }  }
# Line 264  bool esysUtils::shipString(const char* s Line 269  bool esysUtils::shipString(const char* s
269        
270  }  }
271    
   
272  namespace  namespace
273  {  {
274      bool splitworld=false;      // true if a split world call is currently running and MPI_COMM_WORLD should not be allowed by default
275          bool nocommworldplease=false;
276  }  }
277    
278  namespace esysUtils  esysUtils::NoCOMM_WORLD::NoCOMM_WORLD()
 {  
   
 /* has the have sub-communicators been created? */  
 bool getSplitWorld()  
279  {  {
280      return splitworld;        if (nocommworldplease)
281        {
282        throw EsysException("NoCOMM_WORLD does not nest.");
283        }
284        nocommworldplease=true;
285  }  }
286    
287    esysUtils::NoCOMM_WORLD::~NoCOMM_WORLD()
 /* record that a sub-communicator has been created or used */  
 void splitWorld()  
288  {  {
289      splitworld=true;      nocommworldplease=false;
290  }  }  
291    
292    bool esysUtils::NoCOMM_WORLD::active()
293    {
294        return nocommworldplease;
295  }  }
296    
297  /**************************************************  /**************************************************

Legend:
Removed from v.4812  
changed lines
  Added in v.4813

  ViewVC Help
Powered by ViewVC 1.1.26