[MOAB-dev] r5505 - MOAB/trunk/tools/mbcoupler

tautges at mcs.anl.gov tautges at mcs.anl.gov
Fri Apr 27 12:28:20 CDT 2012


Author: tautges
Date: 2012-04-27 12:28:19 -0500 (Fri, 27 Apr 2012)
New Revision: 5505

Modified:
   MOAB/trunk/tools/mbcoupler/Coupler.cpp
Log:
Change to allow mbcoupler to be used in serial.



Modified: MOAB/trunk/tools/mbcoupler/Coupler.cpp
===================================================================
--- MOAB/trunk/tools/mbcoupler/Coupler.cpp	2012-04-27 17:04:09 UTC (rev 5504)
+++ MOAB/trunk/tools/mbcoupler/Coupler.cpp	2012-04-27 17:28:19 UTC (rev 5505)
@@ -36,7 +36,7 @@
                      bool init_tree)
     : mbImpl(impl), myPc(pc), myId(coupler_id), numIts(3)
 {
-  assert(NULL != impl && NULL != myPc);
+  assert(NULL != impl && (pc || !local_elems.empty()));
 
     // keep track of the local points, at least for now
   myRange = local_elems;
@@ -68,9 +68,11 @@
   settings.candidatePlaneSet = AdaptiveKDTree::SUBDIVISION;
 
     //get entities on the local part
-  ErrorCode result = myPc->get_part_entities(local_ents, 3);
-  if (MB_SUCCESS != result) {
-    std::cout << "Problems getting entities by dimension" << std::endl;
+  ErrorCode result = MB_SUCCESS;
+  if (myPc) result = myPc->get_part_entities(local_ents, 3);
+  else local_ents = myRange;
+  if (MB_SUCCESS != result || local_ents.empty()) {
+    std::cout << "Problems getting source entities" << std::endl;
     return result;
   }
 
@@ -96,20 +98,22 @@
   }
 
     // get the bounding box for local tree
-  allBoxes.resize(6*myPc->proc_config().proc_size());
-  unsigned int my_rank = myPc->proc_config().proc_rank();
+  if (myPc)
+    allBoxes.resize(6*myPc->proc_config().proc_size());
+  else allBoxes.resize(6);
+  unsigned int my_rank = (myPc ? myPc->proc_config().proc_rank() : 0);
   result = myTree->get_tree_box(localRoot, &allBoxes[6*my_rank], &allBoxes[6*my_rank+3]);
-
+  if (MB_SUCCESS != result) return result;
+  
     // now communicate to get all boxes
-//   int mpi_err = MPI_Allgather(&allBoxes[6*my_rank], 6, MPI_DOUBLE,
-//                               &allBoxes[0], 6, MPI_DOUBLE, 
-//                               myPc->proc_config().proc_comm());
-    // Change to use "in place" option
-  int mpi_err = MPI_Allgather(MPI_IN_PLACE, 0, MPI_DATATYPE_NULL,
-                              &allBoxes[0], 6, MPI_DOUBLE, 
-                              myPc->proc_config().proc_comm());
+    // use "in place" option


More information about the moab-dev mailing list