[MOAB-dev] r3314 - MOAB/trunk

kraftche at cae.wisc.edu kraftche at cae.wisc.edu
Mon Nov 9 16:52:10 CST 2009


Author: kraftche
Date: 2009-11-09 16:52:10 -0600 (Mon, 09 Nov 2009)
New Revision: 3314

Modified:
   MOAB/trunk/MBCN.cpp
Log:
Don't malloc/free in MBCN::SideNumber

Modified: MOAB/trunk/MBCN.cpp
===================================================================
--- MOAB/trunk/MBCN.cpp	2009-11-09 22:23:13 UTC (rev 3313)
+++ MOAB/trunk/MBCN.cpp	2009-11-09 22:52:10 UTC (rev 3314)
@@ -226,12 +226,13 @@
                 int &offset)
 {
   int parent_num_verts = MBCN::VerticesPerEntity(parent_type);
-  std::vector<int> side_indices(child_num_verts);
+  int side_indices[8]; 
+  assert(sizeof(side_indices)/sizeof(side_indices[0]) <= child_num_verts);
   
   for (int i = 0; i < child_num_verts; i++) {
-    const T *tmp = std::find(parent_conn, parent_conn+parent_num_verts, child_conn[i]);
-    if (tmp == parent_conn+parent_num_verts) return -1;
-    else side_indices[i] = tmp - parent_conn;
+    side_indices[i] = std::find(parent_conn, parent_conn+parent_num_verts, child_conn[i]) - parent_conn;
+    if (side_indices[i] == parent_num_verts) 
+      return -1;
   }
   
   return MBCN::SideNumber(parent_type, &side_indices[0], child_num_verts,



More information about the moab-dev mailing list