From 538ef0012a8489116311fd4302f6ca03c4d842da Mon Sep 17 00:00:00 2001 From: Marc Fehling Date: Fri, 5 Mar 2021 21:20:56 -0700 Subject: [PATCH] Use correct type for FE indices in DoFH::communicate_active_fe_indices(). --- source/dofs/dof_handler.cc | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/source/dofs/dof_handler.cc b/source/dofs/dof_handler.cc index 8d30cbbeff..dc48a04d56 100644 --- a/source/dofs/dof_handler.cc +++ b/source/dofs/dof_handler.cc @@ -17,6 +17,7 @@ #include #include +#include #include #include @@ -1715,6 +1716,9 @@ namespace internal dof_handler.hp_capability_enabled == true, (typename DoFHandler::ExcOnlyAvailableWithHP())); + using active_fe_index_type = + typename dealii::DoFHandler::active_fe_index_type; + if (const dealii::parallel::shared::Triangulation *tr = dynamic_cast< const dealii::parallel::shared::Triangulation @@ -1730,8 +1734,8 @@ namespace internal // on the other cells to zero. then we add all of these vectors // up, and because every vector entry has exactly one processor // that owns it, the sum is correct - std::vector active_fe_indices(tr->n_active_cells(), - 0u); + std::vector active_fe_indices( + tr->n_active_cells(), 0u); for (const auto &cell : dof_handler.active_cell_iterators()) if (cell->is_locally_owned()) active_fe_indices[cell->active_cell_index()] = @@ -1766,15 +1770,17 @@ namespace internal // to have functions that can pack and unpack the data we want to // transport -- namely, the single unsigned int active_fe_index // objects - auto pack = [](const typename dealii::DoFHandler:: - active_cell_iterator &cell) -> unsigned int { + auto pack = + [](const typename dealii::DoFHandler:: + active_cell_iterator &cell) -> active_fe_index_type { return cell->active_fe_index(); }; - auto unpack = [&dof_handler]( - const typename dealii::DoFHandler:: - active_cell_iterator &cell, - const unsigned int active_fe_index) -> void { + auto unpack = + [&dof_handler]( + const typename dealii::DoFHandler:: + active_cell_iterator & cell, + const active_fe_index_type active_fe_index) -> void { // we would like to say // cell->set_active_fe_index(active_fe_index); // but this is not allowed on cells that are not @@ -1785,11 +1791,8 @@ namespace internal }; GridTools::exchange_cell_data_to_ghosts< - unsigned int, - dealii::DoFHandler>( - static_cast &>(dof_handler), - pack, - unpack); + active_fe_index_type, + dealii::DoFHandler>(dof_handler, pack, unpack); } else { -- 2.39.5