From: Wolfgang Bangerth Date: Sat, 25 May 2013 12:23:00 +0000 (+0000) Subject: Fix IndexSet::operator== which we have, mysteriously, gotten wrong... X-Git-Tag: v8.0.0~444 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5444ee045c6be64212b56e78c2e870c27f5685e3;p=dealii.git Fix IndexSet::operator== which we have, mysteriously, gotten wrong... git-svn-id: https://svn.dealii.org/trunk@29592 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/doc/news/changes.h b/deal.II/doc/news/changes.h index fcb38a37b0..f8fd69f022 100644 --- a/deal.II/doc/news/changes.h +++ b/deal.II/doc/news/changes.h @@ -130,6 +130,12 @@ this function.

Specific improvements

    +
  1. Fixed: IndexSet::operator== returned the wrong results +in some cases. +
    +(Wolfgang Bangerth, 2013/05/25) +
  2. +
  3. New: The global function complete_index_set() creates and returns an index set of given size that contains every single index with this range. diff --git a/deal.II/include/deal.II/base/index_set.h b/deal.II/include/deal.II/base/index_set.h index 3fed2dcc20..aff873cba7 100644 --- a/deal.II/include/deal.II/base/index_set.h +++ b/deal.II/include/deal.II/base/index_set.h @@ -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 index 0000000000..b63fd79b74 --- /dev/null +++ b/tests/base/index_set_23.cc @@ -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 +#include +#include +#include +#include + +#include + + +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 index 0000000000..0fd8fc12f0 --- /dev/null +++ b/tests/base/index_set_23/cmp/generic @@ -0,0 +1,2 @@ + +DEAL::OK