]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Make two blocks of code the same.
authorWolfgang Bangerth <bangerth@colostate.edu>
Wed, 19 Jul 2017 18:48:09 +0000 (12:48 -0600)
committerWolfgang Bangerth <bangerth@colostate.edu>
Wed, 19 Jul 2017 22:16:53 +0000 (16:16 -0600)
One part of the renumber_dofs() algorithm in parallel is exactly the
same as in the distribute_dofs() algorithm, so use the same code in
both places.

source/dofs/dof_handler_policy.cc

index 83ba8970fe17cd108b2c55e168d0d24821eadf66..720a7258d9a9eed5d128d0a9baf314e182833f4f 100644 (file)
@@ -4051,34 +4051,33 @@ namespace internal
                                          *dof_handler,
                                          false);
 
-        // communication
+        // communicate newly assigned DoF indices to other processors
+        // and get the same information for our own ghost cells.
+        //
+        // this is the same as phase 4 in the distribute_dofs() algorithm
         {
-          parallel::distributed::Triangulation< dim, spacedim > *triangulation
-            = (dynamic_cast<parallel::distributed::Triangulation<dim,spacedim>*>
-               (const_cast<dealii::Triangulation< dim, spacedim >*>
-                (&dof_handler->get_triangulation())));
-          Assert (triangulation != nullptr, ExcInternalError());
-
           std::vector<bool> user_flags;
           triangulation->save_user_flags(user_flags);
           triangulation->clear_user_flags ();
 
           // mark all own cells for transfer
-          typename DoFHandlerType::active_cell_iterator
-          cell, endc = dof_handler->end();
-          for (cell = dof_handler->begin_active(); cell != endc; ++cell)
+          for (auto cell : dof_handler->active_cell_iterators())
             if (!cell->is_artificial())
               cell->set_user_flag();
 
-          // add each ghostcells' subdomain to the vertex and keep track of
-          // interesting neighbors
+          // figure out which cells are ghost cells on which we have
+          // to exchange DoF indices
           const std::map<unsigned int, std::set<dealii::types::subdomain_id> >
           vertices_with_ghost_neighbors
             = triangulation->compute_vertices_with_ghost_neighbors ();
 
-          // Send and receive cells. After this, only the local cells are
-          // marked, that received new data. This has to be communicated in a
-          // second communication step.
+
+          // Send and receive cells. After this, only the local cells
+          // are marked, that received new data. This has to be
+          // communicated in a second communication step.
+          //
+          // as explained in the 'distributed' paper, this has to be
+          // done twice
           communicate_dof_indices_on_marked_cells (*dof_handler,
                                                    vertices_with_ghost_neighbors,
                                                    triangulation->coarse_cell_to_p4est_tree_permutation,
@@ -4089,6 +4088,8 @@ namespace internal
                                                    triangulation->coarse_cell_to_p4est_tree_permutation,
                                                    triangulation->p4est_tree_to_coarse_cell_permutation);
 
+          triangulation->load_user_flags(user_flags);
+        }
 
           // * Create global_dof_indexsets by transferring our own owned_dofs
           // to every other machine.

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.