]> https://gitweb.dealii.org/ - dealii.git/commitdiff
add a test
authorMatthias Maier <tamiko@43-1.org>
Tue, 8 Aug 2017 22:47:23 +0000 (17:47 -0500)
committerMatthias Maier <tamiko@43-1.org>
Tue, 8 Aug 2017 23:56:24 +0000 (18:56 -0500)
tests/lac/constraints_get_lines.cc [new file with mode: 0644]
tests/lac/constraints_get_lines.output [new file with mode: 0644]

diff --git a/tests/lac/constraints_get_lines.cc b/tests/lac/constraints_get_lines.cc
new file mode 100644 (file)
index 0000000..20f5ed7
--- /dev/null
@@ -0,0 +1,67 @@
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2009 - 2015 by the deal.II authors
+//
+// This file is part of the deal.II library.
+//
+// The deal.II library is free software; you can use it, redistribute
+// it, and/or modify it under the terms of the GNU Lesser General
+// Public License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// The full text of the license can be found in the file LICENSE at
+// the top level of the deal.II distribution.
+//
+// ---------------------------------------------------------------------
+
+
+
+// test: test the ConstraintMatrix::get_lines() range object
+
+
+#include "../tests.h"
+#include <deal.II/lac/constraint_matrix.h>
+
+
+void test ()
+{
+  ConstraintMatrix cm;
+
+  // an inhomogeneous constraint
+  cm.add_line (4);
+  cm.set_inhomogeneity (4, 3.14159);
+
+  // a homogeneous constraint that is
+  // constrained to the inhomogeneous one
+  cm.add_line (1);
+  cm.add_entry (1, 2, 42.);
+  cm.add_entry (1, 4, 1.);
+
+  // and a standard homogeneous constraint
+  cm.add_line (17);
+  cm.add_entry(17, 6, 2.);
+  cm.add_entry(17, 15, 3.);
+
+  // a "singular" constraint
+  cm.add_line (3);
+
+  // now close the constraint matrix
+  cm.close();
+
+  for (auto line : cm.get_lines())
+    {
+      deallog << line.index;
+      for (auto entry : line.entries)
+        {
+          deallog << " (" << entry.first << "," << entry.second << ")";
+        }
+      deallog << " - " << line.inhomogeneity << std::endl;
+    }
+}
+
+
+int main ()
+{
+  initlog();
+  test();
+  deallog << "OK" << std::endl;
+}
diff --git a/tests/lac/constraints_get_lines.output b/tests/lac/constraints_get_lines.output
new file mode 100644 (file)
index 0000000..1b528d2
--- /dev/null
@@ -0,0 +1,6 @@
+
+DEAL::1 (2,42.0000) - 3.14159
+DEAL::3 - 0.00000
+DEAL::4 - 3.14159
+DEAL::17 (6,2.00000) (15,3.00000) - 0.00000
+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.