[MOAB-dev] r5826 - in MOAB/trunk: src/io tools/mbcoupler

tautges at mcs.anl.gov tautges at mcs.anl.gov
Tue Oct 23 14:22:11 CDT 2012


Author: tautges
Date: 2012-10-23 14:22:11 -0500 (Tue, 23 Oct 2012)
New Revision: 5826

Modified:
   MOAB/trunk/src/io/ReadNC.cpp
   MOAB/trunk/tools/mbcoupler/Coupler.cpp
   MOAB/trunk/tools/mbcoupler/Coupler.hpp
   MOAB/trunk/tools/mbcoupler/mbcoupler_test.cpp
Log:
ReadNC:  changing some uses of floor to std::floor, and using casting to guide
  choice of type variant to use (revealed by somebody building on a Cray)

Coupler: adding the ability to specify multiple interpolation methods in the interpolate
  call.  Internally, changed the data handling a bit, so that locally-located points are
  still put in tuple lists and communicated with tuple communication.  Also, if a given
  point is located in multiple places, it is still only counted once, and the last location
  is the one kept.  Eventually I'll change this to choose based on quality, and to better
  detect close-but-not-inside cases.

Passes mbcoupler_test in serial and in parallel.



Modified: MOAB/trunk/src/io/ReadNC.cpp
===================================================================
--- MOAB/trunk/src/io/ReadNC.cpp	2012-10-23 18:26:34 UTC (rev 5825)
+++ MOAB/trunk/src/io/ReadNC.cpp	2012-10-23 19:22:11 UTC (rev 5826)
@@ -659,11 +659,11 @@
 
   if (isParallel) {
     if (rank < num_quads % procs) {
-      num_local_quads = int(floor(1.0 * num_quads / procs)) + 1;
+      num_local_quads = int(std::floor(1.0 * num_quads / procs)) + 1;
       start_idx = 4 * rank * num_local_quads;
     }
     else {
-      num_local_quads = int(floor(1.0 * num_quads / procs));
+      num_local_quads = int(std::floor(1.0 * num_quads / procs));
       start_idx = 4 * (num_quads % procs + rank * num_local_quads);
     }
   }
@@ -774,7 +774,7 @@
 {
   assert (1<=gid);
   assert(gid<=iN);
-  int num_nodes_per_proc = floor(iN/ip); // but the first iN%ip parts get an extra node
+  int num_nodes_per_proc = std::floor(((double)iN)/(double)ip); // but the first iN%ip parts get an extra node
 
   int proc = -1;// not initialized
   if (0==num_nodes_per_proc)
@@ -786,12 +786,12 @@
   if ( gid<= fatProcs*(num_nodes_per_proc+1))
   {
 
-    proc= floor( (gid-1)/(num_nodes_per_proc+1) );
+    proc= floor( ((double)(gid-1))/(double)(num_nodes_per_proc+1) );
     oIndexOnOwningProc = gid-proc*(num_nodes_per_proc+1)-1;//
     return proc;
   }
   int leftover= gid- fatProcs*(num_nodes_per_proc+1);
-  proc = fatProcs+floor((leftover-1)/num_nodes_per_proc);
+  proc = fatProcs+floor(((double)(leftover-1))/(double)num_nodes_per_proc);
   oIndexOnOwningProc = leftover-1-(proc-fatProcs)*num_nodes_per_proc;
   return proc;
 }
@@ -858,11 +858,11 @@
 
   if (isParallel) {
     if (rank < num_total_nodes % procs) {
-      num_owned_nodes = int(floor(1.0 * num_total_nodes / procs)) + 1;
+      num_owned_nodes = int(floor(((double)1.0 * num_total_nodes) / (double)procs)) + 1;
       start_gid = rank * num_owned_nodes + 1; // starts at 1
     }
     else {


More information about the moab-dev mailing list