[MOAB-dev] r4558 - in MOAB/trunk/src: . moab

kraftche at cae.wisc.edu kraftche at cae.wisc.edu
Wed Mar 9 10:27:08 CST 2011


Author: kraftche
Date: 2011-03-09 10:27:07 -0600 (Wed, 09 Mar 2011)
New Revision: 4558

Modified:
   MOAB/trunk/src/DenseTag.cpp
   MOAB/trunk/src/HigherOrderFactory.cpp
   MOAB/trunk/src/SequenceData.cpp
   MOAB/trunk/src/SequenceData.hpp
   MOAB/trunk/src/SequenceManager.cpp
   MOAB/trunk/src/moab/HigherOrderFactory.hpp
Log:
o Reduce default sequence data size from 1M to 512k
o Do not automatically sequence data arrays

Notes:

Reduces runtime for things that create many Core instances (e.g. unit tests)
by a factor of 10.  

Dense tag data is still zeroed if there is no default value.  To do otherwise
would be amount to an API change (we have tests that check for
the zeroing behavior.)  Also, failure to zero the memory could result
in a very minor security issue where possibly unintended data from the 
application address space is written to a file when writing unset dense tag
values.  And for binary IO of floating point values it could be an issue to 
send possibly invalid values to libraries for portable binary IO.




Modified: MOAB/trunk/src/DenseTag.cpp
===================================================================
--- MOAB/trunk/src/DenseTag.cpp	2011-03-09 16:20:23 UTC (rev 4557)
+++ MOAB/trunk/src/DenseTag.cpp	2011-03-09 16:27:07 UTC (rev 4558)
@@ -111,13 +111,11 @@
   
   void* mem = seq->data()->get_tag_data( mySequenceArray );
   if (!mem && allocate) {
-    mem = seq->data()->allocate_tag_array( mySequenceArray, get_size() );
+    mem = seq->data()->allocate_tag_array( mySequenceArray, get_size(), get_default_value() );
     if (!mem)
       return MB_FAILURE;
     
-    if (get_default_value()) 
-      SysUtil::setmem( mem, get_default_value(), get_size(), seq->data()->size() );
-    else
+    if (!get_default_value()) 
       memset( mem, 0, get_size() * seq->data()->size() );
   }
   

Modified: MOAB/trunk/src/HigherOrderFactory.cpp
===================================================================
--- MOAB/trunk/src/HigherOrderFactory.cpp	2011-03-09 16:20:23 UTC (rev 4557)
+++ MOAB/trunk/src/HigherOrderFactory.cpp	2011-03-09 16:27:07 UTC (rev 4558)
@@ -186,6 +186,8 @@
     status = copy_mid_edge_nodes( seq, new_seq );
   else if (seq->has_mid_edge_nodes() && !mid_edge_nodes)
     status = remove_mid_edge_nodes( seq, start, end, deletable_nodes );
+  else if (!seq->has_mid_edge_nodes() && mid_edge_nodes)
+    status = zero_mid_edge_nodes( new_seq );
   if (MB_SUCCESS != status)
     return status;
 
@@ -193,6 +195,8 @@
     status = copy_mid_face_nodes( seq, new_seq );
   else if (seq->has_mid_face_nodes() && !mid_face_nodes)
     status = remove_mid_face_nodes( seq, start, end, deletable_nodes );
+  else if (!seq->has_mid_face_nodes() && mid_face_nodes)
+    status = zero_mid_face_nodes( new_seq );
   if (MB_SUCCESS != status)
     return status;
  
@@ -200,6 +204,8 @@
     status = copy_mid_volume_nodes( seq, new_seq );
   else if (seq->has_mid_volume_nodes() && !mid_volume_nodes)
     status = remove_mid_volume_nodes( seq, start, end, deletable_nodes );
+  else if (!seq->has_mid_volume_nodes() && mid_volume_nodes)
+    status = zero_mid_volume_nodes( new_seq );
   if (MB_SUCCESS != status)
     return status;


More information about the moab-dev mailing list