]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
new tests.
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Sun, 29 Feb 2004 20:49:14 +0000 (20:49 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Sun, 29 Feb 2004 20:49:14 +0000 (20:49 +0000)
git-svn-id: https://svn.dealii.org/trunk@8620 0785d39b-7218-0410-832d-ea1e28bc413d

tests/bits/petsc_57.cc [new file with mode: 0644]
tests/bits/petsc_58.cc [new file with mode: 0644]
tests/bits/petsc_59.cc [new file with mode: 0644]
tests/bits/petsc_60.cc [new file with mode: 0644]
tests/bits/petsc_61.cc [new file with mode: 0644]
tests/results/i686-pc-linux-gnu+gcc3.2/bits/petsc_57.output [new file with mode: 0644]
tests/results/i686-pc-linux-gnu+gcc3.2/bits/petsc_58.output [new file with mode: 0644]
tests/results/i686-pc-linux-gnu+gcc3.2/bits/petsc_59.output [new file with mode: 0644]
tests/results/i686-pc-linux-gnu+gcc3.2/bits/petsc_60.output [new file with mode: 0644]
tests/results/i686-pc-linux-gnu+gcc3.2/bits/petsc_61.output [new file with mode: 0644]

diff --git a/tests/bits/petsc_57.cc b/tests/bits/petsc_57.cc
new file mode 100644 (file)
index 0000000..1da34b5
--- /dev/null
@@ -0,0 +1,90 @@
+//----------------------------  petsc_57.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  petsc_57.cc  ---------------------------
+
+
+// check PETScWrappers::Vector::is_non_zero
+
+#include "../tests.h"
+#include <lac/petsc_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (PETScWrappers::Vector &v)
+{
+                                   // set only certain elements of the
+                                   // vector. they are all positive
+  std::vector<bool> pattern (v.size(), false);
+  for (unsigned int i=0; i<v.size(); i+=1+i)
+    {
+      v(i) += i;
+      pattern[i] = true;
+    }
+
+  v.compress ();
+
+                                   // check that the vector is really
+                                   // non-negative
+  Assert (v.is_non_negative() == true, ExcInternalError());
+
+                                   // then set a single element to a negative
+                                   // value and check again
+  v(v.size()/2) = -1;
+  Assert (v.is_non_negative() == false, ExcInternalError());  
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("petsc_57.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      PetscInitialize(&argc,&argv,0,0);
+      {
+        PETScWrappers::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_58.cc b/tests/bits/petsc_58.cc
new file mode 100644 (file)
index 0000000..8d51ae6
--- /dev/null
@@ -0,0 +1,92 @@
+//----------------------------  petsc_58.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  petsc_58.cc  ---------------------------
+
+
+// check ::Vector (const PETScWrappers::Vector &) copy constructor
+
+#include "../tests.h"
+#include <lac/petsc_vector.h>
+#include <lac/vector.h>
+
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (PETScWrappers::Vector &v)
+{
+                                   // set only certain elements of the
+                                   // vector.
+  std::vector<bool> pattern (v.size(), false);
+  for (unsigned int i=0; i<v.size(); i+=1+i)
+    {
+      v(i) += i;
+      pattern[i] = true;
+    }
+
+  v.compress ();
+
+  Vector<double> w (v);
+  Vector<float>  x (v);
+  
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      Assert (v(i) == w(i), ExcInternalError());
+      Assert (v(i) == x(i), ExcInternalError());
+    }
+      
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("petsc_58.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      PetscInitialize(&argc,&argv,0,0);
+      {
+        PETScWrappers::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_59.cc b/tests/bits/petsc_59.cc
new file mode 100644 (file)
index 0000000..02becd9
--- /dev/null
@@ -0,0 +1,95 @@
+//----------------------------  petsc_59.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  petsc_59.cc  ---------------------------
+
+
+// check PETScWrappers::Vector (const ::Vector &) copy constructor
+
+#include "../tests.h"
+#include <lac/petsc_vector.h>
+#include <lac/vector.h>
+
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (PETScWrappers::Vector &v)
+{
+                                   // set only certain elements of the
+                                   // vector.
+  std::vector<bool> pattern (v.size(), false);
+  for (unsigned int i=0; i<v.size(); i+=1+i)
+    {
+      v(i) += i;
+      pattern[i] = true;
+    }
+
+  v.compress ();
+
+  Vector<double> w (v);
+  Vector<float>  x (v);
+
+  PETScWrappers::Vector w1 (w);
+  PETScWrappers::Vector x1 (x);
+  
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      Assert (w1(i) == w(i), ExcInternalError());
+      Assert (x1(i) == x(i), ExcInternalError());
+    }
+      
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("petsc_59.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      PetscInitialize(&argc,&argv,0,0);
+      {
+        PETScWrappers::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_60.cc b/tests/bits/petsc_60.cc
new file mode 100644 (file)
index 0000000..6d1f87e
--- /dev/null
@@ -0,0 +1,92 @@
+//----------------------------  petsc_60.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  petsc_60.cc  ---------------------------
+
+
+// check ::Vector::operator = (const PETScWrappers::Vector &)
+
+#include "../tests.h"
+#include <lac/petsc_vector.h>
+#include <lac/vector.h>
+
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (PETScWrappers::Vector &v)
+{
+                                   // set only certain elements of the
+                                   // vector.
+  std::vector<bool> pattern (v.size(), false);
+  for (unsigned int i=0; i<v.size(); i+=1+i)
+    {
+      v(i) += i;
+      pattern[i] = true;
+    }
+
+  v.compress ();
+
+  Vector<double> w; w=v;
+  Vector<float>  x; x=v;
+  
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      Assert (v(i) == w(i), ExcInternalError());
+      Assert (v(i) == x(i), ExcInternalError());
+    }
+      
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("petsc_60.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      PetscInitialize(&argc,&argv,0,0);
+      {
+        PETScWrappers::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_61.cc b/tests/bits/petsc_61.cc
new file mode 100644 (file)
index 0000000..3241169
--- /dev/null
@@ -0,0 +1,95 @@
+//----------------------------  petsc_61.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004 by the deal.II authors
+//
+//    This file is subject to QPL and may not be  distributed
+//    without copyright and license information. Please refer
+//    to the file deal.II/doc/license.html for the  text  and
+//    further information on this license.
+//
+//----------------------------  petsc_61.cc  ---------------------------
+
+
+// check PETScWrappers::Vector::operator = (const ::Vector &)
+
+#include "../tests.h"
+#include <lac/petsc_vector.h>
+#include <lac/vector.h>
+
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (PETScWrappers::Vector &v)
+{
+                                   // set only certain elements of the
+                                   // vector.
+  std::vector<bool> pattern (v.size(), false);
+  for (unsigned int i=0; i<v.size(); i+=1+i)
+    {
+      v(i) += i;
+      pattern[i] = true;
+    }
+
+  v.compress ();
+
+  Vector<double> w; w=v;
+  Vector<float>  x; x=v;
+
+  PETScWrappers::Vector w1; w1=w;
+  PETScWrappers::Vector x1; x1=x;
+  
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      Assert (w1(i) == w(i), ExcInternalError());
+      Assert (x1(i) == x(i), ExcInternalError());
+    }
+      
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("petsc_61.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      PetscInitialize(&argc,&argv,0,0);
+      {
+        PETScWrappers::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/results/i686-pc-linux-gnu+gcc3.2/bits/petsc_57.output b/tests/results/i686-pc-linux-gnu+gcc3.2/bits/petsc_57.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_58.output b/tests/results/i686-pc-linux-gnu+gcc3.2/bits/petsc_58.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_59.output b/tests/results/i686-pc-linux-gnu+gcc3.2/bits/petsc_59.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_60.output b/tests/results/i686-pc-linux-gnu+gcc3.2/bits/petsc_60.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_61.output b/tests/results/i686-pc-linux-gnu+gcc3.2/bits/petsc_61.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.