[MOAB-dev] r4313 - MOAB/trunk/itaps/imesh

jvporter at wisc.edu jvporter at wisc.edu
Thu Dec 2 18:21:10 CST 2010


Author: jvporter
Date: 2010-12-02 18:21:10 -0600 (Thu, 02 Dec 2010)
New Revision: 4313

Modified:
   MOAB/trunk/itaps/imesh/iMesh_MOAB.cpp
Log:
Partially fix iMesh_getEnt(Arr)2ndAdj:
* Accepts iBase_ALL_TYPES
* Returns iBase_INVALID_ARGUMENT if bridge and requested types are the same


Modified: MOAB/trunk/itaps/imesh/iMesh_MOAB.cpp
===================================================================
--- MOAB/trunk/itaps/imesh/iMesh_MOAB.cpp	2010-12-02 21:45:52 UTC (rev 4312)
+++ MOAB/trunk/itaps/imesh/iMesh_MOAB.cpp	2010-12-03 00:21:10 UTC (rev 4313)
@@ -765,7 +765,7 @@
   void iMesh_getEntArr2ndAdj( iMesh_Instance instance,
                               iBase_EntityHandle const* entity_handles,
                               int entity_handles_size,
-                              int order_adjacent_key,
+                              int bridge_entity_type,
                               int requested_entity_type,
                               iBase_EntityHandle** adj_entity_handles,
                               int* adj_entity_handles_allocated,
@@ -777,8 +777,8 @@
   {
     ErrorCode result = MB_SUCCESS;
 
-    ALLOC_CHECK_ARRAY(offset, entity_handles_size+1 );
-  
+    ALLOC_CHECK_ARRAY(offset, entity_handles_size+1);
+
     const EntityHandle* entity_iter = (const EntityHandle*)entity_handles;
     const EntityHandle* const entity_end = entity_iter + entity_handles_size;
     int* off_iter = *offset;
@@ -787,16 +787,32 @@
     std::vector<EntityHandle> all_adj_ents;
     MeshTopoUtil mtu(MBI);
     
+    int min_bridge = iBase_VERTEX, max_bridge = iBase_REGION;
+    int min_req    = iBase_VERTEX, max_req    = iBase_REGION;
+    if (iBase_ALL_TYPES != bridge_entity_type)
+      min_bridge = max_bridge = bridge_entity_type;
+    if (iBase_ALL_TYPES != requested_entity_type)
+      min_req = max_req = requested_entity_type;
+
     for ( ; entity_iter != entity_end; ++entity_iter)
     {
       *off_iter = prev_off;
       off_iter++;
       Range adj_ents;
 
-      result = mtu.get_bridge_adjacencies( *entity_iter,
-                                           order_adjacent_key,
-                                           requested_entity_type, adj_ents );
-      CHKERR(result, "iMesh_getEntArrAdj: trouble getting adjacency list.");
+      int source = CN::Dimension(TYPE_FROM_HANDLE(*entity_iter));
+      for (int bridge = min_bridge; bridge <= max_bridge; ++bridge) {
+        if (source == bridge)
+          continue;
+        for (int requested = min_req; requested <= max_req; ++requested) {
+          if (bridge == requested)


More information about the moab-dev mailing list