[MOAB-dev] r3336 - MOAB/trunk

kraftche at cae.wisc.edu kraftche at cae.wisc.edu
Thu Nov 12 14:58:50 CST 2009


Author: kraftche
Date: 2009-11-12 14:58:50 -0600 (Thu, 12 Nov 2009)
New Revision: 3336

Modified:
   MOAB/trunk/AEntityFactory.cpp
Log:
Copy relevant portion of body of get_elements to get_adjacencies, eliminating some redundant checks and eliminating a function call.  Speeds up skinning a tiny bit

Modified: MOAB/trunk/AEntityFactory.cpp
===================================================================
--- MOAB/trunk/AEntityFactory.cpp	2009-11-12 20:48:49 UTC (rev 3335)
+++ MOAB/trunk/AEntityFactory.cpp	2009-11-12 20:58:50 UTC (rev 3336)
@@ -104,7 +104,7 @@
   }
 
   MBErrorCode result;
-  if(mVertElemAdj == false && target_dimension != 0) {
+  if(mVertElemAdj == false) {
     result = create_vert_elem_adjacencies();
     if (MB_SUCCESS != result) return result;
   }
@@ -579,6 +579,7 @@
                                              std::vector<MBEntityHandle> &target_entities )
 {
   const MBEntityType source_type = TYPE_FROM_HANDLE(source_entity);
+  const unsigned source_dimension = MBCN::Dimension(source_type);
 
   MBErrorCode result;
   if (target_dimension == 4) { //get meshsets 'source' is in
@@ -590,12 +591,33 @@
   else if (target_dimension == 0 && source_type == MBPOLYHEDRON) {
     result = get_polyhedron_vertices(source_entity, target_entities);
   }
+  else if (source_dimension == target_dimension) {
+    target_entities.push_back( source_entity );
+    result = MB_SUCCESS;
+  }
   else {
-    result = get_elements( source_entity, 
-                           target_dimension,
-                           target_entities,
-                           create_if_missing );
+    if(mVertElemAdj == false) {
+      result = create_vert_elem_adjacencies();
+      if (MB_SUCCESS != result) return result;
+    }
+
+    if(source_dimension == 0)
+    {
+      result = get_zero_to_n_elements(source_entity, target_dimension,
+        target_entities, create_if_missing);
+    }
+    else if(source_dimension > target_dimension)
+    {
+      result = get_down_adjacency_elements(source_entity, target_dimension,
+                                           target_entities, create_if_missing);
+    }
+    else //if(source_dimension < target_dimension)
+    {
+      result = get_up_adjacency_elements( source_entity, target_dimension,
+             target_entities, create_if_missing);
+    }
   }
+
   return result;
 }
 



More information about the moab-dev mailing list