]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Merge remote-tracking branch 'upstream/master' into parmg
authorTimo Heister <timo.heister@gmail.com>
Sun, 4 Oct 2015 18:43:21 +0000 (14:43 -0400)
committerTimo Heister <timo.heister@gmail.com>
Sun, 4 Oct 2015 18:46:43 +0000 (14:46 -0400)
Conflicts:
examples/step-50/step-50.cc
include/deal.II/dofs/dof_tools.h
include/deal.II/grid/cell_id.h
include/deal.II/multigrid/mg_transfer.h
include/deal.II/multigrid/mg_transfer.templates.h
source/multigrid/mg_transfer_prebuilt.cc

12 files changed:
1  2 
examples/step-16/step-16.cc
examples/step-50/step-50.cc
include/deal.II/dofs/dof_tools.h
include/deal.II/meshworker/simple.h
include/deal.II/multigrid/mg_constrained_dofs.h
include/deal.II/multigrid/mg_transfer.h
include/deal.II/multigrid/mg_transfer.templates.h
include/deal.II/numerics/data_out.h
source/dofs/dof_tools.cc
source/dofs/dof_tools.inst.in
source/multigrid/mg_tools.cc
source/multigrid/mg_transfer_prebuilt.cc

Simple merge
index 5cff7533c86789998f5744851d5c4c1f997f2bcb,f0d201e56cdc2f4f85b759ee201c96d51877683a..8573b59089250127592fc57ee3ae78ecce5cac12
@@@ -372,14 -371,10 +372,14 @@@ namespace Step5
      constraints.close ();
      hanging_node_constraints.close ();
  
 +    //check(constraints);
 +    //check(hanging_node_constraints);
 +
+     DynamicSparsityPattern dsp(mg_dof_handler.n_dofs(), mg_dof_handler.n_dofs());
+     DoFTools::make_sparsity_pattern (mg_dof_handler, dsp, constraints);
+     system_matrix.reinit (mg_dof_handler.locally_owned_dofs(), dsp, MPI_COMM_WORLD, true);
  
-     CompressedSimpleSparsityPattern csp(mg_dof_handler.n_dofs(), mg_dof_handler.n_dofs());
-     DoFTools::make_sparsity_pattern (mg_dof_handler, csp, constraints);
-     system_matrix.reinit (mg_dof_handler.locally_owned_dofs(), csp, MPI_COMM_WORLD, true);
 +
      // The multigrid constraints have to be
      // initialized. They need to know about
      // the boundary values as well, so we
index 4cfa6fa467676e0ec7cab08cad6a1346f34d5e06,729dcb0420e041982c18589b54031fb5096e45d6..ed3356e928e612d8ceae113747546a9514561624
@@@ -1438,16 -1416,42 +1416,54 @@@ namespace DoFTool
    extract_locally_relevant_dofs (const DH &dof_handler,
                                   IndexSet &dof_set);
  
-                                  IndexSet &dof_set,
-                                  unsigned int level);
+   /**
+    *
+    * For each processor, determine the set of locally owned degrees of freedom as an IndexSet.
+    * This function then returns a vector of index sets, where the vector has size equal to the
+    * number of MPI processes that participate in the DoF handler object.
+    *
+    * The function can be used for objects of type dealii::Triangulation or parallel::shared::Triangulation.
+    * It will not work for objects of type parallel::distributed::Triangulation since for such triangulations
+    * we do not have information about all cells of the triangulation available locally,
+    * and consequently can not say anything definitive about the degrees of freedom active on other
+    * processors' locally owned cells.
+    *
+    * @author Denis Davydov, 2015
+    */
+   template <class DH>
+   std::vector<IndexSet>
+   locally_owned_dofs_per_subdomain (const DH   &dof_handler);
+   /**
+    *
+    * For each processor, determine the set of locally relevant degrees of freedom as an IndexSet.
+    * This function then returns a vector of index sets, where the vector has size equal to the
+    * number of MPI processes that participate in the DoF handler object.
+    *
+    * The function can be used for objects of type dealii::Triangulation or parallel::shared::Triangulation.
+    * It will not work for objects of type parallel::distributed::Triangulation since for such triangulations
+    * we do not have information about all cells of the triangulation available locally,
+    * and consequently can not say anything definitive about the degrees of freedom active on other
+    * processors' locally owned cells.
+    *
+    * @author Jean-Paul Pelteret, 2015
+    */
+   template <class DH>
+   std::vector<IndexSet>
+   locally_relevant_dofs_per_subdomain (const DH   &dof_handler);
++
 +  /**
 +   * Same as extract_locally_relevant_dofs() but for multigrid DoFs
 +   * for the given @p level.
 +   */
 +  template <class DH>
 +  void
 +  extract_locally_relevant_mg_dofs (const DH &dof_handler,
++                                    IndexSet &dof_set,
++                                    unsigned int level);
++
 +
    /**
     * For each DoF, return in the output array to which subdomain (as given by
     * the <tt>cell->subdomain_id()</tt> function) it belongs. The output array
Simple merge
index 5a4d9f720c1de30ca61dcb6139c5333ce387df35,13add34b41feaabe90820dee64b734e8af727463..48c4131ff82334071181edf647c5409dc3a509a9
@@@ -265,8 -282,8 +282,8 @@@ private
     *
     * Organization of the data is like for @p copy_indices_mine.
     */
-   std::vector<std::vector<std::pair<types::global_dof_index, unsigned int> > >
+   std::vector<std::vector<std::pair<types::global_dof_index, types::global_dof_index> > >
 -  copy_indices_to_me;
 +  copy_indices_global_mine;
  
    /**
     * Additional degrees of freedom for the copy_from_mg() function. These are
     *
     * Organization of the data is like for @p copy_indices_mine.
     */
-   std::vector<std::vector<std::pair<types::global_dof_index, unsigned int> > >
+   std::vector<std::vector<std::pair<types::global_dof_index, types::global_dof_index> > >
 -  copy_indices_from_me;
 +  copy_indices_level_mine;
  
  
    /**
index 67fbbbd17f8a2a21b4fdc1bf0a903b0c1418206c,1af86a22aff9b8c5be94dc7bf548844644876cd8..5f56a9be9c5f2e9a8254dd08064b3804bbe7bf1a
@@@ -154,13 -177,7 +184,13 @@@ MGTransferPrebuilt<VECTOR>::copy_to_mg 
        --level;
        VECTOR &dst_level = dst[level];
  
-       typedef std::vector<std::pair<types::global_dof_index, unsigned int> >::const_iterator IT;
 +#ifdef DEBUG_OUTPUT
 +      MPI_Barrier(MPI_COMM_WORLD);
 +      int myid=-1;
 +      MPI_Comm_rank (MPI_COMM_WORLD, &myid);
 +#endif
 +
+       typedef std::vector<std::pair<types::global_dof_index, types::global_dof_index> >::const_iterator IT;
        for (IT i= copy_indices[level].begin();
             i != copy_indices[level].end(); ++i)
          dst_level(i->second) = src(i->first);
@@@ -211,17 -215,17 +241,17 @@@ MGTransferPrebuilt<VECTOR>::copy_from_m
    dst = 0;
    for (unsigned int level=0; level<mg_dof_handler.get_tria().n_global_levels(); ++level)
      {
-       typedef std::vector<std::pair<types::global_dof_index, unsigned int> >::const_iterator IT;
+       typedef std::vector<std::pair<types::global_dof_index, types::global_dof_index> >::const_iterator IT;
 +#ifdef DEBUG_OUTPUT
 +      MPI_Barrier(MPI_COMM_WORLD);
 +      std::cout << "copy_from_mg src " << level << " " << src[level].l2_norm() << std::endl;
 +      MPI_Barrier(MPI_COMM_WORLD);
 +#endif
  
        // First copy all indices local to this process
 -      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);
 +      for (IT i= copy_indices[level].begin();
 +           i != copy_indices[level].end(); ++i)
 +        dst(i->first) = src[level](i->second);
  
        // Do the same for the indices where the level index is local,
        // but the global index is not
@@@ -263,10 -259,15 +293,10 @@@ MGTransferPrebuilt<VECTOR>::copy_from_m
    // functions
    for (unsigned int level=0; level<mg_dof_handler.get_tria().n_global_levels(); ++level)
      {
-       typedef std::vector<std::pair<types::global_dof_index, unsigned int> >::const_iterator IT;
+       typedef std::vector<std::pair<types::global_dof_index, types::global_dof_index> >::const_iterator IT;
 -      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);
 +      for (IT i= copy_indices[level].begin();
 +           i != copy_indices[level].end(); ++i)
 +        dst(i->first) += src[level](i->second);
  
        // Do the same for the indices where the level index is local,
        // but the global index is not
Simple merge
Simple merge
Simple merge
Simple merge
index a9b2f8e93f7851d9b80dc4f9c6cb85c0fd12bdaa,fa9d72f02ead8520bc564e0bdb1af99259d13d0d..c237e01cc0c4922747617e5fee844b63992c58fb
@@@ -331,24 -333,17 +351,24 @@@ void MGTransferPrebuilt<VECTOR>::build_
                bool global_mine = mg_dof.locally_owned_dofs().is_element(global_dof_indices[i]);
                bool level_mine = mg_dof.locally_owned_mg_dofs(level).is_element(level_dof_indices[i]);
  
 +
                if (global_mine && level_mine)
 -                copy_indices[level].push_back(
 -                  std::make_pair (global_dof_indices[i], level_dof_indices[i]));
 -              else if (level_mine)
 -                copy_indices_from_me[level].push_back(
 +                {
 +                  copy_indices[level].push_back(
-                       std::pair<unsigned int, unsigned int> (global_dof_indices[i], level_dof_indices[i]));
+                   std::make_pair (global_dof_indices[i], level_dof_indices[i]));
 -              else if (global_mine)
 -                copy_indices_to_me[level].push_back(
 +                }
 +              else if(global_mine)
 +                {
 +                  copy_indices_global_mine[level].push_back(
-                       std::pair<unsigned int, unsigned int> (global_dof_indices[i], level_dof_indices[i]));
+                   std::make_pair (global_dof_indices[i], level_dof_indices[i]));
 +
 +                  //send this to the owner of the level_dof:
 +                  send_data_temp.push_back(dof_pair(level, global_dof_indices[i], level_dof_indices[i]));
 +                }
                else
 -                continue;
 +                {
 +                  // somebody will send those to me
 +                }
  
                dof_touched[global_idx] = true;
              }
    // If we are in debugging mode, we order the copy indices, so we get
    // more reliable output for regression texts
  #ifdef DEBUG
-   std::less<std::pair<types::global_dof_index, unsigned int> > compare;
+   std::less<std::pair<types::global_dof_index, types::global_dof_index> > compare;
    for (unsigned int level=0; level<copy_indices.size(); ++level)
      std::sort(copy_indices[level].begin(), copy_indices[level].end(), compare);
 -  for (unsigned int level=0; level<copy_indices_from_me.size(); ++level)
 -    std::sort(copy_indices_from_me[level].begin(), copy_indices_from_me[level].end(), compare);
 -  for (unsigned int level=0; level<copy_indices_to_me.size(); ++level)
 -    std::sort(copy_indices_to_me[level].begin(), copy_indices_to_me[level].end(), compare);
 +  for (unsigned int level=0; level<copy_indices_level_mine.size(); ++level)
 +    std::sort(copy_indices_level_mine[level].begin(), copy_indices_level_mine[level].end(), compare);
 +  for (unsigned int level=0; level<copy_indices_global_mine.size(); ++level)
 +    std::sort(copy_indices_global_mine[level].begin(), copy_indices_global_mine[level].end(), compare);
  #endif
  }
  

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.