]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
New tests.
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 9 Feb 2004 20:12:43 +0000 (20:12 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 9 Feb 2004 20:12:43 +0000 (20:12 +0000)
git-svn-id: https://svn.dealii.org/trunk@8440 0785d39b-7218-0410-832d-ea1e28bc413d

tests/bits/petsc_vector_equality_1.cc [new file with mode: 0644]
tests/bits/petsc_vector_equality_2.cc [new file with mode: 0644]
tests/bits/petsc_vector_equality_3.cc [new file with mode: 0644]
tests/bits/petsc_vector_equality_4.cc [new file with mode: 0644]
tests/results/i686-pc-linux-gnu+gcc3.2/bits/petsc_vector_equality_1.output [new file with mode: 0644]
tests/results/i686-pc-linux-gnu+gcc3.2/bits/petsc_vector_equality_2.output [new file with mode: 0644]
tests/results/i686-pc-linux-gnu+gcc3.2/bits/petsc_vector_equality_3.output [new file with mode: 0644]
tests/results/i686-pc-linux-gnu+gcc3.2/bits/petsc_vector_equality_4.output [new file with mode: 0644]

diff --git a/tests/bits/petsc_vector_equality_1.cc b/tests/bits/petsc_vector_equality_1.cc
new file mode 100644 (file)
index 0000000..b663407
--- /dev/null
@@ -0,0 +1,84 @@
+//----------------------------  petsc_vector_equality_1.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_vector_equality_1.cc  ---------------------------
+
+
+// check petsc_wrappers::Vector::operator==(petsc_wrappers::Vector) for vectors that are not
+// equal
+
+#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.;
+    }
+
+  Assert (!(v==w), ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc, char **argv)
+{
+  std::ofstream logfile("petsc_vector_equality_1.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_vector_equality_2.cc b/tests/bits/petsc_vector_equality_2.cc
new file mode 100644 (file)
index 0000000..e54cdb2
--- /dev/null
@@ -0,0 +1,86 @@
+//----------------------------  petsc_vector_equality_2.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_vector_equality_2.cc  ---------------------------
+
+
+// check petsc_wrappers::Vector::operator==(petsc_wrappers::Vector) for vectors that are
+// equal
+
+#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.;
+    }
+                                   // but then copy elements and make sure the
+                                   // vectors are actually equal
+  v = w;
+  Assert (v==w, ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc, char **argv)
+{
+  std::ofstream logfile("petsc_vector_equality_2.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_vector_equality_3.cc b/tests/bits/petsc_vector_equality_3.cc
new file mode 100644 (file)
index 0000000..02adb2a
--- /dev/null
@@ -0,0 +1,84 @@
+//----------------------------  petsc_vector_equality_3.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_vector_equality_3.cc  ---------------------------
+
+
+// check petsc_wrappers::Vector::operator!=(petsc_wrappers::Vector) for vectors that are not
+// equal
+
+#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.;
+    }
+
+  Assert (v!=w, ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc, char **argv)
+{
+  std::ofstream logfile("petsc_vector_equality_3.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_vector_equality_4.cc b/tests/bits/petsc_vector_equality_4.cc
new file mode 100644 (file)
index 0000000..d8b9f8a
--- /dev/null
@@ -0,0 +1,86 @@
+//----------------------------  petsc_vector_equality_4.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_vector_equality_4.cc  ---------------------------
+
+
+// check petsc_wrappers::Vector::operator!=(petsc_wrappers::Vector) for vectors that are
+// equal
+
+#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.;
+    }
+                                   // but then copy elements and make sure the
+                                   // vectors are actually equal
+  v = w;
+  Assert (! (v!=w), ExcInternalError());
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc, char **argv)
+{
+  std::ofstream logfile("petsc_vector_equality_4.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/results/i686-pc-linux-gnu+gcc3.2/bits/petsc_vector_equality_1.output b/tests/results/i686-pc-linux-gnu+gcc3.2/bits/petsc_vector_equality_1.output
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/results/i686-pc-linux-gnu+gcc3.2/bits/petsc_vector_equality_2.output b/tests/results/i686-pc-linux-gnu+gcc3.2/bits/petsc_vector_equality_2.output
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/results/i686-pc-linux-gnu+gcc3.2/bits/petsc_vector_equality_3.output b/tests/results/i686-pc-linux-gnu+gcc3.2/bits/petsc_vector_equality_3.output
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK
diff --git a/tests/results/i686-pc-linux-gnu+gcc3.2/bits/petsc_vector_equality_4.output b/tests/results/i686-pc-linux-gnu+gcc3.2/bits/petsc_vector_equality_4.output
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.