[MOAB-dev] r1940 - MOAB/trunk
kraftche at mcs.anl.gov
kraftche at mcs.anl.gov
Fri Jun 27 12:06:29 CDT 2008
Author: kraftche
Date: 2008-06-27 12:06:29 -0500 (Fri, 27 Jun 2008)
New Revision: 1940
Modified:
MOAB/trunk/MBAdaptiveKDTree.cpp
Log:
be more careful about only choosing split planes that are within the bounding box of the leaf to be split for kD-tree subdivision snap algorithm
Modified: MOAB/trunk/MBAdaptiveKDTree.cpp
===================================================================
--- MOAB/trunk/MBAdaptiveKDTree.cpp 2008-06-27 16:05:03 UTC (rev 1939)
+++ MOAB/trunk/MBAdaptiveKDTree.cpp 2008-06-27 17:06:29 UTC (rev 1940)
@@ -851,6 +851,7 @@
const MBCartVect box_min(iter.box_min());
const MBCartVect box_max(iter.box_max());
const MBCartVect diff(box_max - box_min);
+ const MBCartVect tol(eps*diff);
MBRange entities, vertices;
r = iter.tool()->moab()->get_entities_by_handle( iter.handle(), entities );
@@ -876,11 +877,13 @@
for (int p = 1; p <= plane_count; ++p) {
double coord = box_min[axis] + (p/(1.0+plane_count)) * diff[axis];
double closest_coord = tmp_data[0];
+ if (closest_coord - box_min[axis] <= tol[axis] || closest_coord - box_max[axis] >= -tol[axis])
+ closest_coord = 0.5 * (box_min[axis] + box_max[axis]);
for (unsigned i = 1; i < tmp_data.size(); ++i)
- if (fabs(coord-tmp_data[i]) < fabs(coord-closest_coord))
+ if ((fabs(coord-tmp_data[i]) < fabs(coord-closest_coord)) &&
+ (coord - box_min[axis] > tol[axis]) &&
+ (coord - box_max[axis] < -tol[axis]))
closest_coord = tmp_data[i];
- if (closest_coord <= box_min[axis] || closest_coord >= box_max[axis])
- continue;
MBAdaptiveKDTree::Plane plane = { closest_coord, axis };
MBRange left, right, both;
double val;
More information about the moab-dev
mailing list