]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Reset object to native state in IndexSet::clear(). 2524/head
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Wed, 20 Apr 2016 02:53:02 +0000 (21:53 -0500)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Wed, 20 Apr 2016 02:53:02 +0000 (21:53 -0500)
IndexSet stores an index into an array. Upon construction, this index is set
to an invalid value (because the array is empty), whereas after IndexSet::clear()
the index was set to zero -- a perfectly reasonable, and consequently objectionable
index. This patch sets the index to an invalid value instead, as is also
done in the constructor.

include/deal.II/base/index_set.h

index 99e191702b54f0b04402b6ac50bb6b9635f0f4a6..1fa278b935cb0f5120cd9da5b39202c9b69dedff 100644 (file)
@@ -1222,9 +1222,11 @@ inline
 void
 IndexSet::clear ()
 {
+  // reset so that there are no indices in the set any more; however,
+  // as documented, the index set retains its size
   ranges.clear ();
-  largest_range = 0;
   is_compressed = true;
+  largest_range = numbers::invalid_unsigned_int;
 }
 
 

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.