]> https://gitweb.dealii.org/ - dealii.git/commitdiff
More tests.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 9 Feb 2004 13:38:14 +0000 (13:38 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 9 Feb 2004 13:38:14 +0000 (13:38 +0000)
git-svn-id: https://svn.dealii.org/trunk@8432 0785d39b-7218-0410-832d-ea1e28bc413d

73 files changed:
tests/bits/petsc_03a.cc
tests/bits/petsc_17.cc [new file with mode: 0644]
tests/bits/petsc_18.cc [new file with mode: 0644]
tests/bits/petsc_19.cc [new file with mode: 0644]
tests/bits/petsc_20.cc [new file with mode: 0644]
tests/bits/petsc_21.cc [new file with mode: 0644]
tests/bits/petsc_22.cc [new file with mode: 0644]
tests/bits/petsc_23.cc [new file with mode: 0644]
tests/bits/petsc_24.cc [new file with mode: 0644]
tests/bits/petsc_25.cc [new file with mode: 0644]
tests/bits/petsc_26.cc [new file with mode: 0644]
tests/bits/petsc_27.cc [new file with mode: 0644]
tests/bits/petsc_28.cc [new file with mode: 0644]
tests/bits/petsc_29.cc [new file with mode: 0644]
tests/bits/petsc_30.cc [new file with mode: 0644]
tests/bits/petsc_31.cc [new file with mode: 0644]
tests/bits/petsc_32.cc [new file with mode: 0644]
tests/bits/petsc_33.cc [new file with mode: 0644]
tests/bits/petsc_34.cc [new file with mode: 0644]
tests/bits/petsc_35.cc [new file with mode: 0644]
tests/bits/petsc_36.cc [new file with mode: 0644]
tests/bits/petsc_37.cc [new file with mode: 0644]
tests/bits/petsc_38.cc [new file with mode: 0644]
tests/bits/petsc_39.cc [new file with mode: 0644]
tests/bits/petsc_40.cc [new file with mode: 0644]
tests/bits/petsc_41.cc [new file with mode: 0644]
tests/bits/petsc_42.cc [new file with mode: 0644]
tests/bits/petsc_43.cc [new file with mode: 0644]
tests/bits/petsc_44.cc [new file with mode: 0644]
tests/bits/petsc_45.cc [new file with mode: 0644]
tests/bits/petsc_46.cc [new file with mode: 0644]
tests/bits/petsc_47.cc [new file with mode: 0644]
tests/bits/petsc_48.cc [new file with mode: 0644]
tests/bits/sparse_matrix_03a.cc [new file with mode: 0644]
tests/bits/sparse_matrix_03b.cc [new file with mode: 0644]
tests/bits/vector_11.cc [new file with mode: 0644]
tests/bits/vector_12.cc [new file with mode: 0644]
tests/bits/vector_13.cc [new file with mode: 0644]
tests/bits/vector_14.cc [new file with mode: 0644]
tests/bits/vector_15.cc [new file with mode: 0644]
tests/bits/vector_16.cc [new file with mode: 0644]
tests/bits/vector_17.cc [new file with mode: 0644]
tests/bits/vector_18.cc [new file with mode: 0644]
tests/bits/vector_19.cc [new file with mode: 0644]
tests/bits/vector_20.cc [new file with mode: 0644]
tests/bits/vector_21.cc [new file with mode: 0644]
tests/bits/vector_22.cc [new file with mode: 0644]
tests/bits/vector_23.cc [new file with mode: 0644]
tests/bits/vector_24.cc [new file with mode: 0644]
tests/bits/vector_25.cc [new file with mode: 0644]
tests/bits/vector_26.cc [new file with mode: 0644]
tests/bits/vector_27.cc [new file with mode: 0644]
tests/bits/vector_28.cc [new file with mode: 0644]
tests/bits/vector_29.cc [new file with mode: 0644]
tests/bits/vector_30.cc [new file with mode: 0644]
tests/bits/vector_31.cc [new file with mode: 0644]
tests/bits/vector_32.cc [new file with mode: 0644]
tests/bits/vector_33.cc [new file with mode: 0644]
tests/bits/vector_34.cc [new file with mode: 0644]
tests/bits/vector_35.cc [new file with mode: 0644]
tests/bits/vector_36.cc [new file with mode: 0644]
tests/bits/vector_37.cc [new file with mode: 0644]
tests/bits/vector_38.cc [new file with mode: 0644]
tests/bits/vector_39.cc [new file with mode: 0644]
tests/bits/vector_40.cc [new file with mode: 0644]
tests/bits/vector_41.cc [new file with mode: 0644]
tests/bits/vector_42.cc [new file with mode: 0644]
tests/bits/vector_43.cc [new file with mode: 0644]
tests/bits/vector_44.cc [new file with mode: 0644]
tests/bits/vector_45.cc [new file with mode: 0644]
tests/bits/vector_46.cc [new file with mode: 0644]
tests/bits/vector_47.cc [new file with mode: 0644]
tests/bits/vector_48.cc [new file with mode: 0644]

index acc9649b6008c99089b1966b35a5c9bfc63c326a..770d55b3d63815d3a08d0e0ee5edc96c3acfc1a5 100644 (file)
@@ -32,6 +32,7 @@ void test (petsc_wrappers::SparseMatrix &m)
     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)
diff --git a/tests/bits/petsc_17.cc b/tests/bits/petsc_17.cc
new file mode 100644 (file)
index 0000000..6a14203
--- /dev/null
@@ -0,0 +1,82 @@
+//----------------------------  petsc_17.cc  ---------------------------
+//    petsc_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  petsc_17.cc  ---------------------------
+
+
+// check petsc_wrapper::Vector::l1_norm()
+
+#include "../tests.h"
+#include <lac/petsc_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (petsc_wrappers::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("petsc_17.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      PetscInitialize(&argc,&argv,0,0);
+      {
+        petsc_wrappers::Vector v (100);
+        test (v);
+      }
+      PetscFinalize();
+    }
+  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/bits/petsc_18.cc b/tests/bits/petsc_18.cc
new file mode 100644 (file)
index 0000000..64e14d3
--- /dev/null
@@ -0,0 +1,82 @@
+//----------------------------  petsc_18.cc  ---------------------------
+//    petsc_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  petsc_18.cc  ---------------------------
+
+
+// check petsc_wrapper::Vector::l2_norm()
+
+#include "../tests.h"
+#include <lac/petsc_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (petsc_wrappers::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)*std::fabs(1.*i);
+    }
+  v.compress ();
+
+                                   // then check the norm
+  Assert (v.l2_norm() == std::sqrt(norm), ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("petsc_18.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      PetscInitialize(&argc,&argv,0,0);
+      {
+        petsc_wrappers::Vector v (100);
+        test (v);
+      }
+      PetscFinalize();
+    }
+  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/bits/petsc_19.cc b/tests/bits/petsc_19.cc
new file mode 100644 (file)
index 0000000..71adbfd
--- /dev/null
@@ -0,0 +1,82 @@
+//----------------------------  petsc_19.cc  ---------------------------
+//    petsc_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  petsc_19.cc  ---------------------------
+
+
+// check petsc_wrapper::Vector::linfty_norm()
+
+#include "../tests.h"
+#include <lac/petsc_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (petsc_wrappers::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("petsc_19.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      PetscInitialize(&argc,&argv,0,0);
+      {
+        petsc_wrappers::Vector v (100);
+        test (v);
+      }
+      PetscFinalize();
+    }
+  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/bits/petsc_20.cc b/tests/bits/petsc_20.cc
new file mode 100644 (file)
index 0000000..24f0ced
--- /dev/null
@@ -0,0 +1,91 @@
+//----------------------------  petsc_20.cc  ---------------------------
+//    petsc_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  petsc_20.cc  ---------------------------
+
+
+// check petsc_wrapper::Vector::operator *=
+
+#include "../tests.h"
+#include <lac/petsc_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (petsc_wrappers::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("petsc_20.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      PetscInitialize(&argc,&argv,0,0);
+      {
+        petsc_wrappers::Vector v (100);
+        test (v);
+      }
+      PetscFinalize();
+    }
+  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/bits/petsc_21.cc b/tests/bits/petsc_21.cc
new file mode 100644 (file)
index 0000000..ca823de
--- /dev/null
@@ -0,0 +1,91 @@
+//----------------------------  petsc_21.cc  ---------------------------
+//    petsc_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  petsc_21.cc  ---------------------------
+
+
+// check petsc_wrapper::Vector::operator /=
+
+#include "../tests.h"
+#include <lac/petsc_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (petsc_wrappers::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("petsc_21.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      PetscInitialize(&argc,&argv,0,0);
+      {
+        petsc_wrappers::Vector v (100);
+        test (v);
+      }
+      PetscFinalize();
+    }
+  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/bits/petsc_22.cc b/tests/bits/petsc_22.cc
new file mode 100644 (file)
index 0000000..5ff0113
--- /dev/null
@@ -0,0 +1,86 @@
+//----------------------------  petsc_22.cc  ---------------------------
+//    petsc_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  petsc_22.cc  ---------------------------
+
+
+// check petsc_wrapper::Vector::operator*(Vector) on two vectors that are
+// orthogonal
+
+#include "../tests.h"
+#include <lac/petsc_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (petsc_wrappers::Vector &v,
+           petsc_wrappers::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("petsc_22.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      PetscInitialize(&argc,&argv,0,0);
+      {
+        petsc_wrappers::Vector v (100);
+        petsc_wrappers::Vector w (100);
+        test (v,w);
+      }
+      PetscFinalize();
+    }
+  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/bits/petsc_23.cc b/tests/bits/petsc_23.cc
new file mode 100644 (file)
index 0000000..f6b2255
--- /dev/null
@@ -0,0 +1,93 @@
+//----------------------------  petsc_23.cc  ---------------------------
+//    petsc_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  petsc_23.cc  ---------------------------
+
+
+// check petsc_wrapper::Vector::operator*(Vector) on two vectors that are
+// not orthogonal
+
+#include "../tests.h"
+#include <lac/petsc_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (petsc_wrappers::Vector &v,
+           petsc_wrappers::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("petsc_23.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      PetscInitialize(&argc,&argv,0,0);
+      {
+        petsc_wrappers::Vector v (100);
+        petsc_wrappers::Vector w (100);
+        test (v,w);
+      }
+      PetscFinalize();
+    }
+  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/bits/petsc_24.cc b/tests/bits/petsc_24.cc
new file mode 100644 (file)
index 0000000..df35035
--- /dev/null
@@ -0,0 +1,83 @@
+//----------------------------  petsc_24.cc  ---------------------------
+//    petsc_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  petsc_24.cc  ---------------------------
+
+
+// check petsc_wrapper::Vector::clear()
+
+#include "../tests.h"
+#include <lac/petsc_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (petsc_wrappers::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.clear ();
+  Assert (v.size() == sz, ExcInternalError());
+  Assert (v.l2_norm() == 0, ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("petsc_24.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      PetscInitialize(&argc,&argv,0,0);
+      {
+        petsc_wrappers::Vector v (100);
+        test (v);
+      }
+      PetscFinalize();
+    }
+  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/bits/petsc_25.cc b/tests/bits/petsc_25.cc
new file mode 100644 (file)
index 0000000..ddd0b38
--- /dev/null
@@ -0,0 +1,83 @@
+//----------------------------  petsc_25.cc  ---------------------------
+//    petsc_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  petsc_25.cc  ---------------------------
+
+
+// check petsc_wrapper::Vector::operator = (PetscScalar) with setting to zero
+
+#include "../tests.h"
+#include <lac/petsc_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (petsc_wrappers::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("petsc_25.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      PetscInitialize(&argc,&argv,0,0);
+      {
+        petsc_wrappers::Vector v (100);
+        test (v);
+      }
+      PetscFinalize();
+    }
+  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/bits/petsc_26.cc b/tests/bits/petsc_26.cc
new file mode 100644 (file)
index 0000000..ad8c6a4
--- /dev/null
@@ -0,0 +1,82 @@
+//----------------------------  petsc_26.cc  ---------------------------
+//    petsc_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  petsc_26.cc  ---------------------------
+
+
+// check petsc_wrapper::Vector::operator = (PetscScalar) with setting to a
+// nonzero value
+
+#include "../tests.h"
+#include <lac/petsc_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (petsc_wrappers::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("petsc_26.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      PetscInitialize(&argc,&argv,0,0);
+      {
+        petsc_wrappers::Vector v (100);
+        test (v);
+      }
+      PetscFinalize();
+    }
+  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/bits/petsc_27.cc b/tests/bits/petsc_27.cc
new file mode 100644 (file)
index 0000000..4ec5ee3
--- /dev/null
@@ -0,0 +1,86 @@
+//----------------------------  petsc_27.cc  ---------------------------
+//    petsc_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  petsc_27.cc  ---------------------------
+
+
+// check petsc_wrapper::Vector::operator = (Vector) 
+
+#include "../tests.h"
+#include <lac/petsc_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (petsc_wrappers::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
+  petsc_wrappers::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;
+  Assert (std::fabs(v*w - v.l2_norm() * w.l2_norm()) < 1e-14*(v*w),
+          ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("petsc_27.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      PetscInitialize(&argc,&argv,0,0);
+      {
+        petsc_wrappers::Vector v (100);
+        test (v);
+      }
+      PetscFinalize();
+    }
+  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/bits/petsc_28.cc b/tests/bits/petsc_28.cc
new file mode 100644 (file)
index 0000000..e8f4933
--- /dev/null
@@ -0,0 +1,88 @@
+//----------------------------  petsc_28.cc  ---------------------------
+//    petsc_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  petsc_28.cc  ---------------------------
+
+
+// check petsc_wrapper::Vector::operator = (Vector), except that we don't
+// resize the vector to be copied to beforehand
+
+#include "../tests.h"
+#include <lac/petsc_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (petsc_wrappers::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
+  petsc_wrappers::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;
+  Assert (std::fabs(v*w - v.l2_norm() * w.l2_norm()) < 1e-14*(v*w),
+          ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("petsc_28.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      PetscInitialize(&argc,&argv,0,0);
+      {
+        petsc_wrappers::Vector v (100);
+        test (v);
+      }
+      PetscFinalize();
+    }
+  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/bits/petsc_29.cc b/tests/bits/petsc_29.cc
new file mode 100644 (file)
index 0000000..f642113
--- /dev/null
@@ -0,0 +1,74 @@
+//----------------------------  petsc_29.cc  ---------------------------
+//    petsc_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  petsc_29.cc  ---------------------------
+
+
+// check petsc_wrapper::Vector::reinit(fast)
+
+#include "../tests.h"
+#include <lac/petsc_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (petsc_wrappers::Vector &v)
+{
+  v.reinit (13, true);
+  
+  Assert (v.size() == 13, ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("petsc_29.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      PetscInitialize(&argc,&argv,0,0);
+      {
+        petsc_wrappers::Vector v (100);
+        test (v);
+      }
+      PetscFinalize();
+    }
+  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/bits/petsc_30.cc b/tests/bits/petsc_30.cc
new file mode 100644 (file)
index 0000000..883d60e
--- /dev/null
@@ -0,0 +1,82 @@
+//----------------------------  petsc_30.cc  ---------------------------
+//    petsc_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  petsc_30.cc  ---------------------------
+
+
+// check petsc_wrapper::Vector::reinit(!fast)
+
+#include "../tests.h"
+#include <lac/petsc_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (petsc_wrappers::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("petsc_30.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      PetscInitialize(&argc,&argv,0,0);
+      {
+        petsc_wrappers::Vector v (100);
+        test (v);
+      }
+      PetscFinalize();
+    }
+  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/bits/petsc_31.cc b/tests/bits/petsc_31.cc
new file mode 100644 (file)
index 0000000..1d2903d
--- /dev/null
@@ -0,0 +1,83 @@
+//----------------------------  petsc_31.cc  ---------------------------
+//    petsc_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  petsc_31.cc  ---------------------------
+
+
+// check petsc_wrapper::Vector::l2_norm()
+
+#include "../tests.h"
+#include <lac/petsc_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (petsc_wrappers::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)*std::fabs(1.*i);
+    }
+  v.compress ();
+
+                                   // then check the norm
+  Assert (std::fabs(v.norm_sqr() - norm) < 1e-14*norm,
+          ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("petsc_31.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      PetscInitialize(&argc,&argv,0,0);
+      {
+        petsc_wrappers::Vector v (100);
+        test (v);
+      }
+      PetscFinalize();
+    }
+  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/bits/petsc_32.cc b/tests/bits/petsc_32.cc
new file mode 100644 (file)
index 0000000..45e4c02
--- /dev/null
@@ -0,0 +1,83 @@
+//----------------------------  petsc_32.cc  ---------------------------
+//    petsc_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  petsc_32.cc  ---------------------------
+
+
+// check petsc_wrapper::Vector::l2_norm()
+
+#include "../tests.h"
+#include <lac/petsc_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (petsc_wrappers::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;
+    }
+  v.compress ();
+
+                                   // then check the norm
+  Assert (std::fabs(v.mean_value() - sum/v.size()) < 1e-14*sum/v.size(),
+          ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("petsc_32.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      PetscInitialize(&argc,&argv,0,0);
+      {
+        petsc_wrappers::Vector v (100);
+        test (v);
+      }
+      PetscFinalize();
+    }
+  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/bits/petsc_33.cc b/tests/bits/petsc_33.cc
new file mode 100644 (file)
index 0000000..6ec3a93
--- /dev/null
@@ -0,0 +1,84 @@
+//----------------------------  petsc_33.cc  ---------------------------
+//    petsc_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  petsc_33.cc  ---------------------------
+
+
+// check petsc_wrapper::Vector::lp_norm(3)
+
+#include "../tests.h"
+#include <lac/petsc_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (petsc_wrappers::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 ();
+
+                                   // then check the norm
+  Assert (std::fabs(v.lp_norm(3) - std::pow(sum, 1./3.)) <
+          1e-14*std::pow(sum, 1./3.),
+          ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("petsc_33.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      PetscInitialize(&argc,&argv,0,0);
+      {
+        petsc_wrappers::Vector v (100);
+        test (v);
+      }
+      PetscFinalize();
+    }
+  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/bits/petsc_34.cc b/tests/bits/petsc_34.cc
new file mode 100644 (file)
index 0000000..28d51d0
--- /dev/null
@@ -0,0 +1,85 @@
+//----------------------------  petsc_34.cc  ---------------------------
+//    petsc_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  petsc_34.cc  ---------------------------
+
+
+// check petsc_wrapper::Vector::all_zero
+
+#include "../tests.h"
+#include <lac/petsc_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (petsc_wrappers::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("petsc_34.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      PetscInitialize(&argc,&argv,0,0);
+      {
+        petsc_wrappers::Vector v (100);
+        test (v);
+      }
+      PetscFinalize();
+    }
+  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/bits/petsc_35.cc b/tests/bits/petsc_35.cc
new file mode 100644 (file)
index 0000000..c8dc7b7
--- /dev/null
@@ -0,0 +1,102 @@
+//----------------------------  petsc_35.cc  ---------------------------
+//    petsc_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  petsc_35.cc  ---------------------------
+
+
+// check petsc_wrapper::Vector::operator+=(Vector) 
+
+#include "../tests.h"
+#include <lac/petsc_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (petsc_wrappers::Vector &v,
+           petsc_wrappers::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("petsc_35.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      PetscInitialize(&argc,&argv,0,0);
+      {
+        petsc_wrappers::Vector v (100);
+        petsc_wrappers::Vector w (100);
+        test (v,w);
+      }
+      PetscFinalize();
+    }
+  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/bits/petsc_36.cc b/tests/bits/petsc_36.cc
new file mode 100644 (file)
index 0000000..1e1d285
--- /dev/null
@@ -0,0 +1,102 @@
+//----------------------------  petsc_36.cc  ---------------------------
+//    petsc_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  petsc_36.cc  ---------------------------
+
+
+// check petsc_wrapper::Vector::operator-=(Vector) 
+
+#include "../tests.h"
+#include <lac/petsc_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (petsc_wrappers::Vector &v,
+           petsc_wrappers::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("petsc_36.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      PetscInitialize(&argc,&argv,0,0);
+      {
+        petsc_wrappers::Vector v (100);
+        petsc_wrappers::Vector w (100);
+        test (v,w);
+      }
+      PetscFinalize();
+    }
+  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/bits/petsc_37.cc b/tests/bits/petsc_37.cc
new file mode 100644 (file)
index 0000000..0c2babf
--- /dev/null
@@ -0,0 +1,81 @@
+//----------------------------  petsc_37.cc  ---------------------------
+//    petsc_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  petsc_37.cc  ---------------------------
+
+
+// check petsc_wrapper::Vector::add (scalar)
+
+#include "../tests.h"
+#include <lac/petsc_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (petsc_wrappers::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("petsc_37.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      PetscInitialize(&argc,&argv,0,0);
+      {
+        petsc_wrappers::Vector v (100);
+        test (v);
+      }
+      PetscFinalize();
+    }
+  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/bits/petsc_38.cc b/tests/bits/petsc_38.cc
new file mode 100644 (file)
index 0000000..a3dab77
--- /dev/null
@@ -0,0 +1,90 @@
+//----------------------------  petsc_38.cc  ---------------------------
+//    petsc_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  petsc_38.cc  ---------------------------
+
+
+// check petsc_wrapper::Vector::add(Vector) 
+
+#include "../tests.h"
+#include <lac/petsc_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (petsc_wrappers::Vector &v,
+           petsc_wrappers::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("petsc_38.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      PetscInitialize(&argc,&argv,0,0);
+      {
+        petsc_wrappers::Vector v (100);
+        petsc_wrappers::Vector w (100);
+        test (v,w);
+      }
+      PetscFinalize();
+    }
+  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/bits/petsc_39.cc b/tests/bits/petsc_39.cc
new file mode 100644 (file)
index 0000000..54659a0
--- /dev/null
@@ -0,0 +1,90 @@
+//----------------------------  petsc_39.cc  ---------------------------
+//    petsc_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  petsc_39.cc  ---------------------------
+
+
+// check petsc_wrapper::Vector::add(scalar, Vector) 
+
+#include "../tests.h"
+#include <lac/petsc_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (petsc_wrappers::Vector &v,
+           petsc_wrappers::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("petsc_39.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      PetscInitialize(&argc,&argv,0,0);
+      {
+        petsc_wrappers::Vector v (100);
+        petsc_wrappers::Vector w (100);
+        test (v,w);
+      }
+      PetscFinalize();
+    }
+  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/bits/petsc_40.cc b/tests/bits/petsc_40.cc
new file mode 100644 (file)
index 0000000..4f64c22
--- /dev/null
@@ -0,0 +1,95 @@
+//----------------------------  petsc_40.cc  ---------------------------
+//    petsc_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  petsc_40.cc  ---------------------------
+
+
+// check petsc_wrapper::Vector::add(s,V,s,V)
+
+#include "../tests.h"
+#include <lac/petsc_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (petsc_wrappers::Vector &v,
+           petsc_wrappers::Vector &w,
+           petsc_wrappers::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("petsc_40.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      PetscInitialize(&argc,&argv,0,0);
+      {
+        petsc_wrappers::Vector v (100);
+        petsc_wrappers::Vector w (100);
+        petsc_wrappers::Vector x (100);
+        test (v,w,x);
+      }
+      PetscFinalize();
+    }
+  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/bits/petsc_41.cc b/tests/bits/petsc_41.cc
new file mode 100644 (file)
index 0000000..d3b928b
--- /dev/null
@@ -0,0 +1,90 @@
+//----------------------------  petsc_41.cc  ---------------------------
+//    petsc_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  petsc_41.cc  ---------------------------
+
+
+// check petsc_wrapper::Vector::sadd(s, Vector) 
+
+#include "../tests.h"
+#include <lac/petsc_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (petsc_wrappers::Vector &v,
+           petsc_wrappers::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("petsc_41.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      PetscInitialize(&argc,&argv,0,0);
+      {
+        petsc_wrappers::Vector v (100);
+        petsc_wrappers::Vector w (100);
+        test (v,w);
+      }
+      PetscFinalize();
+    }
+  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/bits/petsc_42.cc b/tests/bits/petsc_42.cc
new file mode 100644 (file)
index 0000000..ade9c0c
--- /dev/null
@@ -0,0 +1,90 @@
+//----------------------------  petsc_42.cc  ---------------------------
+//    petsc_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  petsc_42.cc  ---------------------------
+
+
+// check petsc_wrapper::Vector::sadd(scalar, scalar, Vector) 
+
+#include "../tests.h"
+#include <lac/petsc_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (petsc_wrappers::Vector &v,
+           petsc_wrappers::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("petsc_42.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      PetscInitialize(&argc,&argv,0,0);
+      {
+        petsc_wrappers::Vector v (100);
+        petsc_wrappers::Vector w (100);
+        test (v,w);
+      }
+      PetscFinalize();
+    }
+  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/bits/petsc_43.cc b/tests/bits/petsc_43.cc
new file mode 100644 (file)
index 0000000..220e61b
--- /dev/null
@@ -0,0 +1,95 @@
+//----------------------------  petsc_43.cc  ---------------------------
+//    petsc_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  petsc_43.cc  ---------------------------
+
+
+// check petsc_wrapper::Vector::sadd(s,s,V,s,V)
+
+#include "../tests.h"
+#include <lac/petsc_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (petsc_wrappers::Vector &v,
+           petsc_wrappers::Vector &w,
+           petsc_wrappers::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("petsc_43.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      PetscInitialize(&argc,&argv,0,0);
+      {
+        petsc_wrappers::Vector v (100);
+        petsc_wrappers::Vector w (100);
+        petsc_wrappers::Vector x (100);
+        test (v,w,x);
+      }
+      PetscFinalize();
+    }
+  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/bits/petsc_44.cc b/tests/bits/petsc_44.cc
new file mode 100644 (file)
index 0000000..3c96ba0
--- /dev/null
@@ -0,0 +1,100 @@
+//----------------------------  petsc_44.cc  ---------------------------
+//    petsc_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  petsc_44.cc  ---------------------------
+
+
+// check petsc_wrapper::Vector::sadd(s,s,V,s,V,s,V)
+
+#include "../tests.h"
+#include <lac/petsc_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (petsc_wrappers::Vector &v,
+           petsc_wrappers::Vector &w,
+           petsc_wrappers::Vector &x,
+           petsc_wrappers::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("petsc_44.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      PetscInitialize(&argc,&argv,0,0);
+      {
+        petsc_wrappers::Vector v (100);
+        petsc_wrappers::Vector w (100);
+        petsc_wrappers::Vector x (100);
+        petsc_wrappers::Vector y (100);
+        test (v,w,x,y);
+      }
+      PetscFinalize();
+    }
+  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/bits/petsc_45.cc b/tests/bits/petsc_45.cc
new file mode 100644 (file)
index 0000000..d7f02b9
--- /dev/null
@@ -0,0 +1,90 @@
+//----------------------------  petsc_45.cc  ---------------------------
+//    petsc_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  petsc_45.cc  ---------------------------
+
+
+// check petsc_wrapper::Vector::scale
+
+#include "../tests.h"
+#include <lac/petsc_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (petsc_wrappers::Vector &v,
+           petsc_wrappers::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("petsc_45.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      PetscInitialize(&argc,&argv,0,0);
+      {
+        petsc_wrappers::Vector v (100);
+        petsc_wrappers::Vector w (100);
+        test (v,w);
+      }
+      PetscFinalize();
+    }
+  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/bits/petsc_46.cc b/tests/bits/petsc_46.cc
new file mode 100644 (file)
index 0000000..f536bde
--- /dev/null
@@ -0,0 +1,90 @@
+//----------------------------  petsc_46.cc  ---------------------------
+//    petsc_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  petsc_46.cc  ---------------------------
+
+
+// check petsc_wrapper::Vector::equ (s,V)
+
+#include "../tests.h"
+#include <lac/petsc_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (petsc_wrappers::Vector &v,
+           petsc_wrappers::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("petsc_46.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      PetscInitialize(&argc,&argv,0,0);
+      {
+        petsc_wrappers::Vector v (100);
+        petsc_wrappers::Vector w (100);
+        test (v,w);
+      }
+      PetscFinalize();
+    }
+  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/bits/petsc_47.cc b/tests/bits/petsc_47.cc
new file mode 100644 (file)
index 0000000..6b04d2b
--- /dev/null
@@ -0,0 +1,95 @@
+//----------------------------  petsc_47.cc  ---------------------------
+//    petsc_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  petsc_47.cc  ---------------------------
+
+
+// check petsc_wrapper::Vector::equ (s,V,s,V)
+
+#include "../tests.h"
+#include <lac/petsc_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (petsc_wrappers::Vector &v,
+           petsc_wrappers::Vector &w,
+           petsc_wrappers::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("petsc_47.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      PetscInitialize(&argc,&argv,0,0);
+      {
+        petsc_wrappers::Vector v (100);
+        petsc_wrappers::Vector w (100);
+        petsc_wrappers::Vector x (100);
+        test (v,w,x);
+      }
+      PetscFinalize();
+    }
+  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/bits/petsc_48.cc b/tests/bits/petsc_48.cc
new file mode 100644 (file)
index 0000000..8ab4bda
--- /dev/null
@@ -0,0 +1,96 @@
+//----------------------------  petsc_48.cc  ---------------------------
+//    petsc_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  petsc_48.cc  ---------------------------
+
+
+// check petsc_wrapper::Vector::ratio
+
+#include "../tests.h"
+#include <lac/petsc_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (petsc_wrappers::Vector &v,
+           petsc_wrappers::Vector &w,
+           petsc_wrappers::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
+  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.)) < 1e-14*v(i),
+              ExcInternalError());
+    }
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("petsc_48.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      PetscInitialize(&argc,&argv,0,0);
+      {
+        petsc_wrappers::Vector v (100);
+        petsc_wrappers::Vector w (100);
+        petsc_wrappers::Vector x (100);
+        test (v,w,x);
+      }
+      PetscFinalize();
+    }
+  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/bits/sparse_matrix_03a.cc b/tests/bits/sparse_matrix_03a.cc
new file mode 100644 (file)
index 0000000..1e4673a
--- /dev/null
@@ -0,0 +1,103 @@
+//----------------------------  sparse_matrix_03.cc  ---------------------------
+//    sparse_matrix_03.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  sparse_matrix_03.cc  ---------------------------
+
+
+// check setting elements in a sparse 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, but it shouldn't be a
+// problem with the deal.II matrices. worth checking anyway
+//
+// in contrast to petsc_03, we set and add the same elements here twice, to
+// get double the original value
+
+#include "../tests.h"
+#include <lac/sparse_matrix.h>    
+#include <fstream>
+
+
+void test ()
+{
+  SparsityPattern sp (5,5,3);
+  for (unsigned int i=0; i<5; ++i)
+    for (unsigned int j=0; j<5; ++j)
+      if ((i+2*j+1) % 3 == 0)
+        sp.add (i,j);
+  sp.compress ();
+
+  SparseMatrix<double> m(sp);
+  
+                                   // 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);
+  
+                                   // then make sure we retrieve the correct
+                                   // 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.el(i,j) == 0, ExcInternalError());
+        }
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main ()
+{
+  std::ofstream logfile("sparse_matrix_03a.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/bits/sparse_matrix_03b.cc b/tests/bits/sparse_matrix_03b.cc
new file mode 100644 (file)
index 0000000..10d2e0a
--- /dev/null
@@ -0,0 +1,103 @@
+//----------------------------  sparse_matrix_03.cc  ---------------------------
+//    sparse_matrix_03.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  sparse_matrix_03.cc  ---------------------------
+
+
+// check setting elements in a sparse 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, but it shouldn't be a
+// problem with the deal.II matrices. worth checking anyway
+//
+// in contrast to petsc_03, we set and add the same elements here twice, to
+// get double the original value
+
+#include "../tests.h"
+#include <lac/sparse_matrix.h>    
+#include <fstream>
+
+
+void test ()
+{
+  SparsityPattern sp (5,5,3);
+  for (unsigned int i=0; i<5; ++i)
+    for (unsigned int j=0; j<5; ++j)
+      if ((i+2*j+1) % 3 == 0)
+        sp.add (i,j);
+  sp.compress ();
+
+  SparseMatrix<double> m(sp);
+  
+                                   // 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);
+  
+                                   // then make sure we retrieve the correct
+                                   // 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.el(i,j) == 0, ExcInternalError());
+        }
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main ()
+{
+  std::ofstream logfile("sparse_matrix_03b.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/bits/vector_11.cc b/tests/bits/vector_11.cc
new file mode 100644 (file)
index 0000000..07f66c1
--- /dev/null
@@ -0,0 +1,73 @@
+//----------------------------  vector_11.cc  ---------------------------
+//    vector_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  vector_11.cc  ---------------------------
+
+
+// check Vector<double>::size()
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+
+
+void test (Vector<double> &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 () 
+{
+  std::ofstream logfile("vector_11.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      Vector<double> 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/bits/vector_12.cc b/tests/bits/vector_12.cc
new file mode 100644 (file)
index 0000000..ac05ed9
--- /dev/null
@@ -0,0 +1,86 @@
+//----------------------------  vector_12.cc  ---------------------------
+//    vector_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  vector_12.cc  ---------------------------
+
+
+// check Vector<double>::operator() in set-mode
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<double> &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 () 
+{
+  std::ofstream logfile("vector_12.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      Vector<double> 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/bits/vector_13.cc b/tests/bits/vector_13.cc
new file mode 100644 (file)
index 0000000..0efed51
--- /dev/null
@@ -0,0 +1,86 @@
+//----------------------------  vector_13.cc  ---------------------------
+//    vector_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  vector_13.cc  ---------------------------
+
+
+// check Vector<double>::operator() in add-mode
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<double> &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 () 
+{
+  std::ofstream logfile("vector_13.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      Vector<double> 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/bits/vector_14.cc b/tests/bits/vector_14.cc
new file mode 100644 (file)
index 0000000..a7aa45a
--- /dev/null
@@ -0,0 +1,92 @@
+//----------------------------  vector_14.cc  ---------------------------
+//    vector_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  vector_14.cc  ---------------------------
+
+
+// check Vector<double>::operator() in set/add-mode alternatingly
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<double> &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 () 
+{
+  std::ofstream logfile("vector_14.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      Vector<double> 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/bits/vector_15.cc b/tests/bits/vector_15.cc
new file mode 100644 (file)
index 0000000..852a3be
--- /dev/null
@@ -0,0 +1,89 @@
+//----------------------------  vector_15.cc  ---------------------------
+//    vector_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  vector_15.cc  ---------------------------
+
+
+// check Vector<double>::operator() in set/add-mode alternatingly, but
+// writing to the same elements
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<double> &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 () 
+{
+  std::ofstream logfile("vector_15.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      Vector<double> 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/bits/vector_16.cc b/tests/bits/vector_16.cc
new file mode 100644 (file)
index 0000000..886f5b3
--- /dev/null
@@ -0,0 +1,91 @@
+//----------------------------  vector_16.cc  ---------------------------
+//    vector_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  vector_16.cc  ---------------------------
+
+
+// check Vector<double>::operator() in set/add-mode alternatingly, but
+// writing and overwriting the same elements
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<double> &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 () 
+{
+  std::ofstream logfile("vector_16.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      Vector<double> 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/bits/vector_17.cc b/tests/bits/vector_17.cc
new file mode 100644 (file)
index 0000000..2990fd4
--- /dev/null
@@ -0,0 +1,78 @@
+//----------------------------  vector_17.cc  ---------------------------
+//    vector_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  vector_17.cc  ---------------------------
+
+
+// check Vector<double>::l1_norm()
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<double> &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 () 
+{
+  std::ofstream logfile("vector_17.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      Vector<double> 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/bits/vector_18.cc b/tests/bits/vector_18.cc
new file mode 100644 (file)
index 0000000..bf22c28
--- /dev/null
@@ -0,0 +1,78 @@
+//----------------------------  vector_18.cc  ---------------------------
+//    vector_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  vector_18.cc  ---------------------------
+
+
+// check Vector<double>::l2_norm()
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<double> &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)*std::fabs(1.*i);
+    }
+  v.compress ();
+
+                                   // then check the norm
+  Assert (v.l2_norm() == std::sqrt(norm), ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main () 
+{
+  std::ofstream logfile("vector_18.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      Vector<double> 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/bits/vector_19.cc b/tests/bits/vector_19.cc
new file mode 100644 (file)
index 0000000..4daaac5
--- /dev/null
@@ -0,0 +1,78 @@
+//----------------------------  vector_19.cc  ---------------------------
+//    vector_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  vector_19.cc  ---------------------------
+
+
+// check Vector<double>::linfty_norm()
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<double> &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 () 
+{
+  std::ofstream logfile("vector_19.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      Vector<double> 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/bits/vector_20.cc b/tests/bits/vector_20.cc
new file mode 100644 (file)
index 0000000..9feab0c
--- /dev/null
@@ -0,0 +1,87 @@
+//----------------------------  vector_20.cc  ---------------------------
+//    vector_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  vector_20.cc  ---------------------------
+
+
+// check Vector<double>::operator *=
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<double> &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 () 
+{
+  std::ofstream logfile("vector_20.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      Vector<double> 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/bits/vector_21.cc b/tests/bits/vector_21.cc
new file mode 100644 (file)
index 0000000..e169723
--- /dev/null
@@ -0,0 +1,87 @@
+//----------------------------  vector_21.cc  ---------------------------
+//    vector_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  vector_21.cc  ---------------------------
+
+
+// check Vector<double>::operator /=
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<double> &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 () 
+{
+  std::ofstream logfile("vector_21.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      Vector<double> 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/bits/vector_22.cc b/tests/bits/vector_22.cc
new file mode 100644 (file)
index 0000000..bc92ef2
--- /dev/null
@@ -0,0 +1,82 @@
+//----------------------------  vector_22.cc  ---------------------------
+//    vector_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  vector_22.cc  ---------------------------
+
+
+// check Vector<double>::operator*(Vector) on two vectors that are
+// orthogonal
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<double> &v,
+           Vector<double> &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 () 
+{
+  std::ofstream logfile("vector_22.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      Vector<double> v (100);
+      Vector<double> 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/bits/vector_23.cc b/tests/bits/vector_23.cc
new file mode 100644 (file)
index 0000000..96ff010
--- /dev/null
@@ -0,0 +1,89 @@
+//----------------------------  vector_23.cc  ---------------------------
+//    vector_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  vector_23.cc  ---------------------------
+
+
+// check Vector<double>::operator*(Vector) on two vectors that are
+// not orthogonal
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<double> &v,
+           Vector<double> &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 () 
+{
+  std::ofstream logfile("vector_23.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      Vector<double> v (100);
+      Vector<double> 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/bits/vector_24.cc b/tests/bits/vector_24.cc
new file mode 100644 (file)
index 0000000..19bee24
--- /dev/null
@@ -0,0 +1,79 @@
+//----------------------------  vector_24.cc  ---------------------------
+//    vector_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  vector_24.cc  ---------------------------
+
+
+// check Vector<double>::clear()
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<double> &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.clear ();
+  Assert (v.size() == sz, ExcInternalError());
+  Assert (v.l2_norm() == 0, ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main () 
+{
+  std::ofstream logfile("vector_24.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      Vector<double> 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/bits/vector_25.cc b/tests/bits/vector_25.cc
new file mode 100644 (file)
index 0000000..53cd8ee
--- /dev/null
@@ -0,0 +1,77 @@
+//----------------------------  vector_25.cc  ---------------------------
+//    vector_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  vector_25.cc  ---------------------------
+
+// check Vector::operator = (Scalar) with setting to zero
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<double> &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 () 
+{
+  std::ofstream logfile("vector_25.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      Vector<double> 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/bits/vector_26.cc b/tests/bits/vector_26.cc
new file mode 100644 (file)
index 0000000..49dad76
--- /dev/null
@@ -0,0 +1,76 @@
+//----------------------------  vector_26.cc  ---------------------------
+//    vector_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  vector_26.cc  ---------------------------
+
+// check Vector::operator = (scalar) with setting to a
+// nonzero value
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<double> &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 () 
+{
+  std::ofstream logfile("vector_26.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      Vector<double> 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/bits/vector_27.cc b/tests/bits/vector_27.cc
new file mode 100644 (file)
index 0000000..8cf9ef3
--- /dev/null
@@ -0,0 +1,82 @@
+//----------------------------  vector_27.cc  ---------------------------
+//    vector_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  vector_27.cc  ---------------------------
+
+
+// check Vector<double>::operator = (Vector) 
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<double> &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
+  Vector<double> 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;
+  Assert (std::fabs(v*w - v.l2_norm() * w.l2_norm()) < 1e-14*(v*w),
+          ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main () 
+{
+  std::ofstream logfile("vector_27.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      Vector<double> 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/bits/vector_28.cc b/tests/bits/vector_28.cc
new file mode 100644 (file)
index 0000000..4f3ae5c
--- /dev/null
@@ -0,0 +1,84 @@
+//----------------------------  vector_28.cc  ---------------------------
+//    vector_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  vector_28.cc  ---------------------------
+
+
+// check Vector<double>::operator = (Vector), except that we don't
+// resize the vector to be copied to beforehand
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<double> &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
+  Vector<double> 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;
+  Assert (std::fabs(v*w - v.l2_norm() * w.l2_norm()) < 1e-14*(v*w),
+          ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main () 
+{
+  std::ofstream logfile("vector_28.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      Vector<double> 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/bits/vector_29.cc b/tests/bits/vector_29.cc
new file mode 100644 (file)
index 0000000..948cef4
--- /dev/null
@@ -0,0 +1,70 @@
+//----------------------------  vector_29.cc  ---------------------------
+//    vector_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  vector_29.cc  ---------------------------
+
+
+// check Vector<double>::reinit(fast)
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<double> &v)
+{
+  v.reinit (13, true);
+  
+  Assert (v.size() == 13, ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main () 
+{
+  std::ofstream logfile("vector_29.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      Vector<double> 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/bits/vector_30.cc b/tests/bits/vector_30.cc
new file mode 100644 (file)
index 0000000..449f82b
--- /dev/null
@@ -0,0 +1,78 @@
+//----------------------------  vector_30.cc  ---------------------------
+//    vector_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  vector_30.cc  ---------------------------
+
+
+// check Vector<double>::reinit(!fast)
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<double> &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 () 
+{
+  std::ofstream logfile("vector_30.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      Vector<double> 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/bits/vector_31.cc b/tests/bits/vector_31.cc
new file mode 100644 (file)
index 0000000..cb654be
--- /dev/null
@@ -0,0 +1,79 @@
+//----------------------------  vector_31.cc  ---------------------------
+//    vector_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  vector_31.cc  ---------------------------
+
+
+// check Vector<double>::l2_norm()
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<double> &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)*std::fabs(1.*i);
+    }
+  v.compress ();
+
+                                   // then check the norm
+  Assert (std::fabs(v.norm_sqr() - norm) < 1e-14*norm,
+          ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main () 
+{
+  std::ofstream logfile("vector_31.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      Vector<double> 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/bits/vector_32.cc b/tests/bits/vector_32.cc
new file mode 100644 (file)
index 0000000..418fbd9
--- /dev/null
@@ -0,0 +1,79 @@
+//----------------------------  vector_32.cc  ---------------------------
+//    vector_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  vector_32.cc  ---------------------------
+
+
+// check Vector<double>::l2_norm()
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<double> &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;
+    }
+  v.compress ();
+
+                                   // then check the norm
+  Assert (std::fabs(v.mean_value() - sum/v.size()) < 1e-14*sum/v.size(),
+          ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main () 
+{
+  std::ofstream logfile("vector_32.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      Vector<double> 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/bits/vector_33.cc b/tests/bits/vector_33.cc
new file mode 100644 (file)
index 0000000..d605f11
--- /dev/null
@@ -0,0 +1,80 @@
+//----------------------------  vector_33.cc  ---------------------------
+//    vector_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  vector_33.cc  ---------------------------
+
+
+// check Vector<double>::lp_norm(3)
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<double> &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 ();
+
+                                   // then check the norm
+  Assert (std::fabs(v.lp_norm(3) - std::pow(sum, 1./3.)) <
+          1e-14*std::pow(sum, 1./3.),
+          ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main () 
+{
+  std::ofstream logfile("vector_33.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      Vector<double> 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/bits/vector_34.cc b/tests/bits/vector_34.cc
new file mode 100644 (file)
index 0000000..41b4cde
--- /dev/null
@@ -0,0 +1,81 @@
+//----------------------------  vector_34.cc  ---------------------------
+//    vector_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  vector_34.cc  ---------------------------
+
+
+// check Vector<double>::all_zero
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<double> &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 () 
+{
+  std::ofstream logfile("vector_34.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      Vector<double> 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/bits/vector_35.cc b/tests/bits/vector_35.cc
new file mode 100644 (file)
index 0000000..188e633
--- /dev/null
@@ -0,0 +1,98 @@
+//----------------------------  vector_35.cc  ---------------------------
+//    vector_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  vector_35.cc  ---------------------------
+
+
+// check Vector<double>::operator+=(Vector) 
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<double> &v,
+           Vector<double> &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 () 
+{
+  std::ofstream logfile("vector_35.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      Vector<double> v (100);
+      Vector<double> 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/bits/vector_36.cc b/tests/bits/vector_36.cc
new file mode 100644 (file)
index 0000000..649dd8c
--- /dev/null
@@ -0,0 +1,98 @@
+//----------------------------  vector_36.cc  ---------------------------
+//    vector_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  vector_36.cc  ---------------------------
+
+
+// check Vector<double>::operator-=(Vector) 
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<double> &v,
+           Vector<double> &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 () 
+{
+  std::ofstream logfile("vector_36.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      Vector<double> v (100);
+      Vector<double> 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/bits/vector_37.cc b/tests/bits/vector_37.cc
new file mode 100644 (file)
index 0000000..8332e9a
--- /dev/null
@@ -0,0 +1,77 @@
+//----------------------------  vector_37.cc  ---------------------------
+//    vector_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  vector_37.cc  ---------------------------
+
+
+// check Vector<double>::add (scalar)
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<double> &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 () 
+{
+  std::ofstream logfile("vector_37.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      Vector<double> 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/bits/vector_38.cc b/tests/bits/vector_38.cc
new file mode 100644 (file)
index 0000000..af3d9f2
--- /dev/null
@@ -0,0 +1,86 @@
+//----------------------------  vector_38.cc  ---------------------------
+//    vector_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  vector_38.cc  ---------------------------
+
+
+// check Vector<double>::add(Vector) 
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<double> &v,
+           Vector<double> &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 () 
+{
+  std::ofstream logfile("vector_38.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      Vector<double> v (100);
+      Vector<double> 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/bits/vector_39.cc b/tests/bits/vector_39.cc
new file mode 100644 (file)
index 0000000..e1345b0
--- /dev/null
@@ -0,0 +1,86 @@
+//----------------------------  vector_39.cc  ---------------------------
+//    vector_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  vector_39.cc  ---------------------------
+
+
+// check Vector<double>::add(scalar, Vector) 
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<double> &v,
+           Vector<double> &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 () 
+{
+  std::ofstream logfile("vector_39.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      Vector<double> v (100);
+      Vector<double> 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/bits/vector_40.cc b/tests/bits/vector_40.cc
new file mode 100644 (file)
index 0000000..d978c90
--- /dev/null
@@ -0,0 +1,91 @@
+//----------------------------  vector_40.cc  ---------------------------
+//    vector_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  vector_40.cc  ---------------------------
+
+
+// check Vector<double>::add(s,V,s,V)
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<double> &v,
+           Vector<double> &w,
+           Vector<double> &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 () 
+{
+  std::ofstream logfile("vector_40.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      Vector<double> v (100);
+      Vector<double> w (100);
+      Vector<double> 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/bits/vector_41.cc b/tests/bits/vector_41.cc
new file mode 100644 (file)
index 0000000..ae5e38f
--- /dev/null
@@ -0,0 +1,86 @@
+//----------------------------  vector_41.cc  ---------------------------
+//    vector_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  vector_41.cc  ---------------------------
+
+
+// check Vector<double>::sadd(s, Vector) 
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<double> &v,
+           Vector<double> &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 () 
+{
+  std::ofstream logfile("vector_41.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      Vector<double> v (100);
+      Vector<double> 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/bits/vector_42.cc b/tests/bits/vector_42.cc
new file mode 100644 (file)
index 0000000..30ef15c
--- /dev/null
@@ -0,0 +1,86 @@
+//----------------------------  vector_42.cc  ---------------------------
+//    vector_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  vector_42.cc  ---------------------------
+
+
+// check Vector<double>::sadd(scalar, scalar, Vector) 
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<double> &v,
+           Vector<double> &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 () 
+{
+  std::ofstream logfile("vector_42.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      Vector<double> v (100);
+      Vector<double> 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/bits/vector_43.cc b/tests/bits/vector_43.cc
new file mode 100644 (file)
index 0000000..16b51c1
--- /dev/null
@@ -0,0 +1,91 @@
+//----------------------------  vector_43.cc  ---------------------------
+//    vector_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  vector_43.cc  ---------------------------
+
+
+// check Vector<double>::sadd(s,s,V,s,V)
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<double> &v,
+           Vector<double> &w,
+           Vector<double> &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 () 
+{
+  std::ofstream logfile("vector_43.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      Vector<double> v (100);
+      Vector<double> w (100);
+      Vector<double> 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/bits/vector_44.cc b/tests/bits/vector_44.cc
new file mode 100644 (file)
index 0000000..afb7c15
--- /dev/null
@@ -0,0 +1,96 @@
+//----------------------------  vector_44.cc  ---------------------------
+//    vector_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  vector_44.cc  ---------------------------
+
+
+// check Vector<double>::sadd(s,s,V,s,V,s,V)
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<double> &v,
+           Vector<double> &w,
+           Vector<double> &x,
+           Vector<double> &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 () 
+{
+  std::ofstream logfile("vector_44.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      Vector<double> v (100);
+      Vector<double> w (100);
+      Vector<double> x (100);
+      Vector<double> 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/bits/vector_45.cc b/tests/bits/vector_45.cc
new file mode 100644 (file)
index 0000000..892ddb9
--- /dev/null
@@ -0,0 +1,86 @@
+//----------------------------  vector_45.cc  ---------------------------
+//    vector_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  vector_45.cc  ---------------------------
+
+
+// check Vector<double>::scale
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<double> &v,
+           Vector<double> &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 () 
+{
+  std::ofstream logfile("vector_45.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      Vector<double> v (100);
+      Vector<double> 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/bits/vector_46.cc b/tests/bits/vector_46.cc
new file mode 100644 (file)
index 0000000..4a6b5ca
--- /dev/null
@@ -0,0 +1,86 @@
+//----------------------------  vector_46.cc  ---------------------------
+//    vector_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  vector_46.cc  ---------------------------
+
+
+// check Vector<double>::equ (s,V)
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<double> &v,
+           Vector<double> &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 () 
+{
+  std::ofstream logfile("vector_46.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      Vector<double> v (100);
+      Vector<double> 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/bits/vector_47.cc b/tests/bits/vector_47.cc
new file mode 100644 (file)
index 0000000..516b204
--- /dev/null
@@ -0,0 +1,91 @@
+//----------------------------  vector_47.cc  ---------------------------
+//    vector_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  vector_47.cc  ---------------------------
+
+
+// check Vector<double>::equ (s,V,s,V)
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<double> &v,
+           Vector<double> &w,
+           Vector<double> &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 () 
+{
+  std::ofstream logfile("vector_47.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      Vector<double> v (100);
+      Vector<double> w (100);
+      Vector<double> 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/bits/vector_48.cc b/tests/bits/vector_48.cc
new file mode 100644 (file)
index 0000000..bed090b
--- /dev/null
@@ -0,0 +1,92 @@
+//----------------------------  vector_48.cc  ---------------------------
+//    vector_11.cc,v 1.4 2003/07/03 10:31:46 guido Exp
+//    Version: 
+//
+//    Copyright (C) 2004 by the deal.II authors and Anna Schneebeli
+//
+//    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.
+//
+//----------------------------  vector_48.cc  ---------------------------
+
+
+// check Vector<double>::ratio
+
+#include "../tests.h"
+#include <lac/vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (Vector<double> &v,
+           Vector<double> &w,
+           Vector<double> &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
+  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.)) < 1e-14*v(i),
+              ExcInternalError());
+    }
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main () 
+{
+  std::ofstream logfile("vector_48.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      Vector<double> v (100);
+      Vector<double> w (100);
+      Vector<double> 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;
+    };
+}

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.