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

kraftche at mcs.anl.gov kraftche at mcs.anl.gov
Thu Jul 16 17:25:15 CDT 2009


Author: kraftche
Date: 2009-07-16 17:25:15 -0500 (Thu, 16 Jul 2009)
New Revision: 3023

Modified:
   MOAB/trunk/parallel/MBParallelComm.cpp
   MOAB/trunk/parallel/MBParallelComm.hpp
Log:
allow caller to optionally specify tag to use for IDs for resolve_shared_ents

Modified: MOAB/trunk/parallel/MBParallelComm.cpp
===================================================================
--- MOAB/trunk/parallel/MBParallelComm.cpp	2009-07-16 22:24:42 UTC (rev 3022)
+++ MOAB/trunk/parallel/MBParallelComm.cpp	2009-07-16 22:25:15 UTC (rev 3023)
@@ -2457,7 +2457,8 @@
 
 MBErrorCode MBParallelComm::resolve_shared_ents(MBEntityHandle this_set,
                                                 int resolve_dim,
-                                                int shared_dim) 
+                                                int shared_dim,
+                                                MBTag* id_tag) 
 {
   MBErrorCode result;
   MBRange proc_ents;
@@ -2487,13 +2488,14 @@
   
     // must call even if we don't have any entities, to make sure
     // collective comm'n works
-  return resolve_shared_ents(this_set, proc_ents, resolve_dim, shared_dim);
+  return resolve_shared_ents(this_set, proc_ents, resolve_dim, shared_dim, id_tag);
 }
   
 MBErrorCode MBParallelComm::resolve_shared_ents(MBEntityHandle this_set,
                                                 MBRange &proc_ents,
                                                 int resolve_dim,
-                                                int shared_dim) 
+                                                int shared_dim,
+                                                MBTag* id_tag) 
 {
 #ifdef DEBUG_MPE
   define_mpe();
@@ -2554,17 +2556,21 @@
 
     // global id tag
   MBTag gid_tag; int def_val = -1;
-  result = mbImpl->tag_create(GLOBAL_ID_TAG_NAME, sizeof(int),
-                              MB_TAG_DENSE, MB_TYPE_INTEGER, gid_tag,
-                              &def_val, true);
-  if (MB_FAILURE == result) return result;
+  if (id_tag)
+    gid_tag = *id_tag;
+  else {
+    result = mbImpl->tag_create(GLOBAL_ID_TAG_NAME, sizeof(int),
+                                MB_TAG_DENSE, MB_TYPE_INTEGER, gid_tag,
+                                &def_val, true);
+    if (MB_FAILURE == result) return result;
 
-  else if (MB_ALREADY_ALLOCATED != result) {
-      // just created it, so we need global ids
-    result = assign_global_ids(0, skin_dim+1);
-    RRA("Failed assigning global ids.");
+    else if (MB_ALREADY_ALLOCATED != result) {
+        // just created it, so we need global ids
+      result = assign_global_ids(0, skin_dim+1);
+      RRA("Failed assigning global ids.");
+    }
   }
-
+  
     // store index in temp tag; reuse gid_data 
   gid_data.resize(2*skin_ents[0].size());
   int idx = 0;

Modified: MOAB/trunk/parallel/MBParallelComm.hpp
===================================================================
--- MOAB/trunk/parallel/MBParallelComm.hpp	2009-07-16 22:24:42 UTC (rev 3022)
+++ MOAB/trunk/parallel/MBParallelComm.hpp	2009-07-16 22:25:15 UTC (rev 3023)
@@ -267,7 +267,8 @@
   MBErrorCode resolve_shared_ents(MBEntityHandle this_set,
                                   MBRange &proc_ents, 
                                   int resolve_dim = -1,
-                                  int shared_dim = -1);
+                                  int shared_dim = -1,
+                                  MBTag* id_tag = 0);
   
     /** \brief Resolve shared entities between processors
      *
@@ -282,7 +283,8 @@
      */
   MBErrorCode resolve_shared_ents(MBEntityHandle this_set,
                                   int resolve_dim = 3, 
-                                  int shared_dim = -1);
+                                  int shared_dim = -1,
+                                  MBTag* id_tag = 0);
   
   static MBErrorCode resolve_shared_ents(MBParallelComm **pc, 
                                          const unsigned int np, 



More information about the moab-dev mailing list