From: bangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Date: Tue, 7 Aug 2012 14:18:39 +0000 (+0000)
Subject: Avoid modifying a vector that has ghost elements.
X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=84491ae14510bbe93f932606ac66a870da038f87;p=dealii-svn.git

Avoid modifying a vector that has ghost elements.

git-svn-id: https://svn.dealii.org/trunk@25758 0785d39b-7218-0410-832d-ea1e28bc413d
---

diff --git a/tests/mpi/constraint_matrix_trilinos_bug.cc b/tests/mpi/constraint_matrix_trilinos_bug.cc
index 6a4761b0c9..0d50c177f0 100644
--- a/tests/mpi/constraint_matrix_trilinos_bug.cc
+++ b/tests/mpi/constraint_matrix_trilinos_bug.cc
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 2009, 2010 by the deal.II authors
+//    Copyright (C) 2009, 2010, 2012 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -97,9 +97,9 @@ void test()
   unsigned int myid = Utilities::MPI::this_mpi_process (MPI_COMM_WORLD);
 
   parallel::distributed::Triangulation<dim> tr(MPI_COMM_WORLD);
-  
+
   GridGenerator::hyper_cube(tr);
- 
+
   tr.refine_global (1);
   for (unsigned int step=0; step<5;++step)
         {
@@ -121,7 +121,7 @@ void test()
   dofh.distribute_dofs (fe);
 
   IndexSet owned_set = dofh.locally_owned_dofs();
-  
+
   IndexSet dof_set;
   DoFTools::extract_locally_active_dofs (dofh, dof_set);
 
@@ -135,13 +135,12 @@ void test()
 
   TrilinosWrappers::MPI::Vector x_rel;
   x_rel.reinit(relevant_set, MPI_COMM_WORLD);
-  x_rel = 0;
   x_rel.compress();
-  
+
   ConstraintMatrix cm(relevant_set);
   DoFTools::make_hanging_node_constraints (dofh, cm);
   std::vector<bool> velocity_mask (dim+1, true);
-  
+
   velocity_mask[dim] = false;
 
   VectorTools::interpolate_boundary_values (dofh,
@@ -149,17 +148,17 @@ void test()
 					    ZeroFunction<dim>(dim+1),
 					    cm,
 					    velocity_mask);
-  
+
     cm.close ();
 
     TrilinosWrappers::MPI::Vector x_test;
     x_test.reinit(x_rel);
-    
+
     x_test=x;
 
     bool throwing=false;
     try
-      {	
+      {
 	cm.distribute(x_test);
       }
     catch (ExcMessage e)
@@ -176,7 +175,7 @@ void test()
 				     //l2_norm() not possible for ghosted vectors...
     //double a=0;//x_test.l2_norm();
     //double b=0;//x_rel.l2_norm();
-    
+
 /*    if (myid==0)
       deallog << a << " vs " << b << std::endl;
 */
diff --git a/tests/mpi/p4est_2d_constraintmatrix_03.cc b/tests/mpi/p4est_2d_constraintmatrix_03.cc
index 450fd20dd3..d4cbf940b4 100644
--- a/tests/mpi/p4est_2d_constraintmatrix_03.cc
+++ b/tests/mpi/p4est_2d_constraintmatrix_03.cc
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 2009, 2010 by the deal.II authors
+//    Copyright (C) 2009, 2010, 2012 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -147,7 +147,6 @@ void test()
 
   TrilinosWrappers::MPI::Vector x_rel;
   x_rel.reinit(relevant_set, MPI_COMM_WORLD);
-  x_rel = 0;
   x_rel.compress();
 
   ConstraintMatrix cm(relevant_set);
diff --git a/tests/mpi/p4est_2d_constraintmatrix_04.cc b/tests/mpi/p4est_2d_constraintmatrix_04.cc
index c3c8ad97bf..3b68e67243 100644
--- a/tests/mpi/p4est_2d_constraintmatrix_04.cc
+++ b/tests/mpi/p4est_2d_constraintmatrix_04.cc
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 2009, 2010 by the deal.II authors
+//    Copyright (C) 2009, 2010, 2012 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -264,7 +264,6 @@ void test()
       trans.interpolate(x);
 
       x_rel.reinit(relevant_set, MPI_COMM_WORLD);
-      x_rel = 0;
       x_rel.compress();
 
       ConstraintMatrix cm(relevant_set);
diff --git a/tests/mpi/p4est_3d_constraintmatrix_02.cc b/tests/mpi/p4est_3d_constraintmatrix_02.cc
index 9fc5a23aaa..058763664f 100644
--- a/tests/mpi/p4est_3d_constraintmatrix_02.cc
+++ b/tests/mpi/p4est_3d_constraintmatrix_02.cc
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 2009, 2010, 2011 by the deal.II authors
+//    Copyright (C) 2009, 2010, 2011, 2012 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -61,14 +61,14 @@ void test()
 
          tr.execute_coarsening_and_refinement ();
         }
- 
+
   DoFHandler<dim> dofh(tr);
 
   static const FE_Q<dim> fe(1);
   dofh.distribute_dofs (fe);
 
   IndexSet owned_set = dofh.locally_owned_dofs();
-  
+
   IndexSet dof_set;
   DoFTools::extract_locally_active_dofs (dofh, dof_set);
 
@@ -82,38 +82,37 @@ void test()
 
   TrilinosWrappers::MPI::Vector x_rel;
   x_rel.reinit(relevant_set, MPI_COMM_WORLD);
-  x_rel = 0;
   x_rel.compress();
-  
+
   ConstraintMatrix cm(relevant_set);
   DoFTools::make_hanging_node_constraints (dofh, cm);
   cm.close ();
-  
+
   cm.distribute(x);
   x_rel = x;
 
 				   //x.print(std::cout);
-  
+
 //  x_rel.print(std::cout);
 
   TrilinosWrappers::Vector x_dub;
   x_dub.reinit(dof_set.size());
-  
+
   x_dub = x_rel;
 
   {
 	std::stringstream out;
     out << "**** proc " << myid << std::endl;
     x_dub.print (out);
-	
+
 	if (myid==0)
 	  deallog << out.str() << std::endl;
 	else
 	  MPI_Send((void*)out.str().c_str(),out.str().size()+1, MPI_CHAR, 0, 1, MPI_COMM_WORLD);
   }
-  
+
   if (myid == 0)
-    { 
+    {
       for (unsigned int i = 1;i < numproc;++i)
         {
 		  MPI_Status status;
diff --git a/tests/mpi/p4est_3d_constraintmatrix_03.cc b/tests/mpi/p4est_3d_constraintmatrix_03.cc
index c2153bdf81..6c14055139 100644
--- a/tests/mpi/p4est_3d_constraintmatrix_03.cc
+++ b/tests/mpi/p4est_3d_constraintmatrix_03.cc
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 2009, 2010, 2011 by the deal.II authors
+//    Copyright (C) 2009, 2010, 2011, 2012 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -260,7 +260,6 @@ void test()
       trans.interpolate(x);
 
       x_rel.reinit(relevant_set, MPI_COMM_WORLD);
-      x_rel = 0;
       x_rel.compress();
 
       ConstraintMatrix cm(relevant_set);