[MOAB-dev] r5202 - MOAB/trunk/src

iulian at mcs.anl.gov iulian at mcs.anl.gov
Mon Oct 31 22:56:14 CDT 2011


Author: iulian
Date: 2011-10-31 22:56:14 -0500 (Mon, 31 Oct 2011)
New Revision: 5202

Modified:
   MOAB/trunk/src/FBEngine.cpp
Log:
bug in get adjacencies for mesh based geometry
in moab::Interface, the number of hops in children/parent relations is not 
exact, it means "up to"; so, if number of hops is 2, direct children (or
parents) will be returned too, not only the grand-children (or grand-parents)
so, subtract those with a hop number smaller by 1, to get the "exact" 
desired number of hops.



Modified: MOAB/trunk/src/FBEngine.cpp
===================================================================
--- MOAB/trunk/src/FBEngine.cpp	2011-10-26 17:39:44 UTC (rev 5201)
+++ MOAB/trunk/src/FBEngine.cpp	2011-11-01 03:56:14 UTC (rev 5202)
@@ -810,17 +810,26 @@
   ErrorCode rval;
   adjs.clear();
   if (to_dim > this_dim) {
-    int number;
-    rval = MBI->num_parent_meshsets(from, &number, 0);
-    rval = MBI->get_parent_meshsets(from, adjs);
-    adjs.clear();
-    rval = MBI->get_parent_meshsets(from, adjs, to_dim - this_dim);
+    int diffDim = to_dim-this_dim;
+    rval = MBI->get_parent_meshsets(from, adjs, diffDim);
+    if (diffDim>1)
+    {
+      // subtract the parents that come with diffDim-1 hops
+      Range extra;
+      rval = MBI->get_parent_meshsets(from, extra, diffDim-1);
+      adjs = subtract(adjs, extra);
+    }
+
   } else {
-    int number;
-    rval = MBI->num_child_meshsets(from, &number, 0);
-    rval = MBI->get_child_meshsets(from, adjs);
-    adjs.clear();
-    rval = MBI->get_child_meshsets(from, adjs, this_dim - to_dim);
+    int diffDim = this_dim - to_dim;
+    rval = MBI->get_child_meshsets(from, adjs, diffDim);
+    if (diffDim > 1)
+    {
+      // subtract the children that come with diffDim-1 hops
+      Range extra;
+      rval = MBI->get_child_meshsets(from, extra, diffDim-1);
+      adjs = subtract(adjs, extra);
+    }
   }
 
   return MB_SUCCESS;












More information about the moab-dev mailing list