]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Add an even simpler test
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 24 Oct 2006 22:36:09 +0000 (22:36 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 24 Oct 2006 22:36:09 +0000 (22:36 +0000)
git-svn-id: https://svn.dealii.org/trunk@14071 0785d39b-7218-0410-832d-ea1e28bc413d

tests/umfpack/umfpack_05.cc [new file with mode: 0644]
tests/umfpack/umfpack_05/cmp/generic [new file with mode: 0644]

diff --git a/tests/umfpack/umfpack_05.cc b/tests/umfpack/umfpack_05.cc
new file mode 100644 (file)
index 0000000..5ef158c
--- /dev/null
@@ -0,0 +1,72 @@
+//----------------------------------------------------------------------
+//    $Id: umfpack_03.cc 13855 2006-09-08 14:42:11Z heltai $
+//    Version: $Name$ 
+//
+//    Copyright (C) 2002, 2003, 2004, 2005, 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 the umfpack sparse direct solver on a simple 2x2 block matrix
+// that equals the unit matrix
+
+#include "../tests.h"
+#include <iostream>
+#include <fstream>
+#include <cstdlib>
+
+#include <lac/block_sparse_matrix.h>
+#include <lac/block_sparsity_pattern.h>
+#include <lac/vector.h>
+#include <lac/sparse_direct.h>
+
+
+
+template <int dim>
+void test ()
+{
+  std::vector<unsigned int> size (2,2U);
+  
+  BlockSparsityPattern b_sparsity_pattern;
+  b_sparsity_pattern.reinit(size.size(),size.size());
+  for (unsigned int k=0; k<size.size();++k)
+    for (unsigned int l=0; l<size.size();++l)
+      b_sparsity_pattern.block(k,l).reinit(size[k],
+                                          size[l],
+                                          2);
+  b_sparsity_pattern.collect_sizes();
+  for (unsigned int i=0; i<4; ++i)
+    for (unsigned int j=0; j<4; ++j)
+      b_sparsity_pattern.add (i,j);
+  b_sparsity_pattern.compress();
+  
+  BlockSparseMatrix<double> Bb (b_sparsity_pattern);  
+  for (unsigned int i=0; i<4; ++i)
+    Bb.add (i,i,1);
+
+  SparseDirectUMFPACK umfpackb;
+  umfpackb.factorize(Bb);
+
+  Vector<double> ubb(4);
+  for (unsigned int i=0; i<4; ++i)
+    ubb(i) = i;
+  
+  umfpackb.solve(ubb);
+}
+
+
+int main ()
+{
+  std::ofstream logfile("umfpack_05/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  test<1> ();
+  test<2> ();
+  test<3> ();
+}
diff --git a/tests/umfpack/umfpack_05/cmp/generic b/tests/umfpack/umfpack_05/cmp/generic
new file mode 100644 (file)
index 0000000..4135273
--- /dev/null
@@ -0,0 +1,37 @@
+
+DEAL::1d
+DEAL::Number of dofs = 97
+DEAL:cg::Starting value 0.215517
+DEAL:cg::Convergence step 111 value 0
+DEAL:cg::Starting value 0.215517
+DEAL:cg::Convergence step 111 value 0
+DEAL::Sparse Factorization
+DEAL::absolute norms = 6.45748 6.45748
+DEAL::relative norm distance = 0
+DEAL::Block Sparse Factorization
+DEAL::absolute norms = 6.45748 6.45748
+DEAL::relative norm distance = 0
+DEAL::2d
+DEAL::Number of dofs = 994
+DEAL:cg::Starting value 0.595296
+DEAL:cg::Convergence step 58 value 0
+DEAL:cg::Starting value 0.595296
+DEAL:cg::Convergence step 58 value 0
+DEAL::Sparse Factorization
+DEAL::absolute norms = 10.0596 10.0596
+DEAL::relative norm distance = 0
+DEAL::Block Sparse Factorization
+DEAL::absolute norms = 10.0596 10.0596
+DEAL::relative norm distance = 0
+DEAL::3d
+DEAL::Number of dofs = 669
+DEAL:cg::Starting value 3.12141
+DEAL:cg::Convergence step 24 value 0
+DEAL:cg::Starting value 3.12141
+DEAL:cg::Convergence step 24 value 0
+DEAL::Sparse Factorization
+DEAL::absolute norms = 13.7931 13.7931
+DEAL::relative norm distance = 0
+DEAL::Block Sparse Factorization
+DEAL::absolute norms = 13.7931 13.7931
+DEAL::relative norm distance = 0

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.