From: heister Date: Sat, 1 Jun 2013 19:10:23 +0000 (+0000) Subject: attempt to fix failing multigrid tests (is_locally_owned only works with active cells... X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a660b4da1ed10c0cffa51cb4a32f8f78f8ab395d;p=dealii-svn.git attempt to fix failing multigrid tests (is_locally_owned only works with active cells now) git-svn-id: https://svn.dealii.org/trunk@29719 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/include/deal.II/dofs/dof_renumbering.h b/deal.II/include/deal.II/dofs/dof_renumbering.h index fce9f3fb95..0b750d627a 100644 --- a/deal.II/include/deal.II/dofs/dof_renumbering.h +++ b/deal.II/include/deal.II/dofs/dof_renumbering.h @@ -821,7 +821,8 @@ namespace DoFRenumbering compute_component_wise (std::vector &new_dof_indices, const ITERATOR &start, const ENDITERATOR &end, - const std::vector &target_component); + const std::vector &target_component, + bool is_level_operation); /** * @} diff --git a/deal.II/source/dofs/dof_renumbering.cc b/deal.II/source/dofs/dof_renumbering.cc index 8295743bfa..30281f1ea2 100644 --- a/deal.II/source/dofs/dof_renumbering.cc +++ b/deal.II/source/dofs/dof_renumbering.cc @@ -475,7 +475,7 @@ namespace DoFRenumbering compute_component_wise::active_cell_iterator, typename DoFHandler::level_cell_iterator> - (renumbering, start, end, component_order_arg); + (renumbering, start, end, component_order_arg, false); if (result == 0) return; @@ -531,7 +531,7 @@ namespace DoFRenumbering compute_component_wise::dimension,hp::DoFHandler::space_dimension, typename hp::DoFHandler::active_cell_iterator, typename hp::DoFHandler::level_cell_iterator> - (renumbering, start, end, component_order_arg); + (renumbering, start, end, component_order_arg, false); if (result == 0) return; @@ -561,7 +561,7 @@ namespace DoFRenumbering const unsigned int result = compute_component_wise - (renumbering, start, end, component_order_arg); + (renumbering, start, end, component_order_arg, true); if (result == 0) return; @@ -579,7 +579,8 @@ namespace DoFRenumbering compute_component_wise (std::vector &new_indices, const ITERATOR &start, const ENDITERATOR &end, - const std::vector &component_order_arg) + const std::vector &component_order_arg, + bool is_level_operation) { const hp::FECollection fe_collection (start->get_dof_handler().get_fe ()); @@ -660,20 +661,32 @@ namespace DoFRenumbering std::vector > component_to_dof_map (fe_collection.n_components()); for (ITERATOR cell=start; cell!=end; ++cell) - if (cell->is_locally_owned()) - { - // on each cell: get dof indices - // and insert them into the global - // list using their component - const unsigned int fe_index = cell->active_fe_index(); - const unsigned int dofs_per_cell = fe_collection[fe_index].dofs_per_cell; - local_dof_indices.resize (dofs_per_cell); - cell->get_active_or_mg_dof_indices (local_dof_indices); - for (unsigned int i=0; iget_dof_handler().locally_owned_dofs().is_element(local_dof_indices[i])) - component_to_dof_map[component_list[fe_index][i]]. - push_back (local_dof_indices[i]); - } + { + if (is_level_operation) + { + //we are dealing with mg dofs, skip foreign level cells: + if (cell->level_subdomain_id()!=start->get_dof_handler().get_tria().locally_owned_subdomain()) + continue; + } + else + { + //we are dealing with active dofs, skip the loop if not locally + // owned: + if (!cell->active() || !cell->is_locally_owned()) + continue; + } + // on each cell: get dof indices + // and insert them into the global + // list using their component + const unsigned int fe_index = cell->active_fe_index(); + const unsigned int dofs_per_cell = fe_collection[fe_index].dofs_per_cell; + local_dof_indices.resize (dofs_per_cell); + cell->get_active_or_mg_dof_indices (local_dof_indices); + for (unsigned int i=0; iget_dof_handler().locally_owned_dofs().is_element(local_dof_indices[i])) + component_to_dof_map[component_list[fe_index][i]]. + push_back (local_dof_indices[i]); + } // now we've got all indices sorted // into buckets labeled by their