]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Fix IndexSet::operator== which we have, mysteriously, gotten wrong...
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Sat, 25 May 2013 12:23:00 +0000 (12:23 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Sat, 25 May 2013 12:23:00 +0000 (12:23 +0000)
git-svn-id: https://svn.dealii.org/trunk@29592 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/doc/news/changes.h
deal.II/include/deal.II/base/index_set.h
tests/base/index_set_23.cc [new file with mode: 0644]
tests/base/index_set_23/cmp/generic [new file with mode: 0644]

index fcb38a37b012611862a2b254e622c7eea6edd1df..f8fd69f02231016996d877914d098cec4dc83ba8 100644 (file)
@@ -130,6 +130,12 @@ this function.
 <h3>Specific improvements</h3>
 
 <ol>
+<li> Fixed: IndexSet::operator== returned the wrong results
+in some cases.
+<br>
+(Wolfgang Bangerth, 2013/05/25)
+</li>
+
 <li> New: The global function <code>complete_index_set()</code>
 creates and returns an index set of given size that contains
 every single index with this range.
index 3fed2dcc20c3790156d893ab1610efee9a0b2e44..aff873cba72e080a40943198687a2193719e0c4f 100644 (file)
@@ -490,8 +490,8 @@ private:
                             const Range &range_2)
     {
       return ((range_1.begin == range_2.begin)
-              ||
-              (range_1.begin == range_2.begin));
+              &&
+              (range_1.end == range_2.end));
     }
 
     std::size_t memory_consumption () const
diff --git a/tests/base/index_set_23.cc b/tests/base/index_set_23.cc
new file mode 100644 (file)
index 0000000..b63fd79
--- /dev/null
@@ -0,0 +1,51 @@
+//-----------------------------------------------------------------------------
+//    $Id$
+//    Version: $Name$
+//
+//    Copyright (C) 2010, 2012, 2013 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//-----------------------------------------------------------------------------
+
+// we managed to get a function as simple as IndexSet::operator== wrong -- who
+// knew?
+
+#include "../tests.h"
+#include <iomanip>
+#include <iomanip>
+#include <fstream>
+#include <cmath>
+#include <stdlib.h>
+
+#include <deal.II/base/index_set.h>
+
+
+void test ()
+{
+  IndexSet is1 (100), is2 (100);
+
+  is1.add_range (0,10);
+  is2.add_range (0,20);
+
+  Assert((is1 == is2) == false, ExcInternalError());
+  Assert((is1 != is2) == true, ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+
+int main()
+{
+  std::ofstream logfile("index_set_23/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  test ();
+}
diff --git a/tests/base/index_set_23/cmp/generic b/tests/base/index_set_23/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK

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.