[MOAB-dev] r4827 - in MOAB/trunk/src: . moab

iulian at mcs.anl.gov iulian at mcs.anl.gov
Fri May 13 16:46:33 CDT 2011


Author: iulian
Date: 2011-05-13 16:46:32 -0500 (Fri, 13 May 2011)
New Revision: 4827

Modified:
   MOAB/trunk/src/FBEngine.cpp
   MOAB/trunk/src/moab/FBEngine.hpp
Log:
simplify the splitting logic
start from nodes, not from edges or triangle interiors
to do: investigate flood filling performance; using moab::Range for flood filling is
a bad idea. I should use tags (or some markers) on the triangles.



Modified: MOAB/trunk/src/FBEngine.cpp
===================================================================
--- MOAB/trunk/src/FBEngine.cpp	2011-05-13 20:56:33 UTC (rev 4826)
+++ MOAB/trunk/src/FBEngine.cpp	2011-05-13 21:46:32 UTC (rev 4827)
@@ -1086,7 +1086,7 @@
   // assume it is robust; what if it is not sufficiently robust?
 
   ErrorCode rval;
-  std::vector<double> points; // if the point is interior, it will be matched to a triangle,
+  std::vector<CartVect> points; // if the point is interior, it will be matched to a triangle,
   // otherwise to edges or even nodes
   std::vector<EntityHandle> entities;
   //start with initial points, intersect along the direction, find the facets
@@ -1098,9 +1098,9 @@
   MBERRORR(rval, "Failed to get root of face.");
 
   const double dir[] = { direction[0], direction[1], direction[2] };
-  std::vector<EntityHandle> triangles;
+  std::vector<EntityHandle> nodes; // get the nodes closest to the ray traces of interest
   std::vector<EntityHandle> trianglesAlong;
-  std::vector<CartVect> intxPoints;
+
   int i = 0;
   for (; i < numIniPoints; i++) {
     const double point[] = { xyz[3 * i], xyz[3 * i + 1], xyz[3 * i + 2] };// or even point( &(xyz[3*i]) ); //
@@ -1118,13 +1118,38 @@
       std::cout
           << " too many intersection points. Only the first one considered\n";
     }
-    if (sets_out[0] != face)
-      MBERRORR(MB_FAILURE, "Failed intersect given face, bad direction.")
+    std::vector<EntityHandle>::iterator pFace = std::find(sets_out.begin(), sets_out.end(), face);
+
+    if (pFace == sets_out.end())
+      MBERRORR(MB_FAILURE, "Failed to intersect given face, bad direction.");
+    unsigned int index = pFace-sets_out.begin();
+    // get the closest node of the triangle, and modify
     CartVect P(point);
     CartVect Dir(dir);
-    CartVect newPoint = P + distances_out[0] * Dir;
-    intxPoints.push_back(newPoint);
-    triangles.push_back(facets_out[0]);
+    CartVect newPoint = P + distances_out[index] * Dir;
+    // get the triangle coordinates
+    //
+    int nnodes;
+    const EntityHandle * conn3;
+    rval = MBI->get_connectivity(facets_out[index], conn3, nnodes);
+    MBERRORR(rval, "Failed to get connectivity");
+
+    CartVect PP[3];


More information about the moab-dev mailing list