From: heister Date: Fri, 9 Dec 2011 18:08:12 +0000 (+0000) Subject: add IndexSet::add_indices(IndexSet) X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3caa2cca5f344bc6eab4f642a43b2df3f870c06d;p=dealii-svn.git add IndexSet::add_indices(IndexSet) git-svn-id: https://svn.dealii.org/trunk@24807 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/include/deal.II/base/index_set.h b/deal.II/include/deal.II/base/index_set.h index 47b7bddc7b..a7840c485c 100644 --- a/deal.II/include/deal.II/base/index_set.h +++ b/deal.II/include/deal.II/base/index_set.h @@ -115,6 +115,13 @@ class IndexSet void add_indices (const ForwardIterator &begin, const ForwardIterator &end); + /** + * Add the given IndexSet @p other to the + * current one, constructing the union of + * *this and @p other. + */ + void add_indices(const IndexSet & other); + /** * Return whether the specified * index is an element of the @@ -680,6 +687,25 @@ IndexSet::add_indices (const ForwardIterator &begin, +inline +void +IndexSet::add_indices(const IndexSet & other) +{ + if (this == &other) + return; + + for (std::vector::iterator range = other.ranges.begin(); + range != other.ranges.end(); + ++range) + { + add_range(range->begin, range->end); + } + + compress(); +} + + + inline bool IndexSet::is_element (const unsigned int index) const