[MOAB-dev] r2151 - MOAB/trunk
kraftche at mcs.anl.gov
kraftche at mcs.anl.gov
Wed Oct 15 13:29:37 CDT 2008
Author: kraftche
Date: 2008-10-15 13:29:36 -0500 (Wed, 15 Oct 2008)
New Revision: 2151
Modified:
MOAB/trunk/WriteHDF5.cpp
MOAB/trunk/WriteHDF5.hpp
Log:
Fix bug in HDF5 writer: Possibly corrupted set contents if set contains
handles to entities not being written (e.g. stale handles.) Do not
assume that output list size < number of entities implies that output
list is in blocked format. It may be smaller because lots of the
handles were not for entities being written.
Modified: MOAB/trunk/WriteHDF5.cpp
===================================================================
--- MOAB/trunk/WriteHDF5.cpp 2008-10-15 18:21:32 UTC (rev 2150)
+++ MOAB/trunk/WriteHDF5.cpp 2008-10-15 18:29:36 UTC (rev 2151)
@@ -869,10 +869,11 @@
rval = iFace->get_entities_by_handle( *iter, set_contents, false );
CHK_MB_ERR_2C(rval, set_table, writeSetContents, content_table, status);
- rval = range_to_blocked_list( set_contents, id_list );
+ bool blocked_list;
+ rval = range_to_blocked_list( set_contents, id_list, blocked_list );
CHK_MB_ERR_2C(rval, set_table, writeSetContents, content_table, status);
- assert (id_list.size() < (unsigned long)data_size);
+ assert (blocked_list && id_list.size() < (unsigned long)data_size);
flags |= mhdf_SET_RANGE_BIT;
data_size = id_list.size();
++comp;
@@ -1072,8 +1073,10 @@
}
*/
MBErrorCode WriteHDF5::range_to_blocked_list( const MBRange& input_range,
- std::vector<id_t>& output_id_list )
+ std::vector<id_t>& output_id_list,
+ bool& ranged_list )
{
+ ranged_list = false;
if (input_range.empty()) {
output_id_list.clear();
return MB_SUCCESS;
@@ -1116,7 +1119,7 @@
}
// if we ran out of space, (or set is empty) just do list format
- if (output_id_list.end() - i < 2 || i == output_id_list.begin()) {
+ if (output_id_list.end() - i < 2) {
range_to_id_list( input_range, &output_id_list[0] );
output_id_list.erase( std::remove( output_id_list.begin(),
output_id_list.end(),
@@ -1126,6 +1129,7 @@
}
// otherwise check if we can compact the list further
+ ranged_list = true;
size_t r, w = 2;
const size_t e = i - output_id_list.begin() - 1;
for (r = 2; r < e; r += 2) {
@@ -2243,11 +2247,11 @@
rval = iFace->get_entities_by_handle( *iter, set_contents, false );
CHK_MB_ERR_0(rval);
- rval = range_to_blocked_list( set_contents, set_contents_ids );
+ bool blocked_list;
+ rval = range_to_blocked_list( set_contents, set_contents_ids, blocked_list );
CHK_MB_ERR_0(rval);
- if (set_contents_ids.size() < (unsigned long)contents_length_set
- && !set_contents_ids.empty())
+ if (blocked_list)
{
contents_length_set = set_contents_ids.size();
compressed_sets.insert( *iter );
Modified: MOAB/trunk/WriteHDF5.hpp
===================================================================
--- MOAB/trunk/WriteHDF5.hpp 2008-10-15 18:21:32 UTC (rev 2150)
+++ MOAB/trunk/WriteHDF5.hpp 2008-10-15 18:29:36 UTC (rev 2151)
@@ -292,11 +292,12 @@
* If IDs are compacted, the output list will contain
* {start,count} pairs.
*
- * If the ID list is compacted, the length will be less than
- * range.size().
+ * If the ID list is compacted, ranged_list will be 'true'.
+ * Otherwise it will be 'false'.
*/
MBErrorCode range_to_blocked_list( const MBRange& input_range,
- std::vector<id_t>& output_id_list );
+ std::vector<id_t>& output_id_list,
+ bool& ranged_list );
MBErrorCode range_to_id_list( const MBRange& input_range,
More information about the moab-dev
mailing list