]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Add a bunch of tests for Trilinos. Many of them fail right now, we'll work on that...
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 23 Oct 2008 02:08:33 +0000 (02:08 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 23 Oct 2008 02:08:33 +0000 (02:08 +0000)
git-svn-id: https://svn.dealii.org/trunk@17308 0785d39b-7218-0410-832d-ea1e28bc413d

279 files changed:
tests/Makefile
tests/trilinos/01.cc [new file with mode: 0644]
tests/trilinos/01/cmp/generic [new file with mode: 0644]
tests/trilinos/02.cc [new file with mode: 0644]
tests/trilinos/02/cmp/generic [new file with mode: 0644]
tests/trilinos/03.cc [new file with mode: 0644]
tests/trilinos/03/cmp/generic [new file with mode: 0644]
tests/trilinos/03a.cc [new file with mode: 0644]
tests/trilinos/03a/cmp/generic [new file with mode: 0644]
tests/trilinos/03b.cc [new file with mode: 0644]
tests/trilinos/03b/cmp/generic [new file with mode: 0644]
tests/trilinos/04.cc [new file with mode: 0644]
tests/trilinos/04/cmp/generic [new file with mode: 0644]
tests/trilinos/05.cc [new file with mode: 0644]
tests/trilinos/05/cmp/generic [new file with mode: 0644]
tests/trilinos/06.cc [new file with mode: 0644]
tests/trilinos/06/cmp/generic [new file with mode: 0644]
tests/trilinos/07.cc [new file with mode: 0644]
tests/trilinos/07/cmp/generic [new file with mode: 0644]
tests/trilinos/08.cc [new file with mode: 0644]
tests/trilinos/08/cmp/generic [new file with mode: 0644]
tests/trilinos/09.cc [new file with mode: 0644]
tests/trilinos/09/cmp/generic [new file with mode: 0644]
tests/trilinos/10.cc [new file with mode: 0644]
tests/trilinos/10/cmp/generic [new file with mode: 0644]
tests/trilinos/11.cc [new file with mode: 0644]
tests/trilinos/11/cmp/generic [new file with mode: 0644]
tests/trilinos/12.cc [new file with mode: 0644]
tests/trilinos/12/cmp/generic [new file with mode: 0644]
tests/trilinos/13.cc [new file with mode: 0644]
tests/trilinos/13/cmp/generic [new file with mode: 0644]
tests/trilinos/14.cc [new file with mode: 0644]
tests/trilinos/14/cmp/generic [new file with mode: 0644]
tests/trilinos/15.cc [new file with mode: 0644]
tests/trilinos/15/cmp/generic [new file with mode: 0644]
tests/trilinos/16.cc [new file with mode: 0644]
tests/trilinos/16/cmp/generic [new file with mode: 0644]
tests/trilinos/17.cc [new file with mode: 0644]
tests/trilinos/17/cmp/generic [new file with mode: 0644]
tests/trilinos/18.cc [new file with mode: 0644]
tests/trilinos/18/cmp/generic [new file with mode: 0644]
tests/trilinos/19.cc [new file with mode: 0644]
tests/trilinos/19/cmp/generic [new file with mode: 0644]
tests/trilinos/20.cc [new file with mode: 0644]
tests/trilinos/20/cmp/generic [new file with mode: 0644]
tests/trilinos/21.cc [new file with mode: 0644]
tests/trilinos/21/cmp/generic [new file with mode: 0644]
tests/trilinos/22.cc [new file with mode: 0644]
tests/trilinos/22/cmp/generic [new file with mode: 0644]
tests/trilinos/23.cc [new file with mode: 0644]
tests/trilinos/23/cmp/generic [new file with mode: 0644]
tests/trilinos/24.cc [new file with mode: 0644]
tests/trilinos/24/cmp/generic [new file with mode: 0644]
tests/trilinos/25.cc [new file with mode: 0644]
tests/trilinos/25/cmp/generic [new file with mode: 0644]
tests/trilinos/26.cc [new file with mode: 0644]
tests/trilinos/26/cmp/generic [new file with mode: 0644]
tests/trilinos/27.cc [new file with mode: 0644]
tests/trilinos/27/cmp/generic [new file with mode: 0644]
tests/trilinos/28.cc [new file with mode: 0644]
tests/trilinos/28/cmp/generic [new file with mode: 0644]
tests/trilinos/29.cc [new file with mode: 0644]
tests/trilinos/29/cmp/generic [new file with mode: 0644]
tests/trilinos/30.cc [new file with mode: 0644]
tests/trilinos/30/cmp/generic [new file with mode: 0644]
tests/trilinos/31.cc [new file with mode: 0644]
tests/trilinos/31/cmp/generic [new file with mode: 0644]
tests/trilinos/32.cc [new file with mode: 0644]
tests/trilinos/32/cmp/generic [new file with mode: 0644]
tests/trilinos/33.cc [new file with mode: 0644]
tests/trilinos/33/cmp/generic [new file with mode: 0644]
tests/trilinos/34.cc [new file with mode: 0644]
tests/trilinos/34/cmp/generic [new file with mode: 0644]
tests/trilinos/35.cc [new file with mode: 0644]
tests/trilinos/35/cmp/generic [new file with mode: 0644]
tests/trilinos/36.cc [new file with mode: 0644]
tests/trilinos/36/cmp/generic [new file with mode: 0644]
tests/trilinos/37.cc [new file with mode: 0644]
tests/trilinos/37/cmp/generic [new file with mode: 0644]
tests/trilinos/38.cc [new file with mode: 0644]
tests/trilinos/38/cmp/generic [new file with mode: 0644]
tests/trilinos/39.cc [new file with mode: 0644]
tests/trilinos/39/cmp/generic [new file with mode: 0644]
tests/trilinos/40.cc [new file with mode: 0644]
tests/trilinos/40/cmp/generic [new file with mode: 0644]
tests/trilinos/41.cc [new file with mode: 0644]
tests/trilinos/41/cmp/generic [new file with mode: 0644]
tests/trilinos/42.cc [new file with mode: 0644]
tests/trilinos/42/cmp/generic [new file with mode: 0644]
tests/trilinos/43.cc [new file with mode: 0644]
tests/trilinos/43/cmp/generic [new file with mode: 0644]
tests/trilinos/44.cc [new file with mode: 0644]
tests/trilinos/44/cmp/generic [new file with mode: 0644]
tests/trilinos/45.cc [new file with mode: 0644]
tests/trilinos/45/cmp/generic [new file with mode: 0644]
tests/trilinos/46.cc [new file with mode: 0644]
tests/trilinos/46/cmp/generic [new file with mode: 0644]
tests/trilinos/47.cc [new file with mode: 0644]
tests/trilinos/47/cmp/generic [new file with mode: 0644]
tests/trilinos/48.cc [new file with mode: 0644]
tests/trilinos/48/cmp/generic [new file with mode: 0644]
tests/trilinos/49.cc [new file with mode: 0644]
tests/trilinos/49/cmp/generic [new file with mode: 0644]
tests/trilinos/50.cc [new file with mode: 0644]
tests/trilinos/50/cmp/generic [new file with mode: 0644]
tests/trilinos/51.cc [new file with mode: 0644]
tests/trilinos/51/cmp/generic [new file with mode: 0644]
tests/trilinos/52.cc [new file with mode: 0644]
tests/trilinos/52/cmp/generic [new file with mode: 0644]
tests/trilinos/53.cc [new file with mode: 0644]
tests/trilinos/53/cmp/generic [new file with mode: 0644]
tests/trilinos/54.cc [new file with mode: 0644]
tests/trilinos/54/cmp/generic [new file with mode: 0644]
tests/trilinos/55.cc [new file with mode: 0644]
tests/trilinos/55/cmp/generic [new file with mode: 0644]
tests/trilinos/56.cc [new file with mode: 0644]
tests/trilinos/56/cmp/generic [new file with mode: 0644]
tests/trilinos/57.cc [new file with mode: 0644]
tests/trilinos/57/cmp/generic [new file with mode: 0644]
tests/trilinos/58.cc [new file with mode: 0644]
tests/trilinos/58/cmp/generic [new file with mode: 0644]
tests/trilinos/59.cc [new file with mode: 0644]
tests/trilinos/59/cmp/generic [new file with mode: 0644]
tests/trilinos/60.cc [new file with mode: 0644]
tests/trilinos/60/cmp/generic [new file with mode: 0644]
tests/trilinos/61.cc [new file with mode: 0644]
tests/trilinos/61/cmp/generic [new file with mode: 0644]
tests/trilinos/62.cc [new file with mode: 0644]
tests/trilinos/62/cmp/generic [new file with mode: 0644]
tests/trilinos/63.cc [new file with mode: 0644]
tests/trilinos/63/cmp/generic [new file with mode: 0644]
tests/trilinos/64.cc [new file with mode: 0644]
tests/trilinos/64/cmp/generic [new file with mode: 0644]
tests/trilinos/65.cc [new file with mode: 0644]
tests/trilinos/65/cmp/generic [new file with mode: 0644]
tests/trilinos/66.cc [new file with mode: 0644]
tests/trilinos/66/cmp/generic [new file with mode: 0644]
tests/trilinos/66/cmp/powerpc-apple-darwin8.10.0+gcc4.0 [new file with mode: 0644]
tests/trilinos/66/cmp/x86_64-unknown-linux-gnu+gcc3.3 [new file with mode: 0644]
tests/trilinos/67.cc [new file with mode: 0644]
tests/trilinos/67/cmp/generic [new file with mode: 0644]
tests/trilinos/67/cmp/powerpc-apple-darwin8.10.0+gcc4.0 [new file with mode: 0644]
tests/trilinos/67/cmp/x86_64-unknown-linux-gnu+gcc3.3 [new file with mode: 0644]
tests/trilinos/68.cc [new file with mode: 0644]
tests/trilinos/68/cmp/generic [new file with mode: 0644]
tests/trilinos/68/cmp/powerpc-apple-darwin8.10.0+gcc4.0 [new file with mode: 0644]
tests/trilinos/69.cc [new file with mode: 0644]
tests/trilinos/69/cmp/generic [new file with mode: 0644]
tests/trilinos/69/cmp/powerpc-apple-darwin8.10.0+gcc4.0 [new file with mode: 0644]
tests/trilinos/70.cc [new file with mode: 0644]
tests/trilinos/70/cmp/generic [new file with mode: 0644]
tests/trilinos/Makefile [new file with mode: 0644]
tests/trilinos/block_vector_iterator_01.cc [new file with mode: 0644]
tests/trilinos/block_vector_iterator_01/cmp/generic [new file with mode: 0644]
tests/trilinos/block_vector_iterator_02.cc [new file with mode: 0644]
tests/trilinos/block_vector_iterator_02/cmp/generic [new file with mode: 0644]
tests/trilinos/block_vector_iterator_03.cc [new file with mode: 0644]
tests/trilinos/block_vector_iterator_03/cmp/generic [new file with mode: 0644]
tests/trilinos/deal_solver_01.cc [new file with mode: 0644]
tests/trilinos/deal_solver_01/cmp/generic [new file with mode: 0644]
tests/trilinos/deal_solver_02.cc [new file with mode: 0644]
tests/trilinos/deal_solver_02/cmp/generic [new file with mode: 0644]
tests/trilinos/deal_solver_03.cc [new file with mode: 0644]
tests/trilinos/deal_solver_03/cmp/generic [new file with mode: 0644]
tests/trilinos/deal_solver_04.cc [new file with mode: 0644]
tests/trilinos/deal_solver_04/cmp/generic [new file with mode: 0644]
tests/trilinos/deal_solver_05.cc [new file with mode: 0644]
tests/trilinos/deal_solver_05/cmp/generic [new file with mode: 0644]
tests/trilinos/deal_solver_06.cc [new file with mode: 0644]
tests/trilinos/deal_solver_06/cmp/generic [new file with mode: 0644]
tests/trilinos/deal_solver_06/cmp/i386-apple-darwin8.10.1+gcc4.0 [new file with mode: 0644]
tests/trilinos/full_matrix_01.cc [new file with mode: 0644]
tests/trilinos/full_matrix_01/cmp/generic [new file with mode: 0644]
tests/trilinos/full_matrix_02.cc [new file with mode: 0644]
tests/trilinos/full_matrix_02/cmp/generic [new file with mode: 0644]
tests/trilinos/full_matrix_03.cc [new file with mode: 0644]
tests/trilinos/full_matrix_03/cmp/generic [new file with mode: 0644]
tests/trilinos/full_matrix_04.cc [new file with mode: 0644]
tests/trilinos/full_matrix_04/cmp/generic [new file with mode: 0644]
tests/trilinos/full_matrix_05.cc [new file with mode: 0644]
tests/trilinos/full_matrix_05/cmp/generic [new file with mode: 0644]
tests/trilinos/full_matrix_06.cc [new file with mode: 0644]
tests/trilinos/full_matrix_06/cmp/generic [new file with mode: 0644]
tests/trilinos/full_matrix_07.cc [new file with mode: 0644]
tests/trilinos/full_matrix_07/cmp/generic [new file with mode: 0644]
tests/trilinos/full_matrix_08.cc [new file with mode: 0644]
tests/trilinos/full_matrix_08/cmp/generic [new file with mode: 0644]
tests/trilinos/full_matrix_09.cc [new file with mode: 0644]
tests/trilinos/full_matrix_09/cmp/generic [new file with mode: 0644]
tests/trilinos/full_matrix_10.cc [new file with mode: 0644]
tests/trilinos/full_matrix_10/cmp/generic [new file with mode: 0644]
tests/trilinos/full_matrix_iterator_01.cc [new file with mode: 0644]
tests/trilinos/full_matrix_iterator_01/cmp/generic [new file with mode: 0644]
tests/trilinos/full_matrix_vector_01.cc [new file with mode: 0644]
tests/trilinos/full_matrix_vector_01/cmp/generic [new file with mode: 0644]
tests/trilinos/full_matrix_vector_02.cc [new file with mode: 0644]
tests/trilinos/full_matrix_vector_02/cmp/generic [new file with mode: 0644]
tests/trilinos/full_matrix_vector_03.cc [new file with mode: 0644]
tests/trilinos/full_matrix_vector_03/cmp/generic [new file with mode: 0644]
tests/trilinos/full_matrix_vector_04.cc [new file with mode: 0644]
tests/trilinos/full_matrix_vector_04/cmp/generic [new file with mode: 0644]
tests/trilinos/full_matrix_vector_05.cc [new file with mode: 0644]
tests/trilinos/full_matrix_vector_05/cmp/generic [new file with mode: 0644]
tests/trilinos/full_matrix_vector_06.cc [new file with mode: 0644]
tests/trilinos/full_matrix_vector_06/cmp/generic [new file with mode: 0644]
tests/trilinos/full_matrix_vector_07.cc [new file with mode: 0644]
tests/trilinos/full_matrix_vector_07/cmp/generic [new file with mode: 0644]
tests/trilinos/parallel_sparse_matrix_01.cc [new file with mode: 0644]
tests/trilinos/parallel_sparse_matrix_01/cmp/generic [new file with mode: 0644]
tests/trilinos/slowness_01.cc [new file with mode: 0644]
tests/trilinos/slowness_01/cmp/generic [new file with mode: 0644]
tests/trilinos/slowness_02.cc [new file with mode: 0644]
tests/trilinos/slowness_02/cmp/generic [new file with mode: 0644]
tests/trilinos/slowness_03.cc [new file with mode: 0644]
tests/trilinos/slowness_03/cmp/generic [new file with mode: 0644]
tests/trilinos/slowness_04.cc [new file with mode: 0644]
tests/trilinos/slowness_04/cmp/generic [new file with mode: 0644]
tests/trilinos/slowness_04/cmp/powerpc-apple-darwin8.10.0+gcc4.0 [new file with mode: 0644]
tests/trilinos/solver_01.cc [new file with mode: 0644]
tests/trilinos/solver_01/cmp/generic [new file with mode: 0644]
tests/trilinos/solver_02.cc [new file with mode: 0644]
tests/trilinos/solver_02/cmp/generic [new file with mode: 0644]
tests/trilinos/solver_03.cc [new file with mode: 0644]
tests/trilinos/solver_03/cmp/generic [new file with mode: 0644]
tests/trilinos/solver_04.cc [new file with mode: 0644]
tests/trilinos/solver_04/cmp/generic [new file with mode: 0644]
tests/trilinos/solver_05.cc [new file with mode: 0644]
tests/trilinos/solver_05/cmp/generic [new file with mode: 0644]
tests/trilinos/solver_06.cc [new file with mode: 0644]
tests/trilinos/solver_06/cmp/generic [new file with mode: 0644]
tests/trilinos/solver_06/cmp/i386-apple-darwin8.10.1+gcc4.0 [new file with mode: 0644]
tests/trilinos/solver_06/cmp/powerpc-apple-darwin8.10.0+gcc4.0 [new file with mode: 0644]
tests/trilinos/solver_06/cmp/x86_64-unknown-linux-gnu+gcc3.3 [new file with mode: 0644]
tests/trilinos/solver_07.cc [new file with mode: 0644]
tests/trilinos/solver_07/cmp/generic [new file with mode: 0644]
tests/trilinos/solver_08.cc [new file with mode: 0644]
tests/trilinos/solver_08/cmp/generic [new file with mode: 0644]
tests/trilinos/solver_09.cc [new file with mode: 0644]
tests/trilinos/solver_09/cmp/generic [new file with mode: 0644]
tests/trilinos/solver_09/cmp/i386-apple-darwin8.10.1+gcc4.0 [new file with mode: 0644]
tests/trilinos/solver_09/cmp/powerpc-apple-darwin8.10.0+gcc4.0 [new file with mode: 0644]
tests/trilinos/solver_09/cmp/x86_64-unknown-linux-gnu+gcc3.3 [new file with mode: 0644]
tests/trilinos/solver_09/cmp/x86_64-unknown-linux-gnu+gcc4.1 [new file with mode: 0644]
tests/trilinos/solver_10.cc [new file with mode: 0644]
tests/trilinos/solver_10/cmp/generic [new file with mode: 0644]
tests/trilinos/solver_11.cc [new file with mode: 0644]
tests/trilinos/solver_11/cmp/generic [new file with mode: 0644]
tests/trilinos/solver_11/cmp/i386-apple-darwin8.10.1+gcc4.0 [new file with mode: 0644]
tests/trilinos/solver_11/cmp/powerpc-apple-darwin8.10.0+gcc4.0 [new file with mode: 0644]
tests/trilinos/solver_11/cmp/x86_64-unknown-linux-gnu+gcc3.3 [new file with mode: 0644]
tests/trilinos/solver_11/cmp/x86_64-unknown-linux-gnu+gcc4.1 [new file with mode: 0644]
tests/trilinos/sparse_matrix_iterator_01.cc [new file with mode: 0644]
tests/trilinos/sparse_matrix_iterator_01/cmp/generic [new file with mode: 0644]
tests/trilinos/sparse_matrix_vector_01.cc [new file with mode: 0644]
tests/trilinos/sparse_matrix_vector_01/cmp/generic [new file with mode: 0644]
tests/trilinos/sparse_matrix_vector_02.cc [new file with mode: 0644]
tests/trilinos/sparse_matrix_vector_02/cmp/generic [new file with mode: 0644]
tests/trilinos/sparse_matrix_vector_03.cc [new file with mode: 0644]
tests/trilinos/sparse_matrix_vector_03/cmp/generic [new file with mode: 0644]
tests/trilinos/sparse_matrix_vector_04.cc [new file with mode: 0644]
tests/trilinos/sparse_matrix_vector_04/cmp/generic [new file with mode: 0644]
tests/trilinos/sparse_matrix_vector_05.cc [new file with mode: 0644]
tests/trilinos/sparse_matrix_vector_05/cmp/generic [new file with mode: 0644]
tests/trilinos/sparse_matrix_vector_06.cc [new file with mode: 0644]
tests/trilinos/sparse_matrix_vector_06/cmp/generic [new file with mode: 0644]
tests/trilinos/sparse_matrix_vector_07.cc [new file with mode: 0644]
tests/trilinos/sparse_matrix_vector_07/cmp/generic [new file with mode: 0644]
tests/trilinos/vector_assign_01.cc [new file with mode: 0644]
tests/trilinos/vector_assign_01/cmp/generic [new file with mode: 0644]
tests/trilinos/vector_assign_02.cc [new file with mode: 0644]
tests/trilinos/vector_assign_02/cmp/generic [new file with mode: 0644]
tests/trilinos/vector_equality_1.cc [new file with mode: 0644]
tests/trilinos/vector_equality_1/cmp/generic [new file with mode: 0644]
tests/trilinos/vector_equality_2.cc [new file with mode: 0644]
tests/trilinos/vector_equality_2/cmp/generic [new file with mode: 0644]
tests/trilinos/vector_equality_3.cc [new file with mode: 0644]
tests/trilinos/vector_equality_3/cmp/generic [new file with mode: 0644]
tests/trilinos/vector_equality_4.cc [new file with mode: 0644]
tests/trilinos/vector_equality_4/cmp/generic [new file with mode: 0644]

index b8e367f8a5c11891e88c725c4bd3e8ec619345fe..5da88de4afd2dc6f462dd0c3a026dd7aaab76cc7 100644 (file)
@@ -15,6 +15,7 @@ nofail-dirs = base      \
               hp        \
               aniso     \
              $(shell if test "$(USE_CONTRIB_PETSC)" = yes ; then echo petsc ; fi) \
+             $(shell if test "$(USE_CONTRIB_TRILINOS)" = yes ; then echo trilinos ; fi) \
              $(shell if test "$(USE_CONTRIB_UMFPACK)" = yes ; then echo umfpack ; fi) \
              $(shell if grep -q 'define HAVE_LIBLAPACK' $D/base/include/base/config.h ;\
                 then echo umfpack ; fi)
diff --git a/tests/trilinos/01.cc b/tests/trilinos/01.cc
new file mode 100644 (file)
index 0000000..0c63dfd
--- /dev/null
@@ -0,0 +1,91 @@
+//----------------------------  trilinos_01.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_01.cc  ---------------------------
+
+
+// check setting elements in a petsc matrix using
+// TrilinosWrappers::SparseMatrix::set()
+
+#include "../tests.h"
+#include <lac/trilinos_sparse_matrix.h>    
+#include <fstream>
+#include <iostream>
+
+
+void test (TrilinosWrappers::SparseMatrix &m)
+{
+                                   // first set a few entries
+  for (unsigned int i=0; i<m.m(); ++i)
+    for (unsigned int j=0; j<m.m(); ++j)
+      if ((i+2*j+1) % 3 == 0)
+        m.set (i,j, i*j*.5+.5);
+
+  m.compress ();
+  
+                                   // then make sure we retrieve the same ones
+  for (unsigned int i=0; i<m.m(); ++i)
+    for (unsigned int j=0; j<m.m(); ++j)
+      if ((i+2*j+1) % 3 == 0)
+        {
+          Assert (m(i,j) == i*j*.5+.5, ExcInternalError());
+          Assert (m.el(i,j) == i*j*.5+.5, ExcInternalError());
+        }
+      else
+        {
+          Assert (m(i,j) == 0, ExcInternalError());
+          Assert (m.el(i,j) == 0, ExcInternalError());
+        }
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("01/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::SparseMatrix m (5,5,3);
+        test (m);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/01/cmp/generic b/tests/trilinos/01/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/02.cc b/tests/trilinos/02.cc
new file mode 100644 (file)
index 0000000..6058199
--- /dev/null
@@ -0,0 +1,91 @@
+//----------------------------  trilinos_02.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_02.cc  ---------------------------
+
+
+// check setting elements in a petsc matrix using
+// TrilinosWrappers::SparseMatrix::add()
+
+#include "../tests.h"
+#include <lac/trilinos_sparse_matrix.h>    
+#include <fstream>
+#include <iostream>
+
+
+void test (TrilinosWrappers::SparseMatrix &m)
+{
+                                   // first set a few entries
+  for (unsigned int i=0; i<m.m(); ++i)
+    for (unsigned int j=0; j<m.m(); ++j)
+      if ((i+2*j+1) % 3 == 0)
+        m.add (i,j, i*j*.5+.5);
+
+  m.compress ();
+  
+                                   // then make sure we retrieve the same ones
+  for (unsigned int i=0; i<m.m(); ++i)
+    for (unsigned int j=0; j<m.m(); ++j)
+      if ((i+2*j+1) % 3 == 0)
+        {
+          Assert (m(i,j) == i*j*.5+.5, ExcInternalError());
+          Assert (m.el(i,j) == i*j*.5+.5, ExcInternalError());
+        }
+      else
+        {
+          Assert (m(i,j) == 0, ExcInternalError());
+          Assert (m.el(i,j) == 0, ExcInternalError());
+        }
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("02/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::SparseMatrix m (5,5,3);
+        test (m);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/02/cmp/generic b/tests/trilinos/02/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/03.cc b/tests/trilinos/03.cc
new file mode 100644 (file)
index 0000000..ddf629d
--- /dev/null
@@ -0,0 +1,97 @@
+//----------------------------  trilinos_03.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_03.cc  ---------------------------
+
+
+// check setting elements in a petsc matrix using set() and add()
+// intermixed. this poses PETSc some problems, since one has to flush some
+// buffer in between these two types of operations
+
+#include "../tests.h"
+#include <lac/trilinos_sparse_matrix.h>    
+#include <fstream>
+#include <iostream>
+
+
+void test (TrilinosWrappers::SparseMatrix &m)
+{
+                                   // first set a few entries
+  for (unsigned int i=0; i<m.m(); ++i)
+    for (unsigned int j=0; j<m.m(); ++j)
+      if ((i+2*j+1) % 3 == 0)
+        {
+          if (i*j % 2 == 0)
+            m.set (i,j, i*j*.5+.5);
+          else
+            m.add (i,j, i*j*.5+.5);
+        }
+  
+  m.compress ();
+  
+                                   // then make sure we retrieve the same ones
+  for (unsigned int i=0; i<m.m(); ++i)
+    for (unsigned int j=0; j<m.m(); ++j)
+      if ((i+2*j+1) % 3 == 0)
+        {
+          Assert (m(i,j) == i*j*.5+.5, ExcInternalError());
+          Assert (m.el(i,j) == i*j*.5+.5, ExcInternalError());
+        }
+      else
+        {
+          Assert (m(i,j) == 0, ExcInternalError());
+          Assert (m.el(i,j) == 0, ExcInternalError());
+        }
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("03/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::SparseMatrix m (5,5,3);
+        test (m);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/03/cmp/generic b/tests/trilinos/03/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/03a.cc b/tests/trilinos/03a.cc
new file mode 100644 (file)
index 0000000..556e6fd
--- /dev/null
@@ -0,0 +1,101 @@
+//----------------------------  trilinos_03a.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_03a.cc  ---------------------------
+
+
+// check setting elements in a petsc matrix using set() and add()
+// intermixed. this poses PETSc some problems, since one has to flush some
+// buffer in between these two types of operations
+//
+// in contrast to trilinos_03, we set and add the same elements here twice, to
+// get double the original value
+
+#include "../tests.h"
+#include <lac/trilinos_sparse_matrix.h>    
+#include <fstream>
+#include <iostream>
+
+
+void test (TrilinosWrappers::SparseMatrix &m)
+{
+                                   // first set a few entries
+  for (unsigned int i=0; i<m.m(); ++i)
+    for (unsigned int j=0; j<m.m(); ++j)
+      if ((i+2*j+1) % 3 == 0)
+        m.set (i,j, i*j*.5+.5);
+  
+                                   // then add the same elements again
+  for (unsigned int i=0; i<m.m(); ++i)
+    for (unsigned int j=0; j<m.m(); ++j)
+      if ((i+2*j+1) % 3 == 0)
+        m.add (i,j, i*j*.5+.5);
+  
+  m.compress ();
+  
+                                   // then make sure we retrieve the same ones
+  for (unsigned int i=0; i<m.m(); ++i)
+    for (unsigned int j=0; j<m.m(); ++j)
+      if ((i+2*j+1) % 3 == 0)
+        {
+          Assert (m(i,j) == 2*(i*j*.5+.5), ExcInternalError());
+          Assert (m.el(i,j) == 2*(i*j*.5+.5), ExcInternalError());
+        }
+      else
+        {
+          Assert (m(i,j) == 0, ExcInternalError());
+          Assert (m.el(i,j) == 0, ExcInternalError());
+        }
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("03a/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::SparseMatrix m (5,5,3);
+        test (m);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/03a/cmp/generic b/tests/trilinos/03a/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/03b.cc b/tests/trilinos/03b.cc
new file mode 100644 (file)
index 0000000..0c134e4
--- /dev/null
@@ -0,0 +1,105 @@
+//----------------------------  trilinos_03b.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_03b.cc  ---------------------------
+
+
+// check setting elements in a petsc matrix using set() and add()
+// intermixed. this poses PETSc some problems, since one has to flush some
+// buffer in between these two types of operations
+//
+// in contrast to trilinos_03a, we set and add the same elements here twice, then
+// overwrite them again to get the original value back
+
+#include "../tests.h"
+#include <lac/trilinos_sparse_matrix.h>    
+#include <fstream>
+#include <iostream>
+
+
+void test (TrilinosWrappers::SparseMatrix &m)
+{
+                                   // first set a few entries
+  for (unsigned int i=0; i<m.m(); ++i)
+    for (unsigned int j=0; j<m.m(); ++j)
+      if ((i+2*j+1) % 3 == 0)
+        m.set (i,j, i*j*.5+.5);
+                                   // then add the same elements again
+  for (unsigned int i=0; i<m.m(); ++i)
+    for (unsigned int j=0; j<m.m(); ++j)
+      if ((i+2*j+1) % 3 == 0)
+        m.add (i,j, i*j*.5+.5);
+                                   // and overwrite everything again
+  for (unsigned int i=0; i<m.m(); ++i)
+    for (unsigned int j=0; j<m.m(); ++j)
+      if ((i+2*j+1) % 3 == 0)
+        m.set (i,j, i*j*.5+.5);
+  
+  m.compress ();
+  
+                                   // then make sure we retrieve the same ones
+  for (unsigned int i=0; i<m.m(); ++i)
+    for (unsigned int j=0; j<m.m(); ++j)
+      if ((i+2*j+1) % 3 == 0)
+        {
+          Assert (m(i,j) == i*j*.5+.5, ExcInternalError());
+          Assert (m.el(i,j) == i*j*.5+.5, ExcInternalError());
+        }
+      else
+        {
+          Assert (m(i,j) == 0, ExcInternalError());
+          Assert (m.el(i,j) == 0, ExcInternalError());
+        }
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("03b/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::SparseMatrix m (5,5,3);
+        test (m);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/03b/cmp/generic b/tests/trilinos/03b/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/04.cc b/tests/trilinos/04.cc
new file mode 100644 (file)
index 0000000..7f3dffd
--- /dev/null
@@ -0,0 +1,71 @@
+//----------------------------  trilinos_04.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_04.cc  ---------------------------
+
+
+// check querying matrix sizes
+
+#include "../tests.h"
+#include <lac/trilinos_sparse_matrix.h>    
+#include <fstream>
+#include <iostream>
+
+
+void test (TrilinosWrappers::SparseMatrix &m)
+{
+  Assert (m.m() == 5, ExcInternalError());
+  Assert (m.n() == 5, ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("04/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::SparseMatrix m (5,5,3);
+        test (m);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/04/cmp/generic b/tests/trilinos/04/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/05.cc b/tests/trilinos/05.cc
new file mode 100644 (file)
index 0000000..2a5503a
--- /dev/null
@@ -0,0 +1,86 @@
+//----------------------------  trilinos_05.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_05.cc  ---------------------------
+
+
+// check querying the number of nonzero elements in
+// TrilinosWrappers::SparseMatrix
+
+#include "../tests.h"
+#include <lac/trilinos_sparse_matrix.h>    
+#include <fstream>
+#include <iostream>
+
+
+void test (TrilinosWrappers::SparseMatrix &m)
+{
+                                   // first set a few entries. count how many
+                                   // entries we have
+  unsigned int counter = 0;
+  for (unsigned int i=0; i<m.m(); ++i)
+    for (unsigned int j=0; j<m.m(); ++j)
+      if ((i+2*j+1) % 3 == 0)
+        {
+          m.set (i,j, i*j*.5+.5);
+          ++counter;
+        }
+
+  m.compress ();
+
+  deallog << m.n_nonzero_elements() << std::endl;
+  Assert (m.n_nonzero_elements() == counter,
+          ExcInternalError());
+  
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("05/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::SparseMatrix m (5,5,3);
+        test (m);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/05/cmp/generic b/tests/trilinos/05/cmp/generic
new file mode 100644 (file)
index 0000000..169db65
--- /dev/null
@@ -0,0 +1,3 @@
+
+DEAL::8
+DEAL::OK
diff --git a/tests/trilinos/06.cc b/tests/trilinos/06.cc
new file mode 100644 (file)
index 0000000..2a0a4de
--- /dev/null
@@ -0,0 +1,82 @@
+//----------------------------  trilinos_06.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_06.cc  ---------------------------
+
+
+// check TrilinosWrappers::SparseMatrix::l1_norm
+
+#include "../tests.h"
+#include <lac/trilinos_sparse_matrix.h>    
+#include <fstream>
+#include <iostream>
+
+
+void test (TrilinosWrappers::SparseMatrix &m)
+{
+                                   // first set a few entries. count how many
+                                   // entries we have
+  for (unsigned int i=0; i<m.m(); ++i)
+    for (unsigned int j=0; j<m.m(); ++j)
+      if ((i+2*j+1) % 3 == 0)
+        m.set (i,j, i*j*.5+.5);  
+
+  m.compress ();
+
+                                   // compare against the exact value of the
+                                   // l1-norm (max col-sum)
+  deallog << m.l1_norm() << std::endl;
+  Assert (m.l1_norm() == 7, ExcInternalError());
+  
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("06/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::SparseMatrix m (5,5,3);
+        test (m);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/06/cmp/generic b/tests/trilinos/06/cmp/generic
new file mode 100644 (file)
index 0000000..c3a0c69
--- /dev/null
@@ -0,0 +1,3 @@
+
+DEAL::7.00000
+DEAL::OK
diff --git a/tests/trilinos/07.cc b/tests/trilinos/07.cc
new file mode 100644 (file)
index 0000000..6827142
--- /dev/null
@@ -0,0 +1,82 @@
+//----------------------------  trilinos_07.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_07.cc  ---------------------------
+
+
+// check TrilinosWrappers::SparseMatrix::linfty_norm
+
+#include "../tests.h"
+#include <lac/trilinos_sparse_matrix.h>    
+#include <fstream>
+#include <iostream>
+
+
+void test (TrilinosWrappers::SparseMatrix &m)
+{
+                                   // first set a few entries. count how many
+                                   // entries we have
+  for (unsigned int i=0; i<m.m(); ++i)
+    for (unsigned int j=0; j<m.m(); ++j)
+      if ((i+2*j+1) % 3 == 0)
+        m.set (i,j, i*j*.5+.5);  
+
+  m.compress ();
+
+                                   // compare against the exact value of the
+                                   // linfty-norm (max row-sum)
+  deallog << m.linfty_norm() << std::endl;
+  Assert (m.linfty_norm() == 8.5, ExcInternalError());
+  
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("07/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::SparseMatrix m (5,5,3);
+        test (m);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/07/cmp/generic b/tests/trilinos/07/cmp/generic
new file mode 100644 (file)
index 0000000..22d8c0e
--- /dev/null
@@ -0,0 +1,3 @@
+
+DEAL::8.50000
+DEAL::OK
diff --git a/tests/trilinos/08.cc b/tests/trilinos/08.cc
new file mode 100644 (file)
index 0000000..cca957f
--- /dev/null
@@ -0,0 +1,87 @@
+//----------------------------  trilinos_08.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_08.cc  ---------------------------
+
+
+// check TrilinosWrappers::SparseMatrix::frobenius_norm
+
+#include "../tests.h"
+#include <lac/trilinos_sparse_matrix.h>    
+#include <fstream>
+#include <iostream>
+
+
+void test (TrilinosWrappers::SparseMatrix &m)
+{
+                                   // first set a few entries. count how many
+                                   // entries we have
+  PetscScalar norm = 0;
+  for (unsigned int i=0; i<m.m(); ++i)
+    for (unsigned int j=0; j<m.m(); ++j)
+      if ((i+2*j+1) % 3 == 0)
+        {
+          m.set (i,j, i*j*.5+.5);
+          norm += (i*j*.5+.5)*(i*j*.5+.5);
+        }
+  norm = std::sqrt(norm);
+
+  m.compress ();
+
+                                   // compare against the exact value of the
+                                   // l2-norm (max row-sum)
+  deallog << m.frobenius_norm() << std::endl;
+  Assert (m.frobenius_norm() == norm, ExcInternalError());
+  
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("08/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::SparseMatrix m (5,5,3);
+        test (m);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/08/cmp/generic b/tests/trilinos/08/cmp/generic
new file mode 100644 (file)
index 0000000..d4083f6
--- /dev/null
@@ -0,0 +1,3 @@
+
+DEAL::9.04157
+DEAL::OK
diff --git a/tests/trilinos/09.cc b/tests/trilinos/09.cc
new file mode 100644 (file)
index 0000000..5d333d8
--- /dev/null
@@ -0,0 +1,94 @@
+//----------------------------  trilinos_09.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_09.cc  ---------------------------
+
+
+// check TrilinosWrappers::SparseMatrix::operator *=
+
+#include "../tests.h"
+#include <lac/trilinos_sparse_matrix.h>    
+#include <fstream>
+#include <iostream>
+
+
+void test (TrilinosWrappers::SparseMatrix &m)
+{
+                                   // first set a few entries
+  for (unsigned int i=0; i<m.m(); ++i)
+    for (unsigned int j=0; j<m.m(); ++j)
+      if ((i+2*j+1) % 3 == 0)
+        m.set (i,j, i*j*.5+.5);
+
+  m.compress ();
+  
+                                   // then multiply everything by 1.25 and
+                                   // make sure we retrieve the values we
+                                   // expect
+  m *= 1.25;
+  
+  for (unsigned int i=0; i<m.m(); ++i)
+    for (unsigned int j=0; j<m.m(); ++j)
+      if ((i+2*j+1) % 3 == 0)
+        {
+          Assert (m(i,j) == (i*j*.5+.5)*1.25, ExcInternalError());
+          Assert (m.el(i,j) == (i*j*.5+.5)*1.25, ExcInternalError());
+        }
+      else
+        {
+          Assert (m(i,j) == 0, ExcInternalError());
+          Assert (m.el(i,j) == 0, ExcInternalError());
+        }
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("09/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::SparseMatrix m (5,5,3);
+        test (m);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/09/cmp/generic b/tests/trilinos/09/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/10.cc b/tests/trilinos/10.cc
new file mode 100644 (file)
index 0000000..db02749
--- /dev/null
@@ -0,0 +1,94 @@
+//----------------------------  trilinos_10.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_10.cc  ---------------------------
+
+
+// check TrilinosWrappers::SparseMatrix::operator /=
+
+#include "../tests.h"
+#include <lac/trilinos_sparse_matrix.h>    
+#include <fstream>
+#include <iostream>
+
+
+void test (TrilinosWrappers::SparseMatrix &m)
+{
+                                   // first set a few entries
+  for (unsigned int i=0; i<m.m(); ++i)
+    for (unsigned int j=0; j<m.m(); ++j)
+      if ((i+2*j+1) % 3 == 0)
+        m.set (i,j, i*j*.5+.5);
+
+  m.compress ();
+  
+                                   // then divide everything by 4/3 and
+                                   // make sure we retrieve the values we
+                                   // expect
+  m /= 4./3.;
+  
+  for (unsigned int i=0; i<m.m(); ++i)
+    for (unsigned int j=0; j<m.m(); ++j)
+      if ((i+2*j+1) % 3 == 0)
+        {
+          Assert (m(i,j) == (i*j*.5+.5)/4*3, ExcInternalError());
+          Assert (m.el(i,j) == (i*j*.5+.5)/4*3, ExcInternalError());
+        }
+      else
+        {
+          Assert (m(i,j) == 0, ExcInternalError());
+          Assert (m.el(i,j) == 0, ExcInternalError());
+        }
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("10/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::SparseMatrix m (5,5,3);
+        test (m);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/10/cmp/generic b/tests/trilinos/10/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/11.cc b/tests/trilinos/11.cc
new file mode 100644 (file)
index 0000000..8ee8f9c
--- /dev/null
@@ -0,0 +1,76 @@
+//----------------------------  trilinos_11.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_11.cc  ---------------------------
+
+
+// check TrilinosWrappers::Vector::size()
+
+#include "../tests.h"
+#include <lac/trilinos_vector.h>    
+#include <fstream>
+#include <iostream>
+
+
+void test (TrilinosWrappers::Vector &v)
+{
+                                   // set only certain elements of the vector
+  for (unsigned int i=0; i<v.size(); i+=1+i)
+    v(i) = i;
+
+  v.compress ();
+  
+  Assert (v.size() == 100, ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("11/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::Vector v (100);
+        test (v);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/11/cmp/generic b/tests/trilinos/11/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/12.cc b/tests/trilinos/12.cc
new file mode 100644 (file)
index 0000000..50c2d7b
--- /dev/null
@@ -0,0 +1,89 @@
+//----------------------------  trilinos_12.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_12.cc  ---------------------------
+
+
+// check TrilinosWrappers::Vector::operator() in set-mode
+
+#include "../tests.h"
+#include <lac/trilinos_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::Vector &v)
+{
+                                   // set only certain elements of the
+                                   // vector. have a bit pattern of where we
+                                   // actually wrote elements to
+  std::vector<bool> pattern (v.size(), false);
+  for (unsigned int i=0; i<v.size(); i+=1+i)
+    {
+      v(i) = i;
+      pattern[i] = true;
+    }
+
+  v.compress ();
+
+                                   // check that they are ok, and this time
+                                   // all of them
+  for (unsigned int i=0; i<v.size(); ++i)
+    Assert (((pattern[i] == true) && (v(i) == i)
+             ||
+             (pattern[i] == false) && (v(i) == 0)),
+             ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("12/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::Vector v (100);
+        test (v);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/12/cmp/generic b/tests/trilinos/12/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/13.cc b/tests/trilinos/13.cc
new file mode 100644 (file)
index 0000000..feb8896
--- /dev/null
@@ -0,0 +1,89 @@
+//----------------------------  trilinos_13.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_13.cc  ---------------------------
+
+
+// check TrilinosWrappers::Vector::operator() in add-mode
+
+#include "../tests.h"
+#include <lac/trilinos_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::Vector &v)
+{
+                                   // set only certain elements of the
+                                   // vector. have a bit pattern of where we
+                                   // actually wrote elements to
+  std::vector<bool> pattern (v.size(), false);
+  for (unsigned int i=0; i<v.size(); i+=1+i)
+    {
+      v(i) += i;
+      pattern[i] = true;
+    }
+
+  v.compress ();
+
+                                   // check that they are ok, and this time
+                                   // all of them
+  for (unsigned int i=0; i<v.size(); ++i)
+    Assert (((pattern[i] == true) && (v(i) == i)
+             ||
+             (pattern[i] == false) && (v(i) == 0)),
+             ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("13/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::Vector v (100);
+        test (v);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/13/cmp/generic b/tests/trilinos/13/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/14.cc b/tests/trilinos/14.cc
new file mode 100644 (file)
index 0000000..eb805b9
--- /dev/null
@@ -0,0 +1,95 @@
+//----------------------------  trilinos_14.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_14.cc  ---------------------------
+
+
+// check TrilinosWrappers::Vector::operator() in set/add-mode alternatingly
+
+#include "../tests.h"
+#include <lac/trilinos_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::Vector &v)
+{
+                                   // set only certain elements of the
+                                   // vector. have a bit pattern of where we
+                                   // actually wrote elements to
+  std::vector<bool> pattern (v.size(), false);
+  bool flag = false;
+  for (unsigned int i=0; i<v.size(); i+=1+i)
+    {
+      if (flag == true)
+        v(i) += i;
+      else
+        v(i) = i;
+      flag = !flag;
+      
+      pattern[i] = true;
+    }
+
+  v.compress ();
+
+                                   // check that they are ok, and this time
+                                   // all of them
+  for (unsigned int i=0; i<v.size(); ++i)
+    Assert (((pattern[i] == true) && (v(i) == i)
+             ||
+             (pattern[i] == false) && (v(i) == 0)),
+             ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("14/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::Vector v (100);
+        test (v);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/14/cmp/generic b/tests/trilinos/14/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/15.cc b/tests/trilinos/15.cc
new file mode 100644 (file)
index 0000000..b6ebdcc
--- /dev/null
@@ -0,0 +1,92 @@
+//----------------------------  trilinos_15.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_15.cc  ---------------------------
+
+
+// check TrilinosWrappers::Vector::operator() in set/add-mode alternatingly, but
+// writing to the same elements
+
+#include "../tests.h"
+#include <lac/trilinos_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::Vector &v)
+{
+                                   // set only certain elements of the
+                                   // vector. have a bit pattern of where we
+                                   // actually wrote elements to
+  std::vector<bool> pattern (v.size(), false);
+  for (unsigned int i=0; i<v.size(); i+=1+i)
+    {
+      v(i) = i;
+      pattern[i] = true;
+    }
+  for (unsigned int i=0; i<v.size(); i+=1+i)
+    v(i) += i;
+
+  v.compress ();
+
+                                   // check that they are ok, and this time
+                                   // all of them
+  for (unsigned int i=0; i<v.size(); ++i)
+    Assert (((pattern[i] == true) && (v(i) == 2*i)
+             ||
+             (pattern[i] == false) && (v(i) == 0)),
+             ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("15/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::Vector v (100);
+        test (v);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/15/cmp/generic b/tests/trilinos/15/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/16.cc b/tests/trilinos/16.cc
new file mode 100644 (file)
index 0000000..c73b28c
--- /dev/null
@@ -0,0 +1,94 @@
+//----------------------------  trilinos_16.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_16.cc  ---------------------------
+
+
+// check TrilinosWrappers::Vector::operator() in set/add-mode alternatingly, but
+// writing and overwriting the same elements
+
+#include "../tests.h"
+#include <lac/trilinos_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::Vector &v)
+{
+                                   // set only certain elements of the
+                                   // vector. have a bit pattern of where we
+                                   // actually wrote elements to
+  std::vector<bool> pattern (v.size(), false);
+  for (unsigned int i=0; i<v.size(); i+=1+i)
+    {
+      v(i) = i;
+      pattern[i] = true;
+    }
+  for (unsigned int i=0; i<v.size(); i+=1+i)
+    v(i) += i;
+  for (unsigned int i=0; i<v.size(); i+=1+i)
+    v(i) = i;
+
+  v.compress ();
+
+                                   // check that they are ok, and this time
+                                   // all of them
+  for (unsigned int i=0; i<v.size(); ++i)
+    Assert (((pattern[i] == true) && (v(i) == i)
+             ||
+             (pattern[i] == false) && (v(i) == 0)),
+             ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("16/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::Vector v (100);
+        test (v);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/16/cmp/generic b/tests/trilinos/16/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/17.cc b/tests/trilinos/17.cc
new file mode 100644 (file)
index 0000000..7696eba
--- /dev/null
@@ -0,0 +1,81 @@
+//----------------------------  trilinos_17.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_17.cc  ---------------------------
+
+
+// check TrilinosWrappers::Vector::l1_norm()
+
+#include "../tests.h"
+#include <lac/trilinos_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::Vector &v)
+{
+                                   // set some elements of the vector
+  double norm = 0;
+  for (unsigned int i=0; i<v.size(); i+=1+i)
+    {
+      v(i) = i;
+      norm += std::fabs(1.*i);
+    }
+  v.compress ();
+
+                                   // then check the norm
+  Assert (v.l1_norm() == norm, ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("17/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::Vector v (100);
+        test (v);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/17/cmp/generic b/tests/trilinos/17/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/18.cc b/tests/trilinos/18.cc
new file mode 100644 (file)
index 0000000..7d493bb
--- /dev/null
@@ -0,0 +1,82 @@
+//----------------------------  trilinos_18.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_18.cc  ---------------------------
+
+
+// check TrilinosWrappers::Vector::l2_norm()
+
+#include "../tests.h"
+#include <lac/trilinos_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::Vector &v)
+{
+                                   // set some elements of the vector
+  PetscScalar norm = 0;
+  for (unsigned int i=0; i<v.size(); i+=1+i)
+    {
+      v(i) = i;
+      norm += std::fabs(1.*i)*std::fabs(1.*i);
+    }
+  v.compress ();
+
+                                   // then check the norm
+  const double eps=typeid(PetscScalar)==typeid(double) ? 1e-14 : 1e-5;
+  Assert (fabs(v.l2_norm()-std::sqrt(norm))<eps, ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("18/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::Vector v (100);
+        test (v);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/18/cmp/generic b/tests/trilinos/18/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/19.cc b/tests/trilinos/19.cc
new file mode 100644 (file)
index 0000000..c297e62
--- /dev/null
@@ -0,0 +1,81 @@
+//----------------------------  trilinos_19.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_19.cc  ---------------------------
+
+
+// check TrilinosWrappers::Vector::linfty_norm()
+
+#include "../tests.h"
+#include <lac/trilinos_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::Vector &v)
+{
+                                   // set some elements of the vector
+  double norm = 0;
+  for (unsigned int i=0; i<v.size(); i+=1+i)
+    {
+      v(i) = i;
+      norm = std::max(norm,fabs(i));
+    }
+  v.compress ();
+
+                                   // then check the norm
+  Assert (v.linfty_norm() == norm, ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("19/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::Vector v (100);
+        test (v);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/19/cmp/generic b/tests/trilinos/19/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/20.cc b/tests/trilinos/20.cc
new file mode 100644 (file)
index 0000000..69960a6
--- /dev/null
@@ -0,0 +1,90 @@
+//----------------------------  trilinos_20.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_20.cc  ---------------------------
+
+
+// check TrilinosWrappers::Vector::operator *=
+
+#include "../tests.h"
+#include <lac/trilinos_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::Vector &v)
+{
+                                   // set only certain elements of the
+                                   // vector. have a bit pattern of where we
+                                   // actually wrote elements to
+  std::vector<bool> pattern (v.size(), false);
+  for (unsigned int i=0; i<v.size(); i+=1+i)
+    {
+      v(i) = i;
+      pattern[i] = true;
+    }
+  v.compress ();
+
+                                   // multiply v with 5/4
+  v *= 5./4.;
+
+                                   // check that the entries are ok
+  for (unsigned int i=0; i<v.size(); ++i)
+    Assert (((pattern[i] == true) && (v(i) == i*5./4.)
+             ||
+             (pattern[i] == false) && (v(i) == 0)),
+             ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("20/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::Vector v (100);
+        test (v);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/20/cmp/generic b/tests/trilinos/20/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/21.cc b/tests/trilinos/21.cc
new file mode 100644 (file)
index 0000000..e949c3d
--- /dev/null
@@ -0,0 +1,90 @@
+//----------------------------  trilinos_21.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_21.cc  ---------------------------
+
+
+// check TrilinosWrappers::Vector::operator /=
+
+#include "../tests.h"
+#include <lac/trilinos_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::Vector &v)
+{
+                                   // set only certain elements of the
+                                   // vector. have a bit pattern of where we
+                                   // actually wrote elements to
+  std::vector<bool> pattern (v.size(), false);
+  for (unsigned int i=0; i<v.size(); i+=1+i)
+    {
+      v(i) = i;
+      pattern[i] = true;
+    }
+  v.compress ();
+
+                                   // multiply v with 3/4
+  v /= 4./3.;
+
+                                   // check that the entries are ok
+  for (unsigned int i=0; i<v.size(); ++i)
+    Assert (((pattern[i] == true) && (v(i) == i*3./4.)
+             ||
+             (pattern[i] == false) && (v(i) == 0)),
+             ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("21/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::Vector v (100);
+        test (v);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/21/cmp/generic b/tests/trilinos/21/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/22.cc b/tests/trilinos/22.cc
new file mode 100644 (file)
index 0000000..f498709
--- /dev/null
@@ -0,0 +1,85 @@
+//----------------------------  trilinos_22.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_22.cc  ---------------------------
+
+
+// check TrilinosWrappers::Vector::operator*(Vector) on two vectors that are
+// orthogonal
+
+#include "../tests.h"
+#include <lac/trilinos_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::Vector &v,
+           TrilinosWrappers::Vector &w)
+{
+                                   // set only certain elements of each
+                                   // vector, but disjoint sets of elements
+  for (unsigned int i=0; i<v.size(); ++i)
+    if (i%3 == 0)
+      v(i) = i;
+    else
+      w(i) = i;
+  v.compress ();
+  w.compress ();
+
+                                   // make sure the scalar product is zero
+  Assert (v*w == 0, ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("22/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::Vector v (100);
+        TrilinosWrappers::Vector w (100);
+        test (v,w);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/22/cmp/generic b/tests/trilinos/22/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/23.cc b/tests/trilinos/23.cc
new file mode 100644 (file)
index 0000000..ba22d9d
--- /dev/null
@@ -0,0 +1,92 @@
+//----------------------------  trilinos_23.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_23.cc  ---------------------------
+
+
+// check TrilinosWrappers::Vector::operator*(Vector) on two vectors that are
+// not orthogonal
+
+#include "../tests.h"
+#include <lac/trilinos_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::Vector &v,
+           TrilinosWrappers::Vector &w)
+{
+                                   // set only certain elements of each
+                                   // vector, and record the expected scalar
+                                   // product
+  double product = 0;
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      v(i) = i;
+      if (i%3 == 0)
+        {
+          w(i) = i+1.;
+          product += i*(i+1);
+        }
+    }
+  
+  v.compress ();
+  w.compress ();
+
+                                   // make sure the scalar product is zero
+  Assert (v*w == product, ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("23/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::Vector v (100);
+        TrilinosWrappers::Vector w (100);
+        test (v,w);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/23/cmp/generic b/tests/trilinos/23/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/24.cc b/tests/trilinos/24.cc
new file mode 100644 (file)
index 0000000..0493d6b
--- /dev/null
@@ -0,0 +1,84 @@
+//----------------------------  trilinos_24.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_24.cc  ---------------------------
+
+
+// this test used to check for TrilinosWrappers::Vector::clear(). However, this
+// function has since been removed, so we test for v=0 instead, although that
+// may be covered by one of the other tests
+
+#include "../tests.h"
+#include <lac/trilinos_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::Vector &v)
+{
+                                   // set some entries of the vector
+  for (unsigned int i=0; i<v.size(); ++i)
+    if (i%3 == 0)
+      v(i) = i+1.;
+  v.compress ();
+
+                                   // then clear it again and make sure the
+                                   // vector is really empty
+  const unsigned int sz = v.size();
+  v = 0;
+  Assert (v.size() == sz, ExcInternalError());
+  Assert (v.l2_norm() == 0, ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("24/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::Vector v (100);
+        test (v);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/24/cmp/generic b/tests/trilinos/24/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/25.cc b/tests/trilinos/25.cc
new file mode 100644 (file)
index 0000000..619e449
--- /dev/null
@@ -0,0 +1,82 @@
+//----------------------------  trilinos_25.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_25.cc  ---------------------------
+
+
+// check TrilinosWrappers::Vector::operator = (PetscScalar) with setting to zero
+
+#include "../tests.h"
+#include <lac/trilinos_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::Vector &v)
+{
+                                   // set some entries of the vector
+  for (unsigned int i=0; i<v.size(); ++i)
+    if (i%3 == 0)
+      v(i) = i+1.;
+  v.compress ();
+
+                                   // then clear it again and make sure the
+                                   // vector is really empty
+  const unsigned int sz = v.size();
+  v = 0;
+  Assert (v.size() == sz, ExcInternalError());
+  Assert (v.l2_norm() == 0, ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("25/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::Vector v (100);
+        test (v);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/25/cmp/generic b/tests/trilinos/25/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/26.cc b/tests/trilinos/26.cc
new file mode 100644 (file)
index 0000000..746618f
--- /dev/null
@@ -0,0 +1,81 @@
+//----------------------------  trilinos_26.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_26.cc  ---------------------------
+
+
+// check TrilinosWrappers::Vector::operator = (PetscScalar) with setting to a
+// nonzero value
+
+#include "../tests.h"
+#include <lac/trilinos_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::Vector &v)
+{
+                                   // set some entries of the vector
+  for (unsigned int i=0; i<v.size(); ++i)
+    if (i%3 == 0)
+      v(i) = i+1.;
+  v.compress ();
+
+  const unsigned int sz = v.size();
+  v = 2;
+  Assert (v.size() == sz, ExcInternalError());
+  Assert (v.l2_norm() == std::sqrt(4.*sz), ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("26/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::Vector v (100);
+        test (v);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/26/cmp/generic b/tests/trilinos/26/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/27.cc b/tests/trilinos/27.cc
new file mode 100644 (file)
index 0000000..a61cb30
--- /dev/null
@@ -0,0 +1,86 @@
+//----------------------------  trilinos_27.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_27.cc  ---------------------------
+
+
+// check TrilinosWrappers::Vector::operator = (Vector) 
+
+#include "../tests.h"
+#include <lac/trilinos_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::Vector &v)
+{
+                                   // set some entries of the vector
+  for (unsigned int i=0; i<v.size(); ++i)
+    if (i%3 == 0)
+      v(i) = i+1.;
+  v.compress ();
+
+                                   // then copy it
+  TrilinosWrappers::Vector w (v.size());
+  w = v;
+
+                                   // make sure they're equal
+  deallog << v*w << ' ' << v.l2_norm() * w.l2_norm()
+          << ' ' << v*w - v.l2_norm() * w.l2_norm() << std::endl;
+  const double eps=typeid(PetscScalar)==typeid(double) ? 1e-14 : 1e-5;
+  Assert (std::fabs(v*w - v.l2_norm() * w.l2_norm()) < eps*(v*w),
+          ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("27/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::Vector v (100);
+        test (v);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/27/cmp/generic b/tests/trilinos/27/cmp/generic
new file mode 100644 (file)
index 0000000..8c7039a
--- /dev/null
@@ -0,0 +1,3 @@
+
+DEAL::116161. 116161. 0
+DEAL::OK
diff --git a/tests/trilinos/28.cc b/tests/trilinos/28.cc
new file mode 100644 (file)
index 0000000..207305a
--- /dev/null
@@ -0,0 +1,88 @@
+//----------------------------  trilinos_28.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_28.cc  ---------------------------
+
+
+// check TrilinosWrappers::Vector::operator = (Vector), except that we don't
+// resize the vector to be copied to beforehand
+
+#include "../tests.h"
+#include <lac/trilinos_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::Vector &v)
+{
+                                   // set some entries of the vector
+  for (unsigned int i=0; i<v.size(); ++i)
+    if (i%3 == 0)
+      v(i) = i+1.;
+  v.compress ();
+
+                                   // then copy it to a vector of different
+                                   // size
+  TrilinosWrappers::Vector w (1);
+  w = v;
+
+                                   // make sure they're equal
+  deallog << v*w << ' ' << v.l2_norm() * w.l2_norm()
+          << ' ' << v*w - v.l2_norm() * w.l2_norm() << std::endl;
+  const double eps=typeid(PetscScalar)==typeid(double) ? 1e-14 : 1e-5;
+  Assert (std::fabs(v*w - v.l2_norm() * w.l2_norm()) < eps*(v*w),
+          ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("28/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::Vector v (100);
+        test (v);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/28/cmp/generic b/tests/trilinos/28/cmp/generic
new file mode 100644 (file)
index 0000000..8c7039a
--- /dev/null
@@ -0,0 +1,3 @@
+
+DEAL::116161. 116161. 0
+DEAL::OK
diff --git a/tests/trilinos/29.cc b/tests/trilinos/29.cc
new file mode 100644 (file)
index 0000000..03a3856
--- /dev/null
@@ -0,0 +1,73 @@
+//----------------------------  trilinos_29.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_29.cc  ---------------------------
+
+
+// check TrilinosWrappers::Vector::reinit(fast)
+
+#include "../tests.h"
+#include <lac/trilinos_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::Vector &v)
+{
+  v.reinit (13, true);
+  
+  Assert (v.size() == 13, ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("29/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::Vector v (100);
+        test (v);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/29/cmp/generic b/tests/trilinos/29/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/30.cc b/tests/trilinos/30.cc
new file mode 100644 (file)
index 0000000..6e34b81
--- /dev/null
@@ -0,0 +1,81 @@
+//----------------------------  trilinos_30.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_30.cc  ---------------------------
+
+
+// check TrilinosWrappers::Vector::reinit(!fast)
+
+#include "../tests.h"
+#include <lac/trilinos_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::Vector &v)
+{
+                                   // set some entries of the vector
+  for (unsigned int i=0; i<v.size(); ++i)
+    if (i%3 == 0)
+      v(i) = i+1.;
+  v.compress ();
+
+                                   // then resize with setting to zero
+  v.reinit (13, false);
+  
+  Assert (v.size() == 13, ExcInternalError());
+  Assert (v.l2_norm() == 0, ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("30/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::Vector v (100);
+        test (v);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/30/cmp/generic b/tests/trilinos/30/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/31.cc b/tests/trilinos/31.cc
new file mode 100644 (file)
index 0000000..3003e8a
--- /dev/null
@@ -0,0 +1,83 @@
+//----------------------------  trilinos_31.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_31.cc  ---------------------------
+
+
+// check TrilinosWrappers::Vector::l2_norm()
+
+#include "../tests.h"
+#include <lac/trilinos_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::Vector &v)
+{
+                                   // set some elements of the vector
+  PetscScalar norm = 0;
+  for (unsigned int i=0; i<v.size(); i+=1+i)
+    {
+      v(i) = i;
+      norm += std::fabs(1.*i)*std::fabs(1.*i);
+    }
+  v.compress ();
+
+                                   // then check the norm
+  const double eps=typeid(PetscScalar)==typeid(double) ? 1e-14 : 1e-5;
+  Assert (std::fabs(v.norm_sqr() - norm) < eps*norm,
+          ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("31/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::Vector v (100);
+        test (v);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/31/cmp/generic b/tests/trilinos/31/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/32.cc b/tests/trilinos/32.cc
new file mode 100644 (file)
index 0000000..d404ff4
--- /dev/null
@@ -0,0 +1,83 @@
+//----------------------------  trilinos_32.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005, 2007 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.
+//
+//----------------------------  trilinos_32.cc  ---------------------------
+
+
+// check TrilinosWrappers::Vector::mean_value()
+
+#include "../tests.h"
+#include <lac/trilinos_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::Vector &v)
+{
+                                   // set some elements of the vector
+  PetscScalar sum = 0;
+  for (unsigned int i=0; i<v.size(); i+=1+i)
+    {
+      v(i) = i;
+      sum += i;
+    }
+  v.compress ();
+
+                                   // then check the norm
+  const double eps=typeid(PetscScalar)==typeid(double) ? 1e-14 : 1e-5;
+  Assert (std::fabs(v.mean_value() - sum/v.size()) < eps*sum/v.size(),
+          ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("32/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::Vector v (100);
+        test (v);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/32/cmp/generic b/tests/trilinos/32/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/33.cc b/tests/trilinos/33.cc
new file mode 100644 (file)
index 0000000..2dce462
--- /dev/null
@@ -0,0 +1,84 @@
+//----------------------------  trilinos_33.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_33.cc  ---------------------------
+
+
+// check TrilinosWrappers::Vector::lp_norm(3)
+
+#include "../tests.h"
+#include <lac/trilinos_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::Vector &v)
+{
+                                   // set some elements of the vector
+  PetscScalar sum = 0;
+  for (unsigned int i=0; i<v.size(); i+=1+i)
+    {
+      v(i) = i;
+      sum += i*i*i;
+    }
+  v.compress ();
+
+                                   // then check the norm
+  const double eps=typeid(PetscScalar)==typeid(double) ? 1e-14 : 1e-5;
+  const double true_value=std::pow(sum, static_cast<PetscScalar> (1./3.));
+  Assert (std::fabs(v.lp_norm(3) - true_value) < eps*true_value,
+          ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("33/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::Vector v (100);
+        test (v);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/33/cmp/generic b/tests/trilinos/33/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/34.cc b/tests/trilinos/34.cc
new file mode 100644 (file)
index 0000000..317382a
--- /dev/null
@@ -0,0 +1,84 @@
+//----------------------------  trilinos_34.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_34.cc  ---------------------------
+
+
+// check TrilinosWrappers::Vector::all_zero
+
+#include "../tests.h"
+#include <lac/trilinos_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::Vector &v)
+{
+                                   // set some elements of the vector
+  double sum = 0;
+  for (unsigned int i=0; i<v.size(); i+=1+i)
+    {
+      v(i) = i;
+      sum += i*i*i;
+    }
+  v.compress ();
+
+                                   // set them to zero again
+  v = 0;
+
+                                   // then check all_zero
+  Assert (v.all_zero() == true, ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("34/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::Vector v (100);
+        test (v);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/34/cmp/generic b/tests/trilinos/34/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/35.cc b/tests/trilinos/35.cc
new file mode 100644 (file)
index 0000000..cb4280e
--- /dev/null
@@ -0,0 +1,101 @@
+//----------------------------  trilinos_35.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_35.cc  ---------------------------
+
+
+// check TrilinosWrappers::Vector::operator+=(Vector) 
+
+#include "../tests.h"
+#include <lac/trilinos_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::Vector &v,
+           TrilinosWrappers::Vector &w)
+{
+                                   // set only certain elements of each
+                                   // vector
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      v(i) = i;
+      if (i%3 == 0)
+        w(i) = i+1.;
+    }
+  
+  v.compress ();
+  w.compress ();
+
+  v += w;
+
+                                   // make sure we get the expected result
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      if (i%3 == 0)
+        {
+          Assert (w(i) == i+1., ExcInternalError());
+          Assert (v(i) == i+i+1., ExcInternalError());
+        }
+      else
+        {
+          Assert (w(i) == 0, ExcInternalError());
+          Assert (v(i) == i, ExcInternalError());
+        }
+    }
+
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("35/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::Vector v (100);
+        TrilinosWrappers::Vector w (100);
+        test (v,w);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/35/cmp/generic b/tests/trilinos/35/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/36.cc b/tests/trilinos/36.cc
new file mode 100644 (file)
index 0000000..ec723c6
--- /dev/null
@@ -0,0 +1,101 @@
+//----------------------------  trilinos_36.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_36.cc  ---------------------------
+
+
+// check TrilinosWrappers::Vector::operator-=(Vector) 
+
+#include "../tests.h"
+#include <lac/trilinos_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::Vector &v,
+           TrilinosWrappers::Vector &w)
+{
+                                   // set only certain elements of each
+                                   // vector
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      v(i) = i;
+      if (i%3 == 0)
+        w(i) = i+1.;
+    }
+  
+  v.compress ();
+  w.compress ();
+
+  v -= w;
+
+                                   // make sure we get the expected result
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      if (i%3 == 0)
+        {
+          Assert (w(i) == i+1., ExcInternalError());
+          Assert (v(i) == i-(i+1.), ExcInternalError());
+        }
+      else
+        {
+          Assert (w(i) == 0, ExcInternalError());
+          Assert (v(i) == i, ExcInternalError());
+        }
+    }
+
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("36/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::Vector v (100);
+        TrilinosWrappers::Vector w (100);
+        test (v,w);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/36/cmp/generic b/tests/trilinos/36/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/37.cc b/tests/trilinos/37.cc
new file mode 100644 (file)
index 0000000..870655c
--- /dev/null
@@ -0,0 +1,80 @@
+//----------------------------  trilinos_37.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_37.cc  ---------------------------
+
+
+// check TrilinosWrappers::Vector::add (scalar)
+
+#include "../tests.h"
+#include <lac/trilinos_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::Vector &v)
+{
+  for (unsigned int i=0; i<v.size(); ++i)
+    v(i) = i;
+  
+  v.compress ();
+
+  v.add (1.);
+
+                                   // make sure we get the expected result
+  for (unsigned int i=0; i<v.size(); ++i)
+    Assert (v(i) == i+1., ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("37/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::Vector v (100);
+        test (v);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/37/cmp/generic b/tests/trilinos/37/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/38.cc b/tests/trilinos/38.cc
new file mode 100644 (file)
index 0000000..1ee9b86
--- /dev/null
@@ -0,0 +1,89 @@
+//----------------------------  trilinos_38.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_38.cc  ---------------------------
+
+
+// check TrilinosWrappers::Vector::add(Vector) 
+
+#include "../tests.h"
+#include <lac/trilinos_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::Vector &v,
+           TrilinosWrappers::Vector &w)
+{
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      v(i) = i;
+      w(i) = i+1.;
+    }
+  
+  v.compress ();
+  w.compress ();
+
+  v.add (w);
+
+                                   // make sure we get the expected result
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      Assert (w(i) == i+1., ExcInternalError());
+      Assert (v(i) == i+(i+1.), ExcInternalError());
+    }
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("38/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::Vector v (100);
+        TrilinosWrappers::Vector w (100);
+        test (v,w);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/38/cmp/generic b/tests/trilinos/38/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/39.cc b/tests/trilinos/39.cc
new file mode 100644 (file)
index 0000000..c3c3099
--- /dev/null
@@ -0,0 +1,89 @@
+//----------------------------  trilinos_39.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_39.cc  ---------------------------
+
+
+// check TrilinosWrappers::Vector::add(scalar, Vector) 
+
+#include "../tests.h"
+#include <lac/trilinos_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::Vector &v,
+           TrilinosWrappers::Vector &w)
+{
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      v(i) = i;
+      w(i) = i+1.;
+    }
+  
+  v.compress ();
+  w.compress ();
+
+  v.add (2, w);
+
+                                   // make sure we get the expected result
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      Assert (w(i) == i+1., ExcInternalError());
+      Assert (v(i) == i+2*(i+1.), ExcInternalError());
+    }
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("39/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::Vector v (100);
+        TrilinosWrappers::Vector w (100);
+        test (v,w);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/39/cmp/generic b/tests/trilinos/39/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/40.cc b/tests/trilinos/40.cc
new file mode 100644 (file)
index 0000000..8bc2de3
--- /dev/null
@@ -0,0 +1,94 @@
+//----------------------------  trilinos_40.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_40.cc  ---------------------------
+
+
+// check TrilinosWrappers::Vector::add(s,V,s,V)
+
+#include "../tests.h"
+#include <lac/trilinos_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::Vector &v,
+           TrilinosWrappers::Vector &w,
+           TrilinosWrappers::Vector &x)
+{
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      v(i) = i;
+      w(i) = i+1.;
+      x(i) = i+2.;
+    }
+  
+  v.compress ();
+  w.compress ();
+  x.compress ();
+
+  v.add (2, w, 3, x);
+
+                                   // make sure we get the expected result
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      Assert (w(i) == i+1., ExcInternalError());
+      Assert (x(i) == i+2., ExcInternalError());
+      Assert (v(i) == i+2*(i+1.)+3*(i+2.), ExcInternalError());
+    }
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("40/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::Vector v (100);
+        TrilinosWrappers::Vector w (100);
+        TrilinosWrappers::Vector x (100);
+        test (v,w,x);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/40/cmp/generic b/tests/trilinos/40/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/41.cc b/tests/trilinos/41.cc
new file mode 100644 (file)
index 0000000..07a753c
--- /dev/null
@@ -0,0 +1,89 @@
+//----------------------------  trilinos_41.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_41.cc  ---------------------------
+
+
+// check TrilinosWrappers::Vector::sadd(s, Vector) 
+
+#include "../tests.h"
+#include <lac/trilinos_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::Vector &v,
+           TrilinosWrappers::Vector &w)
+{
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      v(i) = i;
+      w(i) = i+1.;
+    }
+  
+  v.compress ();
+  w.compress ();
+
+  v.sadd (2, w);
+
+                                   // make sure we get the expected result
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      Assert (w(i) == i+1., ExcInternalError());
+      Assert (v(i) == 2*i+(i+1.), ExcInternalError());
+    }
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("41/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::Vector v (100);
+        TrilinosWrappers::Vector w (100);
+        test (v,w);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/41/cmp/generic b/tests/trilinos/41/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/42.cc b/tests/trilinos/42.cc
new file mode 100644 (file)
index 0000000..a4ed2d1
--- /dev/null
@@ -0,0 +1,89 @@
+//----------------------------  trilinos_42.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_42.cc  ---------------------------
+
+
+// check TrilinosWrappers::Vector::sadd(scalar, scalar, Vector) 
+
+#include "../tests.h"
+#include <lac/trilinos_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::Vector &v,
+           TrilinosWrappers::Vector &w)
+{
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      v(i) = i;
+      w(i) = i+1.;
+    }
+  
+  v.compress ();
+  w.compress ();
+
+  v.sadd (3, 2, w);
+
+                                   // make sure we get the expected result
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      Assert (w(i) == i+1., ExcInternalError());
+      Assert (v(i) == 3*i+2*(i+1.), ExcInternalError());
+    }
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("42/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::Vector v (100);
+        TrilinosWrappers::Vector w (100);
+        test (v,w);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/42/cmp/generic b/tests/trilinos/42/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/43.cc b/tests/trilinos/43.cc
new file mode 100644 (file)
index 0000000..f477782
--- /dev/null
@@ -0,0 +1,94 @@
+//----------------------------  trilinos_43.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_43.cc  ---------------------------
+
+
+// check TrilinosWrappers::Vector::sadd(s,s,V,s,V)
+
+#include "../tests.h"
+#include <lac/trilinos_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::Vector &v,
+           TrilinosWrappers::Vector &w,
+           TrilinosWrappers::Vector &x)
+{
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      v(i) = i;
+      w(i) = i+1.;
+      x(i) = i+2.;
+    }
+  
+  v.compress ();
+  w.compress ();
+  x.compress ();
+
+  v.sadd (1.5, 2, w, 3, x);
+
+                                   // make sure we get the expected result
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      Assert (w(i) == i+1., ExcInternalError());
+      Assert (x(i) == i+2., ExcInternalError());
+      Assert (v(i) == 1.5*i+2*(i+1.)+3*(i+2.), ExcInternalError());
+    }
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("43/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::Vector v (100);
+        TrilinosWrappers::Vector w (100);
+        TrilinosWrappers::Vector x (100);
+        test (v,w,x);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/43/cmp/generic b/tests/trilinos/43/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/44.cc b/tests/trilinos/44.cc
new file mode 100644 (file)
index 0000000..e8d882b
--- /dev/null
@@ -0,0 +1,99 @@
+//----------------------------  trilinos_44.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_44.cc  ---------------------------
+
+
+// check TrilinosWrappers::Vector::sadd(s,s,V,s,V,s,V)
+
+#include "../tests.h"
+#include <lac/trilinos_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::Vector &v,
+           TrilinosWrappers::Vector &w,
+           TrilinosWrappers::Vector &x,
+           TrilinosWrappers::Vector &y)
+{
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      v(i) = i;
+      w(i) = i+1.;
+      x(i) = i+2.;
+      y(i) = i+3.;
+    }
+  
+  v.compress ();
+  w.compress ();
+  x.compress ();
+  y.compress ();
+
+  v.sadd (1.5, 2, w, 3, x, 4, y);
+
+                                   // make sure we get the expected result
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      Assert (w(i) == i+1., ExcInternalError());
+      Assert (x(i) == i+2., ExcInternalError());
+      Assert (y(i) == i+3., ExcInternalError());
+      Assert (v(i) == 1.5*i+2*(i+1.)+3*(i+2.)+4*(i+3), ExcInternalError());
+    }
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("44/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::Vector v (100);
+        TrilinosWrappers::Vector w (100);
+        TrilinosWrappers::Vector x (100);
+        TrilinosWrappers::Vector y (100);
+        test (v,w,x,y);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/44/cmp/generic b/tests/trilinos/44/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/45.cc b/tests/trilinos/45.cc
new file mode 100644 (file)
index 0000000..e568006
--- /dev/null
@@ -0,0 +1,89 @@
+//----------------------------  trilinos_45.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_45.cc  ---------------------------
+
+
+// check TrilinosWrappers::Vector::scale
+
+#include "../tests.h"
+#include <lac/trilinos_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::Vector &v,
+           TrilinosWrappers::Vector &w)
+{
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      v(i) = i;
+      w(i) = i+1.;
+    }
+  
+  v.compress ();
+  w.compress ();
+
+  v.scale (w);
+
+                                   // make sure we get the expected result
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      Assert (w(i) == i+1., ExcInternalError());
+      Assert (v(i) == i*(i+1.), ExcInternalError());
+    }
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("45/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::Vector v (100);
+        TrilinosWrappers::Vector w (100);
+        test (v,w);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/45/cmp/generic b/tests/trilinos/45/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/46.cc b/tests/trilinos/46.cc
new file mode 100644 (file)
index 0000000..da34b68
--- /dev/null
@@ -0,0 +1,89 @@
+//----------------------------  trilinos_46.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_46.cc  ---------------------------
+
+
+// check TrilinosWrappers::Vector::equ (s,V)
+
+#include "../tests.h"
+#include <lac/trilinos_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::Vector &v,
+           TrilinosWrappers::Vector &w)
+{
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      v(i) = i;
+      w(i) = i+1.;
+    }
+  
+  v.compress ();
+  w.compress ();
+
+  v.equ (2, w);
+
+                                   // make sure we get the expected result
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      Assert (w(i) == i+1., ExcInternalError());
+      Assert (v(i) == 2*(i+1.), ExcInternalError());
+    }
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("46/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::Vector v (100);
+        TrilinosWrappers::Vector w (100);
+        test (v,w);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/46/cmp/generic b/tests/trilinos/46/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/47.cc b/tests/trilinos/47.cc
new file mode 100644 (file)
index 0000000..0cfabfb
--- /dev/null
@@ -0,0 +1,94 @@
+//----------------------------  trilinos_47.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_47.cc  ---------------------------
+
+
+// check TrilinosWrappers::Vector::equ (s,V,s,V)
+
+#include "../tests.h"
+#include <lac/trilinos_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::Vector &v,
+           TrilinosWrappers::Vector &w,
+           TrilinosWrappers::Vector &x)
+{
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      v(i) = i;
+      w(i) = i+1.;
+      x(i) = i+2.;
+    }
+  
+  v.compress ();
+  w.compress ();
+  x.compress ();
+
+  v.equ (2, w, 3, x);
+
+                                   // make sure we get the expected result
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      Assert (w(i) == i+1., ExcInternalError());
+      Assert (x(i) == i+2., ExcInternalError());
+      Assert (v(i) == 2*(i+1.)+3*(i+2.), ExcInternalError());
+    }
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("47/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::Vector v (100);
+        TrilinosWrappers::Vector w (100);
+        TrilinosWrappers::Vector x (100);
+        test (v,w,x);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/47/cmp/generic b/tests/trilinos/47/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/48.cc b/tests/trilinos/48.cc
new file mode 100644 (file)
index 0000000..6dc840d
--- /dev/null
@@ -0,0 +1,96 @@
+//----------------------------  trilinos_48.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_48.cc  ---------------------------
+
+
+// check TrilinosWrappers::Vector::ratio
+
+#include "../tests.h"
+#include <lac/trilinos_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::Vector &v,
+           TrilinosWrappers::Vector &w,
+           TrilinosWrappers::Vector &x)
+{
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      v(i) = i;
+      w(i) = i+1.;
+      x(i) = i+2.;
+    }
+  
+  v.compress ();
+  w.compress ();
+  x.compress ();
+
+  v.ratio (w, x);
+
+                                   // make sure we get the expected result
+  const double eps=typeid(PetscScalar)==typeid(double) ? 1e-14 : 1e-5;
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      Assert (w(i) == i+1., ExcInternalError());
+      Assert (x(i) == i+2., ExcInternalError());
+      Assert (std::fabs(v(i) - (i+1.)/(i+2.)) < eps*v(i),
+              ExcInternalError());
+    }
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("48/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::Vector v (100);
+        TrilinosWrappers::Vector w (100);
+        TrilinosWrappers::Vector x (100);
+        test (v,w,x);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/48/cmp/generic b/tests/trilinos/48/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/49.cc b/tests/trilinos/49.cc
new file mode 100644 (file)
index 0000000..fbaf883
--- /dev/null
@@ -0,0 +1,85 @@
+//----------------------------  trilinos_49.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_49.cc  ---------------------------
+
+
+// check TrilinosWrappers::operator = (Vector<PetscVector>)
+
+#include "../tests.h"
+#include <lac/trilinos_vector.h>
+#include <lac/vector.h>
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::Vector &v)
+{
+  Vector<PetscScalar> w (v.size());
+
+  for (unsigned int i=0; i<w.size(); ++i)
+    w(i) = i;
+  
+  v = w;
+
+  
+                                   // make sure we get the expected result
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      Assert (w(i) == i, ExcInternalError());
+      Assert (v(i) == i, ExcInternalError());
+    }
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("49/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::Vector v (100);
+        test (v);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/49/cmp/generic b/tests/trilinos/49/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/50.cc b/tests/trilinos/50.cc
new file mode 100644 (file)
index 0000000..dad97fa
--- /dev/null
@@ -0,0 +1,101 @@
+//----------------------------  trilinos_50.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_50.cc  ---------------------------
+
+
+// check TrilinosWrappers::operator = (Vector<T>) with T!=PetscScalar
+
+#include "../tests.h"
+#include <lac/trilinos_vector.h>
+#include <lac/vector.h>
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::Vector &v)
+{
+  Vector<double> w (v.size());
+  Vector<float>  x (v.size());
+
+  for (unsigned int i=0; i<w.size(); ++i)
+    {
+      w(i) = i;
+      x(i) = i+1;
+    }
+  
+                                   // first copy from w and make sure we get
+                                   // the expected result. then copy from x
+                                   // and do the same. in at least one of the
+                                   // two cases, the template argument to
+                                   // Vector<T> must be different from
+                                   // PetscScalar
+  v = w;
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      Assert (w(i) == i, ExcInternalError());
+      Assert (v(i) == i, ExcInternalError());
+      Assert (x(i) == i+1, ExcInternalError());
+    }
+
+  v = x;
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      Assert (w(i) == i, ExcInternalError());
+      Assert (v(i) == i+1, ExcInternalError());
+      Assert (x(i) == i+1, ExcInternalError());
+    }
+  
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("50/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::Vector v (100);
+        test (v);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/50/cmp/generic b/tests/trilinos/50/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/51.cc b/tests/trilinos/51.cc
new file mode 100644 (file)
index 0000000..39e64e9
--- /dev/null
@@ -0,0 +1,86 @@
+//----------------------------  trilinos_51.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_51.cc  ---------------------------
+
+
+// check copy constructor TrilinosWrappers::Vector::Vector(Vector) 
+
+#include "../tests.h"
+#include <lac/trilinos_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::Vector &v)
+{
+                                   // set some entries of the vector
+  for (unsigned int i=0; i<v.size(); ++i)
+    if (i%3 == 0)
+      v(i) = i+1.;
+  v.compress ();
+
+                                   // then copy it
+  TrilinosWrappers::Vector w (v);
+  w.compress ();
+
+                                   // make sure they're equal
+  deallog << v*w << ' ' << v.l2_norm() * w.l2_norm()
+          << ' ' << v*w - v.l2_norm() * w.l2_norm() << std::endl;
+  const double eps=typeid(PetscScalar)==typeid(double) ? 1e-14 : 1e-5;
+  Assert (std::fabs(v*w - v.l2_norm() * w.l2_norm()) < eps*(v*w),
+          ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("51/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::Vector v (100);
+        test (v);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/51/cmp/generic b/tests/trilinos/51/cmp/generic
new file mode 100644 (file)
index 0000000..8c7039a
--- /dev/null
@@ -0,0 +1,3 @@
+
+DEAL::116161. 116161. 0
+DEAL::OK
diff --git a/tests/trilinos/52.cc b/tests/trilinos/52.cc
new file mode 100644 (file)
index 0000000..1b83b0d
--- /dev/null
@@ -0,0 +1,94 @@
+//----------------------------  trilinos_52.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_52.cc  ---------------------------
+
+
+// check setting elements in a petsc matrix using
+// TrilinosWrappers::SparseMatrix::set(). like trilinos_01, but use a different
+// constructor for the sparse matrix
+
+#include "../tests.h"
+#include <lac/trilinos_sparse_matrix.h>    
+#include <fstream>
+#include <iostream>
+
+
+void test (TrilinosWrappers::SparseMatrix &m)
+{
+                                   // first set a few entries
+  for (unsigned int i=0; i<m.m(); ++i)
+    for (unsigned int j=0; j<m.m(); ++j)
+      if ((i+2*j+1) % 3 == 0)
+        m.set (i,j, i*j*.5+.5);
+
+  m.compress ();
+  
+                                   // then make sure we retrieve the same ones
+  for (unsigned int i=0; i<m.m(); ++i)
+    for (unsigned int j=0; j<m.m(); ++j)
+      if ((i+2*j+1) % 3 == 0)
+        {
+          Assert (m(i,j) == i*j*.5+.5, ExcInternalError());
+          Assert (m.el(i,j) == i*j*.5+.5, ExcInternalError());
+        }
+      else
+        {
+          Assert (m(i,j) == 0, ExcInternalError());
+          Assert (m.el(i,j) == 0, ExcInternalError());
+        }
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("52/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        std::vector<unsigned int> row_lengths (5, 3U);
+        row_lengths.back() = 2;
+        TrilinosWrappers::SparseMatrix m (5,5,row_lengths);
+        test (m);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/52/cmp/generic b/tests/trilinos/52/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/53.cc b/tests/trilinos/53.cc
new file mode 100644 (file)
index 0000000..db66270
--- /dev/null
@@ -0,0 +1,91 @@
+//----------------------------  trilinos_53.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_53.cc  ---------------------------
+
+
+// check TrilinosWrappers::Vector::operator() in set, and later in add-mode
+
+#include "../tests.h"
+#include <lac/trilinos_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::Vector &v)
+{
+                                   // set only certain elements of the
+                                   // vector. have a bit pattern of where we
+                                   // actually wrote elements to
+  std::vector<bool> pattern (v.size(), false);
+  for (unsigned int i=0; i<v.size(); i+=1+i)
+    {
+      v(i) = i;
+      pattern[i] = true;
+    }
+  for (unsigned int i=0; i<v.size(); i+=1+i)
+    v(i) += i;
+
+  v.compress ();
+
+                                   // check that they are ok, and this time
+                                   // all of them
+  for (unsigned int i=0; i<v.size(); ++i)
+    Assert (((pattern[i] == true) && (v(i) == 2*i)
+             ||
+             (pattern[i] == false) && (v(i) == 0)),
+             ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("53/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::Vector v (100);
+        test (v);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/53/cmp/generic b/tests/trilinos/53/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/54.cc b/tests/trilinos/54.cc
new file mode 100644 (file)
index 0000000..ceffbfa
--- /dev/null
@@ -0,0 +1,91 @@
+//----------------------------  trilinos_54.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_54.cc  ---------------------------
+
+
+// check TrilinosWrappers::Vector::operator() in set, and later in -= mode
+
+#include "../tests.h"
+#include <lac/trilinos_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::Vector &v)
+{
+                                   // set only certain elements of the
+                                   // vector. have a bit pattern of where we
+                                   // actually wrote elements to
+  std::vector<bool> pattern (v.size(), false);
+  for (unsigned int i=0; i<v.size(); i+=1+i)
+    {
+      v(i) = 2*i;
+      pattern[i] = true;
+    }
+  for (unsigned int i=0; i<v.size(); i+=1+i)
+    v(i) -= i;
+
+  v.compress ();
+
+                                   // check that they are ok, and this time
+                                   // all of them
+  for (unsigned int i=0; i<v.size(); ++i)
+    Assert (((pattern[i] == true) && (v(i) == i)
+             ||
+             (pattern[i] == false) && (v(i) == 0)),
+             ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("54/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::Vector v (100);
+        test (v);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/54/cmp/generic b/tests/trilinos/54/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/55.cc b/tests/trilinos/55.cc
new file mode 100644 (file)
index 0000000..514004b
--- /dev/null
@@ -0,0 +1,91 @@
+//----------------------------  trilinos_55.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_55.cc  ---------------------------
+
+
+// check TrilinosWrappers::Vector::operator() in set, and later in *= mode
+
+#include "../tests.h"
+#include <lac/trilinos_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::Vector &v)
+{
+                                   // set only certain elements of the
+                                   // vector. have a bit pattern of where we
+                                   // actually wrote elements to
+  std::vector<bool> pattern (v.size(), false);
+  for (unsigned int i=0; i<v.size(); i+=1+i)
+    {
+      v(i) = i;
+      pattern[i] = true;
+    }
+  for (unsigned int i=0; i<v.size(); i+=1+i)
+    v(i) *= 2;
+
+  v.compress ();
+
+                                   // check that they are ok, and this time
+                                   // all of them
+  for (unsigned int i=0; i<v.size(); ++i)
+    Assert (((pattern[i] == true) && (v(i) == 2*i)
+             ||
+             (pattern[i] == false) && (v(i) == 0)),
+             ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("55/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::Vector v (100);
+        test (v);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/55/cmp/generic b/tests/trilinos/55/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/56.cc b/tests/trilinos/56.cc
new file mode 100644 (file)
index 0000000..4816acf
--- /dev/null
@@ -0,0 +1,91 @@
+//----------------------------  trilinos_56.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_56.cc  ---------------------------
+
+
+// check TrilinosWrappers::Vector::operator() in set, and later in /= mode
+
+#include "../tests.h"
+#include <lac/trilinos_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::Vector &v)
+{
+                                   // set only certain elements of the
+                                   // vector. have a bit pattern of where we
+                                   // actually wrote elements to
+  std::vector<bool> pattern (v.size(), false);
+  for (unsigned int i=0; i<v.size(); i+=1+i)
+    {
+      v(i) = 2*i;
+      pattern[i] = true;
+    }
+  for (unsigned int i=0; i<v.size(); i+=1+i)
+    v(i) /= 2;
+
+  v.compress ();
+
+                                   // check that they are ok, and this time
+                                   // all of them
+  for (unsigned int i=0; i<v.size(); ++i)
+    Assert (((pattern[i] == true) && (v(i) == i)
+             ||
+             (pattern[i] == false) && (v(i) == 0)),
+             ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("56/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::Vector v (100);
+        test (v);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/56/cmp/generic b/tests/trilinos/56/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/57.cc b/tests/trilinos/57.cc
new file mode 100644 (file)
index 0000000..7651de4
--- /dev/null
@@ -0,0 +1,89 @@
+//----------------------------  trilinos_57.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_57.cc  ---------------------------
+
+
+// check TrilinosWrappers::Vector::is_non_zero
+
+#include "../tests.h"
+#include <lac/trilinos_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::Vector &v)
+{
+                                   // set only certain elements of the
+                                   // vector. they are all positive
+  std::vector<bool> pattern (v.size(), false);
+  for (unsigned int i=0; i<v.size(); i+=1+i)
+    {
+      v(i) += i;
+      pattern[i] = true;
+    }
+
+  v.compress ();
+
+                                   // check that the vector is really
+                                   // non-negative
+  Assert (v.is_non_negative() == true, ExcInternalError());
+
+                                   // then set a single element to a negative
+                                   // value and check again
+  v(v.size()/2) = -1;
+  Assert (v.is_non_negative() == false, ExcInternalError());  
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("57/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::Vector v (100);
+        test (v);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/57/cmp/generic b/tests/trilinos/57/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/58.cc b/tests/trilinos/58.cc
new file mode 100644 (file)
index 0000000..f5c1c55
--- /dev/null
@@ -0,0 +1,91 @@
+//----------------------------  trilinos_58.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_58.cc  ---------------------------
+
+
+// check ::Vector (const TrilinosWrappers::Vector &) copy constructor
+
+#include "../tests.h"
+#include <lac/trilinos_vector.h>
+#include <lac/vector.h>
+
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::Vector &v)
+{
+                                   // set only certain elements of the
+                                   // vector.
+  std::vector<bool> pattern (v.size(), false);
+  for (unsigned int i=0; i<v.size(); i+=1+i)
+    {
+      v(i) += i;
+      pattern[i] = true;
+    }
+
+  v.compress ();
+
+  Vector<double> w (v);
+  Vector<float>  x (v);
+  
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      Assert (v(i) == w(i), ExcInternalError());
+      Assert (v(i) == x(i), ExcInternalError());
+    }
+      
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("58/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::Vector v (100);
+        test (v);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/58/cmp/generic b/tests/trilinos/58/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/59.cc b/tests/trilinos/59.cc
new file mode 100644 (file)
index 0000000..fc57128
--- /dev/null
@@ -0,0 +1,94 @@
+//----------------------------  trilinos_59.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_59.cc  ---------------------------
+
+
+// check TrilinosWrappers::Vector (const ::Vector &) copy constructor
+
+#include "../tests.h"
+#include <lac/trilinos_vector.h>
+#include <lac/vector.h>
+
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::Vector &v)
+{
+                                   // set only certain elements of the
+                                   // vector.
+  std::vector<bool> pattern (v.size(), false);
+  for (unsigned int i=0; i<v.size(); i+=1+i)
+    {
+      v(i) += i;
+      pattern[i] = true;
+    }
+
+  v.compress ();
+
+  Vector<double> w (v);
+  Vector<float>  x (v);
+
+  TrilinosWrappers::Vector w1 (w);
+  TrilinosWrappers::Vector x1 (x);
+  
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      Assert (w1(i) == w(i), ExcInternalError());
+      Assert (x1(i) == x(i), ExcInternalError());
+    }
+      
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("59/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::Vector v (100);
+        test (v);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/59/cmp/generic b/tests/trilinos/59/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/60.cc b/tests/trilinos/60.cc
new file mode 100644 (file)
index 0000000..99baef2
--- /dev/null
@@ -0,0 +1,91 @@
+//----------------------------  trilinos_60.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_60.cc  ---------------------------
+
+
+// check ::Vector::operator = (const TrilinosWrappers::Vector &)
+
+#include "../tests.h"
+#include <lac/trilinos_vector.h>
+#include <lac/vector.h>
+
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::Vector &v)
+{
+                                   // set only certain elements of the
+                                   // vector.
+  std::vector<bool> pattern (v.size(), false);
+  for (unsigned int i=0; i<v.size(); i+=1+i)
+    {
+      v(i) += i;
+      pattern[i] = true;
+    }
+
+  v.compress ();
+
+  Vector<double> w; w=v;
+  Vector<float>  x; x=v;
+  
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      Assert (v(i) == w(i), ExcInternalError());
+      Assert (v(i) == x(i), ExcInternalError());
+    }
+      
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("60/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::Vector v (100);
+        test (v);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/60/cmp/generic b/tests/trilinos/60/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/61.cc b/tests/trilinos/61.cc
new file mode 100644 (file)
index 0000000..19a058e
--- /dev/null
@@ -0,0 +1,94 @@
+//----------------------------  trilinos_61.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_61.cc  ---------------------------
+
+
+// check TrilinosWrappers::Vector::operator = (const ::Vector &)
+
+#include "../tests.h"
+#include <lac/trilinos_vector.h>
+#include <lac/vector.h>
+
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::Vector &v)
+{
+                                   // set only certain elements of the
+                                   // vector.
+  std::vector<bool> pattern (v.size(), false);
+  for (unsigned int i=0; i<v.size(); i+=1+i)
+    {
+      v(i) += i;
+      pattern[i] = true;
+    }
+
+  v.compress ();
+
+  Vector<double> w; w=v;
+  Vector<float>  x; x=v;
+
+  TrilinosWrappers::Vector w1; w1=w;
+  TrilinosWrappers::Vector x1; x1=x;
+  
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      Assert (w1(i) == w(i), ExcInternalError());
+      Assert (x1(i) == x(i), ExcInternalError());
+    }
+      
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("61/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::Vector v (100);
+        test (v);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/61/cmp/generic b/tests/trilinos/61/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/62.cc b/tests/trilinos/62.cc
new file mode 100644 (file)
index 0000000..7d4a180
--- /dev/null
@@ -0,0 +1,79 @@
+//----------------------------  trilinos_62.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_62.cc  ---------------------------
+
+
+// check TrilinosWrappers::MatrixBase::clear ()
+
+#include "../tests.h"
+#include <lac/trilinos_sparse_matrix.h>
+#include <lac/vector.h>
+
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::MatrixBase &m)
+{
+  Assert (m.m() != 0, ExcInternalError());
+  Assert (m.n() != 0, ExcInternalError());
+
+  m.clear ();
+
+  Assert (m.m() == 0, ExcInternalError());
+  Assert (m.n() == 0, ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("62/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::SparseMatrix v (100,100,5);
+        test (v);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/62/cmp/generic b/tests/trilinos/62/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/63.cc b/tests/trilinos/63.cc
new file mode 100644 (file)
index 0000000..9fdf84f
--- /dev/null
@@ -0,0 +1,77 @@
+//----------------------------  trilinos_63.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_63.cc  ---------------------------
+
+
+#include "../tests.h"
+#include <lac/trilinos_sparse_matrix.h>
+#include <lac/vector.h>
+
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::MatrixBase &m)
+{
+  Assert (m.m() == 100, ExcInternalError());
+  Assert (m.n() == 100, ExcInternalError());
+
+  m = 0;
+  
+  Assert (m.m() == 100, ExcInternalError());
+  Assert (m.n() == 100, ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("63/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::SparseMatrix v (100,100,5);
+        test (v);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/63/cmp/generic b/tests/trilinos/63/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/64.cc b/tests/trilinos/64.cc
new file mode 100644 (file)
index 0000000..669aacc
--- /dev/null
@@ -0,0 +1,98 @@
+//----------------------------  trilinos_64.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_64.cc  ---------------------------
+
+
+// This test should be run on multiple processors. note that this test also
+// started to fail with the upgrade to petsc 2.2.1 which required a fix in
+// TrilinosWrappers::MatrixBase::operator=
+
+
+#include "../tests.h"
+#include <lac/trilinos_sparse_matrix.h>
+#include <lac/trilinos_parallel_sparse_matrix.h>
+#include <lac/vector.h>
+
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+template<typename MatrixType>
+void test (MatrixType &m)
+{
+  m.add(0,0,1);  
+  m = 0;
+  m.compress();
+
+  Assert(fabs(m.frobenius_norm())<1e-15, ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("64/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+       const unsigned int n_dofs=420;
+                                        // check
+                                        // TrilinosWrappers::SparseMatrix
+        TrilinosWrappers::SparseMatrix
+         v1 (n_dofs, n_dofs, 5);
+        test (v1);
+
+                                        // check
+                                        // TrilinosWrappers::MPI::SparseMatrix
+       MPI_Comm mpi_communicator (MPI_COMM_WORLD);     
+       int n_jobs=1;
+       MPI_Comm_size (mpi_communicator, &n_jobs);
+       const unsigned int n_mpi_processes=static_cast<unsigned int>(n_jobs);
+       Assert(n_dofs%n_mpi_processes==0, ExcInternalError());
+       const unsigned int n_local_dofs=n_dofs/n_mpi_processes;
+        TrilinosWrappers::MPI::SparseMatrix
+         v2 (mpi_communicator, n_dofs, n_dofs, n_local_dofs, n_local_dofs, 5);
+        test (v2);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/64/cmp/generic b/tests/trilinos/64/cmp/generic
new file mode 100644 (file)
index 0000000..8b3b075
--- /dev/null
@@ -0,0 +1,3 @@
+
+DEAL::OK
+DEAL::OK
diff --git a/tests/trilinos/65.cc b/tests/trilinos/65.cc
new file mode 100644 (file)
index 0000000..cf74b47
--- /dev/null
@@ -0,0 +1,74 @@
+//----------------------------  trilinos_65.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_65.cc  ---------------------------
+
+
+// This test used to fail after upgrading to petsc 2.2.1
+
+
+#include "../tests.h"
+#include <lac/trilinos_parallel_vector.h>
+
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test ()
+{
+  TrilinosWrappers::MPI::Vector v(PETSC_COMM_WORLD, 100, 100);
+  v(0) = 1;
+  v = 0;
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("65/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        test ();
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/65/cmp/generic b/tests/trilinos/65/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/66.cc b/tests/trilinos/66.cc
new file mode 100644 (file)
index 0000000..679d927
--- /dev/null
@@ -0,0 +1,133 @@
+//----------------------------  trilinos_66.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_66.cc  ---------------------------
+
+
+// check TrilinosWrappers::MatrixBase::clear_row ()
+
+#include "../tests.h"
+#include <lac/trilinos_sparse_matrix.h>
+#include <lac/vector.h>
+
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::MatrixBase &m)
+{
+  Assert (m.m() != 0, ExcInternalError());
+  Assert (m.n() != 0, ExcInternalError());
+
+                                   // build a tri-diagonal pattern
+  double norm_sqr = 0;
+  unsigned int nnz = 0;
+  const unsigned int N = m.m();
+  for (unsigned int i=0; i<N; ++i)
+    {
+      if (i>=5)
+        {
+          const double s = rand();
+          m.add (i,i-5, s);
+          norm_sqr += s*s;
+          ++nnz;
+        }
+      
+      if (i<N-5)
+        {
+          const double s = rand();
+          m.add (i,i+5, s);
+          norm_sqr += s*s;
+          ++nnz;
+        }
+      
+      const double s = rand();
+      m.add (i,i,s);
+      norm_sqr += s*s;
+      ++nnz;
+    }
+  m.compress ();
+  
+  deallog << m.frobenius_norm() << ' ' << std::sqrt (norm_sqr)
+          << std::endl;
+  deallog << m.n_nonzero_elements() << ' ' << nnz << std::endl;
+
+  Assert (std::fabs (m.frobenius_norm() - std::sqrt(norm_sqr))
+          < std::fabs (std::sqrt (norm_sqr)),
+          ExcInternalError());
+  Assert (m.n_nonzero_elements()-nnz == 0, ExcInternalError());
+
+                                   // now remove the entries of row N/2
+  for (unsigned int i=0; i<N; ++i)
+    {
+      const double s = m.el(N/2,i);
+      norm_sqr -= s*s;
+    }
+  m.clear_row (N/2);
+  
+  deallog << m.frobenius_norm() << ' ' << std::sqrt (norm_sqr)
+          << std::endl;
+  deallog << m.n_nonzero_elements() << ' ' << nnz << std::endl;
+
+  Assert (std::fabs (m.frobenius_norm() - std::sqrt(norm_sqr))
+          < std::fabs (std::sqrt (norm_sqr)),
+          ExcInternalError());
+
+                                   // make sure that zeroing out rows does at
+                                   // least not add new nonzero entries (it
+                                   // may remove some, though)
+  Assert (m.n_nonzero_elements() <= nnz, ExcInternalError());
+  
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("66/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::SparseMatrix v (14,14,3);
+        test (v);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/66/cmp/generic b/tests/trilinos/66/cmp/generic
new file mode 100644 (file)
index 0000000..3a786b7
--- /dev/null
@@ -0,0 +1,6 @@
+
+DEAL::7.15267e+09 7.15267e+09
+DEAL::32 32
+DEAL::6.84337e+09 6.84337e+09
+DEAL::30 32
+DEAL::OK
diff --git a/tests/trilinos/66/cmp/powerpc-apple-darwin8.10.0+gcc4.0 b/tests/trilinos/66/cmp/powerpc-apple-darwin8.10.0+gcc4.0
new file mode 100644 (file)
index 0000000..a6a6d32
--- /dev/null
@@ -0,0 +1,6 @@
+
+DEAL::6.88709e+09 6.88709e+09
+DEAL::32 32
+DEAL::6.68404e+09 6.68404e+09
+DEAL::29 32
+DEAL::OK
diff --git a/tests/trilinos/66/cmp/x86_64-unknown-linux-gnu+gcc3.3 b/tests/trilinos/66/cmp/x86_64-unknown-linux-gnu+gcc3.3
new file mode 100644 (file)
index 0000000..2ba21a4
--- /dev/null
@@ -0,0 +1,6 @@
+
+DEAL::7.15267e+09 7.15267e+09
+DEAL::32 32
+DEAL::6.84337e+09 6.84337e+09
+DEAL::29 32
+DEAL::OK
diff --git a/tests/trilinos/67.cc b/tests/trilinos/67.cc
new file mode 100644 (file)
index 0000000..8ebe569
--- /dev/null
@@ -0,0 +1,139 @@
+//----------------------------  trilinos_67.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_67.cc  ---------------------------
+
+
+// check TrilinosWrappers::MatrixBase::clear_rows ()
+
+#include "../tests.h"
+#include <lac/trilinos_sparse_matrix.h>
+#include <lac/vector.h>
+
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::MatrixBase &m)
+{
+  Assert (m.m() != 0, ExcInternalError());
+  Assert (m.n() != 0, ExcInternalError());
+
+                                   // build a tri-diagonal pattern
+  double norm_sqr = 0;
+  unsigned int nnz = 0;
+  const unsigned int N = m.m();
+  for (unsigned int i=0; i<N; ++i)
+    {
+      if (i>=5)
+        {
+          const double s = rand();
+          m.add (i,i-5, s);
+          norm_sqr += s*s;
+          ++nnz;
+        }
+      
+      if (i<N-5)
+        {
+          const double s = rand();
+          m.add (i,i+5, s);
+          norm_sqr += s*s;
+          ++nnz;
+        }
+      
+      const double s = rand();
+      m.add (i,i,s);
+      norm_sqr += s*s;
+      ++nnz;
+    }
+  m.compress ();
+  
+  deallog << m.frobenius_norm() << ' ' << std::sqrt (norm_sqr)
+          << std::endl;
+  deallog << m.n_nonzero_elements() << ' ' << nnz << std::endl;
+
+  Assert (std::fabs (m.frobenius_norm() - std::sqrt(norm_sqr))
+          < std::fabs (std::sqrt (norm_sqr)),
+          ExcInternalError());
+  Assert (m.n_nonzero_elements()-nnz == 0, ExcInternalError());
+
+                                   // now remove the entries of rows N/2 and N/3
+  for (unsigned int i=0; i<N; ++i)
+    {
+      const double s = m.el(N/2,i);
+      norm_sqr -= s*s;
+    }
+  for (unsigned int i=0; i<N; ++i)
+    {
+      const double s = m.el(N/3,i);
+      norm_sqr -= s*s;
+    }
+  const unsigned int rows[2] = { N/3, N/2 };
+  m.clear_rows (std::vector<unsigned int>(&rows[0], &rows[2]));
+  
+  deallog << m.frobenius_norm() << ' ' << std::sqrt (norm_sqr)
+          << std::endl;
+  deallog << m.n_nonzero_elements() << ' ' << nnz << std::endl;
+
+  Assert (std::fabs (m.frobenius_norm() - std::sqrt(norm_sqr))
+          < std::fabs (std::sqrt (norm_sqr)),
+          ExcInternalError());
+
+                                   // make sure that zeroing out rows does at
+                                   // least not add new nonzero entries (it
+                                   // may remove some, though)
+  Assert (m.n_nonzero_elements() <= nnz, ExcInternalError());
+  
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("67/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::SparseMatrix v (14,14,3);
+        test (v);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/67/cmp/generic b/tests/trilinos/67/cmp/generic
new file mode 100644 (file)
index 0000000..8a0f539
--- /dev/null
@@ -0,0 +1,6 @@
+
+DEAL::7.15267e+09 7.15267e+09
+DEAL::32 32
+DEAL::6.71272e+09 6.71272e+09
+DEAL::29 32
+DEAL::OK
diff --git a/tests/trilinos/67/cmp/powerpc-apple-darwin8.10.0+gcc4.0 b/tests/trilinos/67/cmp/powerpc-apple-darwin8.10.0+gcc4.0
new file mode 100644 (file)
index 0000000..6094697
--- /dev/null
@@ -0,0 +1,6 @@
+
+DEAL::6.88709e+09 6.88709e+09
+DEAL::32 32
+DEAL::6.20640e+09 6.20640e+09
+DEAL::27 32
+DEAL::OK
diff --git a/tests/trilinos/67/cmp/x86_64-unknown-linux-gnu+gcc3.3 b/tests/trilinos/67/cmp/x86_64-unknown-linux-gnu+gcc3.3
new file mode 100644 (file)
index 0000000..729838e
--- /dev/null
@@ -0,0 +1,6 @@
+
+DEAL::7.15267e+09 7.15267e+09
+DEAL::32 32
+DEAL::6.71272e+09 6.71272e+09
+DEAL::27 32
+DEAL::OK
diff --git a/tests/trilinos/68.cc b/tests/trilinos/68.cc
new file mode 100644 (file)
index 0000000..5c4412f
--- /dev/null
@@ -0,0 +1,137 @@
+//----------------------------  trilinos_68.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_68.cc  ---------------------------
+
+
+// check TrilinosWrappers::MatrixBase::clear_row () with used second argument
+
+#include "../tests.h"
+#include <lac/trilinos_sparse_matrix.h>
+#include <lac/vector.h>
+
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::MatrixBase &m)
+{
+  Assert (m.m() != 0, ExcInternalError());
+  Assert (m.n() != 0, ExcInternalError());
+
+                                   // build a tri-diagonal pattern
+  double norm_sqr = 0;
+  unsigned int nnz = 0;
+  const unsigned int N = m.m();
+  for (unsigned int i=0; i<N; ++i)
+    {
+      if (i>=5)
+        {
+          const double s = rand();
+          m.add (i,i-5, s);
+          norm_sqr += s*s;
+          ++nnz;
+        }
+      
+      if (i<N-5)
+        {
+          const double s = rand();
+          m.add (i,i+5, s);
+          norm_sqr += s*s;
+          ++nnz;
+        }
+      
+      const double s = rand();
+      m.add (i,i,s);
+      norm_sqr += s*s;
+      ++nnz;
+    }
+  m.compress ();
+  
+  deallog << m.frobenius_norm() << ' ' << std::sqrt (norm_sqr)
+          << std::endl;
+  deallog << m.n_nonzero_elements() << ' ' << nnz << std::endl;
+
+  Assert (std::fabs (m.frobenius_norm() - std::sqrt(norm_sqr))
+          < std::fabs (std::sqrt (norm_sqr)),
+          ExcInternalError());
+  Assert (m.n_nonzero_elements()-nnz == 0, ExcInternalError());
+
+                                   // now remove the entries of row N/2. set
+                                   // diagonal entries to rnd
+  const double rnd = rand();
+  for (unsigned int i=0; i<N; ++i)
+    {
+      const double s = m.el(N/2,i);
+      norm_sqr -= s*s;
+    }
+  norm_sqr += rnd*rnd;
+  
+  m.clear_row (N/2, rnd);
+  
+  deallog << m.frobenius_norm() << ' ' << std::sqrt (norm_sqr)
+          << std::endl;
+  deallog << m.n_nonzero_elements() << ' ' << nnz << std::endl;
+
+  Assert (std::fabs (m.frobenius_norm() - std::sqrt(norm_sqr))
+          < std::fabs (std::sqrt (norm_sqr)),
+          ExcInternalError());
+
+                                   // make sure that zeroing out rows does at
+                                   // least not add new nonzero entries (it
+                                   // may remove some, though)
+  Assert (m.n_nonzero_elements() <= nnz, ExcInternalError());
+  
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("68/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::SparseMatrix v (14,14,3);
+        test (v);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/68/cmp/generic b/tests/trilinos/68/cmp/generic
new file mode 100644 (file)
index 0000000..a305d35
--- /dev/null
@@ -0,0 +1,6 @@
+
+DEAL::7.15267e+09 7.15267e+09
+DEAL::32 32
+DEAL::6.96869e+09 6.96869e+09
+DEAL::30 32
+DEAL::OK
diff --git a/tests/trilinos/68/cmp/powerpc-apple-darwin8.10.0+gcc4.0 b/tests/trilinos/68/cmp/powerpc-apple-darwin8.10.0+gcc4.0
new file mode 100644 (file)
index 0000000..2fb8955
--- /dev/null
@@ -0,0 +1,6 @@
+
+DEAL::6.88709e+09 6.88709e+09
+DEAL::32 32
+DEAL::6.70776e+09 6.70776e+09
+DEAL::30 32
+DEAL::OK
diff --git a/tests/trilinos/69.cc b/tests/trilinos/69.cc
new file mode 100644 (file)
index 0000000..852c29f
--- /dev/null
@@ -0,0 +1,143 @@
+//----------------------------  trilinos_69.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_69.cc  ---------------------------
+
+
+// check TrilinosWrappers::MatrixBase::clear_rows () with used second argument
+
+#include "../tests.h"
+#include <lac/trilinos_sparse_matrix.h>
+#include <lac/vector.h>
+
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::MatrixBase &m)
+{
+  Assert (m.m() != 0, ExcInternalError());
+  Assert (m.n() != 0, ExcInternalError());
+
+                                   // build a tri-diagonal pattern
+  double norm_sqr = 0;
+  unsigned int nnz = 0;
+  const unsigned int N = m.m();
+  for (unsigned int i=0; i<N; ++i)
+    {
+      if (i>=5)
+        {
+          const double s = rand();
+          m.add (i,i-5, s);
+          norm_sqr += s*s;
+          ++nnz;
+        }
+      
+      if (i<N-5)
+        {
+          const double s = rand();
+          m.add (i,i+5, s);
+          norm_sqr += s*s;
+          ++nnz;
+        }
+      
+      const double s = rand();
+      m.add (i,i,s);
+      norm_sqr += s*s;
+      ++nnz;
+    }
+  m.compress ();
+  
+  deallog << m.frobenius_norm() << ' ' << std::sqrt (norm_sqr)
+          << std::endl;
+  deallog << m.n_nonzero_elements() << ' ' << nnz << std::endl;
+
+  Assert (std::fabs (m.frobenius_norm() - std::sqrt(norm_sqr))
+          < std::fabs (std::sqrt (norm_sqr)),
+          ExcInternalError());
+  Assert (m.n_nonzero_elements()-nnz == 0, ExcInternalError());
+
+                                   // now remove the entries of rows N/2 and
+                                   // N/3. set diagonal entries to rnd
+  const double rnd = rand();
+  for (unsigned int i=0; i<N; ++i)
+    {
+      const double s = m.el(N/2,i);
+      norm_sqr -= s*s;
+    }
+  for (unsigned int i=0; i<N; ++i)
+    {
+      const double s = m.el(N/3,i);
+      norm_sqr -= s*s;
+    }
+  norm_sqr += 2*rnd*rnd;
+  
+  const unsigned int rows[2] = { N/3, N/2 };
+  m.clear_rows (std::vector<unsigned int>(&rows[0], &rows[2]), rnd);
+  
+  deallog << m.frobenius_norm() << ' ' << std::sqrt (norm_sqr)
+          << std::endl;
+  deallog << m.n_nonzero_elements() << ' ' << nnz << std::endl;
+
+  Assert (std::fabs (m.frobenius_norm() - std::sqrt(norm_sqr))
+          < std::fabs (std::sqrt (norm_sqr)),
+          ExcInternalError());
+
+                                   // make sure that zeroing out rows does at
+                                   // least not add new nonzero entries (it
+                                   // may remove some, though)
+  Assert (m.n_nonzero_elements() <= nnz, ExcInternalError());
+  
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("69/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::SparseMatrix v (14,14,3);
+        test (v);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/69/cmp/generic b/tests/trilinos/69/cmp/generic
new file mode 100644 (file)
index 0000000..2000691
--- /dev/null
@@ -0,0 +1,6 @@
+
+DEAL::7.15267e+09 7.15267e+09
+DEAL::32 32
+DEAL::6.96580e+09 6.96580e+09
+DEAL::29 32
+DEAL::OK
diff --git a/tests/trilinos/69/cmp/powerpc-apple-darwin8.10.0+gcc4.0 b/tests/trilinos/69/cmp/powerpc-apple-darwin8.10.0+gcc4.0
new file mode 100644 (file)
index 0000000..1a75a21
--- /dev/null
@@ -0,0 +1,6 @@
+
+DEAL::6.88709e+09 6.88709e+09
+DEAL::32 32
+DEAL::6.25737e+09 6.25737e+09
+DEAL::29 32
+DEAL::OK
diff --git a/tests/trilinos/70.cc b/tests/trilinos/70.cc
new file mode 100644 (file)
index 0000000..8536246
--- /dev/null
@@ -0,0 +1,36 @@
+//----------------------------  trilinos_70.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_70.cc  ---------------------------
+
+
+// check PetscScalar
+
+#include "../tests.h"
+#include <base/logstream.h>
+#include <lac/trilinos_vector.h>
+
+#include <fstream>
+
+int main () 
+{
+  std::ofstream logfile("70/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  if (typeid(PetscScalar)==typeid(double))
+    deallog << "double" << std::endl;
+  else if (typeid(PetscScalar)==typeid(float))
+    deallog << "float" << std::endl;
+  else
+    Assert(false, ExcNotImplemented());
+}
diff --git a/tests/trilinos/70/cmp/generic b/tests/trilinos/70/cmp/generic
new file mode 100644 (file)
index 0000000..04c108a
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::double
diff --git a/tests/trilinos/Makefile b/tests/trilinos/Makefile
new file mode 100644 (file)
index 0000000..381c3f7
--- /dev/null
@@ -0,0 +1,39 @@
+############################################################
+# $Id$
+# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2008 by the deal.II authors
+############################################################
+
+############################################################
+# Include general settings for including DEAL libraries
+############################################################
+
+include ../Makefile.paths
+include $D/common/Make.global_options
+debug-mode = on
+
+libraries = $(lib-lac.g)  \
+            $(lib-base.g)
+libraries_o = $(lib-lac.o)  \
+            $(lib-base.o)
+
+default: run-tests 
+
+############################################################
+
+tests_x = *
+
+
+# from above list of regular expressions, generate the real set of
+# tests
+expand = $(shell echo $(addsuffix .cc,$(1)) \
+           | $(PERL) -pi -e 's/\.cc//g;')
+tests = $(call expand,$(tests_x))
+
+############################################################
+
+
+include ../Makefile.rules
+include Makefile.depend
+include Makefile.tests
+
+.PHONY: default
\ No newline at end of file
diff --git a/tests/trilinos/block_vector_iterator_01.cc b/tests/trilinos/block_vector_iterator_01.cc
new file mode 100644 (file)
index 0000000..132a138
--- /dev/null
@@ -0,0 +1,115 @@
+//----------------------------  trilinos_block_vector_iterator_01.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_block_vector_iterator_01.cc  ---------------------------
+
+
+// make sure that block vector iterator allows reading and writing correctly
+
+#include "../tests.h"
+#include <lac/trilinos_block_vector.h>
+#include <fstream>
+#include <iostream>
+
+
+void test ()
+{
+  TrilinosWrappers::BlockVector v(2,1);
+  v(0) = 1;
+  v(1) = 2;
+
+                                   // first check reading through a const
+                                   // iterator
+  {
+    TrilinosWrappers::BlockVector::const_iterator i=v.begin();
+    Assert (*i == 1, ExcInternalError());
+    ++i;
+    Assert (*i == 2, ExcInternalError());
+  }
+
+                                   // same, but create iterator in a different
+                                   // way
+  {
+    TrilinosWrappers::BlockVector::const_iterator
+      i=const_cast<const TrilinosWrappers::BlockVector&>(v).begin();
+    Assert (*i == 1, ExcInternalError());
+    ++i;
+    Assert (*i == 2, ExcInternalError());
+  }
+
+                                   // read through a read-write iterator
+  {
+    TrilinosWrappers::BlockVector::iterator i = v.begin();
+    Assert (*i == 1, ExcInternalError());
+    ++i;
+    Assert (*i == 2, ExcInternalError());
+  }
+
+                                   // write through a read-write iterator
+  {
+    TrilinosWrappers::BlockVector::iterator i = v.begin();
+
+    *i = 2;
+    ++i;
+    *i = 3;
+  }  
+
+                                   // and read again
+  {
+    TrilinosWrappers::BlockVector::iterator i = v.begin();
+    Assert (*i == 2, ExcInternalError());
+    ++i;
+    Assert (*i == 3, ExcInternalError());
+  }
+  
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv)
+{
+  std::ofstream logfile("block_vector_iterator_01/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        test ();
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/block_vector_iterator_01/cmp/generic b/tests/trilinos/block_vector_iterator_01/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/block_vector_iterator_02.cc b/tests/trilinos/block_vector_iterator_02.cc
new file mode 100644 (file)
index 0000000..b68c616
--- /dev/null
@@ -0,0 +1,109 @@
+//----------------------------  trilinos_block_vector_iterator_02.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_block_vector_iterator_02.cc  ---------------------------
+
+
+// like _01, except that we use operator[] instead of operator*
+
+#include "../tests.h"
+#include <lac/trilinos_block_vector.h>
+#include <fstream>
+#include <iostream>
+
+
+void test ()
+{
+  TrilinosWrappers::BlockVector v(2,1);
+  v(0) = 1;
+  v(1) = 2;
+
+                                   // first check reading through a const
+                                   // iterator
+  {
+    TrilinosWrappers::BlockVector::const_iterator i=v.begin();
+    Assert (i[0] == 1, ExcInternalError());
+    Assert (i[1] == 2, ExcInternalError());
+  }
+
+                                   // same, but create iterator in a different
+                                   // way
+  {
+    TrilinosWrappers::BlockVector::const_iterator
+      i=const_cast<const TrilinosWrappers::BlockVector&>(v).begin();
+    Assert (i[0] == 1, ExcInternalError());
+    Assert (i[1] == 2, ExcInternalError());
+  }
+
+                                   // read through a read-write iterator
+  {
+    TrilinosWrappers::BlockVector::iterator i = v.begin();
+    Assert (i[0] == 1, ExcInternalError());
+    Assert (i[1] == 2, ExcInternalError());
+  }
+
+                                   // write through a read-write iterator
+  {
+    TrilinosWrappers::BlockVector::iterator i = v.begin();
+    i[0] = 2;
+    i[1] = 3;
+  }  
+
+                                   // and read again
+  {
+    TrilinosWrappers::BlockVector::iterator i = v.begin();
+    Assert (i[0] == 2, ExcInternalError());
+    Assert (i[1] == 3, ExcInternalError());
+  }
+  
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv)
+{
+  std::ofstream logfile("block_vector_iterator_02/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        test ();
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/block_vector_iterator_02/cmp/generic b/tests/trilinos/block_vector_iterator_02/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/block_vector_iterator_03.cc b/tests/trilinos/block_vector_iterator_03.cc
new file mode 100644 (file)
index 0000000..056af8d
--- /dev/null
@@ -0,0 +1,364 @@
+//--------------------------------------------------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005 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.
+//
+//--------------------------------------------------------------------
+
+// this test is an adaptation of lac/block_vector_iterator for PETSc block
+// vectors
+
+#include "../tests.h"
+#include <base/logstream.h>
+#include <lac/trilinos_block_vector.h>
+#include <fstream>
+#include <iostream>
+#include <vector>
+#include <algorithm>
+#include <numeric>
+#include <utility>
+#include <cmath>
+
+template <typename number>
+bool operator == (const TrilinosWrappers::BlockVector &v1,
+                 const TrilinosWrappers::BlockVector &v2)
+{
+  if (v1.size() != v2.size())
+    return false;
+  for (unsigned int i=0; i<v1.size(); ++i)
+    if (v1(i) != v2(i))
+      return false;
+  return true;
+}
+
+
+void test ()
+{
+  std::vector<unsigned int> ivector(4);
+  ivector[0] = 2;
+  ivector[1] = 4;
+  ivector[2] = 3;
+  ivector[3] = 5;
+  
+                                  // Check 1: initialization via
+                                  // iterators
+  if (true)
+    {
+      TrilinosWrappers::BlockVector v1(ivector);
+      TrilinosWrappers::BlockVector v2(ivector);
+
+                                      // initialize first vector with
+                                      // simple loop
+      for (unsigned int i=0; i<v1.size(); ++i)
+       v1(i) = i;
+                                      // initialize other vector
+                                      // through iterators
+      TrilinosWrappers::BlockVector::iterator p2 = v2.begin();
+      for (unsigned int i=0; i<v1.size(); ++i, ++p2)
+       *p2 = i;
+      Assert (p2==v2.end(), ExcInternalError());
+      
+                                      // check that the two vectors are equal
+      deallog << "Check 1: " << (v1==v2 ? "true" : "false") << std::endl;
+    };
+
+                                  // Check 1: initialization via
+                                  // iterators
+  if (true)
+    {
+      TrilinosWrappers::BlockVector v1(ivector);
+
+                                      // initialize first vector with
+                                      // simple loop
+      for (unsigned int i=0; i<v1.size(); ++i)
+       v1(i) = i;
+                                      // initialize other vector
+                                      // through iterators into first
+                                      // vector
+      TrilinosWrappers::BlockVector v2(ivector, v1.begin(), v1.end());
+                                      // check that the two vectors are equal
+      deallog << "Check 2: " << (v1==v2 ? "true" : "false") << std::endl;
+    };
+
+                                  // Check 3: loop forward and back
+                                  // and check that things are the
+                                  // same
+  if (true)
+    {
+      TrilinosWrappers::BlockVector v1(ivector);
+                                      // initialize first vector with
+                                      // simple loop
+      for (unsigned int i=0; i<v1.size(); ++i)
+       v1(i) = i;
+
+      TrilinosWrappers::BlockVector::iterator p1 = v1.begin();
+      for (unsigned int i=0; i<v1.size(); ++i, ++p1)
+       Assert (*p1 == i, ExcInternalError());
+
+      Assert (p1 == v1.end(), ExcInternalError());
+      
+                                      // move back into allowable
+                                      // region
+      --p1;
+
+                                      // check backwards
+      for (unsigned int i=0; i<v1.size(); ++i, --p1)
+       Assert (*p1 == v1.size()-i-1, ExcInternalError());
+
+                                      // if we came thus far,
+                                      // everything is alright
+      deallog << "Check 3: true" << std::endl;
+    };
+
+
+                                  // Check 4: same, but this time
+                                  // with const iterators
+  if (true)
+    {
+      TrilinosWrappers::BlockVector v1(ivector);
+                                      // initialize first vector with
+                                      // simple loop
+      for (unsigned int i=0; i<v1.size(); ++i)
+       v1(i) = i;
+
+      TrilinosWrappers::BlockVector::const_iterator p1 = v1.begin();
+      for (unsigned int i=0; i<v1.size(); ++i, ++p1)
+       Assert (*p1 == i, ExcInternalError());
+
+      Assert (p1 == v1.end(), ExcInternalError());
+
+                                      // move back into allowable
+                                      // region
+      --p1;
+
+                                      // check backwards
+      for (unsigned int i=0; i<v1.size(); ++i, --p1)
+       {
+         const double val = *p1;
+         const double ref = v1.size()-i-1;
+         Assert (val==ref, ExcInternalError());
+       };
+
+                                      // if we came thus far,
+                                      // everything is alright
+      deallog << "Check 4: true" << std::endl;
+    };
+
+                                  // Checks 5-14: use some standard
+                                  // algorithms
+  if (true)
+    {
+      TrilinosWrappers::BlockVector v1(ivector);
+                                      // initialize first vector with
+                                      // simple loop
+      for (unsigned int i=0; i<v1.size(); ++i)
+       v1(i) = i;
+
+                                      // check std::distance
+                                      // algorithm
+      deallog << "Check 5: "
+             << (std::distance (v1.begin(), v1.end()) ==
+                 static_cast<signed int>(v1.size()) ?
+                 "true" : "false")
+             << std::endl;
+
+                                      // check std::copy
+      TrilinosWrappers::BlockVector v2(ivector);
+      std::copy (v1.begin(), v1.end(), v2.begin());
+      deallog << "Check 6: " << (v1 == v2 ? "true" : "false") << std::endl;
+
+                                      // check std::transform
+      std::transform (v1.begin(), v1.end(), v2.begin(),
+                     std::bind2nd (std::multiplies<double>(),
+                                   2.0));
+      v2 *= 1./2.;
+      deallog << "Check 7: " << (v1 == v2 ? "true" : "false") << std::endl;
+
+
+                                      // check operators +/-, +=/-=
+      deallog << "Check 8: "
+             << (std::distance(v1.begin(), v1.begin()+3) == 3 ?
+                 "true" : "false")
+             << std::endl;
+      deallog << "Check 9: "
+             << (std::distance(v1.end()-6, v1.end()) == 6 ?
+                 "true" : "false")
+             << std::endl;
+      deallog << "Check 10: "
+             << (std::distance(v1.begin(), v1.end()) == (signed)v1.size() ?
+                 "true" : "false")
+             << std::endl;
+      deallog << "Check 11: "
+             << (std::distance(v1.begin(), (v1.begin()+=7)) == 7 ?
+                 "true" : "false")
+             << std::endl;
+      deallog << "Check 12: "
+             << (std::distance((v1.end()-=4), v1.end()) == 4 ?
+                 "true" : "false")
+             << std::endl;
+
+                                      // check advance
+      TrilinosWrappers::BlockVector::iterator p2 = v1.begin();
+      std::advance (p2, v1.size());
+      deallog << "Check 13: " << (p2 == v1.end() ? "true" : "false") << std::endl;
+
+      TrilinosWrappers::BlockVector::const_iterator p3 = v1.begin();
+      std::advance (p3, v1.size());
+      deallog << "Check 14: " << (p3 == v1.end() ? "true" : "false") << std::endl;
+    };
+
+                                  // Check 15: initialization through
+                                  // iterators
+  if (true)
+    {
+      TrilinosWrappers::BlockVector v1(ivector);
+                                      // initialize first vector with
+                                      // simple loop
+      for (unsigned int i=0; i<v1.size(); ++i)
+       v1(i) = i;
+
+                                      // initialize a normal vector
+                                      // from it
+      Vector<double> v2(v1.begin(), v1.end());
+
+                                      // and reverse way
+      TrilinosWrappers::BlockVector v3(ivector, v2.begin(), v2.end());
+      deallog << "Check 15: " << (v1==v3 ? "true" : "false") << std::endl;
+    };
+
+                                  // Check 16: initialization through
+                                  // iterators. variant with one
+                                  // constant object
+  if (true)
+    {
+      TrilinosWrappers::BlockVector v1(ivector);
+                                      // initialize first vector with
+                                      // simple loop
+      for (unsigned int i=0; i<v1.size(); ++i)
+       v1(i) = i;
+
+                                      // initialize a normal vector
+                                      // from it
+      const Vector<double> v2(v1.begin(), v1.end());
+
+                                      // and reverse way
+      TrilinosWrappers::BlockVector v3(ivector, v2.begin(), v2.end());
+      deallog << "Check 16: " << (v1==v3 ? "true" : "false") << std::endl;
+    };
+  
+                                  // Check 17: initialization through
+                                  // iterators. variant with two
+                                  // constant object
+  if (true)
+    {
+      TrilinosWrappers::BlockVector v1(ivector);
+                                      // initialize first vector with
+                                      // simple loop
+      for (unsigned int i=0; i<v1.size(); ++i)
+       v1(i) = i;
+
+                                      // initialize a normal vector
+                                      // from it
+      const Vector<double> v2(v1.begin(), v1.end());
+
+                                      // and reverse way
+      const TrilinosWrappers::BlockVector v3(ivector, v2.begin(), v2.end());
+      deallog << "Check 17: " << (v1==v3 ? "true" : "false") << std::endl;
+    };
+
+                                  // Check 18: initialization through
+                                  // iterators. variant with three
+                                  // constant object
+  if (true)
+    {
+      TrilinosWrappers::BlockVector v0(ivector);
+                                      // initialize first vector with
+                                      // simple loop
+      for (unsigned int i=0; i<v0.size(); ++i)
+       v0(i) = i;
+
+      const TrilinosWrappers::BlockVector v1 = v0;
+      
+                                      // initialize a normal vector
+                                      // from it
+      const Vector<double> v2(v1.begin(), v1.end());
+
+                                      // and reverse way
+      const TrilinosWrappers::BlockVector v3(ivector, v2.begin(), v2.end());
+      deallog << "Check 18: " << (v1==v3 ? "true" : "false") << std::endl;
+    };
+  
+                                  // Check 19: operator[]
+  if (true)
+    {
+      TrilinosWrappers::BlockVector v1(ivector);
+      for (unsigned int i=0; i<v1.size(); ++i)
+       v1(i) = i;
+
+      for (unsigned int i=0; i<v1.size(); ++i)
+       {
+         const TrilinosWrappers::BlockVector::iterator p = (v1.begin()+i);
+         for (unsigned int j=0; j<v1.size(); ++j)
+           Assert (p[(signed)j-(signed)i] == j, ExcInternalError());
+       };
+
+                                      // if we came thus far,
+                                      // everything is alright
+      deallog << "Check 19: true" << std::endl;      
+    };
+}
+
+
+
+
+
+int main (int argc,char **argv)
+{
+  std::ofstream logfile("block_vector_iterator_03/output");
+  logfile.setf(std::ios::fixed);
+  logfile.precision(3);
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+  
+  try
+    {
+      {
+        test ();
+      }
+    }
+  catch (std::exception &e)
+    {
+      std::cerr << std::endl << std::endl
+          << "----------------------------------------------------"
+          << std::endl;
+      std::cerr << "Exception on processing: " << e.what() << std::endl
+          << "Aborting!" << std::endl
+          << "----------------------------------------------------"
+          << std::endl;
+                                      // abort
+      return 2;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+          << "----------------------------------------------------"
+          << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+          << "Aborting!" << std::endl
+          << "----------------------------------------------------"
+          << std::endl;
+                                      // abort
+      return 3;
+    };
+  
+  
+  return 0;
+}
+
diff --git a/tests/trilinos/block_vector_iterator_03/cmp/generic b/tests/trilinos/block_vector_iterator_03/cmp/generic
new file mode 100644 (file)
index 0000000..ca8a9d5
--- /dev/null
@@ -0,0 +1,20 @@
+
+DEAL::Check 1: true
+DEAL::Check 2: true
+DEAL::Check 3: true
+DEAL::Check 4: true
+DEAL::Check 5: true
+DEAL::Check 6: true
+DEAL::Check 7: true
+DEAL::Check 8: true
+DEAL::Check 9: true
+DEAL::Check 10: true
+DEAL::Check 11: true
+DEAL::Check 12: true
+DEAL::Check 13: true
+DEAL::Check 14: true
+DEAL::Check 15: true
+DEAL::Check 16: true
+DEAL::Check 17: true
+DEAL::Check 18: true
+DEAL::Check 19: true
diff --git a/tests/trilinos/deal_solver_01.cc b/tests/trilinos/deal_solver_01.cc
new file mode 100644 (file)
index 0000000..9f77646
--- /dev/null
@@ -0,0 +1,94 @@
+//----------------------------  trilinos_deal_solver_01.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_deal_solver_01.cc  ---------------------------
+
+// test the CG solver using the PETSc matrix and vector classes
+
+
+#include "../tests.h"
+#include "../lac/testmatrix.h"
+#include <cmath>
+#include <fstream>
+#include <iostream>
+#include <iomanip>
+#include <base/logstream.h>
+#include <lac/trilinos_sparse_matrix.h>
+#include <lac/trilinos_vector.h>
+#include <lac/solver_control.h>
+#include <lac/solver_cg.h>
+#include <lac/solver_gmres.h>
+#include <lac/solver_bicgstab.h>
+#include <lac/solver_richardson.h>
+#include <lac/solver_qmrs.h>
+#include <lac/precondition.h>
+#include <lac/vector_memory.h>
+#include <typeinfo>
+
+template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
+void
+check_solve( SOLVER& solver, const MATRIX& A,
+            VECTOR& u, VECTOR& f, const PRECONDITION& P)
+{
+  deallog << "Solver type: " << typeid(solver).name() << std::endl;
+  
+  u = 0.;
+  f = 1.;
+  try 
+    {
+      solver.solve(A,u,f,P);
+    }
+  catch (std::exception& e)
+    {
+      deallog << e.what() << std::endl;
+      abort ();
+    }
+
+  deallog << "Solver stopped after " << solver.control().last_step()
+          << " iterations" << std::endl;
+}
+
+
+int main(int argc, char **argv)
+{
+  std::ofstream logfile("deal_solver_01/output");
+  logfile.precision(4);
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  {
+    SolverControl control(100, 1.e-3);
+
+    const unsigned int size = 32;
+    unsigned int dim = (size-1)*(size-1);
+
+    deallog << "Size " << size << " Unknowns " << dim << std::endl;
+      
+                                     // Make matrix
+    FDMatrix testproblem(size, size);
+    TrilinosWrappers::SparseMatrix  A(dim, dim, 5);
+    testproblem.five_point(A);
+
+    TrilinosWrappers::Vector  f(dim);
+    TrilinosWrappers::Vector  u(dim);
+    f = 1.;
+    A.compress ();
+    f.compress ();
+    u.compress ();
+
+    GrowingVectorMemory<TrilinosWrappers::Vector> mem;
+    SolverCG<TrilinosWrappers::Vector> solver(control,mem);
+    PreconditionIdentity preconditioner;
+    check_solve (solver, A,u,f, preconditioner);
+  }
+}
+
diff --git a/tests/trilinos/deal_solver_01/cmp/generic b/tests/trilinos/deal_solver_01/cmp/generic
new file mode 100644 (file)
index 0000000..72d2bc0
--- /dev/null
@@ -0,0 +1,8 @@
+
+DEAL::Size 32 Unknowns 961
+DEAL::Solver type: N6dealii8SolverCGINS_13PETScWrappers6VectorEEE
+DEAL:cg::Starting value 31.00
+DEAL:cg::Convergence step 43 value 0.0008189
+DEAL::Solver stopped after 43 iterations
+DEAL::GrowingVectorMemory:Overall allocated vectors: 4
+DEAL::GrowingVectorMemory:Maximum allocated vectors: 4
diff --git a/tests/trilinos/deal_solver_02.cc b/tests/trilinos/deal_solver_02.cc
new file mode 100644 (file)
index 0000000..ede7e69
--- /dev/null
@@ -0,0 +1,96 @@
+//----------------------------  trilinos_deal_solver_02.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_deal_solver_02.cc  ---------------------------
+
+// test the BiCGStab solver using the PETSc matrix and vector classes
+
+
+
+#include "../tests.h"
+#include "../lac/testmatrix.h"
+#include <cmath>
+#include <fstream>
+#include <iostream>
+#include <iomanip>
+#include <base/logstream.h>
+#include <lac/trilinos_sparse_matrix.h>
+#include <lac/trilinos_vector.h>
+#include <lac/solver_control.h>
+#include <lac/solver_cg.h>
+#include <lac/solver_gmres.h>
+#include <lac/solver_bicgstab.h>
+#include <lac/solver_richardson.h>
+#include <lac/solver_qmrs.h>
+#include <lac/solver.h>
+#include <lac/precondition.h>
+#include <lac/vector_memory.h>
+#include <typeinfo>
+
+template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
+void
+check_solve( SOLVER& solver, const MATRIX& A,
+            VECTOR& u, VECTOR& f, const PRECONDITION& P)
+{
+  deallog << "Solver type: " << typeid(solver).name() << std::endl;
+  
+  u = 0.;
+  f = 1.;
+  try 
+    {
+      solver.solve(A,u,f,P);
+    }
+  catch (std::exception& e)
+    {
+      deallog << e.what() << std::endl;
+      abort ();
+    }
+
+  deallog << "Solver stopped after " << solver.control().last_step()
+          << " iterations" << std::endl;
+}
+
+
+int main(int argc, char **argv)
+{
+  std::ofstream logfile("deal_solver_02/output");
+  logfile.precision(4);
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+  
+  {
+    SolverControl control(100, 1.e-3);
+
+    const unsigned int size = 32;
+    unsigned int dim = (size-1)*(size-1);
+
+    deallog << "Size " << size << " Unknowns " << dim << std::endl;
+      
+                                     // Make matrix
+    FDMatrix testproblem(size, size);
+    TrilinosWrappers::SparseMatrix  A(dim, dim, 5);
+    testproblem.five_point(A);
+
+    TrilinosWrappers::Vector  f(dim);
+    TrilinosWrappers::Vector  u(dim);
+    f = 1.;
+    A.compress ();
+    f.compress ();
+    u.compress ();
+
+    GrowingVectorMemory<TrilinosWrappers::Vector> mem;
+    SolverBicgstab<TrilinosWrappers::Vector> solver(control,mem);
+    PreconditionIdentity preconditioner;
+    check_solve (solver, A,u,f, preconditioner);
+  }
+}
+
diff --git a/tests/trilinos/deal_solver_02/cmp/generic b/tests/trilinos/deal_solver_02/cmp/generic
new file mode 100644 (file)
index 0000000..6a6c9d8
--- /dev/null
@@ -0,0 +1,8 @@
+
+DEAL::Size 32 Unknowns 961
+DEAL::Solver type: N6dealii14SolverBicgstabINS_13PETScWrappers6VectorEEE
+DEAL:Bicgstab::Starting value 31.00
+DEAL:Bicgstab::Convergence step 29 value 0.0008735
+DEAL::Solver stopped after 29 iterations
+DEAL::GrowingVectorMemory:Overall allocated vectors: 8
+DEAL::GrowingVectorMemory:Maximum allocated vectors: 8
diff --git a/tests/trilinos/deal_solver_03.cc b/tests/trilinos/deal_solver_03.cc
new file mode 100644 (file)
index 0000000..d435f1e
--- /dev/null
@@ -0,0 +1,96 @@
+//----------------------------  trilinos_deal_solver_03.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_deal_solver_03.cc  ---------------------------
+
+// test the GMRES solver using the PETSc matrix and vector classes
+
+
+
+#include "../tests.h"
+#include "../lac/testmatrix.h"
+#include <cmath>
+#include <fstream>
+#include <iostream>
+#include <iomanip>
+#include <base/logstream.h>
+#include <lac/trilinos_sparse_matrix.h>
+#include <lac/trilinos_vector.h>
+#include <lac/solver_control.h>
+#include <lac/solver_cg.h>
+#include <lac/solver_gmres.h>
+#include <lac/solver_bicgstab.h>
+#include <lac/solver_richardson.h>
+#include <lac/solver_qmrs.h>
+#include <lac/solver.h>
+#include <lac/precondition.h>
+#include <lac/vector_memory.h>
+#include <typeinfo>
+
+template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
+void
+check_solve( SOLVER& solver, const MATRIX& A,
+            VECTOR& u, VECTOR& f, const PRECONDITION& P)
+{
+  deallog << "Solver type: " << typeid(solver).name() << std::endl;
+  
+  u = 0.;
+  f = 1.;
+  try 
+    {
+      solver.solve(A,u,f,P);
+    }
+  catch (std::exception& e)
+    {
+      deallog << e.what() << std::endl;
+      abort ();
+    }
+
+  deallog << "Solver stopped after " << solver.control().last_step()
+          << " iterations" << std::endl;
+}
+
+
+int main(int argc, char **argv)
+{
+  std::ofstream logfile("deal_solver_03/output");
+  logfile.precision(4);
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+  
+  {
+    SolverControl control(100, 1.e-3);
+
+    const unsigned int size = 32;
+    unsigned int dim = (size-1)*(size-1);
+
+    deallog << "Size " << size << " Unknowns " << dim << std::endl;
+      
+                                     // Make matrix
+    FDMatrix testproblem(size, size);
+    TrilinosWrappers::SparseMatrix  A(dim, dim, 5);
+    testproblem.five_point(A);
+
+    TrilinosWrappers::Vector  f(dim);
+    TrilinosWrappers::Vector  u(dim);
+    f = 1.;
+    A.compress ();
+    f.compress ();
+    u.compress ();
+
+    GrowingVectorMemory<TrilinosWrappers::Vector> mem;
+    SolverGMRES<TrilinosWrappers::Vector> solver(control,mem);
+    PreconditionIdentity preconditioner;
+    check_solve (solver, A,u,f, preconditioner);
+  }
+}
+
diff --git a/tests/trilinos/deal_solver_03/cmp/generic b/tests/trilinos/deal_solver_03/cmp/generic
new file mode 100644 (file)
index 0000000..d545230
--- /dev/null
@@ -0,0 +1,8 @@
+
+DEAL::Size 32 Unknowns 961
+DEAL::Solver type: N6dealii11SolverGMRESINS_13PETScWrappers6VectorEEE
+DEAL:GMRES::Starting value 31.00
+DEAL:GMRES::Convergence step 75 value 0.0008096
+DEAL::Solver stopped after 75 iterations
+DEAL::GrowingVectorMemory:Overall allocated vectors: 30
+DEAL::GrowingVectorMemory:Maximum allocated vectors: 30
diff --git a/tests/trilinos/deal_solver_04.cc b/tests/trilinos/deal_solver_04.cc
new file mode 100644 (file)
index 0000000..5513420
--- /dev/null
@@ -0,0 +1,95 @@
+//----------------------------  trilinos_deal_solver_04.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_deal_solver_04.cc  ---------------------------
+
+// test the MINRES solver using the PETSc matrix and vector classes
+
+
+#include "../tests.h"
+#include "../lac/testmatrix.h"
+#include <cmath>
+#include <fstream>
+#include <iostream>
+#include <iomanip>
+#include <base/logstream.h>
+#include <lac/trilinos_sparse_matrix.h>
+#include <lac/trilinos_vector.h>
+#include <lac/solver_control.h>
+#include <lac/solver_cg.h>
+#include <lac/solver_gmres.h>
+#include <lac/solver_bicgstab.h>
+#include <lac/solver_richardson.h>
+#include <lac/solver_qmrs.h>
+#include <lac/solver_minres.h>
+#include <lac/precondition.h>
+#include <lac/vector_memory.h>
+#include <typeinfo>
+
+template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
+void
+check_solve( SOLVER& solver, const MATRIX& A,
+            VECTOR& u, VECTOR& f, const PRECONDITION& P)
+{
+  deallog << "Solver type: " << typeid(solver).name() << std::endl;
+  
+  u = 0.;
+  f = 1.;
+  try 
+    {
+      solver.solve(A,u,f,P);
+    }
+  catch (std::exception& e)
+    {
+      deallog << e.what() << std::endl;
+      abort ();
+    }
+
+  deallog << "Solver stopped after " << solver.control().last_step()
+          << " iterations" << std::endl;
+}
+
+
+int main(int argc, char **argv)
+{
+  std::ofstream logfile("deal_solver_04/output");
+  logfile.precision(4);
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+  
+  {
+    SolverControl control(100, 1.e-3);
+
+    const unsigned int size = 32;
+    unsigned int dim = (size-1)*(size-1);
+
+    deallog << "Size " << size << " Unknowns " << dim << std::endl;
+      
+                                     // Make matrix
+    FDMatrix testproblem(size, size);
+    TrilinosWrappers::SparseMatrix  A(dim, dim, 5);
+    testproblem.five_point(A);
+
+    TrilinosWrappers::Vector  f(dim);
+    TrilinosWrappers::Vector  u(dim);
+    f = 1.;
+    A.compress ();
+    f.compress ();
+    u.compress ();
+
+    GrowingVectorMemory<TrilinosWrappers::Vector> mem;
+    SolverMinRes<TrilinosWrappers::Vector> solver(control,mem);
+    PreconditionIdentity preconditioner;
+    check_solve (solver, A,u,f, preconditioner);
+  }
+}
+
diff --git a/tests/trilinos/deal_solver_04/cmp/generic b/tests/trilinos/deal_solver_04/cmp/generic
new file mode 100644 (file)
index 0000000..e323192
--- /dev/null
@@ -0,0 +1,8 @@
+
+DEAL::Size 32 Unknowns 961
+DEAL::Solver type: N6dealii12SolverMinResINS_13PETScWrappers6VectorEEE
+DEAL:minres::Starting value 31.00
+DEAL:minres::Convergence step 43 value 0.0006916
+DEAL::Solver stopped after 43 iterations
+DEAL::GrowingVectorMemory:Overall allocated vectors: 7
+DEAL::GrowingVectorMemory:Maximum allocated vectors: 7
diff --git a/tests/trilinos/deal_solver_05.cc b/tests/trilinos/deal_solver_05.cc
new file mode 100644 (file)
index 0000000..c6a2b3b
--- /dev/null
@@ -0,0 +1,94 @@
+//----------------------------  trilinos_deal_solver_05.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_deal_solver_05.cc  ---------------------------
+
+// test the QMRS solver using the PETSc matrix and vector classes
+
+
+#include "../tests.h"
+#include "../lac/testmatrix.h"
+#include <cmath>
+#include <fstream>
+#include <iostream>
+#include <iomanip>
+#include <base/logstream.h>
+#include <lac/trilinos_sparse_matrix.h>
+#include <lac/trilinos_vector.h>
+#include <lac/solver_control.h>
+#include <lac/solver_cg.h>
+#include <lac/solver_gmres.h>
+#include <lac/solver_bicgstab.h>
+#include <lac/solver_richardson.h>
+#include <lac/solver_qmrs.h>
+#include <lac/precondition.h>
+#include <lac/vector_memory.h>
+#include <typeinfo>
+
+template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
+void
+check_solve( SOLVER& solver, const MATRIX& A,
+            VECTOR& u, VECTOR& f, const PRECONDITION& P)
+{
+  deallog << "Solver type: " << typeid(solver).name() << std::endl;
+  
+  u = 0.;
+  f = 1.;
+  try 
+    {
+      solver.solve(A,u,f,P);
+    }
+  catch (std::exception& e)
+    {
+      deallog << e.what() << std::endl;
+      abort ();
+    }
+
+  deallog << "Solver stopped after " << solver.control().last_step()
+          << " iterations" << std::endl;
+}
+
+
+int main(int argc, char **argv)
+{
+  std::ofstream logfile("deal_solver_05/output");
+  logfile.precision(4);
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+  
+  {
+    SolverControl control(100, 1.e-3);
+
+    const unsigned int size = 32;
+    unsigned int dim = (size-1)*(size-1);
+
+    deallog << "Size " << size << " Unknowns " << dim << std::endl;
+      
+                                     // Make matrix
+    FDMatrix testproblem(size, size);
+    TrilinosWrappers::SparseMatrix  A(dim, dim, 5);
+    testproblem.five_point(A);
+
+    TrilinosWrappers::Vector  f(dim);
+    TrilinosWrappers::Vector  u(dim);
+    f = 1.;
+    A.compress ();
+    f.compress ();
+    u.compress ();
+
+    GrowingVectorMemory<TrilinosWrappers::Vector> mem;
+    SolverQMRS<TrilinosWrappers::Vector> solver(control,mem);
+    PreconditionIdentity preconditioner;
+    check_solve (solver, A,u,f, preconditioner);
+  }
+}
+
diff --git a/tests/trilinos/deal_solver_05/cmp/generic b/tests/trilinos/deal_solver_05/cmp/generic
new file mode 100644 (file)
index 0000000..d864cd6
--- /dev/null
@@ -0,0 +1,8 @@
+
+DEAL::Size 32 Unknowns 961
+DEAL::Solver type: N6dealii10SolverQMRSINS_13PETScWrappers6VectorEEE
+DEAL:QMRS::Starting value 31.00
+DEAL:QMRS::Convergence step 46 value 0.0009063
+DEAL::Solver stopped after 46 iterations
+DEAL::GrowingVectorMemory:Overall allocated vectors: 5
+DEAL::GrowingVectorMemory:Maximum allocated vectors: 5
diff --git a/tests/trilinos/deal_solver_06.cc b/tests/trilinos/deal_solver_06.cc
new file mode 100644 (file)
index 0000000..8b36eaf
--- /dev/null
@@ -0,0 +1,92 @@
+//----------------------------  trilinos_deal_solver_06.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_deal_solver_06.cc  ---------------------------
+
+// test the Richardson solver using the PETSc matrix and vector classes
+
+
+#include "../tests.h"
+#include "../lac/testmatrix.h"
+#include <cmath>
+#include <fstream>
+#include <iostream>
+#include <iomanip>
+#include <base/logstream.h>
+#include <lac/trilinos_sparse_matrix.h>
+#include <lac/trilinos_vector.h>
+#include <lac/solver_control.h>
+#include <lac/solver_cg.h>
+#include <lac/solver_gmres.h>
+#include <lac/solver_bicgstab.h>
+#include <lac/solver_richardson.h>
+#include <lac/solver_qmrs.h>
+#include <lac/precondition.h>
+#include <lac/vector_memory.h>
+#include <typeinfo>
+
+template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
+void
+check_solve( SOLVER& solver, const MATRIX& A,
+            VECTOR& u, VECTOR& f, const PRECONDITION& P)
+{
+  deallog << "Solver type: " << typeid(solver).name() << std::endl;
+  
+  u = 0.;
+  f = 1.;
+  try 
+    {
+      solver.solve(A,u,f,P);
+    }
+  catch (std::exception& e)
+    {
+      deallog << e.what() << std::endl;
+    }
+
+  deallog << "Solver stopped after " << solver.control().last_step()
+          << " iterations" << std::endl;
+}
+
+
+int main(int argc, char **argv)
+{
+  std::ofstream logfile("deal_solver_06/output");
+  logfile.precision(4);
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  {
+    const unsigned int size = 32;
+    unsigned int dim = (size-1)*(size-1);
+    SolverControl control(10000, 1.e-3);
+
+    deallog << "Size " << size << " Unknowns " << dim << std::endl;
+      
+                                     // Make matrix
+    FDMatrix testproblem(size, size);
+    TrilinosWrappers::SparseMatrix  A(dim, dim, 5);
+    testproblem.five_point(A);
+
+    TrilinosWrappers::Vector  f(dim);
+    TrilinosWrappers::Vector  u(dim);
+    f = 1.;
+    A.compress ();
+    f.compress ();
+    u.compress ();
+
+    GrowingVectorMemory<TrilinosWrappers::Vector> mem;
+    SolverRichardson<TrilinosWrappers::Vector> solver(control,mem);
+    PreconditionIdentity preconditioner;
+    check_solve (solver, A,u,f, preconditioner);
+  }
+}
+
diff --git a/tests/trilinos/deal_solver_06/cmp/generic b/tests/trilinos/deal_solver_06/cmp/generic
new file mode 100644 (file)
index 0000000..487ad5b
--- /dev/null
@@ -0,0 +1,9 @@
+
+DEAL::Size 32 Unknowns 961
+DEAL::Solver type: N6dealii16SolverRichardsonINS_13PETScWrappers6VectorEEE
+DEAL:Richardson::Starting value 31.00
+DEAL:Richardson::Failure step 372 value nan
+DEAL::Iterative method reported convergence failure in step 372 with residual nan
+DEAL::Solver stopped after 372 iterations
+DEAL::GrowingVectorMemory:Overall allocated vectors: 2
+DEAL::GrowingVectorMemory:Maximum allocated vectors: 2
diff --git a/tests/trilinos/deal_solver_06/cmp/i386-apple-darwin8.10.1+gcc4.0 b/tests/trilinos/deal_solver_06/cmp/i386-apple-darwin8.10.1+gcc4.0
new file mode 100644 (file)
index 0000000..de4c75b
--- /dev/null
@@ -0,0 +1,9 @@
+
+DEAL::Size 32 Unknowns 961
+DEAL::Solver type: N6dealii16SolverRichardsonINS_13PETScWrappers6VectorEEE
+DEAL:Richardson::Starting value 31.00
+DEAL:Richardson::Failure step 10000 value nan
+DEAL::Iterative method reported convergence failure in step 10000 with residual nan
+DEAL::Solver stopped after 10000 iterations
+DEAL::GrowingVectorMemory:Overall allocated vectors: 2
+DEAL::GrowingVectorMemory:Maximum allocated vectors: 2
diff --git a/tests/trilinos/full_matrix_01.cc b/tests/trilinos/full_matrix_01.cc
new file mode 100644 (file)
index 0000000..5c7138e
--- /dev/null
@@ -0,0 +1,91 @@
+//----------------------------  trilinos_full_matrix_01.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_full_matrix_01.cc  ---------------------------
+
+
+// check setting elements in a petsc matrix using
+// TrilinosWrappers::FullMatrix::set()
+
+#include "../tests.h"
+#include <lac/trilinos_full_matrix.h>    
+#include <fstream>
+#include <iostream>
+
+
+void test (TrilinosWrappers::FullMatrix &m)
+{
+                                   // first set a few entries
+  for (unsigned int i=0; i<m.m(); ++i)
+    for (unsigned int j=0; j<m.m(); ++j)
+      if ((i+2*j+1) % 3 == 0)
+        m.set (i,j, i*j*.5+.5);
+
+  m.compress ();
+  
+                                   // then make sure we retrieve the same ones
+  for (unsigned int i=0; i<m.m(); ++i)
+    for (unsigned int j=0; j<m.m(); ++j)
+      if ((i+2*j+1) % 3 == 0)
+        {
+          Assert (m(i,j) == i*j*.5+.5, ExcInternalError());
+          Assert (m.el(i,j) == i*j*.5+.5, ExcInternalError());
+        }
+      else
+        {
+          Assert (m(i,j) == 0, ExcInternalError());
+          Assert (m.el(i,j) == 0, ExcInternalError());
+        }
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("full_matrix_01/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::FullMatrix m (5,5);
+        test (m);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/full_matrix_01/cmp/generic b/tests/trilinos/full_matrix_01/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/full_matrix_02.cc b/tests/trilinos/full_matrix_02.cc
new file mode 100644 (file)
index 0000000..0c1ed4b
--- /dev/null
@@ -0,0 +1,91 @@
+//----------------------------  trilinos_full_matrix_02.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_full_matrix_02.cc  ---------------------------
+
+
+// check setting elements in a petsc matrix using
+// TrilinosWrappers::FullMatrix::add()
+
+#include "../tests.h"
+#include <lac/trilinos_full_matrix.h>    
+#include <fstream>
+#include <iostream>
+
+
+void test (TrilinosWrappers::FullMatrix &m)
+{
+                                   // first set a few entries
+  for (unsigned int i=0; i<m.m(); ++i)
+    for (unsigned int j=0; j<m.m(); ++j)
+      if ((i+2*j+1) % 3 == 0)
+        m.add (i,j, i*j*.5+.5);
+
+  m.compress ();
+  
+                                   // then make sure we retrieve the same ones
+  for (unsigned int i=0; i<m.m(); ++i)
+    for (unsigned int j=0; j<m.m(); ++j)
+      if ((i+2*j+1) % 3 == 0)
+        {
+          Assert (m(i,j) == i*j*.5+.5, ExcInternalError());
+          Assert (m.el(i,j) == i*j*.5+.5, ExcInternalError());
+        }
+      else
+        {
+          Assert (m(i,j) == 0, ExcInternalError());
+          Assert (m.el(i,j) == 0, ExcInternalError());
+        }
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("full_matrix_02/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::FullMatrix m (5,5);
+        test (m);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/full_matrix_02/cmp/generic b/tests/trilinos/full_matrix_02/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/full_matrix_03.cc b/tests/trilinos/full_matrix_03.cc
new file mode 100644 (file)
index 0000000..de16191
--- /dev/null
@@ -0,0 +1,97 @@
+//----------------------------  trilinos_full_matrix_03.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_full_matrix_03.cc  ---------------------------
+
+
+// check setting elements in a petsc matrix using set() and add()
+// intermixed. this poses PETSc some problems, since one has to flush some
+// buffer in between these two types of operations
+
+#include "../tests.h"
+#include <lac/trilinos_full_matrix.h>    
+#include <fstream>
+#include <iostream>
+
+
+void test (TrilinosWrappers::FullMatrix &m)
+{
+                                   // first set a few entries
+  for (unsigned int i=0; i<m.m(); ++i)
+    for (unsigned int j=0; j<m.m(); ++j)
+      if ((i+2*j+1) % 3 == 0)
+        {
+          if (i*j % 2 == 0)
+            m.set (i,j, i*j*.5+.5);
+          else
+            m.add (i,j, i*j*.5+.5);
+        }
+  
+  m.compress ();
+  
+                                   // then make sure we retrieve the same ones
+  for (unsigned int i=0; i<m.m(); ++i)
+    for (unsigned int j=0; j<m.m(); ++j)
+      if ((i+2*j+1) % 3 == 0)
+        {
+          Assert (m(i,j) == i*j*.5+.5, ExcInternalError());
+          Assert (m.el(i,j) == i*j*.5+.5, ExcInternalError());
+        }
+      else
+        {
+          Assert (m(i,j) == 0, ExcInternalError());
+          Assert (m.el(i,j) == 0, ExcInternalError());
+        }
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("full_matrix_03/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::FullMatrix m (5,5);
+        test (m);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/full_matrix_03/cmp/generic b/tests/trilinos/full_matrix_03/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/full_matrix_04.cc b/tests/trilinos/full_matrix_04.cc
new file mode 100644 (file)
index 0000000..7159fdf
--- /dev/null
@@ -0,0 +1,71 @@
+//----------------------------  trilinos_full_matrix_04.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_full_matrix_04.cc  ---------------------------
+
+
+// check querying matrix sizes
+
+#include "../tests.h"
+#include <lac/trilinos_full_matrix.h>    
+#include <fstream>
+#include <iostream>
+
+
+void test (TrilinosWrappers::FullMatrix &m)
+{
+  Assert (m.m() == 5, ExcInternalError());
+  Assert (m.n() == 5, ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("full_matrix_04/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::FullMatrix m (5,5);
+        test (m);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/full_matrix_04/cmp/generic b/tests/trilinos/full_matrix_04/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/full_matrix_05.cc b/tests/trilinos/full_matrix_05.cc
new file mode 100644 (file)
index 0000000..f5b86a3
--- /dev/null
@@ -0,0 +1,101 @@
+//----------------------------  trilinos_full_matrix_05.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005, 2007 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.
+//
+//----------------------------  trilinos_full_matrix_05.cc  ---------------------------
+
+
+// check querying the number of nonzero elements in
+// TrilinosWrappers::FullMatrix
+
+#include "../tests.h"
+#include <lac/trilinos_full_matrix.h>    
+#include <fstream>
+#include <iostream>
+
+
+void test (TrilinosWrappers::FullMatrix &m)
+{
+                                   // first set a few entries. count how many
+                                   // entries we have
+  unsigned int counter = 0;
+  for (unsigned int i=0; i<m.m(); ++i)
+    for (unsigned int j=0; j<m.m(); ++j)
+      if ((i+2*j+1) % 3 == 0)
+        {
+          m.set (i,j, i*j*.5+.5);
+          ++counter;
+        }
+
+  m.compress ();
+
+                                  // prior to and including PETSc 2.3.0,
+                                  // n_nonzero_elements returns the actual
+                                  // number of nonzeros. after that, PETSc
+                                  // returns the *total* number of entries of
+                                  // this matrix. check both (in the case
+                                  // post 2.3.0, output a dummy number
+#if (DEAL_II_PETSC_VERSION_MAJOR == 2) &&\
+    ((DEAL_II_PETSC_VERSION_MINOR < 3)   \
+     ||\
+     ((DEAL_II_PETSC_VERSION_MINOR == 3) &&\
+      (DEAL_II_PETSC_VERSION_SUBMINOR == 0)))
+  deallog << m.n_nonzero_elements() << std::endl;
+  Assert (m.n_nonzero_elements() == counter,
+          ExcInternalError());
+#else
+  deallog << counter << std::endl;
+  Assert (m.m() * m.m(), ExcInternalError());
+#endif
+                                                                  
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("full_matrix_05/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::FullMatrix m (5,5);
+        test (m);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/full_matrix_05/cmp/generic b/tests/trilinos/full_matrix_05/cmp/generic
new file mode 100644 (file)
index 0000000..169db65
--- /dev/null
@@ -0,0 +1,3 @@
+
+DEAL::8
+DEAL::OK
diff --git a/tests/trilinos/full_matrix_06.cc b/tests/trilinos/full_matrix_06.cc
new file mode 100644 (file)
index 0000000..f127c07
--- /dev/null
@@ -0,0 +1,82 @@
+//----------------------------  trilinos_full_matrix_06.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_full_matrix_06.cc  ---------------------------
+
+
+// check TrilinosWrappers::FullMatrix::l1_norm
+
+#include "../tests.h"
+#include <lac/trilinos_full_matrix.h>    
+#include <fstream>
+#include <iostream>
+
+
+void test (TrilinosWrappers::FullMatrix &m)
+{
+                                   // first set a few entries. count how many
+                                   // entries we have
+  for (unsigned int i=0; i<m.m(); ++i)
+    for (unsigned int j=0; j<m.m(); ++j)
+      if ((i+2*j+1) % 3 == 0)
+        m.set (i,j, i*j*.5+.5);  
+
+  m.compress ();
+
+                                   // compare against the exact value of the
+                                   // l1-norm (max col-sum)
+  deallog << m.l1_norm() << std::endl;
+  Assert (m.l1_norm() == 7, ExcInternalError());
+  
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("full_matrix_06/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::FullMatrix m (5,5);
+        test (m);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/full_matrix_06/cmp/generic b/tests/trilinos/full_matrix_06/cmp/generic
new file mode 100644 (file)
index 0000000..c3a0c69
--- /dev/null
@@ -0,0 +1,3 @@
+
+DEAL::7.00000
+DEAL::OK
diff --git a/tests/trilinos/full_matrix_07.cc b/tests/trilinos/full_matrix_07.cc
new file mode 100644 (file)
index 0000000..95937fa
--- /dev/null
@@ -0,0 +1,82 @@
+//----------------------------  trilinos_full_matrix_07.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_full_matrix_07.cc  ---------------------------
+
+
+// check TrilinosWrappers::FullMatrix::linfty_norm
+
+#include "../tests.h"
+#include <lac/trilinos_full_matrix.h>    
+#include <fstream>
+#include <iostream>
+
+
+void test (TrilinosWrappers::FullMatrix &m)
+{
+                                   // first set a few entries. count how many
+                                   // entries we have
+  for (unsigned int i=0; i<m.m(); ++i)
+    for (unsigned int j=0; j<m.m(); ++j)
+      if ((i+2*j+1) % 3 == 0)
+        m.set (i,j, i*j*.5+.5);  
+
+  m.compress ();
+
+                                   // compare against the exact value of the
+                                   // linfty-norm (max row-sum)
+  deallog << m.linfty_norm() << std::endl;
+  Assert (m.linfty_norm() == 8.5, ExcInternalError());
+  
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("full_matrix_07/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::FullMatrix m (5,5);
+        test (m);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/full_matrix_07/cmp/generic b/tests/trilinos/full_matrix_07/cmp/generic
new file mode 100644 (file)
index 0000000..22d8c0e
--- /dev/null
@@ -0,0 +1,3 @@
+
+DEAL::8.50000
+DEAL::OK
diff --git a/tests/trilinos/full_matrix_08.cc b/tests/trilinos/full_matrix_08.cc
new file mode 100644 (file)
index 0000000..586c165
--- /dev/null
@@ -0,0 +1,87 @@
+//----------------------------  trilinos_full_matrix_08.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_full_matrix_08.cc  ---------------------------
+
+
+// check TrilinosWrappers::FullMatrix::frobenius_norm
+
+#include "../tests.h"
+#include <lac/trilinos_full_matrix.h>    
+#include <fstream>
+#include <iostream>
+
+
+void test (TrilinosWrappers::FullMatrix &m)
+{
+                                   // first set a few entries. count how many
+                                   // entries we have
+  PetscScalar norm = 0;
+  for (unsigned int i=0; i<m.m(); ++i)
+    for (unsigned int j=0; j<m.m(); ++j)
+      if ((i+2*j+1) % 3 == 0)
+        {
+          m.set (i,j, i*j*.5+.5);
+          norm += (i*j*.5+.5)*(i*j*.5+.5);
+        }
+  norm = std::sqrt(norm);
+
+  m.compress ();
+
+                                   // compare against the exact value of the
+                                   // l2-norm (max row-sum)
+  deallog << m.frobenius_norm() << std::endl;
+  Assert (m.frobenius_norm() == norm, ExcInternalError());
+  
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("full_matrix_08/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::FullMatrix m (5,5);
+        test (m);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/full_matrix_08/cmp/generic b/tests/trilinos/full_matrix_08/cmp/generic
new file mode 100644 (file)
index 0000000..d4083f6
--- /dev/null
@@ -0,0 +1,3 @@
+
+DEAL::9.04157
+DEAL::OK
diff --git a/tests/trilinos/full_matrix_09.cc b/tests/trilinos/full_matrix_09.cc
new file mode 100644 (file)
index 0000000..ad7c807
--- /dev/null
@@ -0,0 +1,94 @@
+//----------------------------  trilinos_full_matrix_09.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_full_matrix_09.cc  ---------------------------
+
+
+// check TrilinosWrappers::FullMatrix::operator *=
+
+#include "../tests.h"
+#include <lac/trilinos_full_matrix.h>    
+#include <fstream>
+#include <iostream>
+
+
+void test (TrilinosWrappers::FullMatrix &m)
+{
+                                   // first set a few entries
+  for (unsigned int i=0; i<m.m(); ++i)
+    for (unsigned int j=0; j<m.m(); ++j)
+      if ((i+2*j+1) % 3 == 0)
+        m.set (i,j, i*j*.5+.5);
+
+  m.compress ();
+  
+                                   // then multiply everything by 1.25 and
+                                   // make sure we retrieve the values we
+                                   // expect
+  m *= 1.25;
+  
+  for (unsigned int i=0; i<m.m(); ++i)
+    for (unsigned int j=0; j<m.m(); ++j)
+      if ((i+2*j+1) % 3 == 0)
+        {
+          Assert (m(i,j) == (i*j*.5+.5)*1.25, ExcInternalError());
+          Assert (m.el(i,j) == (i*j*.5+.5)*1.25, ExcInternalError());
+        }
+      else
+        {
+          Assert (m(i,j) == 0, ExcInternalError());
+          Assert (m.el(i,j) == 0, ExcInternalError());
+        }
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("full_matrix_09/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::FullMatrix m (5,5);
+        test (m);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/full_matrix_09/cmp/generic b/tests/trilinos/full_matrix_09/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/full_matrix_10.cc b/tests/trilinos/full_matrix_10.cc
new file mode 100644 (file)
index 0000000..b07d4a6
--- /dev/null
@@ -0,0 +1,94 @@
+//----------------------------  trilinos_full_matrix_10.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_full_matrix_10.cc  ---------------------------
+
+
+// check TrilinosWrappers::FullMatrix::operator /=
+
+#include "../tests.h"
+#include <lac/trilinos_full_matrix.h>    
+#include <fstream>
+#include <iostream>
+
+
+void test (TrilinosWrappers::FullMatrix &m)
+{
+                                   // first set a few entries
+  for (unsigned int i=0; i<m.m(); ++i)
+    for (unsigned int j=0; j<m.m(); ++j)
+      if ((i+2*j+1) % 3 == 0)
+        m.set (i,j, i*j*.5+.5);
+
+  m.compress ();
+  
+                                   // then divide everything by 4/3 and
+                                   // make sure we retrieve the values we
+                                   // expect
+  m /= 4./3.;
+  
+  for (unsigned int i=0; i<m.m(); ++i)
+    for (unsigned int j=0; j<m.m(); ++j)
+      if ((i+2*j+1) % 3 == 0)
+        {
+          Assert (m(i,j) == (i*j*.5+.5)/4*3, ExcInternalError());
+          Assert (m.el(i,j) == (i*j*.5+.5)/4*3, ExcInternalError());
+        }
+      else
+        {
+          Assert (m(i,j) == 0, ExcInternalError());
+          Assert (m.el(i,j) == 0, ExcInternalError());
+        }
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("full_matrix_10/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::FullMatrix m (5,5);
+        test (m);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/full_matrix_10/cmp/generic b/tests/trilinos/full_matrix_10/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/full_matrix_iterator_01.cc b/tests/trilinos/full_matrix_iterator_01.cc
new file mode 100644 (file)
index 0000000..7893861
--- /dev/null
@@ -0,0 +1,79 @@
+//----------------------------  trilinos_full_matrix_iterator_01.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_full_matrix_iterator_01.cc  ---------------------------
+
+
+// test TrilinosWrappers::MatrixBase::const_iterator
+
+#include "../tests.h"
+#include <lac/trilinos_full_matrix.h>    
+#include <fstream>
+#include <iostream>
+
+
+void test ()
+{
+  TrilinosWrappers::FullMatrix m(5,5);
+  m.set (0,0,1);
+  m.set (1,1,2);
+  m.set (1,2,3);  
+  m.compress ();
+  TrilinosWrappers::FullMatrix::const_iterator i = m.begin();
+  deallog << i->row() << ' ' << i->column() << ' ' << i->value() << std::endl;
+  ++i;
+  deallog << i->row() << ' ' << i->column() << ' ' << i->value() << std::endl;
+  i++;
+  deallog << i->row() << ' ' << i->column() << ' ' << i->value() << std::endl;
+  
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv)
+{
+  std::ofstream logfile("full_matrix_iterator_01/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        test ();
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/full_matrix_iterator_01/cmp/generic b/tests/trilinos/full_matrix_iterator_01/cmp/generic
new file mode 100644 (file)
index 0000000..144ae94
--- /dev/null
@@ -0,0 +1,5 @@
+
+DEAL::0 0 1.00000
+DEAL::0 1 0
+DEAL::0 2 0
+DEAL::OK
diff --git a/tests/trilinos/full_matrix_vector_01.cc b/tests/trilinos/full_matrix_vector_01.cc
new file mode 100644 (file)
index 0000000..fadd44b
--- /dev/null
@@ -0,0 +1,98 @@
+//----------------------------  trilinos_full_matrix_vector_01.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_full_matrix_vector_01.cc  ---------------------------
+
+
+// check FullMatrix::vmult
+
+#include "../tests.h"
+#include <lac/trilinos_vector.h>
+#include <lac/trilinos_full_matrix.h>
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::Vector &v,
+           TrilinosWrappers::Vector &w)
+{
+  TrilinosWrappers::FullMatrix m(v.size(),v.size());
+  for (unsigned int i=0; i<m.m(); ++i)
+    for (unsigned int j=0; j<m.m(); ++j)
+        m.set (i,j, i+2*j);
+
+  for (unsigned int i=0; i<v.size(); ++i)
+    v(i) = i;
+  
+  m.compress ();
+  v.compress ();
+  w.compress ();
+
+                                   // w:=Mv
+  m.vmult (w,v);
+
+                                   // make sure we get the expected result
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      Assert (v(i) == i, ExcInternalError());
+
+      double result = 0;
+      for (unsigned int j=0; j<m.m(); ++j)
+        result += (i+2*j)*j;
+      Assert (w(i) == result, ExcInternalError());
+    }
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc, char **argv)
+{
+  std::ofstream logfile("full_matrix_vector_01/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::Vector v (100);
+        TrilinosWrappers::Vector w (100);
+        test (v,w);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/full_matrix_vector_01/cmp/generic b/tests/trilinos/full_matrix_vector_01/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/full_matrix_vector_02.cc b/tests/trilinos/full_matrix_vector_02.cc
new file mode 100644 (file)
index 0000000..578900c
--- /dev/null
@@ -0,0 +1,98 @@
+//----------------------------  trilinos_full_matrix_vector_02.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_full_matrix_vector_02.cc  ---------------------------
+
+
+// check FullMatrix::Tvmult
+
+#include "../tests.h"
+#include <lac/trilinos_vector.h>
+#include <lac/trilinos_full_matrix.h>
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::Vector &v,
+           TrilinosWrappers::Vector &w)
+{
+  TrilinosWrappers::FullMatrix m(v.size(),v.size());
+  for (unsigned int i=0; i<m.m(); ++i)
+    for (unsigned int j=0; j<m.m(); ++j)
+        m.set (i,j, i+2*j);
+
+  for (unsigned int i=0; i<v.size(); ++i)
+    v(i) = i;
+  
+  m.compress ();
+  v.compress ();
+  w.compress ();
+
+                                   // w:=Mv
+  m.Tvmult (w,v);
+
+                                   // make sure we get the expected result
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      Assert (v(i) == i, ExcInternalError());
+
+      double result = 0;
+      for (unsigned int j=0; j<m.m(); ++j)
+        result += (j+2*i)*j;
+      Assert (w(i) == result, ExcInternalError());
+    }
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc, char **argv)
+{
+  std::ofstream logfile("full_matrix_vector_02/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::Vector v (100);
+        TrilinosWrappers::Vector w (100);
+        test (v,w);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/full_matrix_vector_02/cmp/generic b/tests/trilinos/full_matrix_vector_02/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/full_matrix_vector_03.cc b/tests/trilinos/full_matrix_vector_03.cc
new file mode 100644 (file)
index 0000000..fc18e17
--- /dev/null
@@ -0,0 +1,101 @@
+//----------------------------  trilinos_full_matrix_vector_03.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_full_matrix_vector_03.cc  ---------------------------
+
+
+// check FullMatrix::vmult_add
+
+#include "../tests.h"
+#include <lac/trilinos_vector.h>
+#include <lac/trilinos_full_matrix.h>
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::Vector &v,
+           TrilinosWrappers::Vector &w)
+{
+  TrilinosWrappers::FullMatrix m(v.size(),v.size());
+  for (unsigned int i=0; i<m.m(); ++i)
+    for (unsigned int j=0; j<m.m(); ++j)
+        m.set (i,j, i+2*j);
+
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      v(i) = i;
+      w(i) = i;
+    }
+  
+  m.compress ();
+  v.compress ();
+  w.compress ();
+
+                                   // w:=Mv
+  m.vmult_add (w,v);
+
+                                   // make sure we get the expected result
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      Assert (v(i) == i, ExcInternalError());
+
+      double result = 0;
+      for (unsigned int j=0; j<m.m(); ++j)
+        result += (i+2*j)*j;
+      Assert (w(i) == i+result, ExcInternalError());
+    }
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc, char **argv)
+{
+  std::ofstream logfile("full_matrix_vector_03/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::Vector v (100);
+        TrilinosWrappers::Vector w (100);
+        test (v,w);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/full_matrix_vector_03/cmp/generic b/tests/trilinos/full_matrix_vector_03/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/full_matrix_vector_04.cc b/tests/trilinos/full_matrix_vector_04.cc
new file mode 100644 (file)
index 0000000..1a4f0bd
--- /dev/null
@@ -0,0 +1,101 @@
+//----------------------------  trilinos_full_matrix_vector_04.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_full_matrix_vector_04.cc  ---------------------------
+
+
+// check FullMatrix::Tvmult_add
+
+#include "../tests.h"
+#include <lac/trilinos_vector.h>
+#include <lac/trilinos_full_matrix.h>
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::Vector &v,
+           TrilinosWrappers::Vector &w)
+{
+  TrilinosWrappers::FullMatrix m(v.size(),v.size());
+  for (unsigned int i=0; i<m.m(); ++i)
+    for (unsigned int j=0; j<m.m(); ++j)
+        m.set (i,j, i+2*j);
+
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      v(i) = i;
+      w(i) = i;
+    }
+  
+  m.compress ();
+  v.compress ();
+  w.compress ();
+
+                                   // w:=Mv
+  m.Tvmult_add (w,v);
+
+                                   // make sure we get the expected result
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      Assert (v(i) == i, ExcInternalError());
+
+      double result = 0;
+      for (unsigned int j=0; j<m.m(); ++j)
+        result += (j+2*i)*j;
+      Assert (w(i) == i+result, ExcInternalError());
+    }
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc, char **argv)
+{
+  std::ofstream logfile("full_matrix_vector_04/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::Vector v (100);
+        TrilinosWrappers::Vector w (100);
+        test (v,w);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/full_matrix_vector_04/cmp/generic b/tests/trilinos/full_matrix_vector_04/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/full_matrix_vector_05.cc b/tests/trilinos/full_matrix_vector_05.cc
new file mode 100644 (file)
index 0000000..9ebf850
--- /dev/null
@@ -0,0 +1,104 @@
+//----------------------------  trilinos_full_matrix_vector_05.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_full_matrix_vector_05.cc  ---------------------------
+
+
+// check FullMatrix::matrix_scalar_product
+
+#include "../tests.h"
+#include <lac/trilinos_vector.h>
+#include <lac/trilinos_full_matrix.h>
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::Vector &v,
+           TrilinosWrappers::Vector &w)
+{
+  TrilinosWrappers::FullMatrix m(v.size(),v.size());
+  for (unsigned int i=0; i<m.m(); ++i)
+    for (unsigned int j=0; j<m.m(); ++j)
+        m.set (i,j, i+2*j);
+
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      v(i) = i;
+      w(i) = i+1;
+    }
+  
+  m.compress ();
+  v.compress ();
+  w.compress ();
+
+                                   // <w,Mv>
+  const PetscScalar s = m.matrix_scalar_product (w,v);
+
+                                   // make sure we get the expected result
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      Assert (v(i) == i, ExcInternalError());
+      Assert (w(i) == i+1, ExcInternalError());
+    }
+
+  PetscScalar result = 0;
+  for (unsigned int i=0; i<m.m(); ++i)
+    for (unsigned int j=0; j<m.m(); ++j)
+      result += (i+2*j)*j*(i+1);
+
+  Assert (s == result, ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc, char **argv)
+{
+  std::ofstream logfile("full_matrix_vector_05/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::Vector v (100);
+        TrilinosWrappers::Vector w (100);
+        test (v,w);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/full_matrix_vector_05/cmp/generic b/tests/trilinos/full_matrix_vector_05/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/full_matrix_vector_06.cc b/tests/trilinos/full_matrix_vector_06.cc
new file mode 100644 (file)
index 0000000..a493342
--- /dev/null
@@ -0,0 +1,95 @@
+//----------------------------  trilinos_full_matrix_vector_06.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_full_matrix_vector_06.cc  ---------------------------
+
+
+// check FullMatrix::matrix_norm_square
+
+#include "../tests.h"
+#include <lac/trilinos_vector.h>
+#include <lac/trilinos_full_matrix.h>
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::Vector &v)
+{
+  TrilinosWrappers::FullMatrix m(v.size(),v.size());
+  for (unsigned int i=0; i<m.m(); ++i)
+    for (unsigned int j=0; j<m.m(); ++j)
+        m.set (i,j, i+2*j);
+
+  for (unsigned int i=0; i<v.size(); ++i)
+    v(i) = i;
+  
+  m.compress ();
+  v.compress ();
+
+                                   // <w,Mv>
+  const PetscScalar s = m.matrix_norm_square (v);
+
+                                   // make sure we get the expected result
+  for (unsigned int i=0; i<v.size(); ++i)
+    Assert (v(i) == i, ExcInternalError());
+
+  PetscScalar result = 0;
+  for (unsigned int i=0; i<m.m(); ++i)
+    for (unsigned int j=0; j<m.m(); ++j)
+      result += (i+2*j)*j*i;
+
+  Assert (s == result, ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc, char **argv)
+{
+  std::ofstream logfile("full_matrix_vector_06/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::Vector v (30);
+        test (v);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/full_matrix_vector_06/cmp/generic b/tests/trilinos/full_matrix_vector_06/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/full_matrix_vector_07.cc b/tests/trilinos/full_matrix_vector_07.cc
new file mode 100644 (file)
index 0000000..7aef057
--- /dev/null
@@ -0,0 +1,107 @@
+//----------------------------  trilinos_full_matrix_vector_07.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_full_matrix_vector_07.cc  ---------------------------
+
+
+// check FullMatrix::matrix_norm_square
+
+#include "../tests.h"
+#include <lac/trilinos_vector.h>
+#include <lac/trilinos_full_matrix.h>
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::Vector &v,
+           TrilinosWrappers::Vector &w,
+           TrilinosWrappers::Vector &x)
+{
+  TrilinosWrappers::FullMatrix m(v.size(),v.size());
+  for (unsigned int i=0; i<m.m(); ++i)
+    for (unsigned int j=0; j<m.m(); ++j)
+        m.set (i,j, i+2*j);
+
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      v(i) = i;
+      w(i) = i+1;
+    }
+      
+  m.compress ();
+  v.compress ();
+  w.compress ();
+
+                                   // x=w-Mv
+  const double s = m.residual (x, v, w);
+
+                                   // make sure we get the expected result
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      Assert (v(i) == i, ExcInternalError());
+      Assert (w(i) == i+1, ExcInternalError());
+
+      double result = i+1;
+      for (unsigned int j=0; j<m.m(); ++j)
+        result -= (i+2*j)*j;
+
+      Assert (x(i) == result, ExcInternalError());
+    }
+
+  Assert (s == x.l2_norm(), ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc, char **argv)
+{
+  std::ofstream logfile("full_matrix_vector_07/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::Vector v (100);
+        TrilinosWrappers::Vector w (100);
+        TrilinosWrappers::Vector x (100);
+        test (v,w,x);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/full_matrix_vector_07/cmp/generic b/tests/trilinos/full_matrix_vector_07/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/parallel_sparse_matrix_01.cc b/tests/trilinos/parallel_sparse_matrix_01.cc
new file mode 100644 (file)
index 0000000..1c6c1ea
--- /dev/null
@@ -0,0 +1,151 @@
+//----------------------------  trilinos_parallel_sparse_matrix_01.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_parallel_sparse_matrix_01.cc  ---------------------------
+
+
+// TrilinosWrappers::MPI::SparseMatrix::reinit(CompressedSparsityPattern) should
+// create a matrix that, when filled with elements that match the sparsity
+// pattern, doesn't require any more memory allocation any more. This is
+// tricky to get right, though, and took a while until it worked.
+//
+// the test itself can only check this when run in parallel, but we can add it
+// anyway to the testsuite. in order to check that the library actually does
+// what it is supposed to do, run this program with more than one MPI process
+// and with the option -log_info. All the output should say that no additional
+// malloc calls have been performed
+
+#include "../tests.h"
+#include <lac/trilinos_parallel_sparse_matrix.h>
+#include <lac/compressed_sparsity_pattern.h>
+#include <fstream>
+#include <cstdlib>
+
+
+unsigned int
+get_n_mpi_processes ()
+{
+  int n_jobs;
+  MPI_Comm_size (MPI_COMM_WORLD, &n_jobs);
+    
+  return n_jobs;
+}
+
+
+
+unsigned int
+get_this_mpi_process ()
+{
+  int rank;
+  MPI_Comm_rank (MPI_COMM_WORLD, &rank);
+    
+  return rank;
+}
+
+
+void test ()
+{
+                                   // create a parallel matrix where the first
+                                   // process has 10 rows, the second one 20,
+                                   // the third one 30, and so on
+  unsigned int N = 0;
+  std::vector<unsigned int> local_rows_per_process (get_n_mpi_processes());
+  std::vector<unsigned int> start_row (get_n_mpi_processes());
+  for (unsigned int i=0; i<get_n_mpi_processes(); ++i)
+    {
+      N += (i+1)*10;
+      local_rows_per_process[i] = (i+1)*10;
+      start_row[i] += i*10;
+    }
+
+                                   // here is a sparsity pattern for which we
+                                   // used to allocate additional memory for 2
+                                   // processes. note that only one of the
+                                   // four blocks uses Inodes
+  CompressedSparsityPattern csp (N,N);
+  for (unsigned int i=0; i<N; ++i)
+    for (unsigned int j=0; j<N; ++j)
+      {
+        csp.add (i,i);
+        if (i+local_rows_per_process.back() < N)
+          csp.add (i,i+local_rows_per_process.back());
+        if (i > local_rows_per_process.back())
+          csp.add (i,i-local_rows_per_process.back());
+      }
+
+                                   // here is a sparsity pattern for which no
+                                   // Inodes are used, but it doesn't allocate
+                                   // additional memory
+//   for (unsigned int bi=0; bi<get_n_mpi_processes(); ++bi)
+//     for (unsigned int bj=0; bj<get_n_mpi_processes(); ++bj)
+//       for (unsigned int i=0; i<local_rows_per_process[bi]; ++i)
+//         for (unsigned int k=0; k<6; ++k)
+//           csp.add (start_row[bi] + i,
+//                    start_row[bj] + (i+2*k) % local_rows_per_process[bj]);
+
+  
+  
+                                   // now create a matrix with this sparsity
+                                   // pattern
+  TrilinosWrappers::MPI::SparseMatrix m;
+  m.reinit (MPI_COMM_WORLD, csp, local_rows_per_process,
+            local_rows_per_process, get_this_mpi_process());
+
+                                   // no write into the exact same matrix
+                                   // entries as have been created by the
+                                   // sparsity pattern above
+  for (unsigned int i=0; i<N; ++i)
+    for (unsigned int j=0; j<csp.row_length(i); ++j)
+      m.add (i, csp.column_number(i,j), 1.);
+
+  m.compress ();
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("parallel_sparse_matrix_01/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      test ();
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/parallel_sparse_matrix_01/cmp/generic b/tests/trilinos/parallel_sparse_matrix_01/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/slowness_01.cc b/tests/trilinos/slowness_01.cc
new file mode 100644 (file)
index 0000000..292efb5
--- /dev/null
@@ -0,0 +1,143 @@
+//----------------------------  trilinos_slowness_01.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2005 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.
+//
+//----------------------------  trilinos_slowness_01.cc  ---------------------------
+
+
+// this is part of a whole suite of tests that checks the relative speed of
+// using PETSc for sparse matrices as compared to the speed of our own
+// library. the tests therefore may not all actually use PETSc, but they are
+// meant to compare it
+//
+// the tests build the 5-point stencil matrix for a uniform grid of size N*N
+
+#include "../tests.h"
+#include <lac/sparse_matrix.h>
+#include <lac/vector.h>
+#include <lac/trilinos_sparse_matrix.h>
+#include <fstream>
+#include <iostream>
+
+
+void test ()
+{
+  const unsigned int N = 200;
+
+                                   // first build the sparsity pattern
+  SparsityPattern sparsity (N*N, N*N, 5);
+  for(unsigned int i=0; i<N; i++)
+    for(unsigned int j=0; j<N; j++)
+      {
+        const unsigned int global = i*N+j;
+        sparsity.add(global, global);
+        if (j>0)
+          {
+            sparsity.add(global-1, global);
+            sparsity.add(global, global-1);
+          }
+        if (j<N-1)
+          {
+            sparsity.add(global+1, global);
+            sparsity.add(global, global+1);
+          }
+        if (i>0)
+          {
+            sparsity.add(global-N, global);
+            sparsity.add(global, global-N);
+          }
+        if (i<N-1)
+          {
+            sparsity.add(global+N, global);
+            sparsity.add(global, global+N);
+          }
+      }
+  sparsity.compress();
+  
+
+                                   // next build the sparse matrix itself
+  SparseMatrix<double> matrix (sparsity);
+  for(unsigned int i=0; i<N; i++)
+    for(unsigned int j=0; j<N; j++)
+      {
+        const unsigned int global = i*N+j;
+        matrix.add(global, global, 4);
+        if (j>0)
+          {
+            matrix.add(global-1, global, -1);
+            matrix.add(global, global-1, -1);
+          }
+        if (j<N-1)
+          {
+            matrix.add(global+1, global, -1);
+            matrix.add(global, global+1, -1);
+          }
+        if (i>0)
+          {
+            matrix.add(global-N, global, -1);
+            matrix.add(global, global-N, -1);
+          }
+        if (i<N-1)
+          {
+            matrix.add(global+N, global, -1);
+            matrix.add(global, global+N, -1);
+          }
+      }
+  
+                                   // then do a single matrix-vector
+                                   // multiplication with subsequent formation
+                                   // of the matrix norm
+  Vector<double> v1(N*N), v2(N*N);
+  for (unsigned int i=0; i<N*N; ++i)
+    v1(i) = i;
+  matrix.vmult (v2, v1);
+  
+  deallog << v1*v2 << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("slowness_01/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      {
+        test ();
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/slowness_01/cmp/generic b/tests/trilinos/slowness_01/cmp/generic
new file mode 100644 (file)
index 0000000..0d89007
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::-8.42635e+13
diff --git a/tests/trilinos/slowness_02.cc b/tests/trilinos/slowness_02.cc
new file mode 100644 (file)
index 0000000..d21205e
--- /dev/null
@@ -0,0 +1,114 @@
+//----------------------------  trilinos_slowness_02.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2005 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.
+//
+//----------------------------  trilinos_slowness_02.cc  ---------------------------
+
+
+// this is part of a whole suite of tests that checks the relative speed of
+// using PETSc for sparse matrices as compared to the speed of our own
+// library. the tests therefore may not all actually use PETSc, but they are
+// meant to compare it
+//
+// the tests build the 5-point stencil matrix for a uniform grid of size N*N
+
+#include "../tests.h"
+#include <lac/sparse_matrix.h>
+#include <lac/trilinos_sparse_matrix.h>
+#include <lac/trilinos_vector.h>
+#include <fstream>
+#include <iostream>
+
+
+void test ()
+{
+  const unsigned int N = 200;
+
+                                   // build the sparse matrix 
+  TrilinosWrappers::SparseMatrix matrix (N*N, N*N, 5);
+  for(unsigned int i=0; i<N; i++)
+    for(unsigned int j=0; j<N; j++)
+      {
+        const unsigned int global = i*N+j;
+        matrix.add(global, global, 4);
+        if (j>0)
+          {
+            matrix.add(global-1, global, -1);
+            matrix.add(global, global-1, -1);
+          }
+        if (j<N-1)
+          {
+            matrix.add(global+1, global, -1);
+            matrix.add(global, global+1, -1);
+          }
+        if (i>0)
+          {
+            matrix.add(global-N, global, -1);
+            matrix.add(global, global-N, -1);
+          }
+        if (i<N-1)
+          {
+            matrix.add(global+N, global, -1);
+            matrix.add(global, global+N, -1);
+          }
+      }
+  matrix.compress ();
+  
+  
+                                   // then do a single matrix-vector
+                                   // multiplication with subsequent formation
+                                   // of the matrix norm
+  TrilinosWrappers::Vector v1(N*N), v2(N*N);
+  for (unsigned int i=0; i<N*N; ++i)
+    v1(i) = i;
+  matrix.vmult (v2, v1);
+  
+  deallog << v1*v2 << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("slowness_02/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      {
+        test ();
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/slowness_02/cmp/generic b/tests/trilinos/slowness_02/cmp/generic
new file mode 100644 (file)
index 0000000..0d89007
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::-8.42635e+13
diff --git a/tests/trilinos/slowness_03.cc b/tests/trilinos/slowness_03.cc
new file mode 100644 (file)
index 0000000..4d4a42e
--- /dev/null
@@ -0,0 +1,117 @@
+//----------------------------  trilinos_slowness_03.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2005 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.
+//
+//----------------------------  trilinos_slowness_03.cc  ---------------------------
+
+
+// this is part of a whole suite of tests that checks the relative speed of
+// using PETSc for sparse matrices as compared to the speed of our own
+// library. the tests therefore may not all actually use PETSc, but they are
+// meant to compare it
+//
+// the tests build the 5-point stencil matrix for a uniform grid of size N*N
+
+#include "../tests.h"
+#include <lac/sparse_matrix.h>
+#include <lac/trilinos_parallel_sparse_matrix.h>
+#include <lac/trilinos_parallel_vector.h>
+#include <fstream>
+#include <iostream>
+
+
+void test ()
+{
+  const unsigned int N = 200;
+
+                                   // build the sparse matrix 
+  TrilinosWrappers::MPI::SparseMatrix matrix (PETSC_COMM_WORLD,
+                                           N*N, N*N,
+                                           N*N, N*N,
+                                           5);
+  for(unsigned int i=0; i<N; i++)
+    for(unsigned int j=0; j<N; j++)
+      {
+        const unsigned int global = i*N+j;
+        matrix.add(global, global, 4);
+        if (j>0)
+          {
+            matrix.add(global-1, global, -1);
+            matrix.add(global, global-1, -1);
+          }
+        if (j<N-1)
+          {
+            matrix.add(global+1, global, -1);
+            matrix.add(global, global+1, -1);
+          }
+        if (i>0)
+          {
+            matrix.add(global-N, global, -1);
+            matrix.add(global, global-N, -1);
+          }
+        if (i<N-1)
+          {
+            matrix.add(global+N, global, -1);
+            matrix.add(global, global+N, -1);
+          }
+      }
+  matrix.compress ();
+  
+                                   // then do a single matrix-vector
+                                   // multiplication with subsequent formation
+                                   // of the matrix norm
+  TrilinosWrappers::MPI::Vector v1(PETSC_COMM_WORLD, N*N, N*N);
+  TrilinosWrappers::MPI::Vector v2(PETSC_COMM_WORLD, N*N, N*N);
+  for (unsigned int i=0; i<N*N; ++i)
+    v1(i) = i;
+  matrix.vmult (v2, v1);
+  
+  deallog << v1*v2 << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("slowness_03/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      {
+        test ();
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/slowness_03/cmp/generic b/tests/trilinos/slowness_03/cmp/generic
new file mode 100644 (file)
index 0000000..0d89007
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::-8.42635e+13
diff --git a/tests/trilinos/slowness_04.cc b/tests/trilinos/slowness_04.cc
new file mode 100644 (file)
index 0000000..1638c84
--- /dev/null
@@ -0,0 +1,148 @@
+//----------------------------  trilinos_slowness_03.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2005 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.
+//
+//----------------------------  trilinos_slowness_03.cc  ---------------------------
+
+
+// this is part of a whole suite of tests that checks the relative speed of
+// using PETSc for sparse matrices as compared to the speed of our own
+// library. the tests therefore may not all actually use PETSc, but they are
+// meant to compare it
+//
+// the tests build the 5-point stencil matrix for a uniform grid of size N*N
+//
+// this test does the same as the _03 test, except that it does not allocate
+// the entries in consecutive order, but in pseudo-random order. the reason is
+// that in usual finite element programs, we do not write to the elements of a
+// matrix in a consecutive fashion, but rather according to the order of
+// degrees of freedom in the sequence of cells that we traverse
+
+#include "../tests.h"
+#include <lac/sparse_matrix.h>
+#include <lac/trilinos_parallel_sparse_matrix.h>
+#include <lac/trilinos_parallel_vector.h>
+#include <fstream>
+#include <iostream>
+
+
+void test ()
+{
+  const unsigned int N = 200;
+
+                                   // first find a random permutation of the
+                                   // indices
+  std::vector<unsigned int> permutation (N);
+  {
+    std::vector<unsigned int> unused_indices (N);
+    for (unsigned int i=0; i<N; i++)
+      unused_indices[i] = i;
+
+    for (unsigned int i=0; i<N; i++)
+      {
+                                         // pick a random element among the
+                                         // unused indices
+        const unsigned int k = rand() % (N-i);
+        permutation[i] = unused_indices[k];
+        
+                                         // then swap this used element to the
+                                         // end where we won't consider it any
+                                         // more
+        std::swap (unused_indices[k], unused_indices[N-i-1]);
+      }    
+  }
+  
+                                   // build the sparse matrix 
+  TrilinosWrappers::MPI::SparseMatrix matrix (PETSC_COMM_WORLD,
+                                           N*N, N*N,
+                                           N*N, N*N,
+                                           5);
+  for(unsigned int i_=0; i_<N; i_++)
+    for(unsigned int j_=0; j_<N; j_++)
+      {
+        const unsigned int i=permutation[i_];
+        const unsigned int j=permutation[j_];
+        
+        const unsigned int global = i*N+j;
+        matrix.add(global, global, rand());
+        if (j>0)
+          {
+            matrix.add(global-1, global, rand());
+            matrix.add(global, global-1, rand());
+          }
+        if (j<N-1)
+          {
+            matrix.add(global+1, global, rand());
+            matrix.add(global, global+1, rand());
+          }
+        if (i>0)
+          {
+            matrix.add(global-N, global, rand());
+            matrix.add(global, global-N, rand());
+          }
+        if (i<N-1)
+          {
+            matrix.add(global+N, global, rand());
+            matrix.add(global, global+N, rand());
+          }
+      }
+  matrix.compress ();
+  
+                                   // then do a single matrix-vector
+                                   // multiplication with subsequent formation
+                                   // of the matrix norm
+  TrilinosWrappers::MPI::Vector v1(PETSC_COMM_WORLD, N*N, N*N);
+  TrilinosWrappers::MPI::Vector v2(PETSC_COMM_WORLD, N*N, N*N);
+  for (unsigned int i=0; i<N*N; ++i)
+    v1(i) = i;
+  matrix.vmult (v2, v1);
+  
+  deallog << v1*v2 << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("slowness_04/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      {
+        test ();
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/slowness_04/cmp/generic b/tests/trilinos/slowness_04/cmp/generic
new file mode 100644 (file)
index 0000000..0528791
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::2.04928e+23
diff --git a/tests/trilinos/slowness_04/cmp/powerpc-apple-darwin8.10.0+gcc4.0 b/tests/trilinos/slowness_04/cmp/powerpc-apple-darwin8.10.0+gcc4.0
new file mode 100644 (file)
index 0000000..6bb9edc
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::2.04862e+23
diff --git a/tests/trilinos/solver_01.cc b/tests/trilinos/solver_01.cc
new file mode 100644 (file)
index 0000000..22cd9d6
--- /dev/null
@@ -0,0 +1,90 @@
+//----------------------------  trilinos_solver_01.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_solver_01.cc  ---------------------------
+
+// test the PETSc Richardson solver
+
+
+#include "../tests.h"
+#include "../lac/testmatrix.h"
+#include <cmath>
+#include <fstream>
+#include <iostream>
+#include <iomanip>
+#include <base/logstream.h>
+#include <lac/trilinos_sparse_matrix.h>
+#include <lac/trilinos_vector.h>
+#include <lac/trilinos_solver.h>
+#include <lac/trilinos_precondition.h>
+#include <lac/vector_memory.h>
+#include <typeinfo>
+
+template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
+void
+check_solve( SOLVER& solver, const MATRIX& A,
+            VECTOR& u, VECTOR& f, const PRECONDITION& P)
+{
+  deallog << "Solver type: " << typeid(solver).name() << std::endl;
+  
+  u = 0.;
+  f = 1.;
+  try 
+    {
+      solver.solve(A,u,f,P);
+    }
+  catch (std::exception& e)
+    {
+      deallog << e.what() << std::endl;
+                                       // it needs to be expected for the
+                                       // richardson solver that we end up
+                                       // here, so don't abort
+    }
+
+  deallog << "Solver stopped after " << solver.control().last_step()
+          << " iterations" << std::endl;
+}
+
+
+int main(int argc, char **argv)
+{
+  std::ofstream logfile("solver_01/output");
+  logfile.precision(4);
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+  
+  {
+    SolverControl control(100, 1.e-3);
+
+    const unsigned int size = 32;
+    unsigned int dim = (size-1)*(size-1);
+
+    deallog << "Size " << size << " Unknowns " << dim << std::endl;
+      
+                                     // Make matrix
+    FDMatrix testproblem(size, size);
+    TrilinosWrappers::SparseMatrix  A(dim, dim, 5);
+    testproblem.five_point(A);
+
+    TrilinosWrappers::Vector  f(dim);
+    TrilinosWrappers::Vector  u(dim);
+    f = 1.;
+    A.compress ();
+    f.compress ();
+    u.compress ();
+
+    TrilinosWrappers::SolverRichardson solver(control);
+    TrilinosWrappers::PreconditionJacobi preconditioner(A);
+    check_solve (solver, A,u,f, preconditioner);
+  }
+}
+
diff --git a/tests/trilinos/solver_01/cmp/generic b/tests/trilinos/solver_01/cmp/generic
new file mode 100644 (file)
index 0000000..208bfd4
--- /dev/null
@@ -0,0 +1,7 @@
+
+DEAL::Size 32 Unknowns 961
+DEAL::Solver type: N6dealii13PETScWrappers16SolverRichardsonE
+DEAL::Starting value 7.750
+DEAL::Failure step 100 value 4.004
+DEAL::Iterative method reported convergence failure in step 100 with residual 4.00437
+DEAL::Solver stopped after 100 iterations
diff --git a/tests/trilinos/solver_02.cc b/tests/trilinos/solver_02.cc
new file mode 100644 (file)
index 0000000..5eb0ff3
--- /dev/null
@@ -0,0 +1,89 @@
+//----------------------------  trilinos_solver_02.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_solver_02.cc  ---------------------------
+
+// test the PETSc Chebychev solver
+
+
+#include "../tests.h"
+#include "../lac/testmatrix.h"
+#include <cmath>
+#include <fstream>
+#include <iostream>
+#include <iomanip>
+#include <base/logstream.h>
+#include <lac/trilinos_sparse_matrix.h>
+#include <lac/trilinos_vector.h>
+#include <lac/trilinos_solver.h>
+#include <lac/trilinos_precondition.h>
+#include <lac/vector_memory.h>
+#include <typeinfo>
+
+template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
+void
+check_solve( SOLVER& solver, const MATRIX& A,
+            VECTOR& u, VECTOR& f, const PRECONDITION& P)
+{
+  deallog << "Solver type: " << typeid(solver).name() << std::endl;
+  
+  u = 0.;
+  f = 1.;
+  try 
+    {
+      solver.solve(A,u,f,P);
+    }
+  catch (std::exception& e)
+    {
+      deallog << e.what() << std::endl;
+                                       // just like for Richardson: we end up
+                                       // here normally for this solver
+    }
+
+  deallog << "Solver stopped after " << solver.control().last_step()
+          << " iterations" << std::endl;
+}
+
+
+int main(int argc, char **argv)
+{
+  std::ofstream logfile("solver_02/output");
+  logfile.precision(4);
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  {  
+    SolverControl control(100, 1.e-3);
+
+    const unsigned int size = 32;
+    unsigned int dim = (size-1)*(size-1);
+
+    deallog << "Size " << size << " Unknowns " << dim << std::endl;
+      
+                                     // Make matrix
+    FDMatrix testproblem(size, size);
+    TrilinosWrappers::SparseMatrix  A(dim, dim, 5);
+    testproblem.five_point(A);
+
+    TrilinosWrappers::Vector  f(dim);
+    TrilinosWrappers::Vector  u(dim);
+    f = 1.;
+    A.compress ();
+    f.compress ();
+    u.compress ();
+
+    TrilinosWrappers::SolverChebychev solver(control);
+    TrilinosWrappers::PreconditionJacobi preconditioner(A);
+    check_solve (solver, A,u,f, preconditioner);
+  }
+}
+
diff --git a/tests/trilinos/solver_02/cmp/generic b/tests/trilinos/solver_02/cmp/generic
new file mode 100644 (file)
index 0000000..ec61667
--- /dev/null
@@ -0,0 +1,7 @@
+
+DEAL::Size 32 Unknowns 961
+DEAL::Solver type: N6dealii13PETScWrappers15SolverChebychevE
+DEAL::Starting value 7.745
+DEAL::Failure step 100 value 3.885
+DEAL::Iterative method reported convergence failure in step 100 with residual 3.88526
+DEAL::Solver stopped after 100 iterations
diff --git a/tests/trilinos/solver_03.cc b/tests/trilinos/solver_03.cc
new file mode 100644 (file)
index 0000000..9a68a74
--- /dev/null
@@ -0,0 +1,88 @@
+//----------------------------  trilinos_solver_03.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_solver_03.cc  ---------------------------
+
+// test the PETSc CG solver
+
+
+#include "../tests.h"
+#include "../lac/testmatrix.h"
+#include <cmath>
+#include <fstream>
+#include <iostream>
+#include <iomanip>
+#include <base/logstream.h>
+#include <lac/trilinos_sparse_matrix.h>
+#include <lac/trilinos_vector.h>
+#include <lac/trilinos_solver.h>
+#include <lac/trilinos_precondition.h>
+#include <lac/vector_memory.h>
+#include <typeinfo>
+
+template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
+void
+check_solve( SOLVER& solver, const MATRIX& A,
+            VECTOR& u, VECTOR& f, const PRECONDITION& P)
+{
+  deallog << "Solver type: " << typeid(solver).name() << std::endl;
+  
+  u = 0.;
+  f = 1.;
+  try 
+    {
+      solver.solve(A,u,f,P);
+    }
+  catch (std::exception& e)
+    {
+      deallog << e.what() << std::endl;
+      abort ();
+    }
+
+  deallog << "Solver stopped after " << solver.control().last_step()
+          << " iterations" << std::endl;
+}
+
+
+int main(int argc, char **argv)
+{
+  std::ofstream logfile("solver_03/output");
+  logfile.precision(4);
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  {  
+    SolverControl control(100, 1.e-3);
+
+    const unsigned int size = 32;
+    unsigned int dim = (size-1)*(size-1);
+
+    deallog << "Size " << size << " Unknowns " << dim << std::endl;
+      
+                                     // Make matrix
+    FDMatrix testproblem(size, size);
+    TrilinosWrappers::SparseMatrix  A(dim, dim, 5);
+    testproblem.five_point(A);
+
+    TrilinosWrappers::Vector  f(dim);
+    TrilinosWrappers::Vector  u(dim);
+    f = 1.;
+    A.compress ();
+    f.compress ();
+    u.compress ();
+
+    TrilinosWrappers::SolverCG solver(control);
+    TrilinosWrappers::PreconditionJacobi preconditioner(A);
+    check_solve (solver, A,u,f, preconditioner);
+  }
+}
+
diff --git a/tests/trilinos/solver_03/cmp/generic b/tests/trilinos/solver_03/cmp/generic
new file mode 100644 (file)
index 0000000..2237281
--- /dev/null
@@ -0,0 +1,6 @@
+
+DEAL::Size 32 Unknowns 961
+DEAL::Solver type: N6dealii13PETScWrappers8SolverCGE
+DEAL::Starting value 7.750
+DEAL::Convergence step 41 value 0.0006730
+DEAL::Solver stopped after 41 iterations
diff --git a/tests/trilinos/solver_04.cc b/tests/trilinos/solver_04.cc
new file mode 100644 (file)
index 0000000..ddd924f
--- /dev/null
@@ -0,0 +1,88 @@
+//----------------------------  trilinos_solver_04.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_solver_04.cc  ---------------------------
+
+// test the PETSc BiCG solver
+
+
+#include "../tests.h"
+#include "../lac/testmatrix.h"
+#include <cmath>
+#include <fstream>
+#include <iostream>
+#include <iomanip>
+#include <base/logstream.h>
+#include <lac/trilinos_sparse_matrix.h>
+#include <lac/trilinos_vector.h>
+#include <lac/trilinos_solver.h>
+#include <lac/trilinos_precondition.h>
+#include <lac/vector_memory.h>
+#include <typeinfo>
+
+template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
+void
+check_solve( SOLVER& solver, const MATRIX& A,
+            VECTOR& u, VECTOR& f, const PRECONDITION& P)
+{
+  deallog << "Solver type: " << typeid(solver).name() << std::endl;
+  
+  u = 0.;
+  f = 1.;
+  try 
+    {
+      solver.solve(A,u,f,P);
+    }
+  catch (std::exception& e)
+    {
+      deallog << e.what() << std::endl;
+      abort ();
+    }
+
+  deallog << "Solver stopped after " << solver.control().last_step()
+          << " iterations" << std::endl;
+}
+
+
+int main(int argc, char **argv)
+{
+  std::ofstream logfile("solver_04/output");
+  logfile.precision(4);
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  {  
+    SolverControl control(100, 1.e-3);
+
+    const unsigned int size = 32;
+    unsigned int dim = (size-1)*(size-1);
+
+    deallog << "Size " << size << " Unknowns " << dim << std::endl;
+      
+                                     // Make matrix
+    FDMatrix testproblem(size, size);
+    TrilinosWrappers::SparseMatrix  A(dim, dim, 5);
+    testproblem.five_point(A);
+
+    TrilinosWrappers::Vector  f(dim);
+    TrilinosWrappers::Vector  u(dim);
+    f = 1.;
+    A.compress ();
+    f.compress ();
+    u.compress ();
+
+    TrilinosWrappers::SolverBiCG solver(control);
+    TrilinosWrappers::PreconditionJacobi preconditioner(A);
+    check_solve (solver, A,u,f, preconditioner);
+  }
+}
+
diff --git a/tests/trilinos/solver_04/cmp/generic b/tests/trilinos/solver_04/cmp/generic
new file mode 100644 (file)
index 0000000..d69ef94
--- /dev/null
@@ -0,0 +1,6 @@
+
+DEAL::Size 32 Unknowns 961
+DEAL::Solver type: N6dealii13PETScWrappers10SolverBiCGE
+DEAL::Starting value 7.750
+DEAL::Convergence step 41 value 0.0006730
+DEAL::Solver stopped after 41 iterations
diff --git a/tests/trilinos/solver_05.cc b/tests/trilinos/solver_05.cc
new file mode 100644 (file)
index 0000000..86f9e02
--- /dev/null
@@ -0,0 +1,88 @@
+//----------------------------  trilinos_solver_05.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_solver_05.cc  ---------------------------
+
+// test the PETSc GMRES solver
+
+
+#include "../tests.h"
+#include "../lac/testmatrix.h"
+#include <cmath>
+#include <fstream>
+#include <iostream>
+#include <iomanip>
+#include <base/logstream.h>
+#include <lac/trilinos_sparse_matrix.h>
+#include <lac/trilinos_vector.h>
+#include <lac/trilinos_solver.h>
+#include <lac/trilinos_precondition.h>
+#include <lac/vector_memory.h>
+#include <typeinfo>
+
+template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
+void
+check_solve( SOLVER& solver, const MATRIX& A,
+            VECTOR& u, VECTOR& f, const PRECONDITION& P)
+{
+  deallog << "Solver type: " << typeid(solver).name() << std::endl;
+  
+  u = 0.;
+  f = 1.;
+  try 
+    {
+      solver.solve(A,u,f,P);
+    }
+  catch (std::exception& e)
+    {
+      deallog << e.what() << std::endl;
+      abort ();
+    }
+
+  deallog << "Solver stopped after " << solver.control().last_step()
+          << " iterations" << std::endl;
+}
+
+
+int main(int argc, char **argv)
+{
+  std::ofstream logfile("solver_05/output");
+  logfile.precision(4);
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  {  
+    SolverControl control(100, 1.e-3);
+
+    const unsigned int size = 32;
+    unsigned int dim = (size-1)*(size-1);
+
+    deallog << "Size " << size << " Unknowns " << dim << std::endl;
+      
+                                     // Make matrix
+    FDMatrix testproblem(size, size);
+    TrilinosWrappers::SparseMatrix  A(dim, dim, 5);
+    testproblem.five_point(A);
+
+    TrilinosWrappers::Vector  f(dim);
+    TrilinosWrappers::Vector  u(dim);
+    f = 1.;
+    A.compress ();
+    f.compress ();
+    u.compress ();
+
+    TrilinosWrappers::SolverGMRES solver(control);
+    TrilinosWrappers::PreconditionJacobi preconditioner(A);
+    check_solve (solver, A,u,f, preconditioner);
+  }
+}
+
diff --git a/tests/trilinos/solver_05/cmp/generic b/tests/trilinos/solver_05/cmp/generic
new file mode 100644 (file)
index 0000000..d06c236
--- /dev/null
@@ -0,0 +1,6 @@
+
+DEAL::Size 32 Unknowns 961
+DEAL::Solver type: N6dealii13PETScWrappers11SolverGMRESE
+DEAL::Starting value 7.750
+DEAL::Convergence step 48 value 0.0009841
+DEAL::Solver stopped after 48 iterations
diff --git a/tests/trilinos/solver_06.cc b/tests/trilinos/solver_06.cc
new file mode 100644 (file)
index 0000000..806f3b9
--- /dev/null
@@ -0,0 +1,88 @@
+//----------------------------  trilinos_solver_06.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_solver_06.cc  ---------------------------
+
+// test the PETSc Bicgstab solver
+
+
+#include "../tests.h"
+#include "../lac/testmatrix.h"
+#include <cmath>
+#include <fstream>
+#include <iostream>
+#include <iomanip>
+#include <base/logstream.h>
+#include <lac/trilinos_sparse_matrix.h>
+#include <lac/trilinos_vector.h>
+#include <lac/trilinos_solver.h>
+#include <lac/trilinos_precondition.h>
+#include <lac/vector_memory.h>
+#include <typeinfo>
+
+template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
+void
+check_solve( SOLVER& solver, const MATRIX& A,
+            VECTOR& u, VECTOR& f, const PRECONDITION& P)
+{
+  deallog << "Solver type: " << typeid(solver).name() << std::endl;
+  
+  u = 0.;
+  f = 1.;
+  try 
+    {
+      solver.solve(A,u,f,P);
+    }
+  catch (std::exception& e)
+    {
+      deallog << e.what() << std::endl;
+      abort ();
+    }
+
+  deallog << "Solver stopped after " << solver.control().last_step()
+          << " iterations" << std::endl;
+}
+
+
+int main(int argc, char **argv)
+{
+  std::ofstream logfile("solver_06/output");
+  logfile.precision(4);
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+  
+  {
+    SolverControl control(100, 1.e-3);
+
+    const unsigned int size = 32;
+    unsigned int dim = (size-1)*(size-1);
+
+    deallog << "Size " << size << " Unknowns " << dim << std::endl;
+      
+                                     // Make matrix
+    FDMatrix testproblem(size, size);
+    TrilinosWrappers::SparseMatrix  A(dim, dim, 5);
+    testproblem.five_point(A);
+
+    TrilinosWrappers::Vector  f(dim);
+    TrilinosWrappers::Vector  u(dim);
+    f = 1.;
+    A.compress ();
+    f.compress ();
+    u.compress ();
+
+    TrilinosWrappers::SolverBicgstab solver(control);
+    TrilinosWrappers::PreconditionJacobi preconditioner(A);
+    check_solve (solver, A,u,f, preconditioner);
+  }
+}
+
diff --git a/tests/trilinos/solver_06/cmp/generic b/tests/trilinos/solver_06/cmp/generic
new file mode 100644 (file)
index 0000000..073a215
--- /dev/null
@@ -0,0 +1,6 @@
+
+DEAL::Size 32 Unknowns 961
+DEAL::Solver type: N6dealii13PETScWrappers14SolverBicgstabE
+DEAL::Starting value 7.750
+DEAL::Convergence step 33 value 0.0005745
+DEAL::Solver stopped after 33 iterations
diff --git a/tests/trilinos/solver_06/cmp/i386-apple-darwin8.10.1+gcc4.0 b/tests/trilinos/solver_06/cmp/i386-apple-darwin8.10.1+gcc4.0
new file mode 100644 (file)
index 0000000..3251a82
--- /dev/null
@@ -0,0 +1,6 @@
+
+DEAL::Size 32 Unknowns 961
+DEAL::Solver type: N6dealii13PETScWrappers14SolverBicgstabE
+DEAL::Starting value 7.750
+DEAL::Convergence step 33 value 0.0005777
+DEAL::Solver stopped after 33 iterations
diff --git a/tests/trilinos/solver_06/cmp/powerpc-apple-darwin8.10.0+gcc4.0 b/tests/trilinos/solver_06/cmp/powerpc-apple-darwin8.10.0+gcc4.0
new file mode 100644 (file)
index 0000000..fc4eb83
--- /dev/null
@@ -0,0 +1,6 @@
+
+DEAL::Size 32 Unknowns 961
+DEAL::Solver type: N6dealii13PETScWrappers14SolverBicgstabE
+DEAL::Starting value 7.750
+DEAL::Convergence step 33 value 0.0005766
+DEAL::Solver stopped after 33 iterations
diff --git a/tests/trilinos/solver_06/cmp/x86_64-unknown-linux-gnu+gcc3.3 b/tests/trilinos/solver_06/cmp/x86_64-unknown-linux-gnu+gcc3.3
new file mode 100644 (file)
index 0000000..3251a82
--- /dev/null
@@ -0,0 +1,6 @@
+
+DEAL::Size 32 Unknowns 961
+DEAL::Solver type: N6dealii13PETScWrappers14SolverBicgstabE
+DEAL::Starting value 7.750
+DEAL::Convergence step 33 value 0.0005777
+DEAL::Solver stopped after 33 iterations
diff --git a/tests/trilinos/solver_07.cc b/tests/trilinos/solver_07.cc
new file mode 100644 (file)
index 0000000..797ca4f
--- /dev/null
@@ -0,0 +1,88 @@
+//----------------------------  trilinos_solver_07.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_solver_07.cc  ---------------------------
+
+// test the PETSc CGS solver
+
+
+#include "../tests.h"
+#include "../lac/testmatrix.h"
+#include <cmath>
+#include <fstream>
+#include <iostream>
+#include <iomanip>
+#include <base/logstream.h>
+#include <lac/trilinos_sparse_matrix.h>
+#include <lac/trilinos_vector.h>
+#include <lac/trilinos_solver.h>
+#include <lac/trilinos_precondition.h>
+#include <lac/vector_memory.h>
+#include <typeinfo>
+
+template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
+void
+check_solve( SOLVER& solver, const MATRIX& A,
+            VECTOR& u, VECTOR& f, const PRECONDITION& P)
+{
+  deallog << "Solver type: " << typeid(solver).name() << std::endl;
+  
+  u = 0.;
+  f = 1.;
+  try 
+    {
+      solver.solve(A,u,f,P);
+    }
+  catch (std::exception& e)
+    {
+      deallog << e.what() << std::endl;
+      abort ();
+    }
+
+  deallog << "Solver stopped after " << solver.control().last_step()
+          << " iterations" << std::endl;
+}
+
+
+int main(int argc, char **argv)
+{
+  std::ofstream logfile("solver_07/output");
+  logfile.precision(4);
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  {
+    SolverControl control(100, 1.e-3);
+
+    const unsigned int size = 32;
+    unsigned int dim = (size-1)*(size-1);
+
+    deallog << "Size " << size << " Unknowns " << dim << std::endl;
+      
+                                     // Make matrix
+    FDMatrix testproblem(size, size);
+    TrilinosWrappers::SparseMatrix  A(dim, dim, 5);
+    testproblem.five_point(A);
+
+    TrilinosWrappers::Vector  f(dim);
+    TrilinosWrappers::Vector  u(dim);
+    f = 1.;
+    A.compress ();
+    f.compress ();
+    u.compress ();
+
+    TrilinosWrappers::SolverCGS solver(control);
+    TrilinosWrappers::PreconditionJacobi preconditioner(A);
+    check_solve (solver, A,u,f, preconditioner);
+  }
+}
+
diff --git a/tests/trilinos/solver_07/cmp/generic b/tests/trilinos/solver_07/cmp/generic
new file mode 100644 (file)
index 0000000..f4c2702
--- /dev/null
@@ -0,0 +1,6 @@
+
+DEAL::Size 32 Unknowns 961
+DEAL::Solver type: N6dealii13PETScWrappers9SolverCGSE
+DEAL::Starting value 7.750
+DEAL::Convergence step 40 value 0.0007519
+DEAL::Solver stopped after 40 iterations
diff --git a/tests/trilinos/solver_08.cc b/tests/trilinos/solver_08.cc
new file mode 100644 (file)
index 0000000..519d061
--- /dev/null
@@ -0,0 +1,88 @@
+//----------------------------  trilinos_solver_08.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_solver_08.cc  ---------------------------
+
+// test the PETSc TFQMR solver
+
+
+#include "../tests.h"
+#include "../lac/testmatrix.h"
+#include <cmath>
+#include <fstream>
+#include <iostream>
+#include <iomanip>
+#include <base/logstream.h>
+#include <lac/trilinos_sparse_matrix.h>
+#include <lac/trilinos_vector.h>
+#include <lac/trilinos_solver.h>
+#include <lac/trilinos_precondition.h>
+#include <lac/vector_memory.h>
+#include <typeinfo>
+
+template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
+void
+check_solve( SOLVER& solver, const MATRIX& A,
+            VECTOR& u, VECTOR& f, const PRECONDITION& P)
+{
+  deallog << "Solver type: " << typeid(solver).name() << std::endl;
+  
+  u = 0.;
+  f = 1.;
+  try 
+    {
+      solver.solve(A,u,f,P);
+    }
+  catch (std::exception& e)
+    {
+      deallog << e.what() << std::endl;
+      abort ();
+    }
+
+  deallog << "Solver stopped after " << solver.control().last_step()
+          << " iterations" << std::endl;
+}
+
+
+int main(int argc, char **argv)
+{
+  std::ofstream logfile("solver_08/output");
+  logfile.precision(4);
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+  
+  {
+    SolverControl control(100, 1.e-3);
+
+    const unsigned int size = 32;
+    unsigned int dim = (size-1)*(size-1);
+
+    deallog << "Size " << size << " Unknowns " << dim << std::endl;
+      
+                                     // Make matrix
+    FDMatrix testproblem(size, size);
+    TrilinosWrappers::SparseMatrix  A(dim, dim, 5);
+    testproblem.five_point(A);
+
+    TrilinosWrappers::Vector  f(dim);
+    TrilinosWrappers::Vector  u(dim);
+    f = 1.;
+    A.compress ();
+    f.compress ();
+    u.compress ();
+
+    TrilinosWrappers::SolverTFQMR solver(control);
+    TrilinosWrappers::PreconditionJacobi preconditioner(A);
+    check_solve (solver, A,u,f, preconditioner);
+  }
+}
+
diff --git a/tests/trilinos/solver_08/cmp/generic b/tests/trilinos/solver_08/cmp/generic
new file mode 100644 (file)
index 0000000..7f1d94f
--- /dev/null
@@ -0,0 +1,6 @@
+
+DEAL::Size 32 Unknowns 961
+DEAL::Solver type: N6dealii13PETScWrappers11SolverTFQMRE
+DEAL::Starting value 7.750
+DEAL::Convergence step 40 value 0.0008680
+DEAL::Solver stopped after 40 iterations
diff --git a/tests/trilinos/solver_09.cc b/tests/trilinos/solver_09.cc
new file mode 100644 (file)
index 0000000..39e6bed
--- /dev/null
@@ -0,0 +1,92 @@
+//----------------------------  trilinos_solver_09.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_solver_09.cc  ---------------------------
+
+// test the PETSc TCQMR solver
+//
+// note that this test fails on PETSc 2.1.6 due to a bug in the TCQMR
+// implementation. this is reported and should be fixed soonish
+
+
+
+#include "../tests.h"
+#include "../lac/testmatrix.h"
+#include <cmath>
+#include <fstream>
+#include <iostream>
+#include <iomanip>
+#include <base/logstream.h>
+#include <lac/trilinos_sparse_matrix.h>
+#include <lac/trilinos_vector.h>
+#include <lac/trilinos_solver.h>
+#include <lac/trilinos_precondition.h>
+#include <lac/vector_memory.h>
+#include <typeinfo>
+
+template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
+void
+check_solve( SOLVER& solver, const MATRIX& A,
+            VECTOR& u, VECTOR& f, const PRECONDITION& P)
+{
+  deallog << "Solver type: " << typeid(solver).name() << std::endl;
+  
+  u = 0.;
+  f = 1.;
+  try 
+    {
+      solver.solve(A,u,f,P);
+    }
+  catch (std::exception& e)
+    {
+      deallog << e.what() << std::endl;
+      abort ();
+    }
+
+  deallog << "Solver stopped after " << solver.control().last_step()
+          << " iterations" << std::endl;
+}
+
+
+int main(int argc, char **argv)
+{
+  std::ofstream logfile("solver_09/output");
+  logfile.precision(4);
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+  
+  {
+    SolverControl control(100, 1.e-3);
+
+    const unsigned int size = 32;
+    unsigned int dim = (size-1)*(size-1);
+
+    deallog << "Size " << size << " Unknowns " << dim << std::endl;
+      
+                                     // Make matrix
+    FDMatrix testproblem(size, size);
+    TrilinosWrappers::SparseMatrix  A(dim, dim, 5);
+    testproblem.five_point(A);
+
+    TrilinosWrappers::Vector  f(dim);
+    TrilinosWrappers::Vector  u(dim);
+    f = 1.;
+    A.compress ();
+    f.compress ();
+    u.compress ();
+
+    TrilinosWrappers::SolverTCQMR solver(control);
+    TrilinosWrappers::PreconditionJacobi preconditioner(A);
+    check_solve (solver, A,u,f, preconditioner);
+  }
+}
+
diff --git a/tests/trilinos/solver_09/cmp/generic b/tests/trilinos/solver_09/cmp/generic
new file mode 100644 (file)
index 0000000..c1e7ffb
--- /dev/null
@@ -0,0 +1,7 @@
+
+DEAL::Size 32 Unknowns 961
+DEAL::Solver type: N6dealii13PETScWrappers11SolverTCQMRE
+DEAL::Starting value 7.750
+DEAL::Starting value 7.750
+DEAL::Convergence step 44 value 0.0007016
+DEAL::Solver stopped after 44 iterations
diff --git a/tests/trilinos/solver_09/cmp/i386-apple-darwin8.10.1+gcc4.0 b/tests/trilinos/solver_09/cmp/i386-apple-darwin8.10.1+gcc4.0
new file mode 100644 (file)
index 0000000..c6b97de
--- /dev/null
@@ -0,0 +1,7 @@
+
+DEAL::Size 32 Unknowns 961
+DEAL::Solver type: N6dealii13PETScWrappers11SolverTCQMRE
+DEAL::Starting value 7.750
+DEAL::Starting value 7.750
+DEAL::Convergence step 44 value 0.0007012
+DEAL::Solver stopped after 44 iterations
diff --git a/tests/trilinos/solver_09/cmp/powerpc-apple-darwin8.10.0+gcc4.0 b/tests/trilinos/solver_09/cmp/powerpc-apple-darwin8.10.0+gcc4.0
new file mode 100644 (file)
index 0000000..5757c5d
--- /dev/null
@@ -0,0 +1,7 @@
+
+DEAL::Size 32 Unknowns 961
+DEAL::Solver type: N6dealii13PETScWrappers11SolverTCQMRE
+DEAL::Starting value 7.750
+DEAL::Starting value 7.750
+DEAL::Convergence step 44 value 0.0007011
+DEAL::Solver stopped after 44 iterations
diff --git a/tests/trilinos/solver_09/cmp/x86_64-unknown-linux-gnu+gcc3.3 b/tests/trilinos/solver_09/cmp/x86_64-unknown-linux-gnu+gcc3.3
new file mode 100644 (file)
index 0000000..34a2267
--- /dev/null
@@ -0,0 +1,7 @@
+
+DEAL::Size 32 Unknowns 961
+DEAL::Solver type: N6dealii13PETScWrappers11SolverTCQMRE
+DEAL::Starting value 7.750
+DEAL::Starting value 7.750
+DEAL::Convergence step 44 value 0.0007008
+DEAL::Solver stopped after 44 iterations
diff --git a/tests/trilinos/solver_09/cmp/x86_64-unknown-linux-gnu+gcc4.1 b/tests/trilinos/solver_09/cmp/x86_64-unknown-linux-gnu+gcc4.1
new file mode 100644 (file)
index 0000000..7fad18a
--- /dev/null
@@ -0,0 +1,7 @@
+
+DEAL::Size 32 Unknowns 961
+DEAL::Solver type: N6dealii13PETScWrappers11SolverTCQMRE
+DEAL::Starting value 7.750
+DEAL::Starting value 7.750
+DEAL::Convergence step 44 value 0.0007010
+DEAL::Solver stopped after 44 iterations
diff --git a/tests/trilinos/solver_10.cc b/tests/trilinos/solver_10.cc
new file mode 100644 (file)
index 0000000..d7cd3b7
--- /dev/null
@@ -0,0 +1,88 @@
+//----------------------------  trilinos_solver_10.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_solver_10.cc  ---------------------------
+
+// test the PETSc CR solver
+
+
+#include "../tests.h"
+#include "../lac/testmatrix.h"
+#include <cmath>
+#include <fstream>
+#include <iostream>
+#include <iomanip>
+#include <base/logstream.h>
+#include <lac/trilinos_sparse_matrix.h>
+#include <lac/trilinos_vector.h>
+#include <lac/trilinos_solver.h>
+#include <lac/trilinos_precondition.h>
+#include <lac/vector_memory.h>
+#include <typeinfo>
+
+template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
+void
+check_solve( SOLVER& solver, const MATRIX& A,
+            VECTOR& u, VECTOR& f, const PRECONDITION& P)
+{
+  deallog << "Solver type: " << typeid(solver).name() << std::endl;
+  
+  u = 0.;
+  f = 1.;
+  try 
+    {
+      solver.solve(A,u,f,P);
+    }
+  catch (std::exception& e)
+    {
+      deallog << e.what() << std::endl;
+      abort ();
+    }
+
+  deallog << "Solver stopped after " << solver.control().last_step()
+          << " iterations" << std::endl;
+}
+
+
+int main(int argc, char **argv)
+{
+  std::ofstream logfile("solver_10/output");
+  logfile.precision(4);
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+  
+  {
+    SolverControl control(100, 1.e-3);
+
+    const unsigned int size = 32;
+    unsigned int dim = (size-1)*(size-1);
+
+    deallog << "Size " << size << " Unknowns " << dim << std::endl;
+      
+                                     // Make matrix
+    FDMatrix testproblem(size, size);
+    TrilinosWrappers::SparseMatrix  A(dim, dim, 5);
+    testproblem.five_point(A);
+
+    TrilinosWrappers::Vector  f(dim);
+    TrilinosWrappers::Vector  u(dim);
+    f = 1.;
+    A.compress ();
+    f.compress ();
+    u.compress ();
+
+    TrilinosWrappers::SolverCR solver(control);
+    TrilinosWrappers::PreconditionJacobi preconditioner(A);
+    check_solve (solver, A,u,f, preconditioner);
+  }
+}
+
diff --git a/tests/trilinos/solver_10/cmp/generic b/tests/trilinos/solver_10/cmp/generic
new file mode 100644 (file)
index 0000000..0c6333f
--- /dev/null
@@ -0,0 +1,6 @@
+
+DEAL::Size 32 Unknowns 961
+DEAL::Solver type: N6dealii13PETScWrappers8SolverCRE
+DEAL::Starting value 7.750
+DEAL::Convergence step 41 value 0.0005700
+DEAL::Solver stopped after 41 iterations
diff --git a/tests/trilinos/solver_11.cc b/tests/trilinos/solver_11.cc
new file mode 100644 (file)
index 0000000..14a216e
--- /dev/null
@@ -0,0 +1,89 @@
+//----------------------------  trilinos_solver_11.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_solver_11.cc  ---------------------------
+
+// test the PETSc LSQR solver
+
+
+#include "../tests.h"
+#include "../lac/testmatrix.h"
+#include <cmath>
+#include <fstream>
+#include <iostream>
+#include <iomanip>
+#include <base/logstream.h>
+#include <lac/trilinos_sparse_matrix.h>
+#include <lac/trilinos_vector.h>
+#include <lac/trilinos_solver.h>
+#include <lac/trilinos_precondition.h>
+#include <lac/vector_memory.h>
+#include <typeinfo>
+
+template<class SOLVER, class MATRIX, class VECTOR, class PRECONDITION>
+void
+check_solve( SOLVER& solver, const MATRIX& A,
+            VECTOR& u, VECTOR& f, const PRECONDITION& P)
+{
+  deallog << "Solver type: " << typeid(solver).name() << std::endl;
+  
+  u = 0.;
+  f = 1.;
+  try 
+    {
+      solver.solve(A,u,f,P);
+    }
+  catch (std::exception& e)
+    {
+      deallog << e.what() << std::endl;
+                                       // just like for Richardson: expect to
+                                       // get here, don't abort the program
+    }
+
+  deallog << "Solver stopped after " << solver.control().last_step()
+          << " iterations" << std::endl;
+}
+
+
+int main(int argc, char **argv)
+{
+  std::ofstream logfile("solver_11/output");
+  logfile.precision(4);
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+  
+  {
+    SolverControl control(100, 1.e-3);
+
+    const unsigned int size = 32;
+    unsigned int dim = (size-1)*(size-1);
+
+    deallog << "Size " << size << " Unknowns " << dim << std::endl;
+      
+                                     // Make matrix
+    FDMatrix testproblem(size, size);
+    TrilinosWrappers::SparseMatrix  A(dim, dim, 5);
+    testproblem.five_point(A);
+
+    TrilinosWrappers::Vector  f(dim);
+    TrilinosWrappers::Vector  u(dim);
+    f = 1.;
+    A.compress ();
+    f.compress ();
+    u.compress ();
+
+    TrilinosWrappers::SolverLSQR solver(control);
+    TrilinosWrappers::PreconditionJacobi preconditioner(A);
+    check_solve (solver, A,u,f, preconditioner);
+  }
+}
+
diff --git a/tests/trilinos/solver_11/cmp/generic b/tests/trilinos/solver_11/cmp/generic
new file mode 100644 (file)
index 0000000..2a67dab
--- /dev/null
@@ -0,0 +1,7 @@
+
+DEAL::Size 32 Unknowns 961
+DEAL::Solver type: N6dealii13PETScWrappers10SolverLSQRE
+DEAL::Starting value 31.00
+DEAL::Failure step 100 value 24.01
+DEAL::Iterative method reported convergence failure in step 100 with residual 24.0098
+DEAL::Solver stopped after 100 iterations
diff --git a/tests/trilinos/solver_11/cmp/i386-apple-darwin8.10.1+gcc4.0 b/tests/trilinos/solver_11/cmp/i386-apple-darwin8.10.1+gcc4.0
new file mode 100644 (file)
index 0000000..ef72f8d
--- /dev/null
@@ -0,0 +1,7 @@
+
+DEAL::Size 32 Unknowns 961
+DEAL::Solver type: N6dealii13PETScWrappers10SolverLSQRE
+DEAL::Starting value 31.00
+DEAL::Failure step 100 value 24.02
+DEAL::Iterative method reported convergence failure in step 100 with residual 24.0185
+DEAL::Solver stopped after 100 iterations
diff --git a/tests/trilinos/solver_11/cmp/powerpc-apple-darwin8.10.0+gcc4.0 b/tests/trilinos/solver_11/cmp/powerpc-apple-darwin8.10.0+gcc4.0
new file mode 100644 (file)
index 0000000..a7a6ad6
--- /dev/null
@@ -0,0 +1,7 @@
+
+DEAL::Size 32 Unknowns 961
+DEAL::Solver type: N6dealii13PETScWrappers10SolverLSQRE
+DEAL::Starting value 31.00
+DEAL::Failure step 100 value 24.02
+DEAL::Iterative method reported convergence failure in step 100 with residual 24.0199
+DEAL::Solver stopped after 100 iterations
diff --git a/tests/trilinos/solver_11/cmp/x86_64-unknown-linux-gnu+gcc3.3 b/tests/trilinos/solver_11/cmp/x86_64-unknown-linux-gnu+gcc3.3
new file mode 100644 (file)
index 0000000..3b0d986
--- /dev/null
@@ -0,0 +1,7 @@
+
+DEAL::Size 32 Unknowns 961
+DEAL::Solver type: N6dealii13PETScWrappers10SolverLSQRE
+DEAL::Starting value 31.00
+DEAL::Failure step 100 value 24.02
+DEAL::Iterative method reported convergence failure in step 100 with residual 24.0219
+DEAL::Solver stopped after 100 iterations
diff --git a/tests/trilinos/solver_11/cmp/x86_64-unknown-linux-gnu+gcc4.1 b/tests/trilinos/solver_11/cmp/x86_64-unknown-linux-gnu+gcc4.1
new file mode 100644 (file)
index 0000000..b4f6514
--- /dev/null
@@ -0,0 +1,7 @@
+
+DEAL::Size 32 Unknowns 961
+DEAL::Solver type: N6dealii13PETScWrappers10SolverLSQRE
+DEAL::Starting value 31.00
+DEAL::Failure step 100 value 24.02
+DEAL::Iterative method reported convergence failure in step 100 with residual 24.0221
+DEAL::Solver stopped after 100 iterations
diff --git a/tests/trilinos/sparse_matrix_iterator_01.cc b/tests/trilinos/sparse_matrix_iterator_01.cc
new file mode 100644 (file)
index 0000000..f12b977
--- /dev/null
@@ -0,0 +1,79 @@
+//----------------------------  trilinos_sparse_matrix_iterator_01.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_sparse_matrix_iterator_01.cc  ---------------------------
+
+
+// test TrilinosWrappers::MatrixBase::const_iterator
+
+#include "../tests.h"
+#include <lac/trilinos_sparse_matrix.h>    
+#include <fstream>
+#include <iostream>
+
+
+void test ()
+{
+  TrilinosWrappers::SparseMatrix m(5,5,5);
+  m.set (0,0,1);
+  m.set (1,1,2);
+  m.set (1,2,3);  
+  m.compress ();
+  TrilinosWrappers::SparseMatrix::const_iterator i = m.begin();
+  deallog << i->row() << ' ' << i->column() << ' ' << i->value() << std::endl;
+  ++i;
+  deallog << i->row() << ' ' << i->column() << ' ' << i->value() << std::endl;
+  i++;
+  deallog << i->row() << ' ' << i->column() << ' ' << i->value() << std::endl;
+  
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv)
+{
+  std::ofstream logfile("sparse_matrix_iterator_01/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        test ();
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/sparse_matrix_iterator_01/cmp/generic b/tests/trilinos/sparse_matrix_iterator_01/cmp/generic
new file mode 100644 (file)
index 0000000..e6bdc2e
--- /dev/null
@@ -0,0 +1,5 @@
+
+DEAL::0 0 1.00000
+DEAL::1 1 2.00000
+DEAL::1 2 3.00000
+DEAL::OK
diff --git a/tests/trilinos/sparse_matrix_vector_01.cc b/tests/trilinos/sparse_matrix_vector_01.cc
new file mode 100644 (file)
index 0000000..d414b47
--- /dev/null
@@ -0,0 +1,98 @@
+//----------------------------  trilinos_sparse_matrix_vector_01.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_sparse_matrix_vector_01.cc  ---------------------------
+
+
+// check SparseMatrix::vmult
+
+#include "../tests.h"
+#include <lac/trilinos_vector.h>
+#include <lac/trilinos_sparse_matrix.h>
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::Vector &v,
+           TrilinosWrappers::Vector &w)
+{
+  TrilinosWrappers::SparseMatrix m(v.size(),v.size(),v.size());
+  for (unsigned int i=0; i<m.m(); ++i)
+    for (unsigned int j=0; j<m.m(); ++j)
+        m.set (i,j, i+2*j);
+
+  for (unsigned int i=0; i<v.size(); ++i)
+    v(i) = i;
+  
+  m.compress ();
+  v.compress ();
+  w.compress ();
+
+                                   // w:=Mv
+  m.vmult (w,v);
+
+                                   // make sure we get the expected result
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      Assert (v(i) == i, ExcInternalError());
+
+      double result = 0;
+      for (unsigned int j=0; j<m.m(); ++j)
+        result += (i+2*j)*j;
+      Assert (w(i) == result, ExcInternalError());
+    }
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc, char **argv)
+{
+  std::ofstream logfile("sparse_matrix_vector_01/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::Vector v (100);
+        TrilinosWrappers::Vector w (100);
+        test (v,w);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/sparse_matrix_vector_01/cmp/generic b/tests/trilinos/sparse_matrix_vector_01/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/sparse_matrix_vector_02.cc b/tests/trilinos/sparse_matrix_vector_02.cc
new file mode 100644 (file)
index 0000000..fe7459c
--- /dev/null
@@ -0,0 +1,98 @@
+//----------------------------  trilinos_sparse_matrix_vector_02.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_sparse_matrix_vector_02.cc  ---------------------------
+
+
+// check SparseMatrix::Tvmult
+
+#include "../tests.h"
+#include <lac/trilinos_vector.h>
+#include <lac/trilinos_sparse_matrix.h>
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::Vector &v,
+           TrilinosWrappers::Vector &w)
+{
+  TrilinosWrappers::SparseMatrix m(v.size(),v.size(),v.size());
+  for (unsigned int i=0; i<m.m(); ++i)
+    for (unsigned int j=0; j<m.m(); ++j)
+        m.set (i,j, i+2*j);
+
+  for (unsigned int i=0; i<v.size(); ++i)
+    v(i) = i;
+  
+  m.compress ();
+  v.compress ();
+  w.compress ();
+
+                                   // w:=Mv
+  m.Tvmult (w,v);
+
+                                   // make sure we get the expected result
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      Assert (v(i) == i, ExcInternalError());
+
+      double result = 0;
+      for (unsigned int j=0; j<m.m(); ++j)
+        result += (j+2*i)*j;
+      Assert (w(i) == result, ExcInternalError());
+    }
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc, char **argv)
+{
+  std::ofstream logfile("sparse_matrix_vector_02/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::Vector v (100);
+        TrilinosWrappers::Vector w (100);
+        test (v,w);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/sparse_matrix_vector_02/cmp/generic b/tests/trilinos/sparse_matrix_vector_02/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/sparse_matrix_vector_03.cc b/tests/trilinos/sparse_matrix_vector_03.cc
new file mode 100644 (file)
index 0000000..5340140
--- /dev/null
@@ -0,0 +1,101 @@
+//----------------------------  trilinos_sparse_matrix_vector_03.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_sparse_matrix_vector_03.cc  ---------------------------
+
+
+// check SparseMatrix::vmult_add
+
+#include "../tests.h"
+#include <lac/trilinos_vector.h>
+#include <lac/trilinos_sparse_matrix.h>
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::Vector &v,
+           TrilinosWrappers::Vector &w)
+{
+  TrilinosWrappers::SparseMatrix m(v.size(),v.size(),v.size());
+  for (unsigned int i=0; i<m.m(); ++i)
+    for (unsigned int j=0; j<m.m(); ++j)
+        m.set (i,j, i+2*j);
+
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      v(i) = i;
+      w(i) = i;
+    }
+  
+  m.compress ();
+  v.compress ();
+  w.compress ();
+
+                                   // w:=Mv
+  m.vmult_add (w,v);
+
+                                   // make sure we get the expected result
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      Assert (v(i) == i, ExcInternalError());
+
+      double result = 0;
+      for (unsigned int j=0; j<m.m(); ++j)
+        result += (i+2*j)*j;
+      Assert (w(i) == i+result, ExcInternalError());
+    }
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc, char **argv)
+{
+  std::ofstream logfile("sparse_matrix_vector_03/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::Vector v (100);
+        TrilinosWrappers::Vector w (100);
+        test (v,w);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/sparse_matrix_vector_03/cmp/generic b/tests/trilinos/sparse_matrix_vector_03/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/sparse_matrix_vector_04.cc b/tests/trilinos/sparse_matrix_vector_04.cc
new file mode 100644 (file)
index 0000000..9b6f8fd
--- /dev/null
@@ -0,0 +1,101 @@
+//----------------------------  trilinos_sparse_matrix_vector_04.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_sparse_matrix_vector_04.cc  ---------------------------
+
+
+// check SparseMatrix::Tvmult_add
+
+#include "../tests.h"
+#include <lac/trilinos_vector.h>
+#include <lac/trilinos_sparse_matrix.h>
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::Vector &v,
+           TrilinosWrappers::Vector &w)
+{
+  TrilinosWrappers::SparseMatrix m(v.size(),v.size(),v.size());
+  for (unsigned int i=0; i<m.m(); ++i)
+    for (unsigned int j=0; j<m.m(); ++j)
+        m.set (i,j, i+2*j);
+
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      v(i) = i;
+      w(i) = i;
+    }
+  
+  m.compress ();
+  v.compress ();
+  w.compress ();
+
+                                   // w:=Mv
+  m.Tvmult_add (w,v);
+
+                                   // make sure we get the expected result
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      Assert (v(i) == i, ExcInternalError());
+
+      double result = 0;
+      for (unsigned int j=0; j<m.m(); ++j)
+        result += (j+2*i)*j;
+      Assert (w(i) == i+result, ExcInternalError());
+    }
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc, char **argv)
+{
+  std::ofstream logfile("sparse_matrix_vector_04/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::Vector v (100);
+        TrilinosWrappers::Vector w (100);
+        test (v,w);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/sparse_matrix_vector_04/cmp/generic b/tests/trilinos/sparse_matrix_vector_04/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/sparse_matrix_vector_05.cc b/tests/trilinos/sparse_matrix_vector_05.cc
new file mode 100644 (file)
index 0000000..73ed905
--- /dev/null
@@ -0,0 +1,104 @@
+//----------------------------  trilinos_sparse_matrix_vector_05.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_sparse_matrix_vector_05.cc  ---------------------------
+
+
+// check SparseMatrix::matrix_scalar_product
+
+#include "../tests.h"
+#include <lac/trilinos_vector.h>
+#include <lac/trilinos_sparse_matrix.h>
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::Vector &v,
+           TrilinosWrappers::Vector &w)
+{
+  TrilinosWrappers::SparseMatrix m(v.size(),v.size(),v.size());
+  for (unsigned int i=0; i<m.m(); ++i)
+    for (unsigned int j=0; j<m.m(); ++j)
+        m.set (i,j, i+2*j);
+
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      v(i) = i;
+      w(i) = i+1;
+    }
+  
+  m.compress ();
+  v.compress ();
+  w.compress ();
+
+                                   // <w,Mv>
+  const PetscScalar s = m.matrix_scalar_product (w,v);
+
+                                   // make sure we get the expected result
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      Assert (v(i) == i, ExcInternalError());
+      Assert (w(i) == i+1, ExcInternalError());
+    }
+
+  PetscScalar result = 0;
+  for (unsigned int i=0; i<m.m(); ++i)
+    for (unsigned int j=0; j<m.m(); ++j)
+      result += (i+2*j)*j*(i+1);
+
+  Assert (s == result, ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc, char **argv)
+{
+  std::ofstream logfile("sparse_matrix_vector_05/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::Vector v (100);
+        TrilinosWrappers::Vector w (100);
+        test (v,w);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/sparse_matrix_vector_05/cmp/generic b/tests/trilinos/sparse_matrix_vector_05/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/sparse_matrix_vector_06.cc b/tests/trilinos/sparse_matrix_vector_06.cc
new file mode 100644 (file)
index 0000000..cf224eb
--- /dev/null
@@ -0,0 +1,95 @@
+//----------------------------  trilinos_sparse_matrix_vector_06.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_sparse_matrix_vector_06.cc  ---------------------------
+
+
+// check SparseMatrix::matrix_norm_square
+
+#include "../tests.h"
+#include <lac/trilinos_vector.h>
+#include <lac/trilinos_sparse_matrix.h>
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::Vector &v)
+{
+  TrilinosWrappers::SparseMatrix m(v.size(),v.size(),v.size());
+  for (unsigned int i=0; i<m.m(); ++i)
+    for (unsigned int j=0; j<m.m(); ++j)
+        m.set (i,j, i+2*j);
+
+  for (unsigned int i=0; i<v.size(); ++i)
+    v(i) = i;
+  
+  m.compress ();
+  v.compress ();
+
+                                   // <w,Mv>
+  const PetscScalar s = m.matrix_norm_square (v);
+
+                                   // make sure we get the expected result
+  for (unsigned int i=0; i<v.size(); ++i)
+    Assert (v(i) == i, ExcInternalError());
+
+  PetscScalar result = 0;
+  for (unsigned int i=0; i<m.m(); ++i)
+    for (unsigned int j=0; j<m.m(); ++j)
+      result += (i+2*j)*j*i;
+
+  Assert (s == result, ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc, char **argv)
+{
+  std::ofstream logfile("sparse_matrix_vector_06/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::Vector v (30);
+        test (v);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/sparse_matrix_vector_06/cmp/generic b/tests/trilinos/sparse_matrix_vector_06/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/sparse_matrix_vector_07.cc b/tests/trilinos/sparse_matrix_vector_07.cc
new file mode 100644 (file)
index 0000000..7e921e4
--- /dev/null
@@ -0,0 +1,107 @@
+//----------------------------  trilinos_sparse_matrix_vector_07.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_sparse_matrix_vector_07.cc  ---------------------------
+
+
+// check SparseMatrix::matrix_norm_square
+
+#include "../tests.h"
+#include <lac/trilinos_vector.h>
+#include <lac/trilinos_sparse_matrix.h>
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::Vector &v,
+           TrilinosWrappers::Vector &w,
+           TrilinosWrappers::Vector &x)
+{
+  TrilinosWrappers::SparseMatrix m(v.size(),v.size(),v.size());
+  for (unsigned int i=0; i<m.m(); ++i)
+    for (unsigned int j=0; j<m.m(); ++j)
+        m.set (i,j, i+2*j);
+
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      v(i) = i;
+      w(i) = i+1;
+    }
+      
+  m.compress ();
+  v.compress ();
+  w.compress ();
+
+                                   // x=w-Mv
+  const double s = m.residual (x, v, w);
+
+                                   // make sure we get the expected result
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      Assert (v(i) == i, ExcInternalError());
+      Assert (w(i) == i+1, ExcInternalError());
+
+      double result = i+1;
+      for (unsigned int j=0; j<m.m(); ++j)
+        result -= (i+2*j)*j;
+
+      Assert (x(i) == result, ExcInternalError());
+    }
+
+  Assert (s == x.l2_norm(), ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc, char **argv)
+{
+  std::ofstream logfile("sparse_matrix_vector_07/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::Vector v (100);
+        TrilinosWrappers::Vector w (100);
+        TrilinosWrappers::Vector x (100);
+        test (v,w,x);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/sparse_matrix_vector_07/cmp/generic b/tests/trilinos/sparse_matrix_vector_07/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/vector_assign_01.cc b/tests/trilinos/vector_assign_01.cc
new file mode 100644 (file)
index 0000000..6a507c5
--- /dev/null
@@ -0,0 +1,88 @@
+//----------------------------  trilinos_vector_assign_01.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_vector_assign_01.cc  ---------------------------
+
+
+// when calling TrilinosWrappers::Vector::operator() (), the return type is a
+// reference object, not a reference to the actual element. this leads to the
+// funny situation that an assignment like v2(i)=v1(i) isn't really what it
+// looks like: it tries to copy the reference objects, not the values they
+// point to, as one would expect
+//
+// this was fixed 2004-04-05, and this test checks that it works
+
+#include "../tests.h"
+#include <lac/trilinos_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::Vector &v,
+           TrilinosWrappers::Vector &w)
+{
+                                   // set the first vector
+  for (unsigned int i=0; i<v.size(); ++i)
+    v(i) = i;
+
+                                   // copy elements by reference
+  for (unsigned int i=0; i<v.size(); ++i)
+    w(i) = v(i);
+
+                                   // check that they're equal
+  Assert (v==w, ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc, char **argv)
+{
+  std::ofstream logfile("vector_assign_01/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::Vector v (100);
+        TrilinosWrappers::Vector w (100);
+        test (v,w);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/vector_assign_01/cmp/generic b/tests/trilinos/vector_assign_01/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/vector_assign_02.cc b/tests/trilinos/vector_assign_02.cc
new file mode 100644 (file)
index 0000000..ed21e3f
--- /dev/null
@@ -0,0 +1,87 @@
+//----------------------------  trilinos_vector_assign_02.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_vector_assign_02.cc  ---------------------------
+
+
+// this is equivalent to the trilinos_vector_assign_02 test, except that we use
+// operator+= instead of operator=. Now, this does not present a problem,
+// since the compiler does not automatically generate a version of this
+// operator, but simply performs the conversion to PetscScalar, i.e. the
+// argument to the user-defined operator+=. This is not exciting, but since I
+// wrote the test to make sure it works this way, let's keep it then...
+
+#include "../tests.h"
+#include <lac/trilinos_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::Vector &v,
+           TrilinosWrappers::Vector &w)
+{
+                                   // set the first vector
+  for (unsigned int i=0; i<v.size(); ++i)
+    v(i) = i;
+
+                                   // add elements by reference
+  for (unsigned int i=0; i<v.size(); ++i)
+    w(i) += v(i);
+
+                                   // check that they're equal
+  Assert (v==w, ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc, char **argv)
+{
+  std::ofstream logfile("vector_assign_02/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::Vector v (100);
+        TrilinosWrappers::Vector w (100);
+        test (v,w);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/vector_assign_02/cmp/generic b/tests/trilinos/vector_assign_02/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/vector_equality_1.cc b/tests/trilinos/vector_equality_1.cc
new file mode 100644 (file)
index 0000000..ec6d1f5
--- /dev/null
@@ -0,0 +1,83 @@
+//----------------------------  trilinos_vector_equality_1.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_vector_equality_1.cc  ---------------------------
+
+
+// check TrilinosWrappers::Vector::operator==(TrilinosWrappers::Vector) for vectors that are not
+// equal
+
+#include "../tests.h"
+#include <lac/trilinos_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::Vector &v,
+           TrilinosWrappers::Vector &w)
+{
+                                   // set only certain elements of each
+                                   // vector
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      v(i) = i;
+      if (i%3 == 0)
+        w(i) = i+1.;
+    }
+
+  Assert (!(v==w), ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc, char **argv)
+{
+  std::ofstream logfile("vector_equality_1/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::Vector v (100);
+        TrilinosWrappers::Vector w (100);
+        test (v,w);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/vector_equality_1/cmp/generic b/tests/trilinos/vector_equality_1/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/vector_equality_2.cc b/tests/trilinos/vector_equality_2.cc
new file mode 100644 (file)
index 0000000..184b7b9
--- /dev/null
@@ -0,0 +1,85 @@
+//----------------------------  trilinos_vector_equality_2.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_vector_equality_2.cc  ---------------------------
+
+
+// check TrilinosWrappers::Vector::operator==(TrilinosWrappers::Vector) for vectors that are
+// equal
+
+#include "../tests.h"
+#include <lac/trilinos_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::Vector &v,
+           TrilinosWrappers::Vector &w)
+{
+                                   // set only certain elements of each
+                                   // vector
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      v(i) = i;
+      if (i%3 == 0)
+        w(i) = i+1.;
+    }
+                                   // but then copy elements and make sure the
+                                   // vectors are actually equal
+  v = w;
+  Assert (v==w, ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc, char **argv)
+{
+  std::ofstream logfile("vector_equality_2/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::Vector v (100);
+        TrilinosWrappers::Vector w (100);
+        test (v,w);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/vector_equality_2/cmp/generic b/tests/trilinos/vector_equality_2/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/vector_equality_3.cc b/tests/trilinos/vector_equality_3.cc
new file mode 100644 (file)
index 0000000..083b934
--- /dev/null
@@ -0,0 +1,83 @@
+//----------------------------  trilinos_vector_equality_3.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_vector_equality_3.cc  ---------------------------
+
+
+// check TrilinosWrappers::Vector::operator!=(TrilinosWrappers::Vector) for vectors that are not
+// equal
+
+#include "../tests.h"
+#include <lac/trilinos_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::Vector &v,
+           TrilinosWrappers::Vector &w)
+{
+                                   // set only certain elements of each
+                                   // vector
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      v(i) = i;
+      if (i%3 == 0)
+        w(i) = i+1.;
+    }
+
+  Assert (v!=w, ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc, char **argv)
+{
+  std::ofstream logfile("vector_equality_3/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::Vector v (100);
+        TrilinosWrappers::Vector w (100);
+        test (v,w);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/vector_equality_3/cmp/generic b/tests/trilinos/vector_equality_3/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/trilinos/vector_equality_4.cc b/tests/trilinos/vector_equality_4.cc
new file mode 100644 (file)
index 0000000..9550d63
--- /dev/null
@@ -0,0 +1,85 @@
+//----------------------------  trilinos_vector_equality_4.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005 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.
+//
+//----------------------------  trilinos_vector_equality_4.cc  ---------------------------
+
+
+// check TrilinosWrappers::Vector::operator!=(TrilinosWrappers::Vector) for vectors that are
+// equal
+
+#include "../tests.h"
+#include <lac/trilinos_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::Vector &v,
+           TrilinosWrappers::Vector &w)
+{
+                                   // set only certain elements of each
+                                   // vector
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      v(i) = i;
+      if (i%3 == 0)
+        w(i) = i+1.;
+    }
+                                   // but then copy elements and make sure the
+                                   // vectors are actually equal
+  v = w;
+  Assert (! (v!=w), ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc, char **argv)
+{
+  std::ofstream logfile("vector_equality_4/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  try
+    {
+      {
+        TrilinosWrappers::Vector v (100);
+        TrilinosWrappers::Vector w (100);
+        test (v,w);
+      }
+    }
+  catch (std::exception &exc)
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Exception on processing: " << std::endl
+               << exc.what() << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      
+      return 1;
+    }
+  catch (...) 
+    {
+      std::cerr << std::endl << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      std::cerr << "Unknown exception!" << std::endl
+               << "Aborting!" << std::endl
+               << "----------------------------------------------------"
+               << std::endl;
+      return 1;
+    };
+}
diff --git a/tests/trilinos/vector_equality_4/cmp/generic b/tests/trilinos/vector_equality_4/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+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.