]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Avoid modifying a vector that has ghost elements.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Tue, 7 Aug 2012 14:18:39 +0000 (14:18 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Tue, 7 Aug 2012 14:18:39 +0000 (14:18 +0000)
git-svn-id: https://svn.dealii.org/trunk@25758 0785d39b-7218-0410-832d-ea1e28bc413d

tests/mpi/constraint_matrix_trilinos_bug.cc
tests/mpi/p4est_2d_constraintmatrix_03.cc
tests/mpi/p4est_2d_constraintmatrix_04.cc
tests/mpi/p4est_3d_constraintmatrix_02.cc
tests/mpi/p4est_3d_constraintmatrix_03.cc

index 6a4761b0c9522e324b2a7ccffc10421024b3a06f..0d50c177f077080a9c28618951b112b1662efd1b 100644 (file)
@@ -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;
 */
index 450fd20dd3daeea935bd9533c4cd338add38bf4d..d4cbf940b4931a262b818f298546f82dcfed58ac 100644 (file)
@@ -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);
index c3c8ad97bf77e512eb573c5cdbe1f4f05025f33a..3b68e67243ca007e5b533c088fe51e680b5f365c 100644 (file)
@@ -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);
index 9fc5a23aaaf1ef3ab7c6644eb89983d50a6d039b..058763664fee5f116297a9ed92d91d5b959d9525 100644 (file)
@@ -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;
index c2153bdf81460c1822111439cdae1988079a22e7..6c14055139aeb218fbe751f49c2b1c00ca2f629c 100644 (file)
@@ -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);

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.