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

kraftche at mcs.anl.gov kraftche at mcs.anl.gov
Sat Nov 15 01:33:29 CST 2008


Author: kraftche
Date: 2008-11-15 01:33:28 -0600 (Sat, 15 Nov 2008)
New Revision: 2258

Modified:
   MOAB/trunk/parallel/MBParallelComm.cpp
Log:
Fix bugs:
 o Do not try to ghost entities that aren't owned
 o Not all sent entities are ghosted, or even owned by the 
   current processor.  Don't stomp on pstatus_tag for non-owned
   entities.  Fixes vertex ownership corruption during ghosting.
 o When appending to sharing data, if previous data was in sharedp_tag
   and new data is in sharedps_tag, need to clear sharedp_tag.



Modified: MOAB/trunk/parallel/MBParallelComm.cpp
===================================================================
--- MOAB/trunk/parallel/MBParallelComm.cpp	2008-11-14 23:53:17 UTC (rev 2257)
+++ MOAB/trunk/parallel/MBParallelComm.cpp	2008-11-15 07:33:28 UTC (rev 2258)
@@ -1505,11 +1505,21 @@
       RRA("Couldn't set sharedhs tag (range)");
       std::fill(remote_procs.begin(), remote_procs.end(), -1);
       std::fill(remote_handles.begin(), remote_handles.end(), 0);
+        // need to clear sharedp_tag and sharedh_tag if prev 
+        // data came from there
+      if (-1 != remote_proc[i]) {
+        remote_proc[i] = -1;
+        remote_handle[i] = 0;
+        result = mbImpl->tag_set_data(sharedp_tag, &*rit, 1, &remote_proc[i] );
+        RRA("Couldn't set sharedp tag");
+        result = mbImpl->tag_set_data(sharedh_tag, &*rit, 1, &remote_handle[i] );
+        RRA("Couldn't set sharedp tag");
+      }
     }
   }
 
     // also update shared flag for these ents
-  unsigned int *shared_flags = (unsigned int*) &remote_proc[0];
+  unsigned char *shared_flags = (unsigned char*) &remote_proc[0];
   result = mbImpl->tag_get_data(pstatus_tag, local_range, shared_flags);
   RRA("Couldn't get pstatus tag (range)");
   for (unsigned int i = 0; i < local_range.size(); i++)
@@ -3171,6 +3181,19 @@
     result = mbImpl->get_adjacencies(*bridge_ents_ptr, to_dim, false, new_ghosts,
                                      MBInterface::UNION);
     RRA("Trouble getting ghost adjacencies in iteration.");
+    
+      // remove from new_ghosts any entities that I don't own
+    MBRange::iterator i = new_ghosts.begin();
+    while (i != new_ghosts.end()) {
+      int owner;
+      result = get_owner( *i, owner );
+      RRA("Trouble getting owner of to-be-ghosted entity");
+      if (owner == proc_config().proc_rank())
+        ++i;
+      else
+        i = new_ghosts.erase( i );
+    }
+    
     to_ents.merge(new_ghosts);
     result = mbImpl->get_adjacencies(new_ghosts, bridge_dim, false, new_bridges,
                                      MBInterface::UNION);
@@ -3340,8 +3363,16 @@
     RRA("Failed to pack-send in ghost exchange.");
 
     if (0 != num_layers) {
-      new_ghosted.merge(sent_ents[ind]);
-      ghostedEnts[*sit].merge(sent_ents[ind]);
+      MBRange::iterator ins1 = new_ghosted.begin(), ins2 = ghostedEnts[*sit].begin();
+      int owner;
+      for (MBRange::iterator s = sent_ents[ind].begin(); s != sent_ents[ind].end(); ++s) {
+        result = get_owner( *s, owner );
+        RRA("Trouble getting entity owner");
+        if (owner == proc_config().proc_rank()) {
+          ins1 = new_ghosted.insert( ins1, *s, *s );
+          ins2 = ghostedEnts[*sit].insert( ins2, *s, *s );
+        }
+      }
     }
   }
   




More information about the moab-dev mailing list