]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
test for new PointerMatrixVector
authorkanschat <kanschat@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 18 Sep 2006 01:09:19 +0000 (01:09 +0000)
committerkanschat <kanschat@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 18 Sep 2006 01:09:19 +0000 (01:09 +0000)
git-svn-id: https://svn.dealii.org/trunk@13915 0785d39b-7218-0410-832d-ea1e28bc413d

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

index ea9dbddfb79e5d795ef39574a43eb8204f940e07..6be139206ed162188a3d005b1b9e08ba61a10629 100644 (file)
@@ -26,7 +26,7 @@ tests_x = vector-vector \
        sparsity_pattern sparse_matrices matrices \
        block_sparsity_pattern_01 \
        block_vector block_vector_* block_matrices \
-       matrix_lib matrix_out pointer_matrix \
+       matrix_lib matrix_out pointer_matrix pointer_matrix_vector \
        solver eigen \
        sparse_ilu sparse_ilu_t lapack_fill block_minres \
        identity_matrix* trace
diff --git a/tests/lac/pointer_matrix_vector.cc b/tests/lac/pointer_matrix_vector.cc
new file mode 100644 (file)
index 0000000..1614bad
--- /dev/null
@@ -0,0 +1,61 @@
+//----------------------------------------------------------------------
+//    $Id: pointer_matrix.cc 13349 2006-07-07 09:39:32Z guido $
+//    Version: $Name$ 
+//
+//    Copyright (C) 2006 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 vmult and Tvmult of PointerMatrixVector
+
+#include <base/logstream.h>
+#include <lac/pointer_matrix.h>
+#include <lac/vector.h>
+
+#include <fstream>
+
+int main()
+{
+  std::ofstream logfile("pointer_matrix_vector/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  
+  Vector<double> u(5);
+  Vector<double> v(5);
+  Vector<double> w(1);
+  Vector<float>  x(5);
+  Vector<float>  y(5);
+  Vector<float>  z(1);
+  
+
+  for (unsigned int i=0;i<u.size();++i)
+    {
+      u(i) = 1 << i;
+      x(i) = 1 << i;
+      v(i) = 6-i;
+      y(i) = 6-i;
+    }
+  
+  PointerMatrixVector<double> Mu(&u);
+  Mu.vmult(w,v);
+  deallog << "vmult  " << w(0) << std::endl << "Tvmult";
+  w(0) = 2.;
+  Mu.Tvmult(v,w);
+  for (unsigned int i=0;i<v.size();++i)
+    deallog << ' ' << v(i);
+  deallog << std::endl;
+  
+  PointerMatrixVector<float> Mx(&x);
+  Mx.vmult(z,y);
+  deallog << "vmult  " << z(0) << std::endl << "Tvmult";
+  z(0) = 2.;
+  Mx.Tvmult(y,z);
+  for (unsigned int i=0;i<y.size();++i)
+    deallog << ' ' << y(i);
+  deallog << std::endl;
+}
diff --git a/tests/lac/pointer_matrix_vector/cmp/generic b/tests/lac/pointer_matrix_vector/cmp/generic
new file mode 100644 (file)
index 0000000..f3ce7a8
--- /dev/null
@@ -0,0 +1,5 @@
+
+DEAL::vmult  88.0000
+DEAL::Tvmult 2.00000 4.00000 8.00000 16.0000 32.0000
+DEAL::vmult  88.0000
+DEAL::Tvmult 2.00000 4.00000 8.00000 16.0000 32.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.