From 4b662b1d146b41270c85bc6b5d8e30cc60eba823 Mon Sep 17 00:00:00 2001 From: David Wells Date: Tue, 22 Jun 2021 10:41:10 -0400 Subject: [PATCH] Instantiate a GridTools function for dim = 1. This requires special-casing p::d::T since the internal functions aren't defined for 1D. --- source/grid/grid_tools.cc | 78 +++++++++++++++++++++++++--------- source/grid/grid_tools.inst.in | 2 - 2 files changed, 57 insertions(+), 23 deletions(-) diff --git a/source/grid/grid_tools.cc b/source/grid/grid_tools.cc index 7b973c2f36..8860abe4e7 100644 --- a/source/grid/grid_tools.cc +++ b/source/grid/grid_tools.cc @@ -4128,28 +4128,24 @@ namespace GridTools } } - - - template - std::vector - get_subdomain_association(const Triangulation &triangulation, - const std::vector & cell_ids) + namespace internal { - std::vector subdomain_ids; - subdomain_ids.reserve(cell_ids.size()); - - if (dynamic_cast< - const parallel::fullydistributed::Triangulation *>( - &triangulation) != nullptr) - { - Assert(false, ExcNotImplemented()); - } - else if (const parallel::distributed::Triangulation - *parallel_tria = dynamic_cast< - const parallel::distributed::Triangulation *>( - &triangulation)) + namespace + { + // Split get_subdomain_association() for p::d::T since we want to compile + // it in 1D but none of the p4est stuff is available in 1D. + template + void + get_subdomain_association( + const parallel::distributed::Triangulation + & triangulation, + const std::vector & cell_ids, + std::vector &subdomain_ids) { #ifndef DEAL_II_WITH_P4EST + (void)triangulation; + (void)cell_ids; + (void)subdomain_ids; Assert( false, ExcMessage( @@ -4179,11 +4175,11 @@ namespace GridTools const int owner = dealii::internal::p4est::functions::comm_find_owner( const_cast::forest - *>(parallel_tria->get_p4est()), + *>(triangulation.get_p4est()), cell_id.get_coarse_cell_id(), &p4est_cell, Utilities::MPI::this_mpi_process( - parallel_tria->get_communicator())); + triangulation.get_communicator())); Assert(owner >= 0, ExcMessage("p4est should know the owner.")); @@ -4191,6 +4187,46 @@ namespace GridTools } #endif } + + + + template + void + get_subdomain_association( + const parallel::distributed::Triangulation<1, spacedim> &, + const std::vector &, + std::vector &) + { + Assert(false, ExcNotImplemented()); + } + } // anonymous namespace + } // namespace internal + + + + template + std::vector + get_subdomain_association(const Triangulation &triangulation, + const std::vector & cell_ids) + { + std::vector subdomain_ids; + subdomain_ids.reserve(cell_ids.size()); + + if (dynamic_cast< + const parallel::fullydistributed::Triangulation *>( + &triangulation) != nullptr) + { + Assert(false, ExcNotImplemented()); + } + else if (const parallel::distributed::Triangulation + *parallel_tria = dynamic_cast< + const parallel::distributed::Triangulation *>( + &triangulation)) + { + internal::get_subdomain_association(*parallel_tria, + cell_ids, + subdomain_ids); + } else if (const parallel::shared::Triangulation *shared_tria = dynamic_cast *>(&triangulation)) diff --git a/source/grid/grid_tools.inst.in b/source/grid/grid_tools.inst.in index 57d21677f4..74725e781a 100644 --- a/source/grid/grid_tools.inst.in +++ b/source/grid/grid_tools.inst.in @@ -342,12 +342,10 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS) partition_multigrid_levels( Triangulation &); -# if deal_II_dimension >= 2 template std::vector get_subdomain_association( const Triangulation &, const std::vector &); -# endif template void get_subdomain_association( -- 2.39.5