]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Optimize construction of compressed index sets.
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Sat, 10 Oct 2009 17:01:45 +0000 (17:01 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Sat, 10 Oct 2009 17:01:45 +0000 (17:01 +0000)
git-svn-id: https://svn.dealii.org/trunk@19808 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/base/source/index_set.cc

index ec940c07cf2fba5816f984a9351d8e08f286458b..2519727d4c041427fdb263627344dfb6bcf5a04c 100644 (file)
@@ -122,7 +122,19 @@ IndexSet::compress () const
                                         // current range, so we'll
                                         // delete all of them
        const unsigned int old_index = *next_individual_index;
-       individual_indices.erase (next_individual_index);
+
+       {
+         std::set<unsigned int>::iterator
+           last_index = next_individual_index;
+         ++last_index;
+         while ((last_index != individual_indices.end())
+                &&
+                (*last_index < new_range.second))
+           ++last_index;
+
+         individual_indices.erase (next_individual_index,
+                                   last_index);
+       }
        next_individual_index = individual_indices.lower_bound (old_index);
 
        contiguous_ranges.erase (next_range);

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.