]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
add IndexSet::add_indices(IndexSet)
authorheister <heister@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 9 Dec 2011 18:08:12 +0000 (18:08 +0000)
committerheister <heister@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 9 Dec 2011 18:08:12 +0000 (18:08 +0000)
git-svn-id: https://svn.dealii.org/trunk@24807 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/include/deal.II/base/index_set.h

index 47b7bddc7bff82801dfbe604b5b3aa93b92b65dc..a7840c485c326f82020e8113175f4b4d4de83a81 100644 (file)
@@ -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<Range>::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

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.