]> https://gitweb.dealii.org/ - dealii.git/commitdiff
New test.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Tue, 13 Oct 2009 21:36:41 +0000 (21:36 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Tue, 13 Oct 2009 21:36:41 +0000 (21:36 +0000)
git-svn-id: https://svn.dealii.org/trunk@19853 0785d39b-7218-0410-832d-ea1e28bc413d

tests/base/index_set_10.cc [new file with mode: 0644]
tests/base/index_set_10/cmp/generic [new file with mode: 0644]

diff --git a/tests/base/index_set_10.cc b/tests/base/index_set_10.cc
new file mode 100644 (file)
index 0000000..7c41499
--- /dev/null
@@ -0,0 +1,66 @@
+//-----------------------------------------------------------------------------
+//    $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 indexing in IndexSet variables
+
+#include "../tests.h"
+#include <iomanip>
+#include <iomanip>
+#include <fstream>
+#include <cmath>
+
+#include <base/index_set.h>
+
+
+void test ()
+{
+  IndexSet index_set (20);
+
+  index_set.add_index (2);
+  index_set.add_index (3);
+  index_set.add_index (4);
+
+  index_set.add_index (6);
+  index_set.add_index (7);
+
+  index_set.compress ();
+
+  index_set.add_index (5);
+
+  for (unsigned int i=0; i<index_set.n_elements(); ++i)
+    {
+      deallog << index_set.nth_index_in_set(i)
+             << std::endl;
+      Assert (index_set.index_within_set(index_set.nth_index_in_set(i)) == i,
+             ExcInternalError());
+    }
+  deallog << "OK" << std::endl;
+
+  for (unsigned int i=0; i<index_set.size(); ++i)
+    if (index_set.is_element (i))
+      deallog << i << ' ' << index_set.index_within_set(i)
+             << std::endl;
+}
+
+
+
+
+int main()
+{
+  std::ofstream logfile("index_set_10/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  test ();
+}
diff --git a/tests/base/index_set_10/cmp/generic b/tests/base/index_set_10/cmp/generic
new file mode 100644 (file)
index 0000000..a5cb34c
--- /dev/null
@@ -0,0 +1,14 @@
+
+DEAL::2
+DEAL::3
+DEAL::4
+DEAL::5
+DEAL::6
+DEAL::7
+DEAL::OK
+DEAL::2 0
+DEAL::3 1
+DEAL::4 2
+DEAL::5 3
+DEAL::6 4
+DEAL::7 5

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.