From d10fd9a53d90890bd21bf2c47d9041015a5412ec Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Wed, 19 Jul 2017 12:48:09 -0600 Subject: [PATCH] Make two blocks of code the same. 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 | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/source/dofs/dof_handler_policy.cc b/source/dofs/dof_handler_policy.cc index 83ba8970fe..720a7258d9 100644 --- a/source/dofs/dof_handler_policy.cc +++ b/source/dofs/dof_handler_policy.cc @@ -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*> - (const_cast*> - (&dof_handler->get_triangulation()))); - Assert (triangulation != nullptr, ExcInternalError()); - std::vector 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 > 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. -- 2.39.5