[MOAB-dev] r4404 - MOAB/trunk/test/parallel

kraftche at cae.wisc.edu kraftche at cae.wisc.edu
Wed Dec 22 12:09:41 CST 2010


Author: kraftche
Date: 2010-12-22 12:09:40 -0600 (Wed, 22 Dec 2010)
New Revision: 4404

Modified:
   MOAB/trunk/test/parallel/parallel_unit_tests.cpp
Log:
fix bugs in parallel_unit_tests.cpp (incorrect size, incorrect assumption that global ids are zero-based, etc.)

Modified: MOAB/trunk/test/parallel/parallel_unit_tests.cpp
===================================================================
--- MOAB/trunk/test/parallel/parallel_unit_tests.cpp	2010-12-21 22:40:24 UTC (rev 4403)
+++ MOAB/trunk/test/parallel/parallel_unit_tests.cpp	2010-12-22 18:09:40 UTC (rev 4404)
@@ -7,6 +7,7 @@
 #include "moab_mpi.h"
 #include <iostream>
 #include <algorithm>
+#include <map>
 #include <sstream>
 #include <assert.h>
 #if !defined(_MSC_VER) && !defined(__MINGW32__)
@@ -1125,12 +1126,12 @@
   return MB_SUCCESS;
 }
 
-bool check_consistent_ids( Interface& mb,
-                           const EntityHandle* entities,
-                           const int* orig_ids,
-                           int num_ents,
-                           const char* singular_name,
-                           const char* plural_name )
+ErrorCode check_consistent_ids( Interface& mb,
+                                const EntityHandle* entities,
+                                const int* orig_ids,
+                                int num_ents,
+                                const char* singular_name,
+                                const char* plural_name )
 {
   ErrorCode rval;  
   int rank, size, ierr;
@@ -1141,16 +1142,20 @@
   rval = mb.tag_get_handle( GLOBAL_ID_TAG_NAME, id_tag ); CHKERR(rval);
   std::vector<int> new_ids(num_ents);
   rval = mb.tag_get_data( id_tag, entities, num_ents, &new_ids[0] ); CHKERR(rval);
-  bool valid = true;
-  for (int i = 0; i < num_ents; ++i) 
-    if (new_ids[i] < 0 || new_ids[i] >= num_ents*size) {
-      std::cerr << "ID out of bounds on proc " << rank 
-                << " : " << new_ids[i] << " not in [0," << num_ents*size-1
-                << "]" << std::endl;
-      valid = false;
-    }
-  if (!valid)
-    return false;
+  // This test is wrong.  a) The caller can select a start ID so there's
+  // no guarantee that the IDs will be in any specific range and b) There
+  // is no reason to expect the global number of entities to be num_ents*size
+  // if there are any shared entities. J.Kraftcheck 2010-12-22
+  //rval = MB_SUCCESS;
+  //for (int i = 0; i < num_ents; ++i) 


More information about the moab-dev mailing list