[MOAB-dev] r5693 - MOAB/trunk/src/moab/point_locater

rhl6856 at mcs.anl.gov rhl6856 at mcs.anl.gov
Mon Aug 13 11:49:50 CDT 2012


Author: rhl6856
Date: 2012-08-13 11:49:50 -0500 (Mon, 13 Aug 2012)
New Revision: 5693

Modified:
   MOAB/trunk/src/moab/point_locater/bvh_tree.hpp
   MOAB/trunk/src/moab/point_locater/linear_hex_map.hpp
Log:
added ifdef debug statements and reverted heuristic which slows things down

Modified: MOAB/trunk/src/moab/point_locater/bvh_tree.hpp
===================================================================
--- MOAB/trunk/src/moab/point_locater/bvh_tree.hpp	2012-08-13 16:49:49 UTC (rev 5692)
+++ MOAB/trunk/src/moab/point_locater/bvh_tree.hpp	2012-08-13 16:49:50 UTC (rev 5693)
@@ -693,11 +693,16 @@
 	 * sought point. This results in less overall traversal, and the correct
 	 * cell is identified more quickly.
 	 */
-	bool dir = (point[ node.dim] - node.Rmin) <= 
-					(node.Lmax - point[ node.dim]);
+	//Sofar all testing confirms that this 'heuristic' is 
+	//significantly slower.
+	//I conjecture this is because it gets improperly
+	//branch predicted..
+	//bool dir = (point[ node.dim] - node.Rmin) <= 
+	//				(node.Lmax - point[ node.dim]);
+	bool dir=0;
 	const Entity_handle result =  _find_point( point, node.child+dir, tol);
 	if( result == 0 ){ 
-		return _find_point( point, node.child+(1-dir), tol);
+		return _find_point( point, node.child+(!dir), tol);
 	}
 	return result;
 }
@@ -724,7 +729,7 @@
 					     j != i->entities.end();
 						++j){
 				if( ct::box_contains_point( j->first, 
-								point, tol)){
+							    point, tol)){
 				      const std::pair< bool, Vector> result = 
 				      entity_contains( moab, j->second, point);
 				      if (result.first){

Modified: MOAB/trunk/src/moab/point_locater/linear_hex_map.hpp
===================================================================
--- MOAB/trunk/src/moab/point_locater/linear_hex_map.hpp	2012-08-13 16:49:49 UTC (rev 5692)
+++ MOAB/trunk/src/moab/point_locater/linear_hex_map.hpp	2012-08-13 16:49:50 UTC (rev 5693)
@@ -88,14 +88,37 @@
       evaluate( xi, points, delta);
       vec_subtract( delta, x);
       std::size_t num_iterations=0;
+      #ifdef LINEAR_HEX_DEBUG
+ 	std::stringstream ss;
+	ss << "Point: "; 
+       ss << x[ 0 ] << ", " << x[ 1] 
+          << ", " << x [ 2] << std::endl;
+	ss << "Hex: ";
+	for(int i = 0; i < 8; ++i){
+ 	      	ss << points[ i][ 0] << ", " << points[ i][ 1] << ", "
+		   << points[ i][ 2] << std::endl;


More information about the moab-dev mailing list