]> https://gitweb.dealii.org/ - dealii.git/commitdiff
.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Fri, 6 Feb 2004 19:27:30 +0000 (19:27 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Fri, 6 Feb 2004 19:27:30 +0000 (19:27 +0000)
git-svn-id: https://svn.dealii.org/trunk@8409 0785d39b-7218-0410-832d-ea1e28bc413d

tests/bits/petsc_01.cc
tests/bits/petsc_02.cc
tests/bits/petsc_05.cc
tests/bits/petsc_06.cc
tests/bits/petsc_07.cc
tests/bits/petsc_08.cc
tests/bits/petsc_09.cc [new file with mode: 0644]
tests/bits/petsc_10.cc [new file with mode: 0644]

index ac4b0dd8d63275628d5e87532ee7c5d1aeabeadd..d959ab06782d2bd0c0bd702ced6ae9dfbcb8028a 100644 (file)
@@ -12,7 +12,8 @@
 //----------------------------  petsc_01.cc  ---------------------------
 
 
-// check setting elements in a petsc matrix using set()
+// check setting elements in a petsc matrix using
+// petsc_wrappers::SparseMatrix::set()
 
 #include "../tests.h"
 #include <lac/petsc_sparse_matrix.h>    
index 6e0ec65baa03caa19da6d29cdbab789848d9b33f..ec6286284910e62d06cc10f8be86e86749e0da5c 100644 (file)
@@ -12,7 +12,8 @@
 //----------------------------  petsc_02.cc  ---------------------------
 
 
-// check setting elements in a petsc matrix using add()
+// check setting elements in a petsc matrix using
+// petsc_wrappers::SparseMatrix::add()
 
 #include "../tests.h"
 #include <lac/petsc_sparse_matrix.h>    
index 26d0b160197249cc54a341113bb0b24adbd95ff6..9128f9d263894ac6c4114a639ba8cf0116ced03f 100644 (file)
@@ -12,7 +12,8 @@
 //----------------------------  petsc_05.cc  ---------------------------
 
 
-// check querying the number of nonzero elements
+// check querying the number of nonzero elements in
+// petsc_wrappers::SparseMatrix
 
 #include "../tests.h"
 #include <lac/petsc_sparse_matrix.h>    
index cefe548081d7fcc49080ed3a542935f40d1a92de..f8ab572a98b85f28d9da21fdc41f553ca1e99047 100644 (file)
@@ -12,7 +12,7 @@
 //----------------------------  petsc_06.cc  ---------------------------
 
 
-// check l1_norm
+// check petsc_wrappers::SparseMatrix::l1_norm
 
 #include "../tests.h"
 #include <lac/petsc_sparse_matrix.h>    
index e91d8c37c2ff7df21cc10515c3507a68d27c73da..2d163c3de1e94e4a43df6dbf7ac1a5777ea50ea2 100644 (file)
@@ -12,7 +12,7 @@
 //----------------------------  petsc_07.cc  ---------------------------
 
 
-// check linfty_norm
+// check petsc_wrappers::SparseMatrix::linfty_norm
 
 #include "../tests.h"
 #include <lac/petsc_sparse_matrix.h>    
index 353a792c3476bcf4e3779675ea0d146503768b31..51fb49bd3a5fa1c15d94ab7c703c9a98c39c9b21 100644 (file)
@@ -12,7 +12,7 @@
 //----------------------------  petsc_08.cc  ---------------------------
 
 
-// check l2_norm
+// check petsc_wrappers::SparseMatrix::l2_norm
 
 #include "../tests.h"
 #include <lac/petsc_sparse_matrix.h>    
diff --git a/tests/bits/petsc_09.cc b/tests/bits/petsc_09.cc
new file mode 100644 (file)
index 0000000..ec2d14e
--- /dev/null
@@ -0,0 +1,95 @@
+//----------------------------  petsc_09.cc  ---------------------------
+//    petsc_09.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_09.cc  ---------------------------
+
+
+// check petsc_wrapper::SparseMatrix::operator *=
+
+#include "../tests.h"
+#include <lac/petsc_sparse_matrix.h>    
+#include <fstream>
+#include <iostream>
+
+
+void test (petsc_wrappers::SparseMatrix &m)
+{
+                                   // first set a few entries
+  for (unsigned int i=0; i<m.m(); ++i)
+    for (unsigned int j=0; j<m.m(); ++j)
+      if ((i+2*j+1) % 3 == 0)
+        m.set (i,j, i*j*.5+.5);
+
+  m.compress ();
+  
+                                   // then multiply everything by 1.25 and
+                                   // make sure we retrieve the values we
+                                   // expect
+  m *= 1.25;
+  
+  for (unsigned int i=0; i<m.m(); ++i)
+    for (unsigned int j=0; j<m.m(); ++j)
+      if ((i+2*j+1) % 3 == 0)
+        {
+          Assert (m(i,j) == (i*j*.5+.5)*1.25, ExcInternalError());
+          Assert (m.el(i,j) == (i*j*.5+.5)*1.25, ExcInternalError());
+        }
+      else
+        {
+          Assert (m(i,j) == 0, ExcInternalError());
+          Assert (m.el(i,j) == 0, ExcInternalError());
+        }
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("petsc_09.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      PetscInitialize(&argc,&argv,0,0);
+      {
+        petsc_wrappers::SparseMatrix m (5,5,3);
+        test (m);
+      }
+      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_10.cc b/tests/bits/petsc_10.cc
new file mode 100644 (file)
index 0000000..c3229a4
--- /dev/null
@@ -0,0 +1,95 @@
+//----------------------------  petsc_10.cc  ---------------------------
+//    petsc_10.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_10.cc  ---------------------------
+
+
+// check petsc_wrapper::SparseMatrix::operator /=
+
+#include "../tests.h"
+#include <lac/petsc_sparse_matrix.h>    
+#include <fstream>
+#include <iostream>
+
+
+void test (petsc_wrappers::SparseMatrix &m)
+{
+                                   // first set a few entries
+  for (unsigned int i=0; i<m.m(); ++i)
+    for (unsigned int j=0; j<m.m(); ++j)
+      if ((i+2*j+1) % 3 == 0)
+        m.set (i,j, i*j*.5+.5);
+
+  m.compress ();
+  
+                                   // then divide everything by 4/3 and
+                                   // make sure we retrieve the values we
+                                   // expect
+  m /= 4./3.;
+  
+  for (unsigned int i=0; i<m.m(); ++i)
+    for (unsigned int j=0; j<m.m(); ++j)
+      if ((i+2*j+1) % 3 == 0)
+        {
+          Assert (m(i,j) == (i*j*.5+.5)/4*3, ExcInternalError());
+          Assert (m.el(i,j) == (i*j*.5+.5)/4*3, ExcInternalError());
+        }
+      else
+        {
+          Assert (m(i,j) == 0, ExcInternalError());
+          Assert (m.el(i,j) == 0, ExcInternalError());
+        }
+
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("petsc_10.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      PetscInitialize(&argc,&argv,0,0);
+      {
+        petsc_wrappers::SparseMatrix m (5,5,3);
+        test (m);
+      }
+      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;
+    };
+}

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.