]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
New test.
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 18 Nov 2010 17:27:18 +0000 (17:27 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 18 Nov 2010 17:27:18 +0000 (17:27 +0000)
git-svn-id: https://svn.dealii.org/trunk@22808 0785d39b-7218-0410-832d-ea1e28bc413d

tests/mpi/trilinos_ghost_03_linfty.cc [new file with mode: 0644]
tests/mpi/trilinos_ghost_03_linfty/ncpu_10/cmp/generic [new file with mode: 0644]
tests/mpi/trilinos_ghost_03_linfty/ncpu_4/cmp/generic [new file with mode: 0644]

diff --git a/tests/mpi/trilinos_ghost_03_linfty.cc b/tests/mpi/trilinos_ghost_03_linfty.cc
new file mode 100644 (file)
index 0000000..312c72d
--- /dev/null
@@ -0,0 +1,100 @@
+//----------------------------  trilinos_ghost_03_linfty.cc  ---------------------------
+//    $Id: vector_equality_4.cc 17992 2008-12-18 03:03:20Z bangerth $
+//    Version: $Name$ 
+//
+//    Copyright (C) 2004, 2005, 2008, 2010 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.
+//
+//----------------------------  trilinos_ghost_03_linfty.cc  ---------------------------
+
+
+// while computing the l2norm on ghosted vectors is unsafe, computing
+// the linfty norm should be ok. test this
+
+#include "../tests.h" 
+#include <base/utilities.h>
+#include <base/index_set.h>
+#include <lac/trilinos_vector.h>    
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+
+void test ()
+{
+  unsigned int myid = Utilities::System::get_this_mpi_process (MPI_COMM_WORLD);
+  unsigned int numproc = Utilities::System::get_n_mpi_processes (MPI_COMM_WORLD);
+
+  if (myid==0) deallog << "numproc=" << numproc << std::endl;
+
+
+                                  // each processor owns 2 indices and all
+                                   // are ghosting element 1 (the second)
+  IndexSet local_active(numproc*2);
+  local_active.add_range(myid*2,myid*2+2);
+  IndexSet local_relevant(numproc*2);
+  local_relevant = local_active;
+  local_relevant.add_range(1,2);
+
+  TrilinosWrappers::MPI::Vector v(local_active, MPI_COMM_WORLD);
+  TrilinosWrappers::MPI::Vector v_tmp(local_relevant, MPI_COMM_WORLD);
+  
+
+                                     // set local values
+  v(myid*2)=myid*2;
+  v(myid*2+1)=myid*2+1;
+
+  v.compress();
+
+  v_tmp.reinit(v,false,true);
+
+  deal_II_exceptions::disable_abort_on_exception();
+
+  bool exc = false;
+  double norm;
+  try
+    {
+      norm = v_tmp.linfty_norm();
+    }
+  catch (TrilinosWrappers::VectorBase::ExcTrilinosError e)
+    {
+      exc = true;
+    }
+  
+  Assert (exc == false, ExcInternalError());
+  Assert (norm == 2.*Utilities::System::get_n_mpi_processes (MPI_COMM_WORLD)-1,
+         ExcInternalError());
+  if (Utilities::System::get_this_mpi_process (MPI_COMM_WORLD) == 0)
+    {
+      deallog << norm << std::endl;
+      deallog << "OK" << std::endl;
+    }
+}
+
+
+
+int main (int argc, char **argv)
+{
+  Utilities::System::MPI_InitFinalize mpi_initialization(argc, argv);
+
+  unsigned int myid = Utilities::System::get_this_mpi_process (MPI_COMM_WORLD);
+  deallog.push(Utilities::int_to_string(myid));
+
+  if (myid == 0)
+    {
+      std::ofstream logfile(output_file_for_mpi("trilinos_ghost_03_linfty").c_str());
+      deallog.attach(logfile);
+      deallog << std::setprecision(4);
+      deallog.depth_console(0);
+      deallog.threshold_double(1.e-10);
+
+      test();
+    }
+  else
+    test();
+
+}
diff --git a/tests/mpi/trilinos_ghost_03_linfty/ncpu_10/cmp/generic b/tests/mpi/trilinos_ghost_03_linfty/ncpu_10/cmp/generic
new file mode 100644 (file)
index 0000000..8286d07
--- /dev/null
@@ -0,0 +1,4 @@
+
+DEAL:0::numproc=10
+DEAL:0::19.00
+DEAL:0::OK
diff --git a/tests/mpi/trilinos_ghost_03_linfty/ncpu_4/cmp/generic b/tests/mpi/trilinos_ghost_03_linfty/ncpu_4/cmp/generic
new file mode 100644 (file)
index 0000000..703c340
--- /dev/null
@@ -0,0 +1,4 @@
+
+DEAL:0::numproc=4
+DEAL:0::7.000
+DEAL:0::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.