]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Add a test for the generalized shifted matrix. 1993/head
authorDavid Wells <wellsd2@rpi.edu>
Thu, 17 Dec 2015 21:10:19 +0000 (16:10 -0500)
committerDavid Wells <wellsd2@rpi.edu>
Fri, 18 Dec 2015 16:49:42 +0000 (11:49 -0500)
tests/lac/shifted_matrix_generalized_01.cc [new file with mode: 0644]
tests/lac/shifted_matrix_generalized_01.output [new file with mode: 0644]

diff --git a/tests/lac/shifted_matrix_generalized_01.cc b/tests/lac/shifted_matrix_generalized_01.cc
new file mode 100644 (file)
index 0000000..47aa057
--- /dev/null
@@ -0,0 +1,43 @@
+#include <deal.II/base/logstream.h>
+
+#include <deal.II/lac/full_matrix.h>
+#include <deal.II/lac/shifted_matrix.h>
+#include <deal.II/lac/vector.h>
+
+#include <fstream>
+
+int main()
+{
+  using namespace dealii;
+
+  std::ofstream logfile("output");
+  deallog << std::fixed;
+  deallog << std::setprecision(4);
+  deallog.attach(logfile);
+  deallog.threshold_double(1.e-10);
+
+  FullMatrix<double> m1(2, 2);
+  FullMatrix<double> m2(2, 2);
+
+  m1(0, 0) = 2.0;
+  m1(0, 1) = 1.0;
+  m1(1, 0) = 1.0;
+  m1(1, 1) = 2.0;
+
+  m2(0, 0) = 1.0;
+  m2(0, 1) = 1.0;
+  m2(1, 0) = 1.0;
+  m2(1, 1) = 1.0;
+
+  ShiftedMatrixGeneralized<FullMatrix<double>, FullMatrix<double>, Vector<double> >
+  shifted_matrix(m1, m2, 2.0);
+
+  Vector<double> src(2);
+  src[0] = 3.0;
+  src[1] = 7.0;
+  Vector<double> dst(2);
+  shifted_matrix.vmult(dst, src);
+
+  deallog << dst[0] << ", ";
+  deallog << dst[1] << std::endl;
+}
diff --git a/tests/lac/shifted_matrix_generalized_01.output b/tests/lac/shifted_matrix_generalized_01.output
new file mode 100644 (file)
index 0000000..e40ef76
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::33.0000, 37.0000

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.