From fc53ea687357648664c3638efe8238ebb435de1a Mon Sep 17 00:00:00 2001 From: bangerth Date: Thu, 15 Oct 2009 20:09:37 +0000 Subject: [PATCH] Rename local variables and types. git-svn-id: https://svn.dealii.org/trunk@19887 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/base/include/base/index_set.h | 38 +++++++++++++-------------- deal.II/base/source/index_set.cc | 20 +++++++------- 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/deal.II/base/include/base/index_set.h b/deal.II/base/include/base/index_set.h index 20bc14ae4c..180fe7cf3e 100644 --- a/deal.II/base/include/base/index_set.h +++ b/deal.II/base/include/base/index_set.h @@ -143,7 +143,7 @@ class IndexSet * A type that denotes an index * range. */ - typedef std::pair ContiguousRange; + typedef std::pair Range; /** * A structure that provides an @@ -151,8 +151,8 @@ class IndexSet */ struct RangeComparison { - bool operator() (const ContiguousRange &range_1, - const ContiguousRange &range_2) const; + bool operator() (const Range &range_1, + const Range &range_2) const; }; /** @@ -168,7 +168,7 @@ class IndexSet * representation of this index * set. */ - mutable std::set contiguous_ranges; + mutable std::set ranges; /** * The overall size of the index @@ -184,8 +184,8 @@ class IndexSet inline bool -IndexSet::RangeComparison::operator() (const ContiguousRange &range_1, - const ContiguousRange &range_2) const +IndexSet::RangeComparison::operator() (const Range &range_1, + const Range &range_2) const { return ((range_1.first < range_2.first) || @@ -216,7 +216,7 @@ inline void IndexSet::set_size (const unsigned int sz) { - Assert (contiguous_ranges.size() == 0, + Assert (ranges.size() == 0, ExcMessage ("This function can only be called if the current " "object does not yet contain any elements.")); index_space_size = sz; @@ -252,7 +252,7 @@ IndexSet::add_range (const unsigned int begin, if (end == begin+1) add_index (begin); else - contiguous_ranges.insert (ContiguousRange(begin,end)); + ranges.insert (Range(begin,end)); } } @@ -265,7 +265,7 @@ IndexSet::add_index (const unsigned int index) Assert (index < index_space_size, ExcIndexRange (index, 0, index_space_size)); - contiguous_ranges.insert (ContiguousRange(index, index+1)); + ranges.insert (Range(index, index+1)); } @@ -277,10 +277,10 @@ IndexSet::is_element (const unsigned int index) const //TODO: since the list of ranges is sorted, we be faster here by doing a binary search // if not, we need to walk the list // of contiguous ranges: - if (contiguous_ranges.size() > 0) - for (std::set::const_iterator - i = contiguous_ranges.begin(); - i != contiguous_ranges.end(); + if (ranges.size() > 0) + for (std::set::const_iterator + i = ranges.begin(); + i != ranges.end(); ++i) if ((index >= i->first) && (index < i->second)) return true; @@ -297,7 +297,7 @@ bool IndexSet::is_contiguous () const { compress (); - return (contiguous_ranges.size() <= 1); + return (ranges.size() <= 1); } @@ -312,9 +312,9 @@ IndexSet::n_elements () const compress (); unsigned int s = 0; - for (std::set::iterator - range = contiguous_ranges.begin(); - range != contiguous_ranges.end(); + for (std::set::iterator + range = ranges.begin(); + range != ranges.end(); ++range) s += (range->second - range->first); @@ -330,7 +330,7 @@ IndexSet::nth_index_in_set (const unsigned int n) const Assert (n < n_elements(), ExcIndexRange (n, 0, n_elements())); Assert (is_contiguous(), ExcNotImplemented()); - return (n+contiguous_ranges.begin()->first); + return (n+ranges.begin()->first); } @@ -344,7 +344,7 @@ IndexSet::index_within_set (const unsigned int n) const Assert (n < size(), ExcIndexRange (n, 0, size())); Assert (is_contiguous(), ExcNotImplemented()); - return (n-contiguous_ranges.begin()->first); + return (n-ranges.begin()->first); } diff --git a/deal.II/base/source/index_set.cc b/deal.II/base/source/index_set.cc index ba48629d1e..8838800216 100644 --- a/deal.II/base/source/index_set.cc +++ b/deal.II/base/source/index_set.cc @@ -23,12 +23,12 @@ IndexSet::compress () const // merged. since they are sorted by // their first index, determining // overlap isn't all that hard - for (std::set::iterator - i = contiguous_ranges.begin(); - i != contiguous_ranges.end(); + for (std::set::iterator + i = ranges.begin(); + i != ranges.end(); ++i) { - std::set::const_iterator + std::set::const_iterator next = i; ++next; @@ -38,7 +38,7 @@ IndexSet::compress () const // see if we can merge any of // the following ranges bool can_merge = false; - while (next != contiguous_ranges.end() && + while (next != ranges.end() && (next->first <= last_index)) { last_index = next->second; @@ -51,9 +51,9 @@ IndexSet::compress () const // delete the old // ranges and insert the // new range - contiguous_ranges.erase (i, next); - contiguous_ranges.insert (ContiguousRange(first_index, - last_index)); + ranges.erase (i, next); + ranges.insert (Range(first_index, + last_index)); // then set iterator to // the same position as @@ -69,8 +69,8 @@ IndexSet::compress () const // sure we gobble up as // many of the following // ranges as possible - i = contiguous_ranges.lower_bound (ContiguousRange(first_index, - last_index)); + i = ranges.lower_bound (Range(first_index, + last_index)); } } } -- 2.39.5