]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
document bug in ConstraintMatrix::distribute()
authorheister <heister@0785d39b-7218-0410-832d-ea1e28bc413d>
Sun, 26 May 2013 22:12:24 +0000 (22:12 +0000)
committerheister <heister@0785d39b-7218-0410-832d-ea1e28bc413d>
Sun, 26 May 2013 22:12:24 +0000 (22:12 +0000)
git-svn-id: https://svn.dealii.org/trunk@29628 0785d39b-7218-0410-832d-ea1e28bc413d

tests/mpi/trilinos_distribute_03.cc [new file with mode: 0644]
tests/mpi/trilinos_distribute_03/ncpu_1/cmp/generic [new file with mode: 0644]
tests/mpi/trilinos_distribute_03/ncpu_2/cmp/generic [new file with mode: 0644]

diff --git a/tests/mpi/trilinos_distribute_03.cc b/tests/mpi/trilinos_distribute_03.cc
new file mode 100644 (file)
index 0000000..43eb491
--- /dev/null
@@ -0,0 +1,76 @@
+//---------------------------------------------------------------------------
+//    $Id: trilinos_distribute_02.cc 29593 2013-05-25 12:29:14Z bangerth $
+//    Version: $Name$
+//
+//    Copyright (C) 2009, 2010, 2012, 2013 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.
+//
+//---------------------------------------------------------------------------
+
+
+// document bug in the new ConstraintMatrix::distribute() from r29593
+// if one vector owns all DoFs, then distribute() hangs.
+
+#include "../tests.h"
+#include <deal.II/base/logstream.h>
+#include <deal.II/lac/trilinos_vector.h>
+#include <deal.II/lac/constraint_matrix.h>
+
+#include <fstream>
+#include <sstream>
+
+
+
+void test()
+{
+  const unsigned int myid = Utilities::MPI::this_mpi_process (MPI_COMM_WORLD);
+  const unsigned int n_processes = Utilities::MPI::n_mpi_processes (MPI_COMM_WORLD);
+
+  // create a vector that consists of elements indexed from 0 to 100
+  // everything belongs to proc 0
+  IndexSet idx(100);
+  if (myid==0)
+    idx.add_range(0,100);
+  
+  TrilinosWrappers::MPI::Vector vec (idx, MPI_COMM_WORLD);
+
+  for (unsigned int i=vec.local_range().first; i<vec.local_range().second; ++i)
+    vec(i) = i;
+  vec.compress(VectorOperation::insert);
+
+  ConstraintMatrix cm;
+  cm.close ();
+
+  cm.distribute (vec);
+
+  if (myid == 0)
+    deallog << "OK" << std::endl;
+}
+
+
+int main(int argc, char *argv[])
+{
+  Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1);
+
+  unsigned int myid = Utilities::MPI::this_mpi_process (MPI_COMM_WORLD);
+
+
+  deallog.push(Utilities::int_to_string(myid));
+
+  if (myid == 0)
+    {
+      std::ofstream logfile(output_file_for_mpi("trilinos_distribute_03").c_str());
+      deallog.attach(logfile);
+      deallog.depth_console(0);
+      deallog.threshold_double(1.e-10);
+
+      test();
+    }
+  else
+    test();
+
+}
diff --git a/tests/mpi/trilinos_distribute_03/ncpu_1/cmp/generic b/tests/mpi/trilinos_distribute_03/ncpu_1/cmp/generic
new file mode 100644 (file)
index 0000000..be8d055
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL:0::OK
diff --git a/tests/mpi/trilinos_distribute_03/ncpu_2/cmp/generic b/tests/mpi/trilinos_distribute_03/ncpu_2/cmp/generic
new file mode 100644 (file)
index 0000000..be8d055
--- /dev/null
@@ -0,0 +1,2 @@
+
+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.