[MOAB-dev] r3999 - in MOAB/trunk: src test
kraftche at cae.wisc.edu
kraftche at cae.wisc.edu
Fri Jun 4 15:24:46 CDT 2010
Author: kraftche
Date: 2010-06-04 15:24:46 -0500 (Fri, 04 Jun 2010)
New Revision: 3999
Modified:
MOAB/trunk/src/MeshSet.cpp
MOAB/trunk/test/Test_MBMeshSet.cpp
Log:
o Fix bug inserting entities into ranged (unordered) set.
o Add test that reproduces conditions of above bug
This was interesting in that there was a fairly significant
bug in the insertion of entities into a range-compacted entity set
content list. The bug resulted in range pairs not being correctly
merged and not being kept in the expected sorted order, but all
handles still beign represented. This means that for the most common
scenario of retreiving the contents of such a set in a Range, the
results were always as expected. It would have resulted in errors
for many other cases, though, such as:
o getting a subset by type or dimension might not return all entities
o the contents retreived in a vector might contain duplicates
o testing if a set contains a handle may return false negatives
o issues with set boolean operations
Modified: MOAB/trunk/src/MeshSet.cpp
===================================================================
--- MOAB/trunk/src/MeshSet.cpp 2010-06-04 20:16:35 UTC (rev 3998)
+++ MOAB/trunk/src/MeshSet.cpp 2010-06-04 20:24:46 UTC (rev 3999)
@@ -432,7 +432,7 @@
// if there are holes in the current array, shuffle blocks
// down until we find the next block to merge with or insert before
if (list_read != list_write) {
- while (list_read != list_end && i->second + 1 < list_read[0]) {
+ while (list_read != list_end && list_read[1] + 1 < i->first) {
list_write[0] = list_read[0];
list_write[1] = list_read[1];
list_write += 2;
Modified: MOAB/trunk/test/Test_MBMeshSet.cpp
===================================================================
--- MOAB/trunk/test/Test_MBMeshSet.cpp 2010-06-04 20:16:35 UTC (rev 3998)
+++ MOAB/trunk/test/Test_MBMeshSet.cpp 2010-06-04 20:24:46 UTC (rev 3999)
@@ -98,6 +98,11 @@
void test_clear_ordered_tracking() { test_clear( MESHSET_TRACK_OWNER|MESHSET_ORDERED ); }
void test_clear_set_tracking() { test_clear( MESHSET_TRACK_OWNER|MESHSET_SET ); }
+// Reproduce contitions that resulted in bug reported to
+// mailing list:
+// http://lists.mcs.anl.gov/pipermail/moab-dev/2010/002714.html
+void regression_insert_set_1();
+
int main()
{
int err = 0;
@@ -151,6 +156,8 @@
err += RUN_TEST(test_clear_set);
err += RUN_TEST(test_clear_ordered_tracking);
err += RUN_TEST(test_clear_set_tracking);
+
+ err += RUN_TEST(regression_insert_set_1);
if (!err)
printf("ALL TESTS PASSED\n");
@@ -1099,3 +1106,91 @@
CHECK( check_set_contents( mb, set, contents ) );
}
+void regression_insert_set_1()
+{
+ EntityHandle e = CREATE_HANDLE(MBEDGE,0);
+ EntityHandle q = CREATE_HANDLE(MBQUAD,0);
+ const EntityHandle initial_ranges[] =
+ { 0x7fe, 0x7fe,
+ 0x802, 0x80b,
+ 0xb3a, 0xb3c,
More information about the moab-dev
mailing list