]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add a test for the output of inhomogeneous constraints.
authorMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Fri, 26 Jun 2009 06:00:55 +0000 (06:00 +0000)
committerMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Fri, 26 Jun 2009 06:00:55 +0000 (06:00 +0000)
git-svn-id: https://svn.dealii.org/trunk@18974 0785d39b-7218-0410-832d-ea1e28bc413d

tests/lac/Makefile
tests/lac/constraints_inhomogeneous.cc [new file with mode: 0644]
tests/lac/constraints_inhomogeneous/cmp/generic [new file with mode: 0644]

index 4fd1b76b0186fd1246d89ee4048df75a85862cdf..9f3bf3e058a55e3218b03c58a50d147fec19f3d9 100644 (file)
@@ -32,6 +32,7 @@ tests_x = vector-vector vector_memory \
        compressed_simple_sparsity_pattern_* \
        compressed_set_sparsity_pattern_* \
        constraints_zero* \
+       constraints_inhomogeneous \
        constraint_graph_zero \
        sparse_matrices matrices \
        block_sparsity_pattern_01 \
diff --git a/tests/lac/constraints_inhomogeneous.cc b/tests/lac/constraints_inhomogeneous.cc
new file mode 100644 (file)
index 0000000..815b258
--- /dev/null
@@ -0,0 +1,68 @@
+//-----------------------  constraints_inhomogeneous.cc  ----------------------
+//    $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.
+//
+//-----------------------  constraints_inhomogeneous.cc  ----------------------
+
+
+// test: set inhomogeneous constraints and indirectly apply those to other
+// constrained nodes.
+
+
+#include "../tests.h"
+#include <base/logstream.h>
+#include <lac/constraint_matrix.h>
+
+#include <fstream>
+
+
+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();
+
+  cm.print (deallog.get_file_stream());
+}
+
+
+int main ()
+{
+  std::ofstream logfile("constraints_inhomogeneous/output");
+  logfile.precision(2);
+  
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);  
+
+  test ();
+  
+  deallog << "OK" << std::endl;
+}
diff --git a/tests/lac/constraints_inhomogeneous/cmp/generic b/tests/lac/constraints_inhomogeneous/cmp/generic
new file mode 100644 (file)
index 0000000..eab77e6
--- /dev/null
@@ -0,0 +1,8 @@
+
+    1 2:  42.
+    1: 3.1
+    3 = 0
+    4 = 3.1
+    17 6:  2.0
+    17 15:  3.0
+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.