Changeset 3303

Show
Ignore:
Timestamp:
11/06/09 20:44:41 (2 weeks ago)
Author:
kraftche
Message:

add test case from Jim demonstrating but in adjacencey query for iBase_ALL_TYPEs, and fix bug

Location:
MOAB/trunk/tools/iMesh
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • MOAB/trunk/tools/iMesh/iMesh_MOAB.cpp

    r3271 r3303  
    717717          if (MBCN::Dimension(TYPE_FROM_HANDLE(*entity_iter)) == dim) 
    718718            continue; 
    719           result = MBI->get_adjacencies( entity_iter, 1, dim, false, adj_ents ); 
     719          result = MBI->get_adjacencies( entity_iter, 1, dim, false, adj_ents, MBInterface::UNION ); 
    720720          if (MB_SUCCESS != result) { 
    721721            iMesh_processError(iBase_ERROR_MAP[result], "iMesh_getEntArrAdj: trouble getting adjacency list."); 
  • MOAB/trunk/tools/iMesh/testc_cbind.c

    r3237 r3303  
    20992099} 
    21002100 
     2101int all_adjacency_regression( iMesh_Instance mesh ) 
     2102{ 
     2103    int err; 
     2104 
     2105    double coords[] = { 0,0,0, 1,1,1 }; 
     2106 
     2107    iBase_EntityHandle *verts = NULL; 
     2108    int verts_alloc = 0,verts_size; 
     2109 
     2110    iBase_EntityHandle line; 
     2111    int status; 
     2112 
     2113    iBase_EntityHandle *adj = NULL; 
     2114    int adj_alloc = 0,adj_size; 
     2115 
     2116    iMesh_newMesh("",&mesh,&err,0); 
     2117    if (iBase_SUCCESS != err) return 0; 
     2118 
     2119    iMesh_createVtxArr(mesh,2,iBase_INTERLEAVED,coords,6,&verts,&verts_alloc, 
     2120                       &verts_size,&err); 
     2121    if (iBase_SUCCESS != err) return 0; 
     2122 
     2123    iMesh_createEnt(mesh,iMesh_LINE_SEGMENT,verts,2,&line,&status,&err); 
     2124    if (iBase_SUCCESS != err || status != iBase_NEW) return 0; 
     2125 
     2126    iMesh_getEntAdj(mesh,verts[0],iBase_ALL_TYPES,&adj,&adj_alloc,&adj_size, 
     2127                    &err); 
     2128    if (iBase_SUCCESS != err) return 0; 
     2129    if(adj_size != 1 || adj[0] != line) { 
     2130        printf("Bad: couldn't find adjacency for vertex\n"); 
     2131        return 0; 
     2132    } 
     2133    free(adj); 
     2134 
     2135    adj_alloc = adj = 0; 
     2136    iMesh_getEntAdj(mesh,line,iBase_ALL_TYPES,&adj,&adj_alloc,&adj_size, 
     2137                    &err); 
     2138    if (iBase_SUCCESS != err) return 0; 
     2139    if(adj_size != 2 || ((adj[0] != verts[0] || adj[1] != verts[1]) && 
     2140                         (adj[0] != verts[1] || adj[1] != verts[0])) ) { 
     2141        printf("Bad: couldn't find adjacencies for line\n"); 
     2142        return 0; 
     2143    } 
     2144    free(adj); 
     2145     
     2146    return 1; 
     2147} 
     2148 
    21012149int main( int argc, char *argv[] ) 
    21022150{ 
     
    22272275  printf("\n"); 
    22282276 
     2277    /* regression test for adjacencies with iBase_ALL_TYPES bug */ 
     2278  printf("   all_adjacency_regression: "); 
     2279  result = all_adjacency_regression(mesh); 
     2280  handle_error_code(result, &number_tests_failed, 
     2281                    &number_tests_not_implemented, 
     2282                    &number_tests_successful); 
     2283  number_tests++; 
     2284  printf("\n"); 
     2285 
    22292286    /* summary */ 
    22302287