[MOAB-dev] r1962 - MOAB/trunk/parallel

kraftche at mcs.anl.gov kraftche at mcs.anl.gov
Mon Jun 30 10:26:14 CDT 2008


Author: kraftche
Date: 2008-06-30 10:26:14 -0500 (Mon, 30 Jun 2008)
New Revision: 1962

Modified:
   MOAB/trunk/parallel/MBParallelComm.cpp
   MOAB/trunk/parallel/MBParallelComm.hpp
Log:
Move the majority of remove_nonowned_shared into a separate function that
can be used to get a list non-shared, owned entities without modifying
the input list:  get_owned_entities.




Modified: MOAB/trunk/parallel/MBParallelComm.cpp
===================================================================
--- MOAB/trunk/parallel/MBParallelComm.cpp	2008-06-30 02:36:03 UTC (rev 1961)
+++ MOAB/trunk/parallel/MBParallelComm.cpp	2008-06-30 15:26:14 UTC (rev 1962)
@@ -3050,19 +3050,19 @@
   return false;
 }
 
-MBErrorCode MBParallelComm::remove_nonowned_shared(MBRange &ents,
-                                                   int to_proc,
-                                                   bool owned_test,
-                                                   bool shared_test) 
+MBErrorCode MBParallelComm::get_owned_entities( const MBRange &ents,
+                                                MBRange& tmp_ents,
+                                                int to_proc,
+                                                bool owned_test,
+                                                bool shared_test ) 
 {
-    // remove from ents any entities which are not owned locally or
+    // Put into tmp_ents any entities which are not owned locally or
     // who are already shared with to_proc
   std::vector<unsigned char> shared_flags(ents.size());
   MBErrorCode result = mbImpl->tag_get_data(pstatus_tag(), ents,
                                             &shared_flags[0]);
   RRA("Failed to get pstatus flag.");
-  MBRange tmp_ents;
-  MBRange::iterator rit;
+  MBRange::const_iterator rit;
   int sharing_procs[MAX_SHARING_PROCS];
   std::fill(sharing_procs, sharing_procs+MAX_SHARING_PROCS, -1);
   int i;
@@ -3097,12 +3097,25 @@
       std::fill(sharing_procs, sharing_procs+MAX_SHARING_PROCS, -1);
     }
   }
-    
-  ents.swap(tmp_ents);
   
   return MB_SUCCESS;
 }
 
+MBErrorCode MBParallelComm::remove_nonowned_shared(MBRange &ents,
+                                                   int to_proc,
+                                                   bool owned_test,
+                                                   bool shared_test) 
+{
+  MBRange tmp_ents;
+  MBErrorCode rval;
+  
+  rval = get_owned_entities( ents, tmp_ents, to_proc, owned_test, shared_test );
+  if (MB_SUCCESS == rval)
+    ents.swap(tmp_ents);
+    
+  return rval;
+}
+
 MBErrorCode MBParallelComm::exchange_ghost_cells(int ghost_dim, int bridge_dim,
                                                  int num_layers,
                                                  bool store_remote_handles,

Modified: MOAB/trunk/parallel/MBParallelComm.hpp
===================================================================
--- MOAB/trunk/parallel/MBParallelComm.hpp	2008-06-30 02:36:03 UTC (rev 1961)
+++ MOAB/trunk/parallel/MBParallelComm.hpp	2008-06-30 15:26:14 UTC (rev 1962)
@@ -310,6 +310,22 @@
                                      bool owned_test = true,
                                      bool shared_test = true);
   
+    /** Get entities owned by this processor (including non-shared entities).
+     *  Optionally remove from the result list any entities shared with
+     *  'to_proc'.
+     *\param ents       Input entities to check ownership of.
+     *\param owned_ents Output list.
+     *\param to_proc    Do not return owned entities if they are shared
+     *                  with this processor.
+     *\param owned_test Check entity ownership
+     *\param shared_test Test if entity is shared with 'to_proc'
+     */
+  MBErrorCode get_owned_entities( const MBRange& ents,
+                                  MBRange& owned_ents,
+                                  int to_proc = -1,
+                                  bool owned_test = true,
+                                  bool shared_test = true );
+  
 private:
 
   int num_subranges(const MBRange &this_range);




More information about the moab-dev mailing list