From 5f6a400cbf265cb7ed4813be36799c78d3f51d03 Mon Sep 17 00:00:00 2001 From: bangerth Date: Thu, 19 Nov 2009 04:25:56 +0000 Subject: [PATCH] Another test. git-svn-id: https://svn.dealii.org/trunk@20137 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/base/index_set_14.cc | 79 +++++++++++++++++++++ tests/base/index_set_14/cmp/generic | 103 ++++++++++++++++++++++++++++ 2 files changed, 182 insertions(+) create mode 100644 tests/base/index_set_14.cc create mode 100644 tests/base/index_set_14/cmp/generic diff --git a/tests/base/index_set_14.cc b/tests/base/index_set_14.cc new file mode 100644 index 0000000000..6df7c993de --- /dev/null +++ b/tests/base/index_set_14.cc @@ -0,0 +1,79 @@ +//----------------------------------------------------------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2009 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. +// +//----------------------------------------------------------------------------- + +// test IndexSet::operator & + +#include "../tests.h" +#include +#include +#include +#include +#include + +#include + + +void test () +{ + IndexSet is1 (100); + IndexSet is2 (100); + + // randomly add 90 elements to each + // set, some of which may be + // repetitions of previous ones + for (unsigned int i=0; i<9*is1.size()/10; ++i) + { + is1.add_index (rand() % is1.size()); + is2.add_index (rand() % is2.size()); + } + + IndexSet is3 = is1 & is2; + + deallog << "Set sizes: " + << is1.n_elements() << ' ' + << is2.n_elements() << ' ' + << is3.n_elements() << std::endl; + + for (unsigned int i=0; i