[MOAB-dev] r1635 - MOAB/trunk

kraftche at mcs.anl.gov kraftche at mcs.anl.gov
Wed Mar 5 11:24:50 CST 2008


Author: kraftche
Date: 2008-03-05 11:24:48 -0600 (Wed, 05 Mar 2008)
New Revision: 1635

Modified:
   MOAB/trunk/MBCore.cpp
Log:
Fix bug I introduced in MBCore that breaks kD-tree building code:  The
documentatation for the get_coords function that accepts separate arrays 
for x, y, and z values states that any of those arrays may be NULL if
the caller does not require the coordinates along the corresponding axis.


Modified: MOAB/trunk/MBCore.cpp
===================================================================
--- MOAB/trunk/MBCore.cpp	2008-03-04 20:27:10 UTC (rev 1634)
+++ MOAB/trunk/MBCore.cpp	2008-03-05 17:24:48 UTC (rev 1635)
@@ -647,12 +647,18 @@
     MBErrorCode rval = vseq->get_coordinate_arrays( x, y, z );
     if (MB_SUCCESS != rval)
       return rval;
-    memcpy( x_coords, x + offset, count * sizeof(double ) );
-    memcpy( y_coords, y + offset, count * sizeof(double ) );
-    memcpy( z_coords, z + offset, count * sizeof(double ) );
-    x_coords += count;
-    y_coords += count;
-    z_coords += count;
+    if (x_coords) {
+      memcpy( x_coords, x + offset, count * sizeof(double ) );
+      x_coords += count;
+    }
+    if (y_coords) {
+      memcpy( y_coords, y + offset, count * sizeof(double ) );
+      y_coords += count;
+    }
+    if (z_coords) {
+      memcpy( z_coords, z + offset, count * sizeof(double ) );
+      z_coords += count;
+    }
   }
   
   return MB_SUCCESS;




More information about the moab-dev mailing list