From dd173d55afb4b1af898786fbd7a06d9f1dca1174 Mon Sep 17 00:00:00 2001
From: kronbichler <kronbichler@0785d39b-7218-0410-832d-ea1e28bc413d>
Date: Fri, 31 May 2013 12:49:55 +0000
Subject: [PATCH] Fix test.

git-svn-id: https://svn.dealii.org/trunk@29681 0785d39b-7218-0410-832d-ea1e28bc413d
---
 .../deal.II/lac/constraint_matrix.templates.h       | 13 +++++++++++--
 tests/mpi/constraint_matrix_trilinos_bug.cc         |  3 ---
 .../ncpu_10/cmp/generic                             |  8 ++++----
 .../ncpu_4/cmp/generic                              |  8 ++++----
 4 files changed, 19 insertions(+), 13 deletions(-)

diff --git a/deal.II/include/deal.II/lac/constraint_matrix.templates.h b/deal.II/include/deal.II/lac/constraint_matrix.templates.h
index 24063ce28c..7bd390272e 100644
--- a/deal.II/include/deal.II/lac/constraint_matrix.templates.h
+++ b/deal.II/include/deal.II/lac/constraint_matrix.templates.h
@@ -989,8 +989,17 @@ namespace internal
                                        TrilinosWrappers::MPI::Vector       &output,
                                        const internal::bool2type<false>     /*is_block_vector*/)
     {
-      output.reinit (needed_elements,
-                     dynamic_cast<const Epetra_MpiComm *>(&vec.vector_partitioner().Comm())->GetMpiComm());
+      Assert(!vec.has_ghost_elements(),
+             typename TrilinosWrappers::VectorBase::ExcGhostsPresent());
+#ifdef DEAL_II_WITH_MPI
+      const Epetra_MpiComm *mpi_comm
+        = dynamic_cast<const Epetra_MpiComm *>(&vec.trilinos_vector().Comm());
+
+      Assert (mpi_comm != 0, ExcInternalError());
+      output.reinit (needed_elements, mpi_comm->GetMpiComm());
+#else
+      output.reinit (needed_elements, MPI_COMM_WORLD);
+#endif
       output = vec;
     }
 #endif
diff --git a/tests/mpi/constraint_matrix_trilinos_bug.cc b/tests/mpi/constraint_matrix_trilinos_bug.cc
index e0c397d24a..a8c7445d5e 100644
--- a/tests/mpi/constraint_matrix_trilinos_bug.cc
+++ b/tests/mpi/constraint_matrix_trilinos_bug.cc
@@ -78,9 +78,6 @@ void test()
 
   IndexSet owned_set = dofh.locally_owned_dofs();
 
-  IndexSet dof_set;
-  DoFTools::extract_locally_active_dofs (dofh, dof_set);
-
   IndexSet relevant_set;
   DoFTools::extract_locally_relevant_dofs (dofh, relevant_set);
 
diff --git a/tests/mpi/constraint_matrix_trilinos_bug/ncpu_10/cmp/generic b/tests/mpi/constraint_matrix_trilinos_bug/ncpu_10/cmp/generic
index c3ced6c764..03bf519fa3 100644
--- a/tests/mpi/constraint_matrix_trilinos_bug/ncpu_10/cmp/generic
+++ b/tests/mpi/constraint_matrix_trilinos_bug/ncpu_10/cmp/generic
@@ -1,12 +1,12 @@
 
 DEAL:0:2d::Exception: 
 --------------------------------------------------------
-An error occurred in file <trilinos_vector_base.h> in function
-    void dealii::TrilinosWrappers::VectorBase::set(unsigned int, const unsigned int*, const double*)
+An error occurred in file <constraint_matrix.templates.h> in function
+    void dealii::internal::{anonymous}::import_vector_with_ghost_elements(const dealii::TrilinosWrappers::MPI::Vector&, const dealii::IndexSet&, const dealii::IndexSet&, dealii::TrilinosWrappers::MPI::Vector&, dealii::internal::bool2type<false>)
 The violated condition was: 
-    !has_ghost_elements()
+    !vec.has_ghost_elements()
 The name and call sequence of the exception was:
-    ExcGhostsPresent()
+    typename TrilinosWrappers::VectorBase::ExcGhostsPresent()
 Additional Information: 
 (none)
 --------------------------------------------------------
diff --git a/tests/mpi/constraint_matrix_trilinos_bug/ncpu_4/cmp/generic b/tests/mpi/constraint_matrix_trilinos_bug/ncpu_4/cmp/generic
index c3ced6c764..03bf519fa3 100644
--- a/tests/mpi/constraint_matrix_trilinos_bug/ncpu_4/cmp/generic
+++ b/tests/mpi/constraint_matrix_trilinos_bug/ncpu_4/cmp/generic
@@ -1,12 +1,12 @@
 
 DEAL:0:2d::Exception: 
 --------------------------------------------------------
-An error occurred in file <trilinos_vector_base.h> in function
-    void dealii::TrilinosWrappers::VectorBase::set(unsigned int, const unsigned int*, const double*)
+An error occurred in file <constraint_matrix.templates.h> in function
+    void dealii::internal::{anonymous}::import_vector_with_ghost_elements(const dealii::TrilinosWrappers::MPI::Vector&, const dealii::IndexSet&, const dealii::IndexSet&, dealii::TrilinosWrappers::MPI::Vector&, dealii::internal::bool2type<false>)
 The violated condition was: 
-    !has_ghost_elements()
+    !vec.has_ghost_elements()
 The name and call sequence of the exception was:
-    ExcGhostsPresent()
+    typename TrilinosWrappers::VectorBase::ExcGhostsPresent()
 Additional Information: 
 (none)
 --------------------------------------------------------
-- 
2.39.5