[MOAB-dev] r5653 - in MOAB/trunk: src/moab/point_locater tools

rhl6856 at mcs.anl.gov rhl6856 at mcs.anl.gov
Fri Aug 3 13:37:12 CDT 2012


Author: rhl6856
Date: 2012-08-03 13:37:12 -0500 (Fri, 03 Aug 2012)
New Revision: 5653

Modified:
   MOAB/trunk/src/moab/point_locater/point_locater.hpp
   MOAB/trunk/tools/point_search.cpp
Log:
refactoring point_locater

Modified: MOAB/trunk/src/moab/point_locater/point_locater.hpp
===================================================================
--- MOAB/trunk/src/moab/point_locater/point_locater.hpp	2012-08-02 17:07:38 UTC (rev 5652)
+++ MOAB/trunk/src/moab/point_locater/point_locater.hpp	2012-08-03 18:37:12 UTC (rev 5653)
@@ -53,14 +53,120 @@
 
 namespace moab {
 
-class Point_search
-{
+namespace _point_search {
+template< typename Tuple_list, Vector> 
+void write_data( Tuple_list & tl, 
+		 const Tuple_list & source_pts, 
+		 Vector & located_pts){
+	tl.initialize(3, 0, 0, 1, num_pts);
+	tl.enableWriteAccess();
+	for (unsigned int i = 0; i < source_pts.get_n(); i++) {
+	  //Don't send message for discarded points
+	  if (source_pts.vi_rd[3*i+2] != -1) { 
+	    const int locIndex = source_pts.vi_rd[3*i+1];
+	    //asked 2+ procs if they have point p, they both said 
+	    //yes, we'll keep the one with lowest rank
+	    if(located_pts[locIndex]){  
+	      //TODO: check that the cases where both processors 
+	      //say yes is justified 
+	      continue;
+	    }
+	    located_pts[locIndex] = 1;
+	    tl.vi_wr[3*tl.get_n()]     = source_pts.vi_rd[3*i];
+	    tl.vi_wr[3*tl.get_n() + 1] = source_pts.vi_rd[3*i+1];
+	    tl.vi_wr[3*tl.get_n() + 2] = source_pts.vi_rd[3*i+2];
+	    tl.inc_n();
+	  }
+	}
+	tl.disableWriteAccess();
+}
+
+
+//hide the ugliness
+//TODO: change xyz to query_points
+template< typename Boxes, typename Points>
+bool in_box( const Boxes & box, const Points & xyz, 
+	     const std::size_t i, const std::size_t j ){
+	return   boxes[6*j] <= xyz[i] 	  && xyz[i] <=   boxes[6*j+3] && 
+		 boxes[6*j+1] <= xyz[i+1] && xyz[i+1] <= boxes[6*j+4] && 
+		 boxes[6*j+2] <= xyz[i+2] && xyz[i+2] <= boxes[6*j+5];
+}
+
+
+template< typename Tuple_list, typename Points>


More information about the moab-dev mailing list