[MOAB-dev] r4846 - MOAB/trunk/src

jvporter at wisc.edu jvporter at wisc.edu
Wed May 18 17:13:07 CDT 2011


Author: jvporter
Date: 2011-05-18 17:13:06 -0500 (Wed, 18 May 2011)
New Revision: 4846

Modified:
   MOAB/trunk/src/AEntityFactory.cpp
   MOAB/trunk/src/AEntityFactory.hpp
Log:
Don't allow deletion of vertices if they have upward adjacencies


Modified: MOAB/trunk/src/AEntityFactory.cpp
===================================================================
--- MOAB/trunk/src/AEntityFactory.cpp	2011-05-18 20:40:51 UTC (rev 4845)
+++ MOAB/trunk/src/AEntityFactory.cpp	2011-05-18 22:13:06 UTC (rev 4846)
@@ -1512,5 +1512,24 @@
   amortized += min_per_ent;
   return (rval == MB_FAILURE) ? MB_SUCCESS : rval;
 }   
+
+/*! 
+   calling code is notifying this that an entity is going to be deleted
+   from the database
+*/
+ErrorCode AEntityFactory::notify_delete_entity(EntityHandle entity)
+{
+  if (TYPE_FROM_HANDLE(entity) == MBVERTEX) {
+    std::vector<EntityHandle> adj_entities;
+    for (int dim = 1; dim < 4; ++dim) {
+      get_adjacencies(entity, dim, false, adj_entities);
+      if (!adj_entities.empty())
+        return MB_FAILURE;
+    }
+  }
+
+  // remove any references to this entity from other entities
+  return remove_all_adjacencies(entity, true);
+}
   
 } // namespace moab

Modified: MOAB/trunk/src/AEntityFactory.hpp
===================================================================
--- MOAB/trunk/src/AEntityFactory.hpp	2011-05-18 20:40:51 UTC (rev 4845)
+++ MOAB/trunk/src/AEntityFactory.hpp	2011-05-18 22:13:06 UTC (rev 4846)
@@ -230,17 +230,7 @@
   ErrorCode create_explicit_adjs(EntityHandle this_ent);
   
 };
-
-/*! 
-   calling code is notifying this that an entity is going to be deleted
-   from the database
-*/
-inline ErrorCode AEntityFactory::notify_delete_entity(EntityHandle entity)
-{
-  // remove any references to this entity from other entities
-  return remove_all_adjacencies(entity, true);
-}
-  
+ 
 } // namespace moab


More information about the moab-dev mailing list