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

jvporter at wisc.edu jvporter at wisc.edu
Thu Dec 2 18:40:29 CST 2010


Author: jvporter
Date: 2010-12-02 18:40:29 -0600 (Thu, 02 Dec 2010)
New Revision: 4314

Modified:
   MOAB/trunk/itaps/imesh/iMesh_MOAB.cpp
Log:
Ensure that boolean ops on sets create a set of the appropriate type (i.e. a
list if both operands are lists)


Modified: MOAB/trunk/itaps/imesh/iMesh_MOAB.cpp
===================================================================
--- MOAB/trunk/itaps/imesh/iMesh_MOAB.cpp	2010-12-03 00:21:10 UTC (rev 4313)
+++ MOAB/trunk/itaps/imesh/iMesh_MOAB.cpp	2010-12-03 00:40:29 UTC (rev 4314)
@@ -2359,11 +2359,23 @@
     EntityHandle temp_set;
     EntityHandle set1 = ENTITY_HANDLE(entity_set_1), 
       set2 = ENTITY_HANDLE(entity_set_2);
-    ErrorCode result = MBI->create_meshset(MESHSET_SET, temp_set);
+
+    int isList1, isList2;
+    iMesh_isList(instance, entity_set_1, &isList1, err);
+    if (*err != iBase_SUCCESS) return;
+    iMesh_isList(instance, entity_set_2, &isList2, err);
+    if (*err != iBase_SUCCESS) return;
+
+    ErrorCode result;
+    if (isList1 && isList2)
+      result = MBI->create_meshset(MESHSET_ORDERED, temp_set);
+    else
+      result = MBI->create_meshset(MESHSET_SET, temp_set);
+    
     if (MB_SUCCESS == result) result = MBI->unite_meshset(temp_set, set1);
     if (MB_SUCCESS == result) result = MBI->subtract_meshset(temp_set, set2);
 
-    CHKERR(result,"iMesh_entitysetSubtract: ERROR subtract failed.");
+    CHKERR(result,"iMesh_subtract: ERROR subtract failed.");
 
     *result_entity_set = (iBase_EntitySetHandle)temp_set;
 
@@ -2378,11 +2390,23 @@
     EntityHandle temp_set;
     EntityHandle set1 = ENTITY_HANDLE(entity_set_1), 
       set2 = ENTITY_HANDLE(entity_set_2);
-    ErrorCode result = MBI->create_meshset(MESHSET_SET, temp_set);
+
+    int isList1, isList2;
+    iMesh_isList(instance, entity_set_1, &isList1, err);
+    if (*err != iBase_SUCCESS) return;
+    iMesh_isList(instance, entity_set_2, &isList2, err);
+    if (*err != iBase_SUCCESS) return;
+
+    ErrorCode result;
+    if (isList1 && isList2)
+      result = MBI->create_meshset(MESHSET_ORDERED, temp_set);
+    else
+      result = MBI->create_meshset(MESHSET_SET, temp_set);
+
     if (MB_SUCCESS == result) result = MBI->unite_meshset(temp_set, set1);
     if (MB_SUCCESS == result) result = MBI->intersect_meshset(temp_set, set2);
 


More information about the moab-dev mailing list