From: Peter Munch Date: Mon, 29 Jun 2020 06:40:29 +0000 (+0200) Subject: Remove DoFHandlerType from grid_tools.h and trilinos_precondition.h X-Git-Tag: v9.3.0-rc1~1349^2~3 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9ad61f60357c18888e96d2d3fb2e2ca97c7accb7;p=dealii.git Remove DoFHandlerType from grid_tools.h and trilinos_precondition.h --- diff --git a/include/deal.II/grid/grid_tools.h b/include/deal.II/grid/grid_tools.h index c0febf279d..3d6e6fd29a 100644 --- a/include/deal.II/grid/grid_tools.h +++ b/include/deal.II/grid/grid_tools.h @@ -2398,14 +2398,14 @@ namespace GridTools /** * This function runs through the degrees of freedom defined by the - * DoFHandlerType and for each dof constructs a vector of + * DoFHandler and for each dof constructs a vector of * active_cell_iterators representing the cells of support of the associated * basis element at that degree of freedom. This function was originally * designed for the implementation of local projections, for instance the * Clement interpolant, in conjunction with other local patch functions like * GridTools::build_triangulation_from_patch. * - * DoFHandlerType's built on top of Triangulation or + * DoFHandler's built on top of Triangulation or * parallel:distributed::Triangulation are supported and handled * appropriately. * @@ -2418,21 +2418,20 @@ namespace GridTools * consist exclusively of the single cell on which the degree of freedom is * located. * - * @tparam DoFHandlerType The DoFHandlerType should be a DoFHandler or - * hp::DoFHandler. - * @param[in] dof_handler The DoFHandlerType which could be built on a + * @param[in] dof_handler The DoFHandler which could be built on a * Triangulation or a parallel::distributed::Triangulation with a finite * element that has degrees of freedom that are logically associated to a * vertex, line, quad, or hex. * @return A map from the global_dof_index of * degrees of freedom on locally relevant cells to vectors containing - * DoFHandlerType::active_cell_iterators of cells in the support of the basis + * DoFHandler::active_cell_iterators of cells in the support of the basis * function at that degree of freedom. */ - template - std::map> - get_dof_to_support_patch_map(DoFHandlerType &dof_handler); + template + std::map< + types::global_dof_index, + std::vector::active_cell_iterator>> + get_dof_to_support_patch_map(DoFHandler &dof_handler); /*@}*/ diff --git a/include/deal.II/lac/trilinos_precondition.h b/include/deal.II/lac/trilinos_precondition.h index 986a309aba..e4b5b471eb 100644 --- a/include/deal.II/lac/trilinos_precondition.h +++ b/include/deal.II/lac/trilinos_precondition.h @@ -1366,7 +1366,7 @@ namespace TrilinosWrappers * #include * ... * - * DoFHandlerType<...> dof_handler; + * DoFHandler<...> dof_handler; * FEValuesExtractors::Type... field_extractor; * ... * diff --git a/source/grid/grid_tools_dof_handlers.cc b/source/grid/grid_tools_dof_handlers.cc index 2933623d74..8f782e61bf 100644 --- a/source/grid/grid_tools_dof_handlers.cc +++ b/source/grid/grid_tools_dof_handlers.cc @@ -1706,10 +1706,11 @@ namespace GridTools - template - std::map> - get_dof_to_support_patch_map(DoFHandlerType &dof_handler) + template + std::map< + types::global_dof_index, + std::vector::active_cell_iterator>> + get_dof_to_support_patch_map(DoFHandler &dof_handler) { // This is the map from global_dof_index to // a set of cells on patch. We first map into @@ -1722,7 +1723,7 @@ namespace GridTools // since that is the preferred output for other // functions. std::map> + std::set::active_cell_iterator>> dof_to_set_of_cells_map; std::vector local_dof_indices; @@ -1736,22 +1737,21 @@ namespace GridTools // in 3d, we need pointers from active lines to the // active parent lines, so we construct it as needed. - std::map + std::map::active_line_iterator, + typename DoFHandler::line_iterator> lines_to_parent_lines_map; - if (DoFHandlerType::dimension == 3) + if (dim == 3) { // save user flags as they will be modified and then later restored dof_handler.get_triangulation().save_user_flags(user_flags); - const_cast &>( + const_cast &>( dof_handler.get_triangulation()) .clear_user_flags(); - typename DoFHandlerType::active_cell_iterator cell = dof_handler - .begin_active(), - endc = dof_handler.end(); + typename DoFHandler::active_cell_iterator + cell = dof_handler.begin_active(), + endc = dof_handler.end(); for (; cell != endc; ++cell) { // We only want lines that are locally_relevant @@ -1760,9 +1760,7 @@ namespace GridTools // few and we don't have to use them. if (cell->is_artificial() == false) { - for (unsigned int l = 0; - l < - GeometryInfo::lines_per_cell; + for (unsigned int l = 0; l < GeometryInfo::lines_per_cell; ++l) if (cell->line(l)->has_children()) for (unsigned int c = 0; c < cell->line(l)->n_children(); @@ -1785,9 +1783,9 @@ namespace GridTools // which it is a part, mainly the ones that must // be added on account of adaptivity hanging node // constraints. - typename DoFHandlerType::active_cell_iterator cell = - dof_handler.begin_active(), - endc = dof_handler.end(); + typename DoFHandler::active_cell_iterator + cell = dof_handler.begin_active(), + endc = dof_handler.end(); for (; cell != endc; ++cell) { // Need to loop through all cells that could @@ -1812,8 +1810,7 @@ namespace GridTools // face (or line). // Take care of dofs on neighbor faces - for (const unsigned int f : - GeometryInfo::face_indices()) + for (const unsigned int f : GeometryInfo::face_indices()) { if (cell->face(f)->has_children()) { @@ -1918,11 +1915,9 @@ namespace GridTools // if cell's line has an active parent, then // distribute cell to dofs on parent line // and dofs on all children of parent line. - if (DoFHandlerType::dimension == 3) + if (dim == 3) { - for (unsigned int l = 0; - l < - GeometryInfo::lines_per_cell; + for (unsigned int l = 0; l < GeometryInfo::lines_per_cell; ++l) { if (cell->line(l)->has_children()) @@ -1955,8 +1950,9 @@ namespace GridTools // children else if (cell->line(l)->user_flag_set() == true) { - typename DoFHandlerType::line_iterator parent_line = - lines_to_parent_lines_map[cell->line(l)]; + typename DoFHandler::line_iterator + parent_line = + lines_to_parent_lines_map[cell->line(l)]; Assert(parent_line->has_children(), ExcInternalError()); // dofs_per_line returns number of dofs @@ -1991,30 +1987,31 @@ namespace GridTools } } } // for lines l - } // if DoFHandlerType::dimension == 3 + } // if dim == 3 } // if cell->is_locally_owned() } // for cells - if (DoFHandlerType::dimension == 3) + if (dim == 3) { // finally, restore user flags that were changed above // to when we constructed the pointers to parent of lines // Since dof_handler is const, we must leave it unchanged. - const_cast &>( + const_cast &>( dof_handler.get_triangulation()) .load_user_flags(user_flags); } // Finally, we copy map of sets to // map of vectors using the std::vector::assign() function - std::map> + std::map< + types::global_dof_index, + std::vector::active_cell_iterator>> dof_to_cell_patches; - typename std::map>:: + typename std::map< + types::global_dof_index, + std::set::active_cell_iterator>>:: iterator it = dof_to_set_of_cells_map.begin(), it_end = dof_to_set_of_cells_map.end(); for (; it != it_end; ++it) diff --git a/source/grid/grid_tools_dof_handlers.inst.in b/source/grid/grid_tools_dof_handlers.inst.in index a8df05c2c5..18920f929e 100644 --- a/source/grid/grid_tools_dof_handlers.inst.in +++ b/source/grid/grid_tools_dof_handlers.inst.in @@ -216,8 +216,7 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS; -for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS; - Container : DOFHANDLER_TEMPLATE) +for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS) { #if deal_II_dimension <= deal_II_space_dimension namespace GridTools @@ -225,11 +224,10 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS; template std::map< types::global_dof_index, - std::vector::active_cell_iterator>> - get_dof_to_support_patch_map< - Container>( - Container &dof_handler); + std::vector::active_cell_iterator>> + get_dof_to_support_patch_map( + DoFHandler &dof_handler); \} #endif