]> https://gitweb.dealii.org/ - dealii.git/commitdiff
temp: bug finding
authorTimo Heister <timo.heister@gmail.com>
Mon, 4 Aug 2014 18:16:17 +0000 (14:16 -0400)
committerTimo Heister <timo.heister@gmail.com>
Mon, 4 Aug 2014 18:16:17 +0000 (14:16 -0400)
include/deal.II/multigrid/mg_transfer.templates.h
source/multigrid/mg_tools.cc

index 2fdb4c3d9b0d2424fef19039e527f401d3fc4f7a..6b23301886ce746d6450e7a1f556c8fcf6a56379 100644 (file)
@@ -156,20 +156,24 @@ MGTransferPrebuilt<VECTOR>::copy_to_mg (
 {
   reinit_vector(mg_dof_handler, component_to_block_map, dst);
   bool first = true;
-  //deallog << "copy_to_mg src " << src.l2_norm() << std::endl;
-  //MPI_Barrier(MPI_COMM_WORLD);
+  std::cout << "copy_to_mg src " << src.l2_norm() << std::endl;
+  MPI_Barrier(MPI_COMM_WORLD);
   for (unsigned int level=mg_dof_handler.get_tria().n_global_levels(); level != 0;)
     {
       --level;
       VECTOR &dst_level = dst[level];
+      
+      MPI_Barrier(MPI_COMM_WORLD);
+      int myid=-1;
+      MPI_Comm_rank (MPI_COMM_WORLD, &myid);
 
       typedef std::vector<std::pair<types::global_dof_index, unsigned int> >::const_iterator IT;
       for (IT i= copy_indices[level].begin();
            i != copy_indices[level].end(); ++i)
         {
           dst_level(i->second) = src(i->first);
-        //if (i->first == 446)
-        //std::cout << "L" << level << " " << i->first << " -> " << i->second << ": " << src(i->first) << std::endl;
+          if (i->first == 41)
+          std::cout << "L" << level << " " << i->first << " -> " << i->second << ": " << src(i->first) << " iam=" << myid << std::endl;
 
         }
 
@@ -178,17 +182,19 @@ MGTransferPrebuilt<VECTOR>::copy_to_mg (
          {
            dst_level(i->second) = src(i->first);
            //if (i->first == 446)
-             //std::cout << "L" << level << " " << i->first << " --> " << i->second << ": " << src(i->first) << std::endl;
+           if (i->first == 41)
+          std::cout << "L" << level << " " << i->first << " --> " << i->second << ": " << src(i->first)<< " iam=" << myid << std::endl;
          }
 
       dst_level.compress(VectorOperation::insert);
-      //MPI_Barrier(MPI_COMM_WORLD);
-      //deallog << "copy_to_mg dst " << level << " " << dst_level.l2_norm() << std::endl;
+      MPI_Barrier(MPI_COMM_WORLD);
+      std::cout << "copy_to_mg dst " << level << " " << dst_level.l2_norm() << std::endl;
 
       if (!first)
         {
+          //if (level<2)
           restrict_and_add (level+1, dst[level], dst[level+1]);
-          //deallog << "copy_to_mg restr&add " << level << " " << dst_level.l2_norm() << std::endl;
+          std::cout << "copy_to_mg restr&add " << level << " " << dst_level.l2_norm() << std::endl;
 
         }
 
@@ -218,7 +224,11 @@ MGTransferPrebuilt<VECTOR>::copy_from_mg(
     {
       typedef std::vector<std::pair<types::global_dof_index, unsigned int> >::const_iterator IT;
 
-      //deallog << "copy_from_mg src " << level << " " << src[level].l2_norm() << std::endl;
+      MPI_Barrier(MPI_COMM_WORLD);
+      int myid=-1;
+      MPI_Comm_rank (MPI_COMM_WORLD, &myid);
+      std::cout << "copy_from_mg src " << level << " " << src[level].l2_norm() << std::endl;
+      MPI_Barrier(MPI_COMM_WORLD);
 
 
       // First copy all indices local to this process
@@ -229,7 +239,11 @@ MGTransferPrebuilt<VECTOR>::copy_from_mg(
       else
         for (IT i= copy_indices[level].begin();
              i != copy_indices[level].end(); ++i)
+             {
+               std::cout << "L" << level << " " << i->first << " <- " << i->second << ": " << src[level](i->second) << " iam=" << myid << std::endl;
+               
           constraints->distribute_local_to_global(i->first, src[level](i->second), dst);
+             }
 
       // Do the same for the indices where the level index is local,
       // but the global index is not
@@ -240,13 +254,17 @@ MGTransferPrebuilt<VECTOR>::copy_from_mg(
       else
         for (IT i= copy_indices_from_me[level].begin();
              i != copy_indices_from_me[level].end(); ++i)
+             {
+               std::cout << "L" << level << " " << i->first << " <- " << i->second << ": " << src[level](i->second) << " iam=" << myid << " from-me"<< std::endl;
           constraints->distribute_local_to_global(i->first, src[level](i->second), dst);
+             }
     }
   if (constraints == 0)
     dst.compress(VectorOperation::insert);
   else
     dst.compress(VectorOperation::add);
-  //deallog << "copy_from_mg " << dst.l2_norm() << std::endl;
+  MPI_Barrier(MPI_COMM_WORLD);
+  std::cout << "copy_from_mg " << dst.l2_norm() << std::endl;
 }
 
 
index 4f942a4663d846a3494c6657e5f6483d36fe2f07..4ff902ec4bd449a1be65b6474811fd6a3710202b 100644 (file)
@@ -1537,8 +1537,9 @@ namespace MGTools
 
     for (; cell!=endc; ++cell)
       {
+        // do not look at artificial cells
         if (mg_dof_handler.get_tria().locally_owned_subdomain()!=numbers::invalid_subdomain_id
-            && cell->level_subdomain_id()!=mg_dof_handler.get_tria().locally_owned_subdomain())
+          && cell->level_subdomain_id()==numbers::artificial_subdomain_id)
           continue;
 
         bool has_coarser_neighbor = false;
@@ -1554,6 +1555,15 @@ namespace MGTools
                 const typename DoFHandler<dim>::cell_iterator
                 neighbor = cell->neighbor(face_nr);
 
+                // only process cell pairs if one of them is mine
+                if (mg_dof_handler.get_tria().locally_owned_subdomain()!=numbers::invalid_subdomain_id
+                    && 
+                    neighbor->level_subdomain_id()==numbers::artificial_subdomain_id)
+//                    neighbor->level_subdomain_id()!=mg_dof_handler.get_tria().locally_owned_subdomain()
+//                   && 
+//                   cell->level_subdomain_id()!=mg_dof_handler.get_tria().locally_owned_subdomain())
+                  continue;
+                
                 // Do refinement face
                 // from the coarse side
                 if (neighbor->level() < cell->level())

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.