[MOAB-dev] r2238 - MOAB/trunk/tools/iMesh

kraftche at mcs.anl.gov kraftche at mcs.anl.gov
Thu Nov 13 13:28:26 CST 2008


Author: kraftche
Date: 2008-11-13 13:28:26 -0600 (Thu, 13 Nov 2008)
New Revision: 2238

Modified:
   MOAB/trunk/tools/iMesh/iMeshP_unit_tests.cpp
Log:
add some utility code for attaching a debugger to only one proc and fix bugs in a test

Modified: MOAB/trunk/tools/iMesh/iMeshP_unit_tests.cpp
===================================================================
--- MOAB/trunk/tools/iMesh/iMeshP_unit_tests.cpp	2008-11-13 19:27:16 UTC (rev 2237)
+++ MOAB/trunk/tools/iMesh/iMeshP_unit_tests.cpp	2008-11-13 19:28:26 UTC (rev 2238)
@@ -8,6 +8,10 @@
 #include <math.h>
 #include <map>
 
+#ifndef _MSC_VER
+#include <unistd.h>
+#endif
+
 #define STRINGIFY_(X) #X
 #define STRINGIFY(X) STRINGIFY_(X)
 const char* const FILENAME = "iMeshP_test_file";
@@ -322,6 +326,21 @@
   MPI_Comm_rank( MPI_COMM_WORLD, &rank );
   MPI_Comm_size( MPI_COMM_WORLD, &size );
 
+  if (argc > 2 && !strcmp(argv[1], "-p")) {
+#ifndef _MSC_VER
+    std::cout << "Processor " << rank << " of " << size << " with PID " << getpid() << std::endl;
+    std::cout.flush();
+#endif
+      // loop forever on requested processor, giving the user time
+      // to attach a debugger.  Once the debugger in attached, user
+      // can change 'stop'.  E.g. on gdb do "set var stop = 1"
+    if (atoi(argv[2]) == rank) {
+      volatile int stop = 0;
+      while (!stop);
+    }
+    MPI_Barrier(MPI_COMM_WORLD);
+  }
+
   if (rank == 0) {
     ierr = create_mesh( FILENAME, size );
   }
@@ -1213,9 +1232,9 @@
   
     // get vertices in quads
   iBase_EntityHandle conn[16];
-  int offsets[4], *off_ptr = offsets, junk3 = 4, junk4;
+  int offsets[5], *off_ptr = offsets, junk3 = 5, junk4;
   ptr = conn;
-  junk1 = 4;
+  junk1 = 16;
   iMesh_getEntArrAdj( imesh, quads, 4, iBase_VERTEX, 
                       &ptr, &junk1, &junk2,
                       &off_ptr, &junk3, &junk4,
@@ -1225,10 +1244,10 @@
   assert( junk1 == 16 );
   assert( junk2 == 16 );
   assert( off_ptr == offsets );
-  assert( junk3 == 4 );
-  assert( junk4 == 4 );
+  assert( junk3 == 5 );
+  assert( junk4 == 5 );
   
-    // make unique vertex li8st
+    // make unique vertex list
   std::sort( conn, conn + 16 );
   const int num_vtx = std::unique( conn, conn+16 ) - conn;
   assert(9 == num_vtx);




More information about the moab-dev mailing list