]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Take over a test from mainline.
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 29 Jun 2009 09:37:29 +0000 (09:37 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 29 Jun 2009 09:37:29 +0000 (09:37 +0000)
git-svn-id: https://svn.dealii.org/branches/releases/Branch-6-2@18993 0785d39b-7218-0410-832d-ea1e28bc413d

tests/trilinos/49b.cc [new file with mode: 0644]
tests/trilinos/49b/cmp/generic [new file with mode: 0644]

diff --git a/tests/trilinos/49b.cc b/tests/trilinos/49b.cc
new file mode 100644 (file)
index 0000000..98cab09
--- /dev/null
@@ -0,0 +1,108 @@
+//----------------------------  49b.cc  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005, 2008, 2009 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.
+//
+//----------------------------  49b.cc  ---------------------------
+
+
+// like 49, but do the test for
+//  TrilinosWrappers::MPI::BlockVector
+//         ::operator = (dealii::BlockVector<TrilinosScalar>)
+// with block vectors instead of plain vectors
+
+#include "../tests.h" 
+#include <base/utilities.h>
+#include <lac/trilinos_block_vector.h>
+#include <lac/block_vector.h>
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test (TrilinosWrappers::MPI::BlockVector &v)
+{
+  std::vector<unsigned int> sizes (2, 3);
+  dealii::BlockVector<TrilinosScalar> w (sizes);
+
+  for (unsigned int i=0; i<w.size(); ++i)
+    w(i) = i;
+  
+  v = w;
+
+  
+                                   // make sure we get the expected result
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      Assert (w(i) == i, ExcInternalError());
+      Assert (v(i) == i, ExcInternalError());
+    }
+
+                                  // now also check the reverse assignment
+  w = 0;
+  w = v;
+  for (unsigned int i=0; i<v.size(); ++i)
+    {
+      Assert (w(i) == i, ExcInternalError());
+      Assert (v(i) == i, ExcInternalError());
+    }
+  
+  
+  deallog << "OK" << std::endl;
+}
+
+
+
+int main (int argc,char **argv) 
+{
+  std::ofstream logfile("49b/output");
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10); 
+
+  Utilities::System::MPI_InitFinalize mpi_initialization (argc, argv);
+
+
+  try
+    {
+      {
+       std::vector<Epetra_Map> sizes;
+       Epetra_Map map(3, 3, 0, Utilities::Trilinos::comm_world());
+       sizes.push_back (map);
+       sizes.push_back (map);
+       
+        TrilinosWrappers::MPI::BlockVector v (sizes);
+        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/trilinos/49b/cmp/generic b/tests/trilinos/49b/cmp/generic
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.