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

iulian at mcs.anl.gov iulian at mcs.anl.gov
Wed Jan 11 10:53:57 CST 2012


Author: iulian
Date: 2012-01-11 10:53:57 -0600 (Wed, 11 Jan 2012)
New Revision: 5305

Modified:
   MOAB/trunk/src/FBEngine.cpp
   MOAB/trunk/src/moab/FBEngine.hpp
Log:
modify the split boundary method, used for "grounding line" scenarios, to 
split intersecting boundary edges if needed; before, the closest node
to the splitting polyline was chosen as a starting point


Modified: MOAB/trunk/src/FBEngine.cpp
===================================================================
--- MOAB/trunk/src/FBEngine.cpp	2012-01-11 14:55:18 UTC (rev 5304)
+++ MOAB/trunk/src/FBEngine.cpp	2012-01-11 16:53:57 UTC (rev 5305)
@@ -1155,11 +1155,15 @@
 
   // first of all, find all intersection points (piercing in the face along the direction)
   // assume it is robust; what if it is not sufficiently robust?
+  // if the polyline is open, find the intersection with the boundary edges, of the
+  // polyline extruded at ends
 
   ErrorCode rval;
 
   // then find the position
   int numIniPoints = (int) xyz.size() / 3;
+  if (  (closed && numIniPoints < 3)  ||  (!closed && numIniPoints<2) )
+    MBERRORR(MB_FAILURE, "not enough polyline points ");
   EntityHandle rootForFace;
 
   rval = _my_geomTopoTool->get_root(face, rootForFace);
@@ -1175,6 +1179,7 @@
   std::vector<CartVect> b_pos;
   std::vector<EntityHandle> boundary_nodes;
   std::vector<EntityHandle> splittingNodes;
+  Range boundary_mesh_edges;
   if (!closed)
   {
     rval = boundary_nodes_on_face(face, boundary_nodes);
@@ -1182,31 +1187,88 @@
     b_pos.resize(boundary_nodes.size());
     rval = _mbImpl->get_coords(&(boundary_nodes[0]), boundary_nodes.size(), (double *)(&b_pos[0][0]));
     MBERRORR(rval, "Failed to get coordinates for boundary nodes.");
+    rval = boundary_mesh_edges_on_face(face, boundary_mesh_edges);
+    MBERRORR(rval, "Failed to get mesh boundary edges for face.");
   }
   //
   int i = 0;
+  CartVect dirct(direction);
+  dirct.normalize(); // maybe an overkill?
   for (; i < numIniPoints; i++) {
 
     const double point[] = { xyz[3 * i], xyz[3 * i + 1], xyz[3 * i + 2] };// or even point( &(xyz[3*i]) ); //
+    CartVect p1(point);
     if (!closed && ( (0==i) || (numIniPoints-1==i) ) )
     {
-      // find the closest boundary point based on absolute distance
-      // (we do not consider the shooting direction at all...)
-      CartVect pierce(point);
-      int index = 0;
-      double dist2min= (pierce-b_pos[0]).length_squared();
-      for ( unsigned int j = 1; j<boundary_nodes.size(); ++j )


More information about the moab-dev mailing list