From: Marco Feder Date: Mon, 31 Jul 2023 19:40:06 +0000 (+0000) Subject: Move create_coarse_partitioner to public X-Git-Tag: relicensing~633^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F15812%2Fhead;p=dealii.git Move create_coarse_partitioner to public --- diff --git a/include/deal.II/multigrid/mg_transfer_global_coarsening.templates.h b/include/deal.II/multigrid/mg_transfer_global_coarsening.templates.h index 6e78493f1e..8502e0144c 100644 --- a/include/deal.II/multigrid/mg_transfer_global_coarsening.templates.h +++ b/include/deal.II/multigrid/mg_transfer_global_coarsening.templates.h @@ -1043,49 +1043,6 @@ namespace internal class MGTwoLevelTransferImplementation { - template - static std::shared_ptr - create_coarse_partitioner( - const DoFHandler & dof_handler_coarse, - const dealii::AffineConstraints &constraints_coarse, - const unsigned int mg_level_coarse) - { - IndexSet locally_relevant_dofs = - (mg_level_coarse == numbers::invalid_unsigned_int) ? - DoFTools::extract_locally_active_dofs(dof_handler_coarse) : - DoFTools::extract_locally_active_level_dofs(dof_handler_coarse, - mg_level_coarse); - - std::vector locally_relevant_dofs_temp; - - for (const auto i : locally_relevant_dofs) - { - if (locally_relevant_dofs.is_element(i) == false) - locally_relevant_dofs_temp.emplace_back(i); - - const auto constraints = constraints_coarse.get_constraint_entries(i); - - if (constraints) - for (const auto &p : *constraints) - if (locally_relevant_dofs.is_element(p.first) == false) - locally_relevant_dofs_temp.emplace_back(p.first); - } - - std::sort(locally_relevant_dofs_temp.begin(), - locally_relevant_dofs_temp.end()); - locally_relevant_dofs.add_indices(locally_relevant_dofs_temp.begin(), - locally_relevant_dofs_temp.end()); - - return std::make_shared( - mg_level_coarse == numbers::invalid_unsigned_int ? - dof_handler_coarse.locally_owned_dofs() : - dof_handler_coarse.locally_owned_mg_dofs(mg_level_coarse), - locally_relevant_dofs, - dof_handler_coarse.get_communicator()); - } - - - template static void compute_weights( @@ -1212,6 +1169,49 @@ namespace internal public: + template + static std::shared_ptr + create_coarse_partitioner( + const DoFHandler & dof_handler_coarse, + const dealii::AffineConstraints &constraints_coarse, + const unsigned int mg_level_coarse) + { + IndexSet locally_relevant_dofs = + (mg_level_coarse == numbers::invalid_unsigned_int) ? + DoFTools::extract_locally_active_dofs(dof_handler_coarse) : + DoFTools::extract_locally_active_level_dofs(dof_handler_coarse, + mg_level_coarse); + + std::vector locally_relevant_dofs_temp; + + for (const auto i : locally_relevant_dofs) + { + if (locally_relevant_dofs.is_element(i) == false) + locally_relevant_dofs_temp.emplace_back(i); + + const auto constraints = constraints_coarse.get_constraint_entries(i); + + if (constraints) + for (const auto &p : *constraints) + if (locally_relevant_dofs.is_element(p.first) == false) + locally_relevant_dofs_temp.emplace_back(p.first); + } + + std::sort(locally_relevant_dofs_temp.begin(), + locally_relevant_dofs_temp.end()); + locally_relevant_dofs.add_indices(locally_relevant_dofs_temp.begin(), + locally_relevant_dofs_temp.end()); + + return std::make_shared( + mg_level_coarse == numbers::invalid_unsigned_int ? + dof_handler_coarse.locally_owned_dofs() : + dof_handler_coarse.locally_owned_mg_dofs(mg_level_coarse), + locally_relevant_dofs, + dof_handler_coarse.get_communicator()); + } + + + template static void reinit_geometric_transfer( @@ -2224,18 +2224,6 @@ namespace internal compress_weights(transfer); } } - - - template - friend void - MGTwoLevelTransferNonNested>:: - reinit(const DoFHandler & dof_handler_fine, - const DoFHandler & dof_handler_coarse, - const Mapping & mapping_fine, - const Mapping & mapping_coarse, - const AffineConstraints &constraint_fine, - const AffineConstraints &constraint_coarse); };