]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Add a test for ProductMatrix::vmult.
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 14 Feb 2014 20:52:51 +0000 (20:52 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 14 Feb 2014 20:52:51 +0000 (20:52 +0000)
git-svn-id: https://svn.dealii.org/trunk@32491 0785d39b-7218-0410-832d-ea1e28bc413d

tests/lac/product_matrix_01.cc [new file with mode: 0644]
tests/lac/product_matrix_01.output [new file with mode: 0644]

diff --git a/tests/lac/product_matrix_01.cc b/tests/lac/product_matrix_01.cc
new file mode 100644 (file)
index 0000000..271998f
--- /dev/null
@@ -0,0 +1,80 @@
+// ---------------------------------------------------------------------
+// $Id$
+//
+// Copyright (C) 2014 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.
+//
+// ---------------------------------------------------------------------
+
+
+// check ProductMatrix::vmult
+
+
+#include "../tests.h"
+#include <deal.II/base/logstream.h>
+#include <deal.II/lac/matrix_lib.h>
+#include <deal.II/lac/full_matrix.h>
+#include <deal.II/lac/vector.h>
+
+#include <fstream>
+#include <iomanip>
+#include <cmath>
+
+template<typename number>
+void
+check()
+{
+  const double Adata[] =
+    {
+         2, 3,
+         4, 5
+    };
+
+  const double Bdata[] =
+    {
+         0, 1,
+         2, 3
+    };
+
+
+  FullMatrix<float> A(2,2);
+  FullMatrix<double> B(2,2);
+
+  A.fill(Adata);
+  B.fill(Bdata);
+
+  GrowingVectorMemory<Vector<number> > mem;
+
+  ProductMatrix<Vector<number> > AB(A,B,mem);
+
+  Vector<number> u(2);
+  Vector<number> v(2);
+
+  u(0) = 1.;
+  u(1) = 2.;
+
+  AB.vmult(v,u);
+
+  deallog << v(0) << '\t' << v(1) << std::endl;
+}
+
+
+int main()
+{
+  std::ofstream logfile("output");
+  deallog << std::setprecision(4);
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  check<double>();
+  check<float>();
+}
diff --git a/tests/lac/product_matrix_01.output b/tests/lac/product_matrix_01.output
new file mode 100644 (file)
index 0000000..bb1ca41
--- /dev/null
@@ -0,0 +1,3 @@
+
+DEAL::28.00    48.00
+DEAL::28.00    48.00

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.