[MOAB-dev] r2554 - MOAB/trunk

kraftche at mcs.anl.gov kraftche at mcs.anl.gov
Thu Jan 15 16:53:32 CST 2009


Author: kraftche
Date: 2009-01-15 16:53:32 -0600 (Thu, 15 Jan 2009)
New Revision: 2554

Modified:
   MOAB/trunk/MBCN.cpp
Log:
Fix bugs in MBCN::OppositeSide:
 - incorrect for type = TET, dim = 0, idx = 0 to 2
 - incorrect for type = TET, dim = 1, idx = 3 to 6
 - missing OppositeSide for type = HEX


Modified: MOAB/trunk/MBCN.cpp
===================================================================
--- MOAB/trunk/MBCN.cpp	2009-01-15 22:51:47 UTC (rev 2553)
+++ MOAB/trunk/MBCN.cpp	2009-01-15 22:53:32 UTC (rev 2554)
@@ -345,11 +345,13 @@
         switch (child_dim) {
           case 0:
               opposite_dim = 2;
-              opposite_index = (child_index+2)%3 + 2*(child_index/3);
+              opposite_index = (child_index+1)%3 + 2*(child_index/3);
               break;
           case 1:
               opposite_dim = 1;
-              opposite_index = 3 + (child_index + 5)%3;
+              opposite_index = child_index < 3 
+                             ? 3 + (child_index + 2)%3
+                             : (child_index + 1)%3;
               break;
           case 2:
               opposite_dim = 0;
@@ -360,6 +362,26 @@
         }
         break;
     case MBHEX:
+      opposite_dim = child_dim;
+      switch (child_dim) {
+        case 0:
+          opposite_index = child_index < 4 
+                         ? 4 + (child_index + 2) % 4
+                         : (child_index - 2) % 4;
+          break;
+        case 1:
+          opposite_index = 4*(2-child_index/4) + (child_index+2)%4;
+          break;
+        case 2:
+          opposite_index = child_index < 4 
+                         ? (child_index + 2) % 4
+                         : 9 - child_index;
+          break;
+        default:
+          return -1;
+      }
+      break;
+        
       
     default:
         return -1;




More information about the moab-dev mailing list