]> https://gitweb.dealii.org/ - dealii.git/commitdiff
reintroduce constraints and add debug function
authorGuido Kanschat <dr.guido.kanschat@gmail.com>
Mon, 27 May 2013 13:39:17 +0000 (13:39 +0000)
committerGuido Kanschat <dr.guido.kanschat@gmail.com>
Mon, 27 May 2013 13:39:17 +0000 (13:39 +0000)
git-svn-id: https://svn.dealii.org/trunk@29644 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/include/deal.II/multigrid/mg_transfer.h
deal.II/include/deal.II/multigrid/mg_transfer.templates.h
deal.II/source/multigrid/mg_transfer_prebuilt.cc

index 43d586f667c9d220da955238544b9f88fd152c7d..3662b26b4567486bbfbecf14140fe35714c08d84 100644 (file)
@@ -236,6 +236,11 @@ public:
    */
   void print_matrices(std::ostream& os) const;
 
+  /**
+   * Print the copy index fields for debugging purposes.
+   */
+  void print_indices(std::ostream& os) const;
+  
 private:
 
   /**
index 80684076a7b9a269ad72d44411e9c04e0a0a0ef1..50027ee3682ff6028248a1909ceedace3889589f 100644 (file)
@@ -161,9 +161,9 @@ MGTransferPrebuilt<VECTOR>::copy_to_mg (
            i != copy_indices[level].end(); ++i)
         dst_level(i->second) = src(i->first);
 
-      for (IT i= copy_indices_to_me[level].begin();
-           i != copy_indices_to_me[level].end(); ++i)
-        dst_level(i->second) = src(i->first);
+      // for (IT i= copy_indices_to_me[level].begin();
+      //      i != copy_indices_to_me[level].end(); ++i)
+      //   dst_level(i->second) = src(i->first);
 
       dst_level.compress(VectorOperation::insert);
 
@@ -197,15 +197,25 @@ MGTransferPrebuilt<VECTOR>::copy_from_mg(
       typedef std::vector<std::pair<unsigned int, unsigned int> >::const_iterator IT;
 
       // First copy all indices local to this process
-      for (IT i= copy_indices[level].begin();
-          i != copy_indices[level].end(); ++i)
-       dst(i->first) = src[level](i->second);
-      
+      if (constraints==0)
+       for (IT i= copy_indices[level].begin();
+            i != copy_indices[level].end(); ++i)
+         dst(i->first) = src[level](i->second);
+      else
+       for (IT i= copy_indices[level].begin();
+            i != copy_indices[level].end(); ++i)
+         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
-      for (IT i= copy_indices_from_me[level].begin();
-          i != copy_indices_from_me[level].end(); ++i)
-       dst(i->first) = src[level](i->second);
+      if (constraints==0)
+       for (IT i= copy_indices_from_me[level].begin();
+            i != copy_indices_from_me[level].end(); ++i)
+         dst(i->first) = src[level](i->second);
+      else
+       for (IT i= copy_indices_from_me[level].begin();
+            i != copy_indices_from_me[level].end(); ++i)
+         constraints->distribute_local_to_global(i->first, src[level](i->second), dst);
     }
 }
 
@@ -229,15 +239,25 @@ MGTransferPrebuilt<VECTOR>::copy_from_mg_add (
   for (unsigned int level=0; level<mg_dof_handler.get_tria().n_global_levels(); ++level)
     {
       typedef std::vector<std::pair<unsigned int, unsigned int> >::const_iterator IT;
-      for (IT i= copy_indices[level].begin();
-           i != copy_indices[level].end(); ++i)
-        dst(i->first) += src[level](i->second);
-
+      if (constraints==0)
+       for (IT i= copy_indices[level].begin();
+            i != copy_indices[level].end(); ++i)
+         dst(i->first) += src[level](i->second);
+      else
+       for (IT i= copy_indices[level].begin();
+            i != copy_indices[level].end(); ++i)
+         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
-      for (IT i= copy_indices_from_me[level].begin();
-          i != copy_indices_from_me[level].end(); ++i)
-       dst(i->first) += src[level](i->second);
+      if (constraints==0)
+       for (IT i= copy_indices_from_me[level].begin();
+            i != copy_indices_from_me[level].end(); ++i)
+         dst(i->first) += src[level](i->second);
+      else
+       for (IT i= copy_indices_from_me[level].begin();
+            i != copy_indices_from_me[level].end(); ++i)
+         constraints->distribute_local_to_global(i->first, src[level](i->second), dst);
     }
 }
 
index fa73027ff04edaab3028d3269fd2d704d1225fb7..d16733ea0e8f62691cad706fa95e23f7a097b542 100644 (file)
@@ -314,6 +314,20 @@ MGTransferPrebuilt<VECTOR>::print_matrices (std::ostream& os) const
     }
 }
 
+template <class VECTOR>
+void
+MGTransferPrebuilt<VECTOR>::print_indices (std::ostream& os) const
+{
+  os << "Copy indices" << std::endl;
+  for (unsigned int level = 0;level<copy_indices.size();++level)
+    {
+      os << "Level " << level << std::endl;
+      for (unsigned int i=0;i<copy_indices[level].size();++i)
+       os << copy_indices[level][i].first << '\t' << copy_indices[level][i].second << std::endl;
+      os << std::endl;
+    }
+}
+
 
 // explicit instantiation
 #include "mg_transfer_prebuilt.inst"

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.