]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
New tests.
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Sun, 7 Mar 2004 22:31:12 +0000 (22:31 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Sun, 7 Mar 2004 22:31:12 +0000 (22:31 +0000)
git-svn-id: https://svn.dealii.org/trunk@8669 0785d39b-7218-0410-832d-ea1e28bc413d

tests/bits/petsc_full_matrix_iterator_01.cc [new file with mode: 0644]
tests/bits/petsc_sparse_matrix_iterator_01.cc [new file with mode: 0644]
tests/results/i686-pc-linux-gnu+gcc3.2/bits/petsc_full_matrix_iterator_01.output [new file with mode: 0644]
tests/results/i686-pc-linux-gnu+gcc3.2/bits/petsc_sparse_matrix_iterator_01.output [new file with mode: 0644]

diff --git a/tests/bits/petsc_full_matrix_iterator_01.cc b/tests/bits/petsc_full_matrix_iterator_01.cc
new file mode 100644 (file)
index 0000000..987aefb
--- /dev/null
@@ -0,0 +1,80 @@
+//----------------------------  petsc_full_matrix_iterator_01.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_full_matrix_iterator_01.cc  ---------------------------
+
+
+// test PETScWrappers::MatrixBase::const_iterator
+
+#include "../tests.h"
+#include <lac/petsc_full_matrix.h>    
+#include <fstream>
+#include <iostream>
+
+
+void test ()
+{
+  PETScWrappers::FullMatrix m(5,5);
+  m.set (0,0,1);
+  m.set (1,1,2);
+  m.set (1,2,3);  
+  m.compress ();
+  PETScWrappers::FullMatrix::const_iterator i = m.begin();
+  deallog << i->row() << ' ' << i->column() << ' ' << i->value() << std::endl;
+  ++i;
+  deallog << i->row() << ' ' << i->column() << ' ' << i->value() << std::endl;
+  i++;
+  deallog << i->row() << ' ' << i->column() << ' ' << i->value() << std::endl;
+  
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv)
+{
+  std::ofstream logfile("petsc_full_matrix_iterator_01.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      PetscInitialize(&argc,&argv,0,0);
+      {
+        test ();
+      }
+      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_sparse_matrix_iterator_01.cc b/tests/bits/petsc_sparse_matrix_iterator_01.cc
new file mode 100644 (file)
index 0000000..d6080fa
--- /dev/null
@@ -0,0 +1,80 @@
+//----------------------------  petsc_sparse_matrix_iterator_01.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_sparse_matrix_iterator_01.cc  ---------------------------
+
+
+// test PETScWrappers::MatrixBase::const_iterator
+
+#include "../tests.h"
+#include <lac/petsc_sparse_matrix.h>    
+#include <fstream>
+#include <iostream>
+
+
+void test ()
+{
+  PETScWrappers::SparseMatrix m(5,5,5);
+  m.set (0,0,1);
+  m.set (1,1,2);
+  m.set (1,2,3);  
+  m.compress ();
+  PETScWrappers::SparseMatrix::const_iterator i = m.begin();
+  deallog << i->row() << ' ' << i->column() << ' ' << i->value() << std::endl;
+  ++i;
+  deallog << i->row() << ' ' << i->column() << ' ' << i->value() << std::endl;
+  i++;
+  deallog << i->row() << ' ' << i->column() << ' ' << i->value() << std::endl;
+  
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv)
+{
+  std::ofstream logfile("petsc_sparse_matrix_iterator_01.output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+
+  try
+    {
+      PetscInitialize(&argc,&argv,0,0);
+      {
+        test ();
+      }
+      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_full_matrix_iterator_01.output b/tests/results/i686-pc-linux-gnu+gcc3.2/bits/petsc_full_matrix_iterator_01.output
new file mode 100644 (file)
index 0000000..1946991
--- /dev/null
@@ -0,0 +1,5 @@
+
+DEAL::0 0 1.00000
+DEAL::0 1 0.00000
+DEAL::0 2 0.00000
+DEAL::OK
diff --git a/tests/results/i686-pc-linux-gnu+gcc3.2/bits/petsc_sparse_matrix_iterator_01.output b/tests/results/i686-pc-linux-gnu+gcc3.2/bits/petsc_sparse_matrix_iterator_01.output
new file mode 100644 (file)
index 0000000..e6bdc2e
--- /dev/null
@@ -0,0 +1,5 @@
+
+DEAL::0 0 1.00000
+DEAL::1 1 2.00000
+DEAL::1 2 3.00000
+DEAL::OK

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.