[MOAB-dev] r5115 - MOAB/trunk/src/parallel

tautges at mcs.anl.gov tautges at mcs.anl.gov
Thu Aug 25 11:38:51 CDT 2011


Author: tautges
Date: 2011-08-25 11:38:50 -0500 (Thu, 25 Aug 2011)
New Revision: 5115

Modified:
   MOAB/trunk/src/parallel/ParallelComm.cpp
Log:
For resolving shared sets, neglect sets that don't have a global id.



Modified: MOAB/trunk/src/parallel/ParallelComm.cpp
===================================================================
--- MOAB/trunk/src/parallel/ParallelComm.cpp	2011-08-25 15:15:36 UTC (rev 5114)
+++ MOAB/trunk/src/parallel/ParallelComm.cpp	2011-08-25 16:38:50 UTC (rev 5115)
@@ -3843,25 +3843,23 @@
     // build sharing list for all sets
   
     // get ids for sets in a vector, to pass to gs
-  const size_t nsets = sets.size();
-  std::vector<long> larray(nsets); // allocate sufficient space for longs
-  int* ids = reinterpret_cast<int*>(&larray[0]); // but work with ints
-  result = mbImpl->tag_get_data(idtag, sets, ids);
-  RRA("Couldn't get global ids for sets.");
-
-    // convert from int to long if necessary
-  if (sizeof(long) > sizeof(int)) {
-    size_t i = nsets;
-    while (i) {
-      --i;
-      larray[i] = ids[i];
+  std::vector<long> larray; // allocate sufficient space for longs
+  std::vector<unsigned long> handles;
+  Range tmp_sets;
+  for (Range::iterator rit = sets.begin(); rit != sets.end(); rit++) {
+    int dum;
+    result = mbImpl->tag_get_data(idtag, &(*rit), 1, &dum);
+    if (MB_SUCCESS == result) {
+      larray.push_back(dum);
+      handles.push_back(*rit);
+      tmp_sets.insert(tmp_sets.end(), *rit);
     }
   }
+  
+  const size_t nsets = handles.size();
     
     // get handle array for sets
   assert(sizeof(EntityHandle) <= sizeof(unsigned long));
-  std::vector<unsigned long> handles(nsets);
-  std::copy( sets.begin(), sets.end(), handles.begin() );
 
     // do communication of data
   crystal_data *cd = procConfig.crystal_router();
@@ -3900,8 +3898,8 @@
   size_t ti = 0;
   unsigned idx = 0;
   std::vector<unsigned> procs;
-  Range::iterator si = sets.begin();
-  while (si != sets.end() && ti < tuples.size()) {
+  Range::iterator si = tmp_sets.begin();
+  while (si != tmp_sets.end() && ti < tuples.size()) {
     assert(idx <= tuples[ti].idx);


More information about the moab-dev mailing list