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

tautges at mcs.anl.gov tautges at mcs.anl.gov
Fri Jul 11 16:25:02 CDT 2008


Author: tautges
Date: 2008-07-11 16:25:02 -0500 (Fri, 11 Jul 2008)
New Revision: 2008

Modified:
   MOAB/trunk/parallel/MBParallelComm.cpp
   MOAB/trunk/parallel/mbparallelcomm_test.cpp
Log:
Fixing a bug in remote handle initialization for 0 < d entities.

Tweaking mbparallelcomm_test to print usage if # files isn't input.

Passes make check and mbparallelcomm_test.


Modified: MOAB/trunk/parallel/MBParallelComm.cpp
===================================================================
--- MOAB/trunk/parallel/MBParallelComm.cpp	2008-07-10 14:59:28 UTC (rev 2007)
+++ MOAB/trunk/parallel/MBParallelComm.cpp	2008-07-11 21:25:02 UTC (rev 2008)
@@ -1606,15 +1606,17 @@
                                             MBEntityHandle remote_handle) 
 {
   int i = 0;
-  bool more = (remote_procs[0] != -1);
+  bool more = (remote_procs[0] != remote_proc);
   
   while (-1 != remote_procs[i] && i < MAX_SHARING_PROCS && 
          remote_proc > remote_procs[i]) i++;
 
-  if (remote_procs[i] == remote_proc) return MB_SUCCESS;
+  if (remote_procs[i] == remote_proc && 
+      remote_hs[i] == remote_handle)
+    return MB_SUCCESS;
   
   assert(i < MAX_SHARING_PROCS-1);
-  if (-1 != remote_procs[i]) {
+  if (remote_procs[i] != remote_proc) {
     for (int j = MAX_SHARING_PROCS-1; j > i; j--) {
       remote_procs[j] = remote_procs[j-1];
       remote_hs[j] = remote_hs[j-1];
@@ -3011,7 +3013,8 @@
     // if 0 layers, put bridge_ents in to_ents, to avoid range copy later
   if (0 == num_layers) bridge_ents_ptr = &to_ents;
 
-  if (bridge_dim == -1)
+  if (bridge_dim == -1 ||
+      (to_dim == -1 && !num_layers))
     result = mbImpl->get_entities_by_handle(iface_set, *bridge_ents_ptr);
   else
     result = mbImpl->get_entities_by_dimension(iface_set, bridge_dim, *bridge_ents_ptr);
@@ -3345,6 +3348,11 @@
     for (MBRange::iterator rit = interfaceSets.begin(); rit != interfaceSets.end();
          rit++) {
       if (!is_iface_proc(*rit, *sit)) continue;
+
+      int owner;
+      result = get_owner(*rit, owner);
+      if (MB_SUCCESS != result || owner != (int)proc_config().proc_rank()) 
+        continue;
       
       result = get_ghost_layers(*rit, -1, 0, 0, tag_ents);
       RRA("Failed to get tag ents for exchange.");

Modified: MOAB/trunk/parallel/mbparallelcomm_test.cpp
===================================================================
--- MOAB/trunk/parallel/mbparallelcomm_test.cpp	2008-07-10 14:59:28 UTC (rev 2007)
+++ MOAB/trunk/parallel/mbparallelcomm_test.cpp	2008-07-11 21:25:02 UTC (rev 2008)
@@ -56,6 +56,8 @@
 MBErrorCode report_iface_ents(MBInterface *mbImpl,
                               std::vector<MBParallelComm *> &pcs);
 
+void print_usage(const char *);
+
 int main(int argc, char **argv) 
 {
     // need to init MPI first, to tell how many procs and rank
@@ -81,20 +83,7 @@
 
     // get N, M from command line
   if (argc < 3) {
-    if (0 == rank)
-      std::cerr 
-        << "Usage: " << argv[0] 
-        << " [readpar_option] <opt> <input> [...] where:" << std::endl
-        << " readpar_option = 0 (BCAST_DELETE) (default), -1 (READ_DELETE), " << std::endl
-        << "                 -2 (READ_PARALLEL), -3 (BCAST)" << std::endl
-        << "opt   input" << std::endl
-        << "===   =====" << std::endl
-        << " 1     <linear_ints> <shared_verts> " << std::endl
-        << " 2     <n_ints> " << std::endl
-        << " 3*    <# files> <file_names...> [<tag_name>=\"MATERIAL_SET\" [tag_val] [distribute=1] [resolve_shared=1] [with_ghosts=1] [use_mpio=0]" << std::endl
-        << " 4    <file_name> " << std::endl
-        << "*Note: if opt 3 is used, it must be the last one." << std::endl;
-    
+    if (0 == rank) print_usage(argv[0]);
     err = MPI_Finalize();
     return 1;
   }
@@ -122,6 +111,11 @@
           tag_name = "MATERIAL_SET";
           tag_val = -1;
           num_files = strtol(argv[npos++], NULL, 0);
+          if (0 == num_files) {
+            if (0 == rank) print_usage(argv[0]);
+            err = MPI_Finalize();
+            return 1;
+          }
           while (num_files-- && npos < argc)
             filenames.push_back(std::string(argv[npos++]));
           if (npos < argc) tag_name = argv[npos++];
@@ -211,6 +205,22 @@
   return (MB_SUCCESS == result ? 0 : 1);
 }
 
+void print_usage(const char *command) 
+{
+  std::cerr 
+      << "Usage: " << command
+      << " [readpar_option] <opt> <input> [...] where:" << std::endl
+      << " readpar_option = 0 (BCAST_DELETE) (default), -1 (READ_DELETE), " << std::endl
+      << "                 -2 (READ_PARALLEL), -3 (BCAST)" << std::endl
+      << "opt   input" << std::endl
+      << "===   =====" << std::endl
+      << " 1     <linear_ints> <shared_verts> " << std::endl
+      << " 2     <n_ints> " << std::endl
+      << " 3*    <# files> <file_names...> [<tag_name>=\"MATERIAL_SET\" [tag_val] [distribute=1] [resolve_shared=1] [with_ghosts=1] [use_mpio=0]" << std::endl
+      << " 4    <file_name> " << std::endl
+      << "*Note: if opt 3 is used, it must be the last one." << std::endl;
+}
+
 MBErrorCode report_nsets(MBInterface *mbImpl) 
 {
     // get and report various numbers...




More information about the moab-dev mailing list