[MOAB-dev] r3303 - MOAB/trunk/tools/iMesh

kraftche at cae.wisc.edu kraftche at cae.wisc.edu
Fri Nov 6 20:44:41 CST 2009


Author: kraftche
Date: 2009-11-06 20:44:41 -0600 (Fri, 06 Nov 2009)
New Revision: 3303

Modified:
   MOAB/trunk/tools/iMesh/iMesh_MOAB.cpp
   MOAB/trunk/tools/iMesh/testc_cbind.c
Log:
add test case from Jim demonstrating but in adjacencey query for iBase_ALL_TYPEs, and fix bug

Modified: MOAB/trunk/tools/iMesh/iMesh_MOAB.cpp
===================================================================
--- MOAB/trunk/tools/iMesh/iMesh_MOAB.cpp	2009-11-07 02:33:00 UTC (rev 3302)
+++ MOAB/trunk/tools/iMesh/iMesh_MOAB.cpp	2009-11-07 02:44:41 UTC (rev 3303)
@@ -716,7 +716,7 @@
         for (int dim = 0; dim < 4; ++dim) {
           if (MBCN::Dimension(TYPE_FROM_HANDLE(*entity_iter)) == dim)
             continue;
-          result = MBI->get_adjacencies( entity_iter, 1, dim, false, adj_ents );
+          result = MBI->get_adjacencies( entity_iter, 1, dim, false, adj_ents, MBInterface::UNION );
           if (MB_SUCCESS != result) {
             iMesh_processError(iBase_ERROR_MAP[result], "iMesh_getEntArrAdj: trouble getting adjacency list.");
             RETURN(iBase_ERROR_MAP[result]);

Modified: MOAB/trunk/tools/iMesh/testc_cbind.c
===================================================================
--- MOAB/trunk/tools/iMesh/testc_cbind.c	2009-11-07 02:33:00 UTC (rev 3302)
+++ MOAB/trunk/tools/iMesh/testc_cbind.c	2009-11-07 02:44:41 UTC (rev 3303)
@@ -2098,6 +2098,54 @@
     return 1;
 }
 
+int all_adjacency_regression( iMesh_Instance mesh )
+{
+    int err;
+
+    double coords[] = { 0,0,0, 1,1,1 };
+
+    iBase_EntityHandle *verts = NULL;
+    int verts_alloc = 0,verts_size;
+
+    iBase_EntityHandle line;
+    int status;
+
+    iBase_EntityHandle *adj = NULL;
+    int adj_alloc = 0,adj_size;
+
+    iMesh_newMesh("",&mesh,&err,0);
+    if (iBase_SUCCESS != err) return 0;
+
+    iMesh_createVtxArr(mesh,2,iBase_INTERLEAVED,coords,6,&verts,&verts_alloc,
+                       &verts_size,&err);
+    if (iBase_SUCCESS != err) return 0;
+
+    iMesh_createEnt(mesh,iMesh_LINE_SEGMENT,verts,2,&line,&status,&err);
+    if (iBase_SUCCESS != err || status != iBase_NEW) return 0;
+
+    iMesh_getEntAdj(mesh,verts[0],iBase_ALL_TYPES,&adj,&adj_alloc,&adj_size,
+                    &err);
+    if (iBase_SUCCESS != err) return 0;
+    if(adj_size != 1 || adj[0] != line) {
+        printf("Bad: couldn't find adjacency for vertex\n");
+        return 0;
+    }
+    free(adj);
+
+    adj_alloc = adj = 0;
+    iMesh_getEntAdj(mesh,line,iBase_ALL_TYPES,&adj,&adj_alloc,&adj_size,
+                    &err);
+    if (iBase_SUCCESS != err) return 0;
+    if(adj_size != 2 || ((adj[0] != verts[0] || adj[1] != verts[1]) &&
+                         (adj[0] != verts[1] || adj[1] != verts[0])) ) {
+        printf("Bad: couldn't find adjacencies for line\n");
+        return 0;
+    }
+    free(adj);
+    
+    return 1;
+}
+
 int main( int argc, char *argv[] )
 {
     /* Check command line arg */
@@ -2226,6 +2274,15 @@
   number_tests++;
   printf("\n");
 
+    /* regression test for adjacencies with iBase_ALL_TYPES bug */
+  printf("   all_adjacency_regression: ");
+  result = all_adjacency_regression(mesh);
+  handle_error_code(result, &number_tests_failed,
+                    &number_tests_not_implemented,
+                    &number_tests_successful);
+  number_tests++;
+  printf("\n");
+
     /* summary */
 
   printf("\nTSTT TEST SUMMARY: \n");



More information about the moab-dev mailing list