From: Wolfgang Bangerth Date: Mon, 19 Dec 2016 22:50:20 +0000 (-0700) Subject: Let IndexSet::nth_index_within_set() call compress(). X-Git-Tag: v8.5.0-rc1~326^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a784dd0c67f6a8c73bbb41efefac74b9e06d736c;p=dealii.git Let IndexSet::nth_index_within_set() call compress(). This follows the pattern of all other const functions of the class. --- diff --git a/doc/news/changes/minor/20161219Bangerth b/doc/news/changes/minor/20161219Bangerth new file mode 100644 index 0000000000..94887e2bd7 --- /dev/null +++ b/doc/news/changes/minor/20161219Bangerth @@ -0,0 +1,6 @@ +
  • Changed: IndexSet::nth_index_in_set() can now be called without + calling IndexSet::compress() first. +
    + (Wolfgang Bangerth, 2016/12/19) +
  • + diff --git a/include/deal.II/base/index_set.h b/include/deal.II/base/index_set.h index cc3caf0170..67dd11a99c 100644 --- a/include/deal.II/base/index_set.h +++ b/include/deal.II/base/index_set.h @@ -1604,11 +1604,10 @@ inline IndexSet::size_type IndexSet::nth_index_in_set (const unsigned int n) const { - // to make this call thread-safe, compress() must not be called through this - // function - Assert (is_compressed == true, ExcMessage ("IndexSet must be compressed.")); Assert (n < n_elements(), ExcIndexRangeType (n, 0, n_elements())); + compress (); + // first check whether the index is in the largest range Assert (largest_range < ranges.size(), ExcInternalError()); std::vector::const_iterator main_range=ranges.begin()+largest_range;