From 0d941cfb77f7d50db28269c61d3e0d56e2ab975b Mon Sep 17 00:00:00 2001 From: Peter Munch Date: Fri, 26 Jun 2020 09:09:34 +0200 Subject: [PATCH] Remove DoFHandlerType from dofs/dof_tools --- examples/step-45/step-45.cc | 10 +- include/deal.II/dofs/dof_tools.h | 511 +++++++++++-------- source/dofs/dof_tools.cc | 589 ++++++++++------------ source/dofs/dof_tools.inst.in | 233 +++++---- source/dofs/dof_tools_constraints.cc | 107 ++-- source/dofs/dof_tools_constraints.inst.in | 34 +- source/dofs/dof_tools_sparsity.cc | 162 +++--- source/dofs/dof_tools_sparsity.inst.in | 251 ++++----- source/multigrid/mg_tools.cc | 5 +- tests/hp/step-13.cc | 2 +- 10 files changed, 968 insertions(+), 936 deletions(-) diff --git a/examples/step-45/step-45.cc b/examples/step-45/step-45.cc index d97f7d3994..606d7d5445 100644 --- a/examples/step-45/step-45.cc +++ b/examples/step-45/step-45.cc @@ -457,11 +457,11 @@ namespace Step45 // After setting up all the information in periodicity_vector all we have // to do is to tell make_periodicity_constraints to create the desired // constraints. - DoFTools::make_periodicity_constraints>( - periodicity_vector, - constraints, - fe.component_mask(velocities), - first_vector_components); + DoFTools::make_periodicity_constraints(periodicity_vector, + constraints, + fe.component_mask( + velocities), + first_vector_components); VectorTools::interpolate_boundary_values(mapping, dof_handler, diff --git a/include/deal.II/dofs/dof_tools.h b/include/deal.II/dofs/dof_tools.h index 58a1d760c0..57c1c76721 100644 --- a/include/deal.II/dofs/dof_tools.h +++ b/include/deal.II/dofs/dof_tools.h @@ -79,10 +79,10 @@ namespace DoFTools * lambda in the parameter list) to avoid a bug in gcc where the same lambda * gets defined multiple times. */ - template + template inline bool always_couple_on_faces( - const typename DoFHandlerType::active_cell_iterator &, + const typename DoFHandler::active_cell_iterator &, const unsigned int) { return true; @@ -426,12 +426,13 @@ namespace DoFTools * * @ingroup constraints */ - template void make_sparsity_pattern( - const DoFHandlerType & dof_handler, + const DoFHandler &dof_handler, SparsityPatternType & sparsity_pattern, const AffineConstraints &constraints = AffineConstraints(), const bool keep_constrained_dofs = true, @@ -502,12 +503,13 @@ namespace DoFTools * * @ingroup constraints */ - template void make_sparsity_pattern( - const DoFHandlerType & dof_handler, + const DoFHandler &dof_handler, const Table<2, Coupling> & coupling, SparsityPatternType & sparsity_pattern, const AffineConstraints &constraints = AffineConstraints(), @@ -534,11 +536,11 @@ namespace DoFTools * whereas the ones that correspond to columns come from the second * DoFHandler. */ - template + template void - make_sparsity_pattern(const DoFHandlerType &dof_row, - const DoFHandlerType &dof_col, - SparsityPatternType & sparsity); + make_sparsity_pattern(const DoFHandler &dof_row, + const DoFHandler &dof_col, + SparsityPatternType & sparsity); /** * Compute which entries of a matrix built on the given @p dof_handler may @@ -585,10 +587,10 @@ namespace DoFTools * * @ingroup constraints */ - template + template void - make_flux_sparsity_pattern(const DoFHandlerType &dof_handler, - SparsityPatternType & sparsity_pattern); + make_flux_sparsity_pattern(const DoFHandler &dof_handler, + SparsityPatternType & sparsity_pattern); /** * This function does essentially the same as the other @@ -598,12 +600,13 @@ namespace DoFTools * * @ingroup constraints */ - template void make_flux_sparsity_pattern( - const DoFHandlerType & dof_handler, + const DoFHandler &dof_handler, SparsityPatternType & sparsity_pattern, const AffineConstraints &constraints, const bool keep_constrained_dofs = true, @@ -629,13 +632,13 @@ namespace DoFTools * * @ingroup constraints */ - template + template void make_flux_sparsity_pattern( - const DoFHandlerType & dof, - SparsityPatternType & sparsity, - const Table<2, Coupling> &cell_integrals_mask, - const Table<2, Coupling> &face_integrals_mask, + const DoFHandler &dof, + SparsityPatternType & sparsity, + const Table<2, Coupling> & cell_integrals_mask, + const Table<2, Coupling> & face_integrals_mask, const types::subdomain_id subdomain_id = numbers::invalid_subdomain_id); @@ -665,12 +668,13 @@ namespace DoFTools * }; * @endcode */ - template void make_flux_sparsity_pattern( - const DoFHandlerType & dof, + const DoFHandler &dof, SparsityPatternType & sparsity, const AffineConstraints &constraints, const bool keep_constrained_dofs, @@ -678,9 +682,9 @@ namespace DoFTools const Table<2, Coupling> & face_couplings, const types::subdomain_id subdomain_id, const std::function< - bool(const typename DoFHandlerType::active_cell_iterator &, + bool(const typename DoFHandler::active_cell_iterator &, const unsigned int)> &face_has_flux_coupling = - &internal::always_couple_on_faces); + &internal::always_couple_on_faces); /** * Create the sparsity pattern for boundary matrices. See the general @@ -691,10 +695,10 @@ namespace DoFTools * the matrix does not consist of domain integrals, but only of integrals * over the boundary of the domain. */ - template + template void make_boundary_sparsity_pattern( - const DoFHandlerType & dof, + const DoFHandler & dof, const std::vector &dof_to_boundary_mapping, SparsityPatternType & sparsity_pattern); @@ -715,14 +719,14 @@ namespace DoFTools * map with the boundary indicators you want and set the function pointers to * null pointers). */ - template void make_boundary_sparsity_pattern( - const DoFHandlerType &dof, - const std::map *> + const DoFHandler &dof, + const std::map *> & boundary_ids, const std::vector &dof_to_boundary_mapping, SparsityPatternType & sparsity); @@ -777,10 +781,10 @@ namespace DoFTools * * @ingroup constraints */ - template + template void - make_hanging_node_constraints(const DoFHandlerType & dof_handler, - AffineConstraints &constraints); + make_hanging_node_constraints(const DoFHandler &dof_handler, + AffineConstraints & constraints); /** * This function is used when different variables in a problem are @@ -1097,8 +1101,25 @@ namespace DoFTools * @ref GlossPeriodicConstraints "Glossary entry on periodic boundary conditions" * and step-45 for further information. */ - template + template void + make_periodicity_constraints( + const std::vector::cell_iterator>> &periodic_faces, + AffineConstraints & constraints, + const ComponentMask & component_mask = ComponentMask(), + const std::vector &first_vector_components = + std::vector(), + const number periodicity_factor = 1.); + + /** + * The same as above. + * + * @deprecated Use the function that takes dim and spacedim as template + * argument. + */ + template + DEAL_II_DEPRECATED void make_periodicity_constraints( const std::vector< GridTools::PeriodicFacePair> @@ -1140,16 +1161,16 @@ namespace DoFTools * @ref GlossPeriodicConstraints "Glossary entry on periodic boundary conditions" * for further information. */ - template + template void make_periodicity_constraints( - const DoFHandlerType & dof_handler, - const types::boundary_id b_id1, - const types::boundary_id b_id2, - const unsigned int direction, - AffineConstraints &constraints, - const ComponentMask & component_mask = ComponentMask(), - const number periodicity_factor = 1.); + const DoFHandler &dof_handler, + const types::boundary_id b_id1, + const types::boundary_id b_id2, + const unsigned int direction, + AffineConstraints & constraints, + const ComponentMask & component_mask = ComponentMask(), + const number periodicity_factor = 1.); @@ -1178,15 +1199,15 @@ namespace DoFTools * @ref GlossPeriodicConstraints "Glossary entry on periodic boundary conditions" * for further information. */ - template + template void make_periodicity_constraints( - const DoFHandlerType & dof_handler, - const types::boundary_id b_id, - const unsigned int direction, - AffineConstraints &constraints, - const ComponentMask & component_mask = ComponentMask(), - const number periodicity_factor = 1.); + const DoFHandler &dof_handler, + const types::boundary_id b_id, + const unsigned int direction, + AffineConstraints & constraints, + const ComponentMask & component_mask = ComponentMask(), + const number periodicity_factor = 1.); /** * @} @@ -1215,18 +1236,18 @@ namespace DoFTools * @deprecated For the reason stated above, this function is deprecated in * favor of the following function. */ - template + template DEAL_II_DEPRECATED void - extract_hanging_node_dofs(const DoFHandlerType &dof_handler, - std::vector & selected_dofs); + extract_hanging_node_dofs(const DoFHandler &dof_handler, + std::vector & selected_dofs); /** * Same as above but return the selected DoFs as IndexSet. In particular, * for parallel::TriangulationBase objects this function should be preferred. */ - template + template IndexSet - extract_hanging_node_dofs(const DoFHandlerType &dof_handler); + extract_hanging_node_dofs(const DoFHandler &dof_handler); /** * Extract the indices of the degrees of freedom belonging to certain vector @@ -1270,11 +1291,11 @@ namespace DoFTools * freedom. It is consequently deprecated in favor of the following * function. */ - template + template DEAL_II_DEPRECATED void - extract_dofs(const DoFHandlerType &dof_handler, - const ComponentMask & component_mask, - std::vector & selected_dofs); + extract_dofs(const DoFHandler &dof_handler, + const ComponentMask & component_mask, + std::vector & selected_dofs); /** * Extract the (locally owned) indices of the degrees of freedom belonging to @@ -1308,10 +1329,10 @@ namespace DoFTools * number of degrees of freedom. Note that the resulting object is always * a subset of what DoFHandler::locally_owned_dofs() returns. */ - template + template IndexSet - extract_dofs(const DoFHandlerType &dof_handler, - const ComponentMask & component_mask); + extract_dofs(const DoFHandler &dof_handler, + const ComponentMask & component_mask); /** * This function is the equivalent to the DoFTools::extract_dofs() functions @@ -1343,11 +1364,11 @@ namespace DoFTools * freedom. It is consequently deprecated in favor of the following * function. */ - template + template DEAL_II_DEPRECATED void - extract_dofs(const DoFHandlerType &dof_handler, - const BlockMask & block_mask, - std::vector & selected_dofs); + extract_dofs(const DoFHandler &dof_handler, + const BlockMask & block_mask, + std::vector & selected_dofs); /** * This function is the equivalent to the DoFTools::extract_dofs() functions @@ -1372,31 +1393,32 @@ namespace DoFTools * number of degrees of freedom. Note that the resulting object is always * a subset of what DoFHandler::locally_owned_dofs() returns. */ - template + template IndexSet - extract_dofs(const DoFHandlerType &dof_handler, const BlockMask &block_mask); + extract_dofs(const DoFHandler &dof_handler, + const BlockMask & block_mask); /** * Do the same thing as the corresponding extract_dofs() function for one * level of a multi-grid DoF numbering. */ - template + template void - extract_level_dofs(const unsigned int level, - const DoFHandlerType &dof, - const ComponentMask & component_mask, - std::vector & selected_dofs); + extract_level_dofs(const unsigned int level, + const DoFHandler &dof, + const ComponentMask & component_mask, + std::vector & selected_dofs); /** * Do the same thing as the corresponding extract_dofs() function for one * level of a multi-grid DoF numbering. */ - template + template void - extract_level_dofs(const unsigned int level, - const DoFHandlerType &dof, - const BlockMask & component_mask, - std::vector & selected_dofs); + extract_level_dofs(const unsigned int level, + const DoFHandler &dof, + const BlockMask & component_mask, + std::vector & selected_dofs); /** * Extract all degrees of freedom which are at the boundary and belong to @@ -1450,9 +1472,9 @@ namespace DoFTools * @see * @ref GlossBoundaryIndicator "Glossary entry on boundary indicators" */ - template + template void - extract_boundary_dofs(const DoFHandlerType & dof_handler, + extract_boundary_dofs(const DoFHandler & dof_handler, const ComponentMask & component_mask, std::vector & selected_dofs, const std::set &boundary_ids = @@ -1488,9 +1510,9 @@ namespace DoFTools * @see * @ref GlossBoundaryIndicator "Glossary entry on boundary indicators" */ - template + template void - extract_boundary_dofs(const DoFHandlerType & dof_handler, + extract_boundary_dofs(const DoFHandler & dof_handler, const ComponentMask & component_mask, IndexSet & selected_dofs, const std::set &boundary_ids = @@ -1512,10 +1534,10 @@ namespace DoFTools * @see * @ref GlossBoundaryIndicator "Glossary entry on boundary indicators" */ - template + template void extract_dofs_with_support_on_boundary( - const DoFHandlerType & dof_handler, + const DoFHandler & dof_handler, const ComponentMask & component_mask, std::vector & selected_dofs, const std::set &boundary_ids = @@ -1548,12 +1570,13 @@ namespace DoFTools * DoFs that are associated with the locally owned or ghost cells, but are not * owned by the current MPI core. */ - template + template IndexSet extract_dofs_with_support_contained_within( - const DoFHandlerType &dof_handler, + const DoFHandler &dof_handler, const std::function< - bool(const typename DoFHandlerType::active_cell_iterator &)> &predicate, + bool(const typename DoFHandler::active_cell_iterator &)> + & predicate, const AffineConstraints &constraints = AffineConstraints()); /** @@ -1589,11 +1612,11 @@ namespace DoFTools * The main reason for this program is the use of the null space with the * AMG preconditioner. */ - template + template void - extract_constant_modes(const DoFHandlerType & dof_handler, - const ComponentMask & component_mask, - std::vector> &constant_modes); + extract_constant_modes(const DoFHandler &dof_handler, + const ComponentMask & component_mask, + std::vector> & constant_modes); //@} /** @@ -1609,11 +1632,11 @@ namespace DoFTools * If you want to get a unique association of degree of freedom with * subdomains, use the @p get_subdomain_association function. */ - template + template void - extract_subdomain_dofs(const DoFHandlerType & dof_handler, - const types::subdomain_id subdomain_id, - std::vector & selected_dofs); + extract_subdomain_dofs(const DoFHandler &dof_handler, + const types::subdomain_id subdomain_id, + std::vector & selected_dofs); /** * Extract the set of global DoF indices that are active on the current @@ -1629,10 +1652,10 @@ namespace DoFTools * from the dof_indices_with_subdomain_association() function when called * with the locally owned subdomain id. */ - template + template void - extract_locally_active_dofs(const DoFHandlerType &dof_handler, - IndexSet & dof_set); + extract_locally_active_dofs(const DoFHandler &dof_handler, + IndexSet & dof_set); /** * Extract the set of global DoF indices that are active on the current @@ -1643,10 +1666,10 @@ namespace DoFTools * not artificial (see * @ref GlossArtificialCell "the glossary"). */ - template + template void - extract_locally_relevant_dofs(const DoFHandlerType &dof_handler, - IndexSet & dof_set); + extract_locally_relevant_dofs(const DoFHandler &dof_handler, + IndexSet & dof_set); /** @@ -1658,11 +1681,11 @@ namespace DoFTools * also corresponds to the default value), then the union of the returned * index sets equlas what DoFHandler::locally_owned_dofs() returns. */ - template + template std::vector locally_owned_dofs_per_component( - const DoFHandlerType &dof_handler, - const ComponentMask & components = ComponentMask()); + const DoFHandler &dof_handler, + const ComponentMask & components = ComponentMask()); /** * For each processor, determine the set of locally owned degrees of freedom @@ -1677,9 +1700,10 @@ namespace DoFTools * locally, and consequently can not say anything definitive about the * degrees of freedom active on other processors' locally owned cells. */ - template + template std::vector - locally_owned_dofs_per_subdomain(const DoFHandlerType &dof_handler); + locally_owned_dofs_per_subdomain( + const DoFHandler &dof_handler); /** * @@ -1695,20 +1719,22 @@ namespace DoFTools * locally, and consequently can not say anything definitive about the * degrees of freedom active on other processors' locally owned cells. */ - template + template std::vector - locally_relevant_dofs_per_subdomain(const DoFHandlerType &dof_handler); + locally_relevant_dofs_per_subdomain( + const DoFHandler &dof_handler); /** * Same as extract_locally_relevant_dofs() but for multigrid DoFs for the * given @p level. */ - template + template void - extract_locally_relevant_level_dofs(const DoFHandlerType &dof_handler, - const unsigned int level, - IndexSet & dof_set); + extract_locally_relevant_level_dofs( + const DoFHandler &dof_handler, + const unsigned int level, + IndexSet & dof_set); /** @@ -1741,9 +1767,9 @@ namespace DoFTools * subdomain are not the same the DoFHandler class identifies as those it * owns. */ - template + template void - get_subdomain_association(const DoFHandlerType & dof_handler, + get_subdomain_association(const DoFHandler & dof_handler, std::vector &subdomain); /** @@ -1771,10 +1797,11 @@ namespace DoFTools * subdomain are not the same the DoFHandler class identifies as those it * owns. */ - template + template unsigned int - count_dofs_with_subdomain_association(const DoFHandlerType & dof_handler, - const types::subdomain_id subdomain); + count_dofs_with_subdomain_association( + const DoFHandler &dof_handler, + const types::subdomain_id subdomain); /** * Count how many degrees of freedom are uniquely associated with the given @@ -1795,12 +1822,12 @@ namespace DoFTools * subdomain are not the same the DoFHandler class identifies as those it * owns. */ - template + template void count_dofs_with_subdomain_association( - const DoFHandlerType & dof_handler, - const types::subdomain_id subdomain, - std::vector &n_dofs_on_subdomain); + const DoFHandler &dof_handler, + const types::subdomain_id subdomain, + std::vector & n_dofs_on_subdomain); /** * Return a set of indices that denotes the degrees of freedom that live on @@ -1823,10 +1850,11 @@ namespace DoFTools * subdomain are not the same the DoFHandler class identifies as those it * owns. */ - template + template IndexSet - dof_indices_with_subdomain_association(const DoFHandlerType & dof_handler, - const types::subdomain_id subdomain); + dof_indices_with_subdomain_association( + const DoFHandler &dof_handler, + const types::subdomain_id subdomain); // @} /** * @name DoF indices on patches of cells @@ -1868,13 +1896,8 @@ namespace DoFTools * one considers the index into this array a local DoF index, then the local * system that results retains the block structure of the global system. * - * @tparam DoFHandlerType A type that is either DoFHandler or - * hp::DoFHandler. In C++, the compiler can not determine the type of - * DoFHandlerType from the function call. You need to specify - * it as an explicit template argument following the function name. - * * @param patch A collection of cells within an object of type - * DoFHandlerType + * DoFHandler::active_cell_iterator * * @return A list of those global degrees of freedom located on the patch, * as defined above. @@ -1887,10 +1910,22 @@ namespace DoFTools * degrees of freedom on these. In other words, this function can only work * if all cells in the patch are either locally owned or ghost cells. */ - template + template std::vector get_dofs_on_patch( - const std::vector &patch); + const std::vector::active_cell_iterator> + &patch); + + /** + * The same as above. + * + * @deprecated Use the function that takes dim and spacedim as template + * argument. + */ + template + DEAL_II_DEPRECATED std::vector + get_dofs_on_patch( + const std::vector &patch); /** * Creates a sparsity pattern, which lists @@ -1971,16 +2006,16 @@ namespace DoFTools * contains one vertex index for each block; if false, then the return value * contains one block index or invalid_unsigned_int for each vertex. */ - template + template std::vector - make_vertex_patches(SparsityPattern & block_list, - const DoFHandlerType &dof_handler, - const unsigned int level, - const bool interior_dofs_only, - const bool boundary_patches = false, - const bool level_boundary_patches = false, - const bool single_cell_patches = false, - const bool invert_vertex_mapping = false); + make_vertex_patches(SparsityPattern & block_list, + const DoFHandler &dof_handler, + const unsigned int level, + const bool interior_dofs_only, + const bool boundary_patches = false, + const bool level_boundary_patches = false, + const bool single_cell_patches = false, + const bool invert_vertex_mapping = false); /** * Same as above but allows boundary dofs on blocks to be excluded @@ -1996,16 +2031,16 @@ namespace DoFTools * the patch if the boolean value for the corresponding block in the * BlockMask of @p exclude_boundary_dofs is false. */ - template + template std::vector - make_vertex_patches(SparsityPattern & block_list, - const DoFHandlerType &dof_handler, - const unsigned int level, - const BlockMask & exclude_boundary_dofs = BlockMask(), - const bool boundary_patches = false, - const bool level_boundary_patches = false, - const bool single_cell_patches = false, - const bool invert_vertex_mapping = false); + make_vertex_patches(SparsityPattern & block_list, + const DoFHandler &dof_handler, + const unsigned int level, + const BlockMask &exclude_boundary_dofs = BlockMask(), + const bool boundary_patches = false, + const bool level_boundary_patches = false, + const bool single_cell_patches = false, + const bool invert_vertex_mapping = false); /** * Create an incidence matrix that for every cell on a given level of a @@ -2044,13 +2079,13 @@ namespace DoFTools * the domain, and thus need smoothing. This parameter has no effect if * interior_dofs_only is false. */ - template + template void - make_child_patches(SparsityPattern & block_list, - const DoFHandlerType &dof_handler, - const unsigned int level, - const bool interior_dofs_only, - const bool boundary_dofs = false); + make_child_patches(SparsityPattern & block_list, + const DoFHandler &dof_handler, + const unsigned int level, + const bool interior_dofs_only, + const bool boundary_dofs = false); /** * Create a block list with only a single patch, which in turn contains all @@ -2071,12 +2106,12 @@ namespace DoFTools * @arg interior_dofs_only: if true, exclude degrees of freedom on * the boundary of the domain. */ - template + template void - make_single_patch(SparsityPattern & block_list, - const DoFHandlerType &dof_handler, - const unsigned int level, - const bool interior_dofs_only = false); + make_single_patch(SparsityPattern & block_list, + const DoFHandler &dof_handler, + const unsigned int level, + const bool interior_dofs_only = false); /** * @} @@ -2120,10 +2155,10 @@ namespace DoFTools * in @p target_component. If this is not the case, an assertion is thrown. * The indices not targeted by target_components are left untouched. */ - template + template std::vector count_dofs_per_fe_component( - const DoFHandlerType & dof_handler, + const DoFHandler &dof_handler, const bool vector_valued_once = false, const std::vector &target_component = {}); @@ -2131,10 +2166,10 @@ namespace DoFTools * @deprecated A version of the previous function that returns its * information through the non-`const` second argument. */ - template + template DEAL_II_DEPRECATED void count_dofs_per_component( - const DoFHandlerType & dof_handler, + const DoFHandler & dof_handler, std::vector &dofs_per_component, const bool vector_valued_once = false, const std::vector & target_component = {}); @@ -2155,9 +2190,9 @@ namespace DoFTools * element used by the dof_handler argument has blocks, or alternatively as * many blocks as are enumerated in the target_blocks argument if given. */ - template + template std::vector - count_dofs_per_fe_block(const DoFHandlerType & dof, + count_dofs_per_fe_block(const DoFHandler &dof, const std::vector &target_block = std::vector()); @@ -2165,9 +2200,9 @@ namespace DoFTools * @deprecated A version of the previous function that returns its * information through the non-`const` second argument. */ - template + template DEAL_II_DEPRECATED void - count_dofs_per_block(const DoFHandlerType & dof, + count_dofs_per_block(const DoFHandler & dof, std::vector &dofs_per_block, const std::vector & target_block = std::vector()); @@ -2182,10 +2217,10 @@ namespace DoFTools * finite element. For a hp::DoFHandler, the values may be different, * though. */ - template + template void - get_active_fe_indices(const DoFHandlerType & dof_handler, - std::vector &active_fe_indices); + get_active_fe_indices(const DoFHandler &dof_handler, + std::vector & active_fe_indices); /** * Count how many degrees of freedom live on a set of cells (i.e., a patch) @@ -2200,13 +2235,8 @@ namespace DoFTools * DoFTools::get_dofs_on_patch() will then help to make the connection * between global degrees of freedom and the local ones. * - * @tparam DoFHandlerType A type that is either DoFHandler or - * hp::DoFHandler. In C++, the compiler can not determine the type of - * DoFHandlerType from the function call. You need to specify - * it as an explicit template argument following the function name. - * * @param patch A collection of cells within an object of type - * DoFHandlerType + * DoFHandler * * @return The number of degrees of freedom associated with the cells of * this patch. @@ -2219,8 +2249,20 @@ namespace DoFTools * degrees of freedom on these. In other words, this function can only work * if all cells in the patch are either locally owned or ghost cells. */ - template + template unsigned int + count_dofs_on_patch( + const std::vector::active_cell_iterator> + &patch); + + /** + * The same as above. + * + * @deprecated Use the function that takes dim and spacedim as template + * argument. + */ + template + DEAL_II_DEPRECATED unsigned int count_dofs_on_patch( const std::vector &patch); @@ -2246,9 +2288,9 @@ namespace DoFTools * * Prior content of @p mapping is deleted. */ - template + template void - map_dof_to_boundary_indices(const DoFHandlerType & dof_handler, + map_dof_to_boundary_indices(const DoFHandler & dof_handler, std::vector &mapping); /** @@ -2261,9 +2303,9 @@ namespace DoFTools * @see * @ref GlossBoundaryIndicator "Glossary entry on boundary indicators" */ - template + template void - map_dof_to_boundary_indices(const DoFHandlerType & dof_handler, + map_dof_to_boundary_indices(const DoFHandler & dof_handler, const std::set &boundary_ids, std::vector &mapping); @@ -2383,15 +2425,13 @@ namespace DoFTools * only the last value in the map returned by map_dofs_to_support_points() for * each point will be returned. */ - template + template void map_support_points_to_dofs( - const Mapping - & mapping, - const DoFHandlerType &dof_handler, - std::map, - types::global_dof_index, - Comp> & point_to_index_map); + const Mapping & mapping, + const DoFHandler &dof_handler, + std::map, types::global_dof_index, Comp> + &point_to_index_map); /** * @} */ @@ -2429,12 +2469,12 @@ namespace DoFTools * functions that are non-zero in more than one vector component (in deal.II * speak: they are non-primitive). */ - template + template void - distribute_cell_to_dof_vector(const DoFHandlerType &dof_handler, - const Vector &cell_data, - Vector & dof_data, - const unsigned int component = 0); + distribute_cell_to_dof_vector(const DoFHandler &dof_handler, + const Vector & cell_data, + Vector & dof_data, + const unsigned int component = 0); /** @@ -2560,16 +2600,13 @@ namespace DoFTools * @see * @ref GlossBoundaryIndicator "Glossary entry on boundary indicators" */ - template class DoFHandlerType, - typename number> + template void make_zero_boundary_constraints( - const DoFHandlerType &dof, - const types::boundary_id boundary_id, - AffineConstraints & zero_boundary_constraints, - const ComponentMask & component_mask = ComponentMask()); + const DoFHandler &dof, + const types::boundary_id boundary_id, + AffineConstraints & zero_boundary_constraints, + const ComponentMask & component_mask = ComponentMask()); /** * Do the same as the previous function, except do it for all parts of the @@ -2581,15 +2618,12 @@ namespace DoFTools * * @ingroup constraints */ - template class DoFHandlerType, - typename number> + template void make_zero_boundary_constraints( - const DoFHandlerType &dof, - AffineConstraints & zero_boundary_constraints, - const ComponentMask & component_mask = ComponentMask()); + const DoFHandler &dof, + AffineConstraints & zero_boundary_constraints, + const ComponentMask & component_mask = ComponentMask()); /** * @} @@ -2679,21 +2713,18 @@ namespace DoFTools // ---------------------- inline and template functions -------------------- - template + template void map_support_points_to_dofs( - const Mapping - & mapping, - const DoFHandlerType &dof_handler, - std::map, - types::global_dof_index, - Comp> & point_to_index_map) + const Mapping & mapping, + const DoFHandler &dof_handler, + std::map, types::global_dof_index, Comp> + &point_to_index_map) { // let the checking of arguments be // done by the function first // called - std::vector> support_points( - dof_handler.n_dofs()); + std::vector> support_points(dof_handler.n_dofs()); map_dofs_to_support_points(mapping, dof_handler, support_points); // now copy over the results of the // previous function into the @@ -2702,6 +2733,50 @@ namespace DoFTools for (types::global_dof_index i = 0; i < dof_handler.n_dofs(); ++i) point_to_index_map[support_points[i]] = i; } + + + + template + inline void + make_periodicity_constraints( + const std::vector< + GridTools::PeriodicFacePair> + & periodic_faces, + AffineConstraints & constraints, + const ComponentMask & component_mask, + const std::vector &first_vector_components, + const number periodicity_factor) + { + make_periodicity_constraints( + periodic_faces, + constraints, + component_mask, + first_vector_components, + periodicity_factor); + } + + + + template + inline std::vector + get_dofs_on_patch( + const std::vector &patch) + { + return get_dofs_on_patch(patch); + } + + + + template + inline unsigned int + count_dofs_on_patch( + const std::vector &patch) + { + return count_dofs_on_patch(patch); + } } // namespace DoFTools #endif diff --git a/source/dofs/dof_tools.cc b/source/dofs/dof_tools.cc index 05695a385c..632236dcd1 100644 --- a/source/dofs/dof_tools.cc +++ b/source/dofs/dof_tools.cc @@ -193,15 +193,14 @@ namespace DoFTools // shape function // - otherwise, the shape function is assigned the first component selected // in the component_mask that corresponds to this shape function - template + template void - get_component_association(const DoFHandlerType & dof, - const ComponentMask & component_mask, + get_component_association(const DoFHandler &dof, + const ComponentMask & component_mask, std::vector &dofs_by_component) { - const dealii::hp::FECollection - &fe_collection = dof.get_fe_collection(); + const dealii::hp::FECollection &fe_collection = + dof.get_fe_collection(); Assert(fe_collection.n_components() < 256, ExcNotImplemented()); Assert(dofs_by_component.size() == dof.n_locally_owned_dofs(), ExcDimensionMismatch(dofs_by_component.size(), @@ -218,9 +217,7 @@ namespace DoFTools fe_collection.size()); for (unsigned int f = 0; f < fe_collection.size(); ++f) { - const FiniteElement &fe = - fe_collection[f]; + const FiniteElement &fe = fe_collection[f]; local_component_association[f] = get_local_component_association(fe, component_mask); } @@ -249,14 +246,13 @@ namespace DoFTools // vector block. if the DoFHandler is based on a parallel distributed // triangulation then the output array is index by // dof.locally_owned_dofs().index_within_set(indices[i]) - template + template inline void - get_block_association(const DoFHandlerType & dof, - std::vector &dofs_by_block) + get_block_association(const DoFHandler &dof, + std::vector & dofs_by_block) { - const dealii::hp::FECollection - &fe_collection = dof.get_fe_collection(); + const dealii::hp::FECollection &fe_collection = + dof.get_fe_collection(); Assert(fe_collection.n_components() < 256, ExcNotImplemented()); Assert(dofs_by_block.size() == dof.n_locally_owned_dofs(), ExcDimensionMismatch(dofs_by_block.size(), @@ -273,9 +269,7 @@ namespace DoFTools fe_collection.size()); for (unsigned int f = 0; f < fe_collection.size(); ++f) { - const FiniteElement &fe = - fe_collection[f]; + const FiniteElement &fe = fe_collection[f]; local_block_association[f].resize(fe.dofs_per_cell, static_cast(-1)); for (unsigned int i = 0; i < fe.dofs_per_cell; ++i) @@ -307,15 +301,13 @@ namespace DoFTools - template + template void - distribute_cell_to_dof_vector(const DoFHandlerType &dof_handler, - const Vector &cell_data, - Vector & dof_data, - const unsigned int component) + distribute_cell_to_dof_vector(const DoFHandler &dof_handler, + const Vector & cell_data, + Vector & dof_data, + const unsigned int component) { - const unsigned int dim = DoFHandlerType::dimension; - const unsigned int spacedim = DoFHandlerType::space_dimension; const Triangulation &tria = dof_handler.get_triangulation(); (void)tria; @@ -355,9 +347,9 @@ namespace DoFTools // count how often we have added a value in the sum for each dof std::vector touch_count(dof_handler.n_dofs(), 0); - 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(); std::vector dof_indices; dof_indices.reserve(fe_collection.max_dofs_per_cell()); @@ -396,11 +388,11 @@ namespace DoFTools - template + template void - extract_dofs(const DoFHandlerType &dof, - const ComponentMask & component_mask, - std::vector & selected_dofs) + extract_dofs(const DoFHandler &dof, + const ComponentMask & component_mask, + std::vector & selected_dofs) { Assert(component_mask.represents_n_components( dof.get_fe_collection().n_components()), @@ -443,9 +435,10 @@ namespace DoFTools - template + template IndexSet - extract_dofs(const DoFHandlerType &dof, const ComponentMask &component_mask) + extract_dofs(const DoFHandler &dof, + const ComponentMask & component_mask) { Assert(component_mask.represents_n_components( dof.get_fe_collection().n_components()), @@ -507,34 +500,35 @@ namespace DoFTools - template + template void - extract_dofs(const DoFHandlerType &dof, - const BlockMask & block_mask, - std::vector & selected_dofs) + extract_dofs(const DoFHandler &dof, + const BlockMask & block_mask, + std::vector & selected_dofs) { // simply forward to the function that works based on a component mask - extract_dofs( + extract_dofs( dof, dof.get_fe_collection().component_mask(block_mask), selected_dofs); } - template + template IndexSet - extract_dofs(const DoFHandlerType &dof, const BlockMask &block_mask) + extract_dofs(const DoFHandler &dof, + const BlockMask & block_mask) { // simply forward to the function that works based on a component mask - return extract_dofs( + return extract_dofs( dof, dof.get_fe_collection().component_mask(block_mask)); } - template + template std::vector - locally_owned_dofs_per_component(const DoFHandlerType &dof, - const ComponentMask & component_mask) + locally_owned_dofs_per_component(const DoFHandler &dof, + const ComponentMask &component_mask) { const auto n_comps = dof.get_fe_collection().n_components(); Assert(component_mask.represents_n_components(n_comps), @@ -565,15 +559,14 @@ namespace DoFTools - template + template void - extract_level_dofs(const unsigned int level, - const DoFHandlerType &dof, - const ComponentMask & component_mask, - std::vector & selected_dofs) + extract_level_dofs(const unsigned int level, + const DoFHandler &dof, + const ComponentMask & component_mask, + std::vector & selected_dofs) { - const FiniteElement &fe = dof.get_fe(); + const FiniteElement &fe = dof.get_fe(); Assert(component_mask.represents_n_components( dof.get_fe_collection().n_components()), @@ -611,8 +604,8 @@ namespace DoFTools local_selected_dofs[i] = component_mask[local_component_asssociation[i]]; // then loop over all cells and do work - std::vector indices(fe.dofs_per_cell); - typename DoFHandlerType::level_cell_iterator c; + std::vector indices(fe.dofs_per_cell); + typename DoFHandler::level_cell_iterator c; for (c = dof.begin(level); c != dof.end(level); ++c) { c->get_mg_dof_indices(indices); @@ -623,12 +616,12 @@ namespace DoFTools - template + template void - extract_level_dofs(const unsigned int level, - const DoFHandlerType &dof, - const BlockMask & block_mask, - std::vector & selected_dofs) + extract_level_dofs(const unsigned int level, + const DoFHandler &dof, + const BlockMask & block_mask, + std::vector & selected_dofs) { // simply defer to the other extract_level_dofs() function extract_level_dofs(level, @@ -639,16 +632,15 @@ namespace DoFTools - template + template void - extract_boundary_dofs(const DoFHandlerType & dof_handler, + extract_boundary_dofs(const DoFHandler & dof_handler, const ComponentMask & component_mask, std::vector & selected_dofs, const std::set &boundary_ids) { - Assert((dynamic_cast *>( + Assert((dynamic_cast< + const parallel::distributed::Triangulation *>( &dof_handler.get_triangulation()) == nullptr), ExcMessage( "This function can not be used with distributed triangulations. " @@ -666,9 +658,9 @@ namespace DoFTools } - template + template void - extract_boundary_dofs(const DoFHandlerType & dof_handler, + extract_boundary_dofs(const DoFHandler & dof_handler, const ComponentMask & component_mask, IndexSet & selected_dofs, const std::set &boundary_ids) @@ -679,7 +671,6 @@ namespace DoFTools Assert(boundary_ids.find(numbers::internal_face_boundary_id) == boundary_ids.end(), ExcInvalidBoundaryIndicator()); - const unsigned int dim = DoFHandlerType::dimension; // first reset output argument selected_dofs.clear(); @@ -712,16 +703,13 @@ namespace DoFTools // only work on cells that are either locally owned or at least ghost // cells if (cell->is_artificial() == false) - for (const unsigned int face : - GeometryInfo::face_indices()) + for (const unsigned int face : GeometryInfo::face_indices()) if (cell->at_boundary(face)) if (!check_boundary_id || (boundary_ids.find(cell->face(face)->boundary_id()) != boundary_ids.end())) { - const FiniteElement &fe = - cell->get_fe(); + const FiniteElement &fe = cell->get_fe(); const unsigned int dofs_per_face = fe.dofs_per_face; face_dof_indices.resize(dofs_per_face); @@ -777,10 +765,10 @@ namespace DoFTools - template + template void extract_dofs_with_support_on_boundary( - const DoFHandlerType & dof_handler, + const DoFHandler & dof_handler, const ComponentMask & component_mask, std::vector & selected_dofs, const std::set &boundary_ids) @@ -815,16 +803,13 @@ namespace DoFTools // boundary line is also part of a boundary face which we will be // visiting sooner or later for (const auto &cell : dof_handler.active_cell_iterators()) - for (const unsigned int face : - GeometryInfo::face_indices()) + for (const unsigned int face : GeometryInfo::face_indices()) if (cell->at_boundary(face)) if (!check_boundary_id || (boundary_ids.find(cell->face(face)->boundary_id()) != boundary_ids.end())) { - const FiniteElement &fe = - cell->get_fe(); + const FiniteElement &fe = cell->get_fe(); const unsigned int dofs_per_cell = fe.dofs_per_cell; cell_dof_indices.resize(dofs_per_cell); @@ -862,20 +847,21 @@ namespace DoFTools - template + template IndexSet extract_dofs_with_support_contained_within( - const DoFHandlerType &dof_handler, + const DoFHandler &dof_handler, const std::function< - bool(const typename DoFHandlerType::active_cell_iterator &)> &predicate, - const AffineConstraints & cm) + bool(const typename DoFHandler::active_cell_iterator &)> + & predicate, + const AffineConstraints &cm) { const std::function + const typename DoFHandler::active_cell_iterator &)> predicate_local = - [=](const typename DoFHandlerType::active_cell_iterator &cell) -> bool { - return cell->is_locally_owned() && predicate(cell); - }; + [=]( + const typename DoFHandler::active_cell_iterator &cell) + -> bool { return cell->is_locally_owned() && predicate(cell); }; std::vector local_dof_indices; local_dof_indices.reserve( @@ -884,9 +870,9 @@ namespace DoFTools // Get all the dofs that live on the subdomain: std::set predicate_dofs; - 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) if (!cell->is_artificial() && predicate(cell)) { @@ -899,11 +885,11 @@ namespace DoFTools // Get halo layer and accumulate its DoFs std::set dofs_with_support_on_halo_cells; - const std::vector + const std::vector::active_cell_iterator> halo_cells = GridTools::compute_active_cell_halo_layer(dof_handler, predicate_local); - for (typename std::vector< - typename DoFHandlerType::active_cell_iterator>::const_iterator it = + for (typename std::vector:: + active_cell_iterator>::const_iterator it = halo_cells.begin(); it != halo_cells.end(); ++it) @@ -1075,10 +1061,10 @@ namespace DoFTools - template + template void - extract_hanging_node_dofs(const DoFHandlerType &dof_handler, - std::vector & selected_dofs) + extract_hanging_node_dofs(const DoFHandler &dof_handler, + std::vector & selected_dofs) { const IndexSet selected_dofs_as_index_set = extract_hanging_node_dofs(dof_handler); @@ -1092,20 +1078,20 @@ namespace DoFTools - template + template IndexSet - extract_hanging_node_dofs(const DoFHandlerType &dof_handler) + extract_hanging_node_dofs(const DoFHandler &dof_handler) { return internal::extract_hanging_node_dofs(dof_handler); } - template + template void - extract_subdomain_dofs(const DoFHandlerType & dof_handler, - const types::subdomain_id subdomain_id, - std::vector & selected_dofs) + extract_subdomain_dofs(const DoFHandler &dof_handler, + const types::subdomain_id subdomain_id, + std::vector & selected_dofs) { Assert(selected_dofs.size() == dof_handler.n_dofs(), ExcDimensionMismatch(selected_dofs.size(), dof_handler.n_dofs())); @@ -1119,9 +1105,9 @@ namespace DoFTools // this function is similar to the make_sparsity_pattern function, see // there for more information - 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) if (cell->subdomain_id() == subdomain_id) { @@ -1135,10 +1121,10 @@ namespace DoFTools - template + template void - extract_locally_active_dofs(const DoFHandlerType &dof_handler, - IndexSet & dof_set) + extract_locally_active_dofs(const DoFHandler &dof_handler, + IndexSet & dof_set) { // collect all the locally owned dofs dof_set = dof_handler.locally_owned_dofs(); @@ -1149,9 +1135,9 @@ namespace DoFTools std::vector dof_indices; std::set global_dof_indices; - 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) if (cell->is_locally_owned()) { @@ -1170,10 +1156,10 @@ namespace DoFTools - template + template void - extract_locally_relevant_dofs(const DoFHandlerType &dof_handler, - IndexSet & dof_set) + extract_locally_relevant_dofs(const DoFHandler &dof_handler, + IndexSet & dof_set) { // collect all the locally owned dofs dof_set = dof_handler.locally_owned_dofs(); @@ -1189,9 +1175,9 @@ namespace DoFTools std::vector dof_indices; std::vector dofs_on_ghosts; - 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) if (cell->is_ghost()) { @@ -1212,11 +1198,12 @@ namespace DoFTools - template + template void - extract_locally_relevant_level_dofs(const DoFHandlerType &dof_handler, - const unsigned int level, - IndexSet & dof_set) + extract_locally_relevant_level_dofs( + const DoFHandler &dof_handler, + const unsigned int level, + IndexSet & dof_set) { // collect all the locally owned dofs dof_set = dof_handler.locally_owned_mg_dofs(level); @@ -1232,8 +1219,10 @@ namespace DoFTools std::vector dof_indices; std::vector dofs_on_ghosts; - typename DoFHandlerType::cell_iterator cell = dof_handler.begin(level), - endc = dof_handler.end(level); + typename DoFHandler::cell_iterator cell = dof_handler.begin( + level), + endc = + dof_handler.end(level); for (; cell != endc; ++cell) { const types::subdomain_id id = cell->level_subdomain_id(); @@ -1261,11 +1250,11 @@ namespace DoFTools - template + template void - extract_constant_modes(const DoFHandlerType & dof_handler, - const ComponentMask & component_mask, - std::vector> &constant_modes) + extract_constant_modes(const DoFHandler &dof_handler, + const ComponentMask & component_mask, + std::vector> & constant_modes) { // If there are no locally owned DoFs, return with an empty // constant_modes object: @@ -1304,9 +1293,8 @@ namespace DoFTools // // TODO: We might be able to extend this also for elements which do not // have the same constant modes, but that is messy... - const dealii::hp::FECollection - & fe_collection = dof_handler.get_fe_collection(); + const dealii::hp::FECollection &fe_collection = + dof_handler.get_fe_collection(); std::vector> element_constant_modes; std::vector>> constant_mode_to_component_translation(n_components); @@ -1357,33 +1345,32 @@ namespace DoFTools - template + template void - get_active_fe_indices(const DoFHandlerType & dof_handler, - std::vector &active_fe_indices) + get_active_fe_indices(const DoFHandler &dof_handler, + std::vector & active_fe_indices) { AssertDimension(active_fe_indices.size(), dof_handler.get_triangulation().n_active_cells()); - 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) active_fe_indices[cell->active_cell_index()] = cell->active_fe_index(); } - template + template std::vector - locally_owned_dofs_per_subdomain(const DoFHandlerType &dof_handler) + locally_owned_dofs_per_subdomain(const DoFHandler &dof_handler) { Assert(dof_handler.n_dofs() > 0, ExcMessage("The given DoFHandler has no DoFs.")); // If the Triangulation is distributed, the only thing we can usefully // ask is for its locally owned subdomain - Assert((dynamic_cast *>( + Assert((dynamic_cast< + const parallel::distributed::Triangulation *>( &dof_handler.get_triangulation()) == nullptr), ExcMessage( "For parallel::distributed::Triangulation objects and " @@ -1411,9 +1398,7 @@ namespace DoFTools // collect information for each subdomain index anyway, not just for the // used one.) const unsigned int n_subdomains = - (dynamic_cast *>( + (dynamic_cast *>( &dof_handler.get_triangulation()) == nullptr ? [&dof_handler]() { unsigned int max_subdomain_id = 0; @@ -1423,9 +1408,7 @@ namespace DoFTools return max_subdomain_id + 1; }() : Utilities::MPI::n_mpi_processes( - dynamic_cast *>( + dynamic_cast *>( &dof_handler.get_triangulation()) ->get_communicator())); Assert(n_subdomains > *std::max_element(subdomain_association.begin(), @@ -1472,15 +1455,15 @@ namespace DoFTools return index_sets; } - template + template std::vector - locally_relevant_dofs_per_subdomain(const DoFHandlerType &dof_handler) + locally_relevant_dofs_per_subdomain( + const DoFHandler &dof_handler) { // If the Triangulation is distributed, the only thing we can usefully // ask is for its locally owned subdomain - Assert((dynamic_cast *>( + Assert((dynamic_cast< + const parallel::distributed::Triangulation *>( &dof_handler.get_triangulation()) == nullptr), ExcMessage( "For parallel::distributed::Triangulation objects and " @@ -1507,9 +1490,10 @@ namespace DoFTools { // Extract the layer of cells around this subdomain std::function + const typename DoFHandler::active_cell_iterator &)> predicate = IteratorFilters::SubdomainEqualTo(subdomain_id); - const std::vector + const std::vector< + typename DoFHandler::active_cell_iterator> active_halo_layer = GridTools::compute_active_cell_halo_layer(dof_handler, predicate); @@ -1517,13 +1501,13 @@ namespace DoFTools std::vector local_dof_indices; std::set subdomain_halo_global_dof_indices; for (typename std::vector< - typename DoFHandlerType::active_cell_iterator>::const_iterator - it_cell = active_halo_layer.begin(); + typename DoFHandler::active_cell_iterator>:: + const_iterator it_cell = active_halo_layer.begin(); it_cell != active_halo_layer.end(); ++it_cell) { - const typename DoFHandlerType::active_cell_iterator &cell = - *it_cell; + const typename DoFHandler::active_cell_iterator + &cell = *it_cell; Assert( cell->subdomain_id() != subdomain_id, ExcMessage( @@ -1547,17 +1531,16 @@ namespace DoFTools return dof_set; } - template + template void get_subdomain_association( - const DoFHandlerType & dof_handler, + const DoFHandler & dof_handler, std::vector &subdomain_association) { // if the Triangulation is distributed, the only thing we can usefully // ask is for its locally owned subdomain - Assert((dynamic_cast *>( + Assert((dynamic_cast< + const parallel::distributed::Triangulation *>( &dof_handler.get_triangulation()) == nullptr), ExcMessage( "For parallel::distributed::Triangulation objects and " @@ -1580,11 +1563,8 @@ namespace DoFTools // subdomain_id as stored in cell->subdomain_id(). std::vector cell_owners( dof_handler.get_triangulation().n_active_cells()); - if (const parallel::shared::Triangulation - *tr = (dynamic_cast *>( + if (const parallel::shared::Triangulation *tr = + (dynamic_cast *>( &dof_handler.get_triangulation()))) { cell_owners = tr->get_true_subdomain_ids_of_cells(); @@ -1594,7 +1574,7 @@ namespace DoFTools } else { - for (typename DoFHandlerType::active_cell_iterator cell = + for (typename DoFHandler::active_cell_iterator cell = dof_handler.begin_active(); cell != dof_handler.end(); cell++) @@ -1613,9 +1593,9 @@ namespace DoFTools // loop over all cells and record which subdomain a DoF belongs to. // give to the smaller subdomain_id in case it is on an interface - 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) { const types::subdomain_id subdomain_id = @@ -1647,10 +1627,11 @@ namespace DoFTools - template + template unsigned int - count_dofs_with_subdomain_association(const DoFHandlerType & dof_handler, - const types::subdomain_id subdomain) + count_dofs_with_subdomain_association( + const DoFHandler &dof_handler, + const types::subdomain_id subdomain) { std::vector subdomain_association( dof_handler.n_dofs()); @@ -1663,10 +1644,11 @@ namespace DoFTools - template + template IndexSet - dof_indices_with_subdomain_association(const DoFHandlerType & dof_handler, - const types::subdomain_id subdomain) + dof_indices_with_subdomain_association( + const DoFHandler &dof_handler, + const types::subdomain_id subdomain) { // If we have a distributed::Triangulation only allow locally_owned // subdomain. @@ -1692,9 +1674,9 @@ namespace DoFTools // more expensive than a vector std::vector subdomain_indices; - 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) if ((cell->is_artificial() == false) && (cell->subdomain_id() == subdomain)) @@ -1721,12 +1703,12 @@ namespace DoFTools - template + template void count_dofs_with_subdomain_association( - const DoFHandlerType & dof_handler, - const types::subdomain_id subdomain, - std::vector &n_dofs_on_subdomain) + const DoFHandler &dof_handler, + const types::subdomain_id subdomain, + std::vector & n_dofs_on_subdomain) { Assert(n_dofs_on_subdomain.size() == dof_handler.get_fe(0).n_components(), ExcDimensionMismatch(n_dofs_on_subdomain.size(), @@ -1736,8 +1718,10 @@ namespace DoFTools // Make sure there are at least some cells with this subdomain id Assert(std::any_of( dof_handler.begin_active(), - typename DoFHandlerType::active_cell_iterator{dof_handler.end()}, - [subdomain](const typename DoFHandlerType::cell_accessor &cell) { + typename DoFHandler::active_cell_iterator{ + dof_handler.end()}, + [subdomain]( + const typename DoFHandler::cell_accessor &cell) { return cell.subdomain_id() == subdomain; }), ExcMessage("There are no cells for the given subdomain!")); @@ -1891,10 +1875,10 @@ namespace DoFTools // deprecated function - template + template void count_dofs_per_component( - const DoFHandlerType & dof_handler, + const DoFHandler & dof_handler, std::vector &dofs_per_component, const bool only_once, const std::vector & target_component) @@ -1905,10 +1889,10 @@ namespace DoFTools - template + template std::vector count_dofs_per_fe_component( - const DoFHandlerType & dof_handler, + const DoFHandler &dof_handler, const bool only_once, const std::vector &target_component_) { @@ -1974,8 +1958,6 @@ namespace DoFTools // reduce information from all CPUs #ifdef DEAL_II_WITH_MPI - const unsigned int dim = DoFHandlerType::dimension; - const unsigned int spacedim = DoFHandlerType::space_dimension; if (const parallel::TriangulationBase *tria = (dynamic_cast *>( @@ -2000,9 +1982,9 @@ namespace DoFTools // deprecated function - template + template void - count_dofs_per_block(const DoFHandlerType & dof_handler, + count_dofs_per_block(const DoFHandler & dof_handler, std::vector &dofs_per_block, const std::vector & target_block) { @@ -2011,14 +1993,13 @@ namespace DoFTools - template + template std::vector - count_dofs_per_fe_block(const DoFHandlerType & dof_handler, + count_dofs_per_fe_block(const DoFHandler &dof_handler, const std::vector &target_block_) { - const dealii::hp::FECollection - &fe_collection = dof_handler.get_fe_collection(); + const dealii::hp::FECollection &fe_collection = + dof_handler.get_fe_collection(); Assert(fe_collection.size() < 256, ExcNotImplemented()); // If the empty vector for target_block(e.g., as default argument), then @@ -2065,9 +2046,7 @@ namespace DoFTools this_fe < fe_collection.size(); ++this_fe) { - const FiniteElement &fe = - fe_collection[this_fe]; + const FiniteElement &fe = fe_collection[this_fe]; std::vector dofs_by_block( dof_handler.n_locally_owned_dofs()); @@ -2081,11 +2060,8 @@ namespace DoFTools #ifdef DEAL_II_WITH_MPI // if we are working on a parallel mesh, we now need to collect // this information from all processors - if (const parallel::TriangulationBase - *tria = (dynamic_cast *>( + if (const parallel::TriangulationBase *tria = + (dynamic_cast *>( &dof_handler.get_triangulation()))) { std::vector local_dof_count = @@ -2106,9 +2082,9 @@ namespace DoFTools - template + template void - map_dof_to_boundary_indices(const DoFHandlerType & dof_handler, + map_dof_to_boundary_indices(const DoFHandler & dof_handler, std::vector &mapping) { mapping.clear(); @@ -2126,12 +2102,11 @@ namespace DoFTools // do not support boundaries of dimension dim-2, and so every isolated // boundary line is also part of a boundary face which we will be // visiting sooner or later - 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) - for (const unsigned int f : - GeometryInfo::face_indices()) + for (const unsigned int f : GeometryInfo::face_indices()) if (cell->at_boundary(f)) { const unsigned int dofs_per_face = cell->get_fe().dofs_per_face; @@ -2148,9 +2123,9 @@ namespace DoFTools - template + template void - map_dof_to_boundary_indices(const DoFHandlerType & dof_handler, + map_dof_to_boundary_indices(const DoFHandler & dof_handler, const std::set &boundary_ids, std::vector &mapping) { @@ -2171,12 +2146,11 @@ namespace DoFTools dofs_on_face.reserve(dof_handler.get_fe_collection().max_dofs_per_face()); types::global_dof_index next_boundary_index = 0; - 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) - for (const unsigned int f : - GeometryInfo::face_indices()) + for (const unsigned int f : GeometryInfo::face_indices()) if (boundary_ids.find(cell->face(f)->boundary_id()) != boundary_ids.end()) { @@ -2197,19 +2171,14 @@ namespace DoFTools { namespace { - template + template void map_dofs_to_support_points( - const hp::MappingCollection &mapping, - const DoFHandlerType & dof_handler, - std::map> &support_points, - const ComponentMask & in_mask) + const hp::MappingCollection & mapping, + const DoFHandler & dof_handler, + std::map> &support_points, + const ComponentMask & in_mask) { - const unsigned int dim = DoFHandlerType::dimension; - const unsigned int spacedim = DoFHandlerType::space_dimension; - const hp::FECollection &fe_collection = dof_handler.get_fe_collection(); hp::QCollection q_coll_dummy; @@ -2237,13 +2206,13 @@ namespace DoFTools // // The weights of the quadrature rule have been set to invalid // values by the used constructor. - hp::FEValues hp_fe_values(mapping, + hp::FEValues hp_fe_values(mapping, fe_collection, q_coll_dummy, update_quadrature_points); - 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(); std::vector local_dof_indices; for (; cell != endc; ++cell) @@ -2272,19 +2241,16 @@ namespace DoFTools } - template + template void map_dofs_to_support_points( - const hp::MappingCollection &mapping, - const DoFHandlerType & dof_handler, - std::vector> &support_points, - const ComponentMask & mask) + const hp::MappingCollection &mapping, + const DoFHandler & dof_handler, + std::vector> & support_points, + const ComponentMask & mask) { // get the data in the form of the map as above - std::map> - x_support_points; + std::map> x_support_points; map_dofs_to_support_points(mapping, dof_handler, x_support_points, @@ -2538,17 +2504,18 @@ namespace DoFTools } - template + template void - make_single_patch(SparsityPattern & block_list, - const DoFHandlerType &dof_handler, - const unsigned int level, - const bool interior_only) + make_single_patch(SparsityPattern & block_list, + const DoFHandler &dof_handler, + const unsigned int level, + const bool interior_only) { - const FiniteElement &fe = dof_handler.get_fe(); + const FiniteElement &fe = dof_handler.get_fe(); block_list.reinit(1, dof_handler.n_dofs(level), dof_handler.n_dofs(level)); - typename DoFHandlerType::level_cell_iterator cell; - typename DoFHandlerType::level_cell_iterator endc = dof_handler.end(level); + typename DoFHandler::level_cell_iterator cell; + typename DoFHandler::level_cell_iterator endc = + dof_handler.end(level); std::vector indices; std::vector exclude; @@ -2565,8 +2532,7 @@ namespace DoFTools std::fill(exclude.begin(), exclude.end(), false); const unsigned int dpf = fe.dofs_per_face; - for (const unsigned int face : - GeometryInfo::face_indices()) + for (const unsigned int face : GeometryInfo::face_indices()) if (cell->at_boundary(face) || cell->neighbor(face)->level() != cell->level()) for (unsigned int i = 0; i < dpf; ++i) @@ -2584,20 +2550,20 @@ namespace DoFTools } - template + template void - make_child_patches(SparsityPattern & block_list, - const DoFHandlerType &dof_handler, - const unsigned int level, - const bool interior_dofs_only, - const bool boundary_dofs) + make_child_patches(SparsityPattern & block_list, + const DoFHandler &dof_handler, + const unsigned int level, + const bool interior_dofs_only, + const bool boundary_dofs) { Assert(level > 0 && level < dof_handler.get_triangulation().n_levels(), ExcIndexRange(level, 1, dof_handler.get_triangulation().n_levels())); - typename DoFHandlerType::level_cell_iterator pcell = + typename DoFHandler::level_cell_iterator pcell = dof_handler.begin(level - 1); - typename DoFHandlerType::level_cell_iterator endc = + typename DoFHandler::level_cell_iterator endc = dof_handler.end(level - 1); std::vector indices; @@ -2610,13 +2576,12 @@ namespace DoFTools for (unsigned int child = 0; child < pcell->n_children(); ++child) { - const typename DoFHandlerType::level_cell_iterator cell = + const typename DoFHandler::level_cell_iterator cell = pcell->child(child); // For hp, only this line here would have to be replaced. - const FiniteElement &fe = - dof_handler.get_fe(); - const unsigned int n_dofs = fe.dofs_per_cell; + const FiniteElement &fe = dof_handler.get_fe(); + const unsigned int n_dofs = fe.dofs_per_cell; indices.resize(n_dofs); exclude.resize(n_dofs); std::fill(exclude.begin(), exclude.end(), false); @@ -2628,10 +2593,10 @@ namespace DoFTools // of the parent const unsigned int dpf = fe.dofs_per_face; - for (unsigned int d = 0; d < DoFHandlerType::dimension; ++d) + for (unsigned int d = 0; d < dim; ++d) { - const unsigned int face = GeometryInfo< - DoFHandlerType::dimension>::vertex_to_face[child][d]; + const unsigned int face = + GeometryInfo::vertex_to_face[child][d]; for (unsigned int i = 0; i < dpf; ++i) exclude[fe.face_to_cell_index(i, face)] = true; } @@ -2640,7 +2605,7 @@ namespace DoFTools // from the exclusion list if (boundary_dofs) for (const unsigned int face : - GeometryInfo::face_indices()) + GeometryInfo::face_indices()) if (cell->at_boundary(face)) for (unsigned int i = 0; i < dpf; ++i) exclude[fe.face_to_cell_index(i, face)] = false; @@ -2654,16 +2619,16 @@ namespace DoFTools } } - template + template std::vector - make_vertex_patches(SparsityPattern & block_list, - const DoFHandlerType &dof_handler, - const unsigned int level, - const bool interior_only, - const bool boundary_patches, - const bool level_boundary_patches, - const bool single_cell_patches, - const bool invert_vertex_mapping) + make_vertex_patches(SparsityPattern & block_list, + const DoFHandler &dof_handler, + const unsigned int level, + const bool interior_only, + const bool boundary_patches, + const bool level_boundary_patches, + const bool single_cell_patches, + const bool invert_vertex_mapping) { const unsigned int n_blocks = dof_handler.get_fe().n_blocks(); BlockMask exclude_boundary_dofs = BlockMask(n_blocks, interior_only); @@ -2677,19 +2642,20 @@ namespace DoFTools invert_vertex_mapping); } - template + template std::vector - make_vertex_patches(SparsityPattern & block_list, - const DoFHandlerType &dof_handler, - const unsigned int level, - const BlockMask & exclude_boundary_dofs, - const bool boundary_patches, - const bool level_boundary_patches, - const bool single_cell_patches, - const bool invert_vertex_mapping) + make_vertex_patches(SparsityPattern & block_list, + const DoFHandler &dof_handler, + const unsigned int level, + const BlockMask & exclude_boundary_dofs, + const bool boundary_patches, + const bool level_boundary_patches, + const bool single_cell_patches, + const bool invert_vertex_mapping) { - typename DoFHandlerType::level_cell_iterator cell; - typename DoFHandlerType::level_cell_iterator endc = dof_handler.end(level); + typename DoFHandler::level_cell_iterator cell; + typename DoFHandler::level_cell_iterator endc = + dof_handler.end(level); // Vector mapping from vertex index in the triangulation to consecutive // block indices on this level The number of cells at a vertex @@ -2711,16 +2677,14 @@ namespace DoFTools // Identify all vertices active on this level and remember some data // about them for (cell = dof_handler.begin(level); cell != endc; ++cell) - for (const unsigned int v : - GeometryInfo::vertex_indices()) + for (const unsigned int v : GeometryInfo::vertex_indices()) { const unsigned int vg = cell->vertex_index(v); vertex_dof_count[vg] += cell->get_fe().dofs_per_cell; ++vertex_cell_count[vg]; - for (unsigned int d = 0; d < DoFHandlerType::dimension; ++d) + for (unsigned int d = 0; d < dim; ++d) { - const unsigned int face = - GeometryInfo::vertex_to_face[v][d]; + const unsigned int face = GeometryInfo::vertex_to_face[v][d]; if (cell->at_boundary(face)) vertex_boundary[vg] = true; else if ((!level_boundary_patches) && @@ -2763,12 +2727,11 @@ namespace DoFTools for (cell = dof_handler.begin(level); cell != endc; ++cell) { - const FiniteElement &fe = cell->get_fe(); + const FiniteElement &fe = cell->get_fe(); indices.resize(fe.dofs_per_cell); cell->get_mg_dof_indices(indices); - for (const unsigned int v : - GeometryInfo::vertex_indices()) + for (const unsigned int v : GeometryInfo::vertex_indices()) { const unsigned int vg = cell->vertex_index(v); const unsigned int block = vertex_mapping[vg]; @@ -2786,12 +2749,12 @@ namespace DoFTools std::fill(exclude.begin(), exclude.end(), false); const unsigned int dpf = fe.dofs_per_face; - for (unsigned int d = 0; d < DoFHandlerType::dimension; ++d) + for (unsigned int d = 0; d < dim; ++d) { - const unsigned int a_face = GeometryInfo< - DoFHandlerType::dimension>::vertex_to_face[v][d]; - const unsigned int face = GeometryInfo< - DoFHandlerType::dimension>::opposite_face[a_face]; + const unsigned int a_face = + GeometryInfo::vertex_to_face[v][d]; + const unsigned int face = + GeometryInfo::opposite_face[a_face]; for (unsigned int i = 0; i < dpf; ++i) { // For each dof, get the block it is in and decide to @@ -2831,10 +2794,11 @@ namespace DoFTools } - template + template unsigned int count_dofs_on_patch( - const std::vector &patch) + const std::vector::active_cell_iterator> + &patch) { std::set dofs_on_patch; std::vector local_dof_indices; @@ -2844,7 +2808,8 @@ namespace DoFTools // all duplicates are ignored for (unsigned int i = 0; i < patch.size(); ++i) { - const typename DoFHandlerType::active_cell_iterator cell = patch[i]; + const typename DoFHandler::active_cell_iterator cell = + patch[i]; Assert(cell->is_artificial() == false, ExcMessage("This function can not be called with cells that are " "not either locally owned or ghost cells.")); @@ -2860,10 +2825,11 @@ namespace DoFTools - template + template std::vector get_dofs_on_patch( - const std::vector &patch) + const std::vector::active_cell_iterator> + &patch) { std::set dofs_on_patch; std::vector local_dof_indices; @@ -2873,7 +2839,8 @@ namespace DoFTools // all duplicates are ignored for (unsigned int i = 0; i < patch.size(); ++i) { - const typename DoFHandlerType::active_cell_iterator cell = patch[i]; + const typename DoFHandler::active_cell_iterator cell = + patch[i]; Assert(cell->is_artificial() == false, ExcMessage("This function can not be called with cells that are " "not either locally owned or ghost cells.")); @@ -2883,7 +2850,7 @@ namespace DoFTools local_dof_indices.end()); } - Assert(dofs_on_patch.size() == count_dofs_on_patch(patch), + Assert((dofs_on_patch.size() == count_dofs_on_patch(patch)), ExcInternalError()); // return a vector with the content of the set above. copying diff --git a/source/dofs/dof_tools.inst.in b/source/dofs/dof_tools.inst.in index eb588ed02d..49ec698e40 100644 --- a/source/dofs/dof_tools.inst.in +++ b/source/dofs/dof_tools.inst.in @@ -14,81 +14,73 @@ // --------------------------------------------------------------------- -for (DoFHandler : DOFHANDLER_TEMPLATES; - deal_II_dimension, deal_II_space_dimension : DIMENSIONS) +for (deal_II_dimension, deal_II_space_dimension : DIMENSIONS) { #if deal_II_dimension <= deal_II_space_dimension namespace DoFTools \{ template void - extract_locally_relevant_dofs< - DoFHandler>( + extract_locally_relevant_dofs( const DoFHandler & dof_handler, IndexSet &dof_set); template void - extract_locally_relevant_level_dofs< - DoFHandler>( + extract_locally_relevant_level_dofs( const DoFHandler & dof_handler, const unsigned int level, IndexSet & dof_set); template void - extract_locally_active_dofs< - DoFHandler>( + extract_locally_active_dofs( const DoFHandler & dof_handler, IndexSet &dof_set); template std::vector - locally_owned_dofs_per_component< - DoFHandler>( + locally_owned_dofs_per_component( const DoFHandler & dof_handler, const ComponentMask &components); // deprecated versions of the count_dofs_per_*() functions template void - count_dofs_per_component< - DoFHandler>( + count_dofs_per_component( const DoFHandler &, std::vector &, const bool, const std::vector &); template void - count_dofs_per_block< - DoFHandler>( + count_dofs_per_block( const DoFHandler &, std::vector &, const std::vector &); // new versions of the count_dofs_per_*() functions template std::vector - count_dofs_per_fe_component< - DoFHandler>( + count_dofs_per_fe_component( const DoFHandler &, const bool, const std::vector &); template std::vector - count_dofs_per_fe_block< - DoFHandler>( + count_dofs_per_fe_block( const DoFHandler &, const std::vector &); template unsigned int - count_dofs_on_patch< - DoFHandler>( + count_dofs_on_patch( const std::vector< DoFHandler::active_cell_iterator> &patch); template std::vector - get_dofs_on_patch>( + get_dofs_on_patch( const std::vector< DoFHandler::active_cell_iterator> &patch); @@ -96,13 +88,13 @@ for (DoFHandler : DOFHANDLER_TEMPLATES; // extract_dofs(): Deprecated versions that return information through // the last argument template void - extract_dofs>( + extract_dofs( const DoFHandler &, const ComponentMask &, std::vector &); template void - extract_dofs>( + extract_dofs( const DoFHandler &, const BlockMask &, std::vector &); @@ -110,12 +102,12 @@ for (DoFHandler : DOFHANDLER_TEMPLATES; // extract_dofs(): New versions that return information as an IndexSet template IndexSet - extract_dofs>( + extract_dofs( const DoFHandler &, const ComponentMask &); template IndexSet - extract_dofs>( + extract_dofs( const DoFHandler &, const BlockMask &); \} @@ -124,7 +116,7 @@ for (DoFHandler : DOFHANDLER_TEMPLATES; -for (DoFHandler : DOFHANDLER_TEMPLATES; deal_II_dimension : DIMENSIONS) +for (deal_II_dimension : DIMENSIONS) { template std::vector DoFTools::make_vertex_patches( SparsityPattern &, @@ -161,36 +153,39 @@ for (DoFHandler : DOFHANDLER_TEMPLATES; deal_II_dimension : DIMENSIONS) // TODO: can cleanup a bit more to fit into the scheme used above - template void - DoFTools::distribute_cell_to_dof_vector>( + template void DoFTools::distribute_cell_to_dof_vector( const DoFHandler &dof_handler, const Vector & cell_data, Vector & dof_data, const unsigned int component); - template void - DoFTools::distribute_cell_to_dof_vector>( + template void DoFTools::distribute_cell_to_dof_vector( const DoFHandler &dof_handler, const Vector & cell_data, Vector & dof_data, const unsigned int component); - template void DoFTools::extract_boundary_dofs< - DoFHandler>(const DoFHandler &, - const ComponentMask &, - std::vector &, - const std::set &); + template void + DoFTools::extract_boundary_dofs( + const DoFHandler &, + const ComponentMask &, + std::vector &, + const std::set &); - template void DoFTools::extract_boundary_dofs< - DoFHandler>(const DoFHandler &, - const ComponentMask &, - IndexSet &, - const std::set &); + template void + DoFTools::extract_boundary_dofs( + const DoFHandler &, + const ComponentMask &, + IndexSet &, + const std::set &); template void DoFTools::extract_dofs_with_support_on_boundary< - DoFHandler>(const DoFHandler &, - const ComponentMask &, - std::vector &, - const std::set &); + deal_II_dimension, + deal_II_dimension>(const DoFHandler &, + const ComponentMask &, + std::vector &, + const std::set &); template IndexSet DoFTools::extract_hanging_node_dofs( const DoFHandler &); @@ -198,149 +193,154 @@ for (DoFHandler : DOFHANDLER_TEMPLATES; deal_II_dimension : DIMENSIONS) template void DoFTools::extract_hanging_node_dofs( const DoFHandler &, std::vector &); - template void - DoFTools::extract_subdomain_dofs>( + template void DoFTools::extract_subdomain_dofs( const DoFHandler &dof_handler, const types::subdomain_id subdomain_id, std::vector & selected_dofs); - template void - DoFTools::extract_constant_modes>( + template void DoFTools::extract_constant_modes( const DoFHandler &dof_handler, const ComponentMask & selected_components, std::vector> & constant_modes); - template void - DoFTools::get_active_fe_indices>( + template void DoFTools::get_active_fe_indices( const DoFHandler &dof_handler, std::vector & active_fe_indices); - template void - DoFTools::get_subdomain_association>( + template void DoFTools::get_subdomain_association( const DoFHandler &dof_handler, std::vector & subdomain_association); template std::vector - DoFTools::locally_owned_dofs_per_subdomain>( + DoFTools::locally_owned_dofs_per_subdomain( const DoFHandler &dof_handler); - template std::vector DoFTools:: - locally_relevant_dofs_per_subdomain>( - const DoFHandler &dof_handler); + template std::vector + DoFTools::locally_relevant_dofs_per_subdomain( + const DoFHandler &dof_handler); - template unsigned int DoFTools::count_dofs_with_subdomain_association< - DoFHandler>(const DoFHandler &, - const types::subdomain_id); - template IndexSet DoFTools::dof_indices_with_subdomain_association< - DoFHandler>(const DoFHandler &, - const types::subdomain_id); + template unsigned int + DoFTools::count_dofs_with_subdomain_association( + const DoFHandler &, const types::subdomain_id); + template IndexSet + DoFTools::dof_indices_with_subdomain_association( + const DoFHandler &, const types::subdomain_id); template void DoFTools::count_dofs_with_subdomain_association< - DoFHandler>(const DoFHandler &, - const types::subdomain_id, - std::vector &); + deal_II_dimension, + deal_II_dimension>(const DoFHandler &, + const types::subdomain_id, + std::vector &); #if deal_II_dimension < 3 - template void DoFTools::extract_boundary_dofs< - DoFHandler>( + template void + DoFTools::extract_boundary_dofs( const DoFHandler &, const ComponentMask &, std::vector &, const std::set &); - template void DoFTools::extract_boundary_dofs< - DoFHandler>( + template void + DoFTools::extract_boundary_dofs( const DoFHandler &, const ComponentMask &, IndexSet &, const std::set &); - template unsigned int DoFTools::count_dofs_with_subdomain_association< - DoFHandler>( + template unsigned int + DoFTools::count_dofs_with_subdomain_association( const DoFHandler &, const types::subdomain_id); - template IndexSet DoFTools::dof_indices_with_subdomain_association< - DoFHandler>( + template IndexSet + DoFTools::dof_indices_with_subdomain_association( const DoFHandler &, const types::subdomain_id); - template void DoFTools::count_dofs_with_subdomain_association< - DoFHandler>( + template void + DoFTools::count_dofs_with_subdomain_association( const DoFHandler &, const types::subdomain_id, std::vector &); - template void DoFTools::get_subdomain_association< - DoFHandler>( + template void DoFTools::get_subdomain_association( const DoFHandler &dof_handler, std::vector &subdomain_association); - template std::vector DoFTools::locally_owned_dofs_per_subdomain< - DoFHandler>( + template std::vector + DoFTools::locally_owned_dofs_per_subdomain( const DoFHandler &dof_handler); template std::vector - DoFTools::locally_relevant_dofs_per_subdomain< - DoFHandler>( + DoFTools::locally_relevant_dofs_per_subdomain( const DoFHandler &dof_handler); #endif #if deal_II_dimension == 3 - template void DoFTools::extract_boundary_dofs>( + template void DoFTools::extract_boundary_dofs<1, 3>( const DoFHandler<1, 3> &, const ComponentMask &, std::vector &, const std::set &); - template void DoFTools::extract_boundary_dofs>( + template void DoFTools::extract_boundary_dofs<1, 3>( const DoFHandler<1, 3> &, const ComponentMask &, IndexSet &, const std::set &); - template void DoFTools::get_subdomain_association>( + template void DoFTools::get_subdomain_association<1, 3>( const DoFHandler<1, 3> & dof_handler, std::vector &subdomain_association); template std::vector - DoFTools::locally_owned_dofs_per_subdomain>( + DoFTools::locally_owned_dofs_per_subdomain<1, 3>( const DoFHandler<1, 3> &dof_handler); template std::vector - DoFTools::locally_relevant_dofs_per_subdomain>( + DoFTools::locally_relevant_dofs_per_subdomain<1, 3>( const DoFHandler<1, 3> &dof_handler); - template unsigned int DoFTools::count_dofs_with_subdomain_association< - DoFHandler<1, 3>>(const DoFHandler<1, 3> &, const types::subdomain_id); - template IndexSet DoFTools::dof_indices_with_subdomain_association< - DoFHandler<1, 3>>(const DoFHandler<1, 3> &, const types::subdomain_id); - template void DoFTools::count_dofs_with_subdomain_association< - DoFHandler<1, 3>>(const DoFHandler<1, 3> &, - const types::subdomain_id, - std::vector &); + template unsigned int DoFTools::count_dofs_with_subdomain_association<1, 3>( + const DoFHandler<1, 3> &, const types::subdomain_id); + template IndexSet DoFTools::dof_indices_with_subdomain_association<1, 3>( + const DoFHandler<1, 3> &, const types::subdomain_id); + template void DoFTools::count_dofs_with_subdomain_association<1, 3>( + const DoFHandler<1, 3> &, + const types::subdomain_id, + std::vector &); #endif - template void DoFTools::map_dof_to_boundary_indices< - DoFHandler>(const DoFHandler &, - const std::set &, - std::vector &); + template void + DoFTools::map_dof_to_boundary_indices( + const DoFHandler &, + const std::set &, + std::vector &); - template void DoFTools::map_dof_to_boundary_indices< - DoFHandler>(const DoFHandler &, - std::vector &); + template void + DoFTools::map_dof_to_boundary_indices( + const DoFHandler &, + std::vector &); #if deal_II_dimension < 3 - template void DoFTools::map_dof_to_boundary_indices< - DoFHandler>( + template void DoFTools::map_dof_to_boundary_indices( const DoFHandler &, const std::set &, std::vector &); - template void DoFTools::map_dof_to_boundary_indices< - DoFHandler>( + template void DoFTools::map_dof_to_boundary_indices( const DoFHandler &, std::vector &); @@ -355,12 +355,12 @@ for (DoFHandler : DOFHANDLER_TEMPLATES; deal_II_dimension : DIMENSIONS) #if deal_II_dimension == 3 - template void DoFTools::map_dof_to_boundary_indices>( + template void DoFTools::map_dof_to_boundary_indices<1, 3>( const DoFHandler<1, 3> &, const std::set &, std::vector &); - template void DoFTools::map_dof_to_boundary_indices>( + template void DoFTools::map_dof_to_boundary_indices<1, 3>( const DoFHandler<1, 3> &, std::vector &); template IndexSet DoFTools::extract_hanging_node_dofs( @@ -386,12 +386,12 @@ for (deal_II_dimension : DIMENSIONS) } -for (DoFHandler : DOFHANDLER_TEMPLATES; deal_II_dimension : DIMENSIONS; - S : REAL_AND_COMPLEX_SCALARS) +for (deal_II_dimension : DIMENSIONS; S : REAL_AND_COMPLEX_SCALARS) { - template IndexSet DoFTools::extract_dofs_with_support_contained_within< - DoFHandler, - S>( + template IndexSet + DoFTools::extract_dofs_with_support_contained_within( const DoFHandler &, const std::function::active_cell_iterator &)> @@ -439,24 +439,21 @@ for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : DIMENSIONS) } -for (DoFHandler : DOFHANDLER_TEMPLATES; deal_II_dimension : DIMENSIONS; - deal_II_space_dimension : DIMENSIONS) +for (deal_II_dimension : DIMENSIONS; deal_II_space_dimension : DIMENSIONS) { #if deal_II_dimension <= deal_II_space_dimension namespace DoFTools \{ // extract_level_dofs() for ComponentMask and BlockMask template void - extract_level_dofs< - DoFHandler>( + extract_level_dofs( const unsigned int level, const DoFHandler &, const ComponentMask &, std::vector &); template void - extract_level_dofs< - DoFHandler>( + extract_level_dofs( const unsigned int level, const DoFHandler &, const BlockMask &, diff --git a/source/dofs/dof_tools_constraints.cc b/source/dofs/dof_tools_constraints.cc index 72e63f0553..56a98a28b2 100644 --- a/source/dofs/dof_tools_constraints.cc +++ b/source/dofs/dof_tools_constraints.cc @@ -1704,10 +1704,10 @@ namespace DoFTools - template + template void - make_hanging_node_constraints(const DoFHandlerType & dof_handler, - AffineConstraints &constraints) + make_hanging_node_constraints(const DoFHandler &dof_handler, + AffineConstraints & constraints) { // Decide whether to use the new or old make_hanging_node_constraints // function. If all the FiniteElement or all elements in a FECollection @@ -1717,9 +1717,7 @@ namespace DoFTools internal::make_hp_hanging_node_constraints(dof_handler, constraints); else internal::make_oldstyle_hanging_node_constraints( - dof_handler, - constraints, - std::integral_constant()); + dof_handler, constraints, std::integral_constant()); } @@ -2417,21 +2415,20 @@ namespace DoFTools - template + template void make_periodicity_constraints( - const std::vector< - GridTools::PeriodicFacePair> - & periodic_faces, - AffineConstraints & constraints, - const ComponentMask & component_mask, + const std::vector::cell_iterator>> &periodic_faces, + AffineConstraints & constraints, + const ComponentMask & component_mask, const std::vector &first_vector_components, const number periodicity_factor) { // Loop over all periodic faces... for (auto &pair : periodic_faces) { - using FaceIterator = typename DoFHandlerType::face_iterator; + using FaceIterator = typename DoFHandler::face_iterator; const FaceIterator face_1 = pair.cell[0]->face(pair.face_idx[0]); const FaceIterator face_2 = pair.cell[1]->face(pair.face_idx[1]); @@ -2459,9 +2456,9 @@ namespace DoFTools // High level interface variants: - template + template void - make_periodicity_constraints(const DoFHandlerType & dof_handler, + make_periodicity_constraints(const DoFHandler & dof_handler, const types::boundary_id b_id1, const types::boundary_id b_id2, const unsigned int direction, @@ -2469,51 +2466,44 @@ namespace DoFTools const ComponentMask &component_mask, const number periodicity_factor) { - static const int spacedim = DoFHandlerType::space_dimension; - (void)spacedim; AssertIndexRange(direction, spacedim); Assert(b_id1 != b_id2, ExcMessage("The boundary indicators b_id1 and b_id2 must be " "different to denote different boundaries.")); - std::vector< - GridTools::PeriodicFacePair> + std::vector::cell_iterator>> matched_faces; // Collect matching periodic cells on the coarsest level: GridTools::collect_periodic_faces( dof_handler, b_id1, b_id2, direction, matched_faces); - make_periodicity_constraints(matched_faces, - constraints, - component_mask, - std::vector(), - periodicity_factor); + make_periodicity_constraints(matched_faces, + constraints, + component_mask, + std::vector(), + periodicity_factor); } - template + template void - make_periodicity_constraints(const DoFHandlerType & dof_handler, - const types::boundary_id b_id, - const unsigned int direction, - AffineConstraints &constraints, - const ComponentMask & component_mask, - const number periodicity_factor) + make_periodicity_constraints(const DoFHandler &dof_handler, + const types::boundary_id b_id, + const unsigned int direction, + AffineConstraints & constraints, + const ComponentMask & component_mask, + const number periodicity_factor) { - static const int dim = DoFHandlerType::dimension; - static const int spacedim = DoFHandlerType::space_dimension; - (void)dim; - (void)spacedim; - AssertIndexRange(direction, spacedim); Assert(dim == spacedim, ExcNotImplemented()); - std::vector< - GridTools::PeriodicFacePair> + std::vector::cell_iterator>> matched_faces; // Collect matching periodic cells on the coarsest level: @@ -2522,11 +2512,11 @@ namespace DoFTools direction, matched_faces); - make_periodicity_constraints(matched_faces, - constraints, - component_mask, - std::vector(), - periodicity_factor); + make_periodicity_constraints(matched_faces, + constraints, + component_mask, + std::vector(), + periodicity_factor); } @@ -3125,8 +3115,7 @@ namespace DoFTools mask[coarse_component] = true; coarse_dof_is_parameter = - extract_dofs>(coarse_grid, - ComponentMask(mask)); + extract_dofs(coarse_grid, ComponentMask(mask)); } // now we know that the weights in each row constitute a constraint. enter @@ -3344,16 +3333,13 @@ namespace DoFTools - template class DoFHandlerType, - typename number> + template void make_zero_boundary_constraints( - const DoFHandlerType &dof, - const types::boundary_id boundary_id, - AffineConstraints & zero_boundary_constraints, - const ComponentMask & component_mask) + const DoFHandler &dof, + const types::boundary_id boundary_id, + AffineConstraints & zero_boundary_constraints, + const ComponentMask & component_mask) { Assert(component_mask.represents_n_components(dof.get_fe(0).n_components()), ExcMessage("The number of components in the mask has to be either " @@ -3372,7 +3358,7 @@ namespace DoFTools std::vector cell_dofs; cell_dofs.reserve(dof.get_fe_collection().max_dofs_per_cell()); - typename DoFHandlerType::active_cell_iterator + typename DoFHandler::active_cell_iterator cell = dof.begin_active(), endc = dof.end(); for (; cell != endc; ++cell) @@ -3386,7 +3372,7 @@ namespace DoFTools for (const auto face_no : cell->face_indices()) { - const typename DoFHandlerType::face_iterator face = + const typename DoFHandler::face_iterator face = cell->face(face_no); // if face is on the boundary and satisfies the correct boundary @@ -3433,15 +3419,12 @@ namespace DoFTools - template class DoFHandlerType, - typename number> + template void make_zero_boundary_constraints( - const DoFHandlerType &dof, - AffineConstraints & zero_boundary_constraints, - const ComponentMask & component_mask) + const DoFHandler &dof, + AffineConstraints & zero_boundary_constraints, + const ComponentMask & component_mask) { make_zero_boundary_constraints(dof, numbers::invalid_boundary_id, diff --git a/source/dofs/dof_tools_constraints.inst.in b/source/dofs/dof_tools_constraints.inst.in index 1ada0c0d40..84bf7d227c 100644 --- a/source/dofs/dof_tools_constraints.inst.in +++ b/source/dofs/dof_tools_constraints.inst.in @@ -42,22 +42,24 @@ for (deal_II_dimension : DIMENSIONS) #endif } -for (DH : DOFHANDLER_TEMPLATES; deal_II_dimension : DIMENSIONS) +for (deal_II_dimension : DIMENSIONS) { - template void - DoFTools::make_periodicity_constraints, double>( - const std::vector< - GridTools::PeriodicFacePair::cell_iterator>> &, + template void DoFTools::make_periodicity_constraints( + const std::vector::cell_iterator>> &, AffineConstraints &, const ComponentMask &, const std::vector &, const double); #ifdef DEAL_II_WITH_COMPLEX_VALUES - template void DoFTools::make_periodicity_constraints, + template void DoFTools::make_periodicity_constraints>( - const std::vector< - GridTools::PeriodicFacePair::cell_iterator>> &, + const std::vector::cell_iterator>> &, AffineConstraints> &, const ComponentMask &, const std::vector &, @@ -65,7 +67,7 @@ for (DH : DOFHANDLER_TEMPLATES; deal_II_dimension : DIMENSIONS) #endif template void DoFTools::make_periodicity_constraints( - const DH &, + const DoFHandler &, const types::boundary_id, const types::boundary_id, const unsigned int, @@ -75,7 +77,7 @@ for (DH : DOFHANDLER_TEMPLATES; deal_II_dimension : DIMENSIONS) #ifdef DEAL_II_WITH_COMPLEX_VALUES template void DoFTools::make_periodicity_constraints( - const DH &, + const DoFHandler &, const types::boundary_id, const types::boundary_id, const unsigned int, @@ -85,7 +87,7 @@ for (DH : DOFHANDLER_TEMPLATES; deal_II_dimension : DIMENSIONS) #endif template void DoFTools::make_periodicity_constraints( - const DH &, + const DoFHandler &, const types::boundary_id, const unsigned int, AffineConstraints &, @@ -94,7 +96,7 @@ for (DH : DOFHANDLER_TEMPLATES; deal_II_dimension : DIMENSIONS) #ifdef DEAL_II_WITH_COMPLEX_VALUES template void DoFTools::make_periodicity_constraints( - const DH &, + const DoFHandler &, const types::boundary_id, const unsigned int, AffineConstraints> &, @@ -103,22 +105,22 @@ for (DH : DOFHANDLER_TEMPLATES; deal_II_dimension : DIMENSIONS) #endif } -for (DH : DOFHANDLER_TEMPLATES; deal_II_dimension : DIMENSIONS; +for (DoFHandler : DOFHANDLER_TEMPLATE; deal_II_dimension : DIMENSIONS; deal_II_space_dimension : SPACE_DIMENSIONS; S : REAL_AND_COMPLEX_SCALARS) { #if deal_II_dimension <= deal_II_space_dimension template void DoFTools::make_hanging_node_constraints( - const DH &, + const DoFHandler &, AffineConstraints &); template void DoFTools::make_zero_boundary_constraints( - const DH &, + const DoFHandler &, AffineConstraints &, const ComponentMask &); template void DoFTools::make_zero_boundary_constraints( - const DH &, + const DoFHandler &, const types::boundary_id, AffineConstraints &, const ComponentMask &); diff --git a/source/dofs/dof_tools_sparsity.cc b/source/dofs/dof_tools_sparsity.cc index 49cde87a33..a7b3bdcbbc 100644 --- a/source/dofs/dof_tools_sparsity.cc +++ b/source/dofs/dof_tools_sparsity.cc @@ -56,11 +56,12 @@ DEAL_II_NAMESPACE_OPEN namespace DoFTools { - template void - make_sparsity_pattern(const DoFHandlerType & dof, + make_sparsity_pattern(const DoFHandler &dof, SparsityPatternType & sparsity, const AffineConstraints &constraints, const bool keep_constrained_dofs, @@ -89,8 +90,9 @@ namespace DoFTools std::vector dofs_on_this_cell; dofs_on_this_cell.reserve(dof.get_fe_collection().max_dofs_per_cell()); - typename DoFHandlerType::active_cell_iterator cell = dof.begin_active(), - endc = dof.end(); + typename DoFHandler::active_cell_iterator + cell = dof.begin_active(), + endc = dof.end(); // In case we work with a distributed sparsity pattern of Trilinos // type, we only have to do the work if the current cell is owned by @@ -115,11 +117,12 @@ namespace DoFTools - template void - make_sparsity_pattern(const DoFHandlerType & dof, + make_sparsity_pattern(const DoFHandler &dof, const Table<2, Coupling> & couplings, SparsityPatternType & sparsity, const AffineConstraints &constraints, @@ -153,8 +156,7 @@ namespace DoFTools "associated DoF handler objects, asking for any subdomain other " "than the locally owned one does not make sense.")); - const hp::FECollection &fe_collection = + const hp::FECollection &fe_collection = dof.get_fe_collection(); const std::vector> dof_mask //(fe_collection.size()) @@ -177,8 +179,9 @@ namespace DoFTools std::vector dofs_on_this_cell( fe_collection.max_dofs_per_cell()); - typename DoFHandlerType::active_cell_iterator cell = dof.begin_active(), - endc = dof.end(); + typename DoFHandler::active_cell_iterator + cell = dof.begin_active(), + endc = dof.end(); // In case we work with a distributed sparsity pattern of Trilinos // type, we only have to do the work if the current cell is owned by @@ -208,11 +211,11 @@ namespace DoFTools - template + template void - make_sparsity_pattern(const DoFHandlerType &dof_row, - const DoFHandlerType &dof_col, - SparsityPatternType & sparsity) + make_sparsity_pattern(const DoFHandler &dof_row, + const DoFHandler &dof_col, + SparsityPatternType & sparsity) { const types::global_dof_index n_dofs_row = dof_row.n_dofs(); const types::global_dof_index n_dofs_col = dof_col.n_dofs(); @@ -229,8 +232,6 @@ namespace DoFTools // different processors) and unequal: no processor will be responsible for // assembling coupling terms between dofs on a cell owned by one processor // and dofs on a cell owned by a different processor. - constexpr int dim = DoFHandlerType::dimension; - constexpr int spacedim = DoFHandlerType::space_dimension; if (dynamic_cast *>( &dof_row.get_triangulation()) != nullptr || dynamic_cast *>( @@ -243,7 +244,7 @@ namespace DoFTools // TODO: Looks like wasteful memory management here - using cell_iterator = typename DoFHandlerType::cell_iterator; + using cell_iterator = typename DoFHandler::cell_iterator; std::list> cell_list = GridTools::get_finest_common_cells(dof_row, dof_col); @@ -297,13 +298,15 @@ namespace DoFTools } else if (cell_row->has_children()) { - const std::vector + const std::vector< + typename DoFHandler::active_cell_iterator> child_cells = - GridTools::get_active_child_cells(cell_row); + GridTools::get_active_child_cells>( + cell_row); for (unsigned int i = 0; i < child_cells.size(); i++) { - const typename DoFHandlerType::cell_iterator cell_row_child = - child_cells[i]; + const typename DoFHandler::cell_iterator + cell_row_child = child_cells[i]; const unsigned int dofs_per_cell_row = cell_row_child->get_fe().dofs_per_cell; const unsigned int dofs_per_cell_col = @@ -322,12 +325,14 @@ namespace DoFTools } else { - std::vector + std::vector< + typename DoFHandler::active_cell_iterator> child_cells = - GridTools::get_active_child_cells(cell_col); + GridTools::get_active_child_cells>( + cell_col); for (unsigned int i = 0; i < child_cells.size(); i++) { - const typename DoFHandlerType::active_cell_iterator + const typename DoFHandler::active_cell_iterator cell_col_child = child_cells[i]; const unsigned int dofs_per_cell_row = cell_row->get_fe().dofs_per_cell; @@ -350,23 +355,22 @@ namespace DoFTools - template + template void make_boundary_sparsity_pattern( - const DoFHandlerType & dof, + const DoFHandler & dof, const std::vector &dof_to_boundary_mapping, SparsityPatternType & sparsity) { - if (DoFHandlerType::dimension == 1) + if (dim == 1) { // there are only 2 boundary indicators in 1d, so it is no // performance problem to call the other function - std::map *> + std::map *> boundary_ids; boundary_ids[0] = nullptr; boundary_ids[1] = nullptr; - make_boundary_sparsity_pattern( + make_boundary_sparsity_pattern( dof, boundary_ids, dof_to_boundary_mapping, sparsity); return; } @@ -396,11 +400,11 @@ namespace DoFTools // @p{cell->has_boundary_lines}), since we do not support boundaries of // dimension dim-2, and so every boundary line is also part of a // boundary face. - typename DoFHandlerType::active_cell_iterator cell = dof.begin_active(), - endc = dof.end(); + typename DoFHandler::active_cell_iterator + cell = dof.begin_active(), + endc = dof.end(); for (; cell != endc; ++cell) - for (const unsigned int f : - GeometryInfo::face_indices()) + for (const unsigned int f : GeometryInfo::face_indices()) if (cell->at_boundary(f)) { const unsigned int dofs_per_face = cell->get_fe().dofs_per_face; @@ -418,19 +422,19 @@ namespace DoFTools - template void make_boundary_sparsity_pattern( - const DoFHandlerType &dof, - const std::map *> + const DoFHandler &dof, + const std::map *> & boundary_ids, const std::vector &dof_to_boundary_mapping, SparsityPatternType & sparsity) { - if (DoFHandlerType::dimension == 1) + if (dim == 1) { // first check left, then right boundary point for (unsigned int direction = 0; direction < 2; ++direction) @@ -441,7 +445,8 @@ namespace DoFTools // find active cell at that boundary: first go to left/right, // then to children - typename DoFHandlerType::level_cell_iterator cell = dof.begin(0); + typename DoFHandler::level_cell_iterator cell = + dof.begin(0); while (!cell->at_boundary(direction)) cell = cell->neighbor(direction); while (!cell->is_active()) @@ -470,7 +475,7 @@ namespace DoFTools AssertDimension(dof_to_boundary_mapping.size(), n_dofs); Assert(boundary_ids.find(numbers::internal_face_boundary_id) == boundary_ids.end(), - typename DoFHandlerType::ExcInvalidBoundaryIndicator()); + (typename DoFHandler::ExcInvalidBoundaryIndicator())); Assert(sparsity.n_rows() == dof.n_boundary_dofs(boundary_ids), ExcDimensionMismatch(sparsity.n_rows(), dof.n_boundary_dofs(boundary_ids))); @@ -490,11 +495,11 @@ namespace DoFTools std::vector dofs_on_this_face; dofs_on_this_face.reserve(dof.get_fe_collection().max_dofs_per_face()); - typename DoFHandlerType::active_cell_iterator cell = dof.begin_active(), - endc = dof.end(); + typename DoFHandler::active_cell_iterator + cell = dof.begin_active(), + endc = dof.end(); for (; cell != endc; ++cell) - for (const unsigned int f : - GeometryInfo::face_indices()) + for (const unsigned int f : GeometryInfo::face_indices()) if (boundary_ids.find(cell->face(f)->boundary_id()) != boundary_ids.end()) { @@ -513,11 +518,12 @@ namespace DoFTools - template void - make_flux_sparsity_pattern(const DoFHandlerType & dof, + make_flux_sparsity_pattern(const DoFHandler &dof, SparsityPatternType & sparsity, const AffineConstraints &constraints, const bool keep_constrained_dofs, @@ -549,8 +555,9 @@ namespace DoFTools std::vector dofs_on_other_cell; dofs_on_this_cell.reserve(dof.get_fe_collection().max_dofs_per_cell()); dofs_on_other_cell.reserve(dof.get_fe_collection().max_dofs_per_cell()); - typename DoFHandlerType::active_cell_iterator cell = dof.begin_active(), - endc = dof.end(); + typename DoFHandler::active_cell_iterator + cell = dof.begin_active(), + endc = dof.end(); // TODO: in an old implementation, we used user flags before to tag // faces that were already touched. this way, we could reduce the work @@ -576,22 +583,21 @@ namespace DoFTools sparsity, keep_constrained_dofs); - for (const unsigned int face : - GeometryInfo::face_indices()) + for (const unsigned int face : GeometryInfo::face_indices()) { - typename DoFHandlerType::face_iterator cell_face = + typename DoFHandler::face_iterator cell_face = cell->face(face); const bool periodic_neighbor = cell->has_periodic_neighbor(face); if (!cell->at_boundary(face) || periodic_neighbor) { - typename DoFHandlerType::level_cell_iterator neighbor = - cell->neighbor_or_periodic_neighbor(face); + typename DoFHandler::level_cell_iterator + neighbor = cell->neighbor_or_periodic_neighbor(face); // in 1d, we do not need to worry whether the neighbor // might have children and then loop over those children. // rather, we may as well go straight to the cell behind // this particular cell's most terminal child - if (DoFHandlerType::dimension == 1) + if (dim == 1) while (neighbor->has_children()) neighbor = neighbor->child(face == 0 ? 1 : 0); @@ -601,8 +607,8 @@ namespace DoFTools sub_nr != cell_face->number_of_children(); ++sub_nr) { - const typename DoFHandlerType::level_cell_iterator - sub_neighbor = + const typename DoFHandler:: + level_cell_iterator sub_neighbor = periodic_neighbor ? cell->periodic_neighbor_child_on_subface( face, sub_nr) : @@ -684,10 +690,10 @@ namespace DoFTools - template + template void - make_flux_sparsity_pattern(const DoFHandlerType &dof, - SparsityPatternType & sparsity) + make_flux_sparsity_pattern(const DoFHandler &dof, + SparsityPatternType & sparsity) { AffineConstraints dummy; make_flux_sparsity_pattern(dof, sparsity, dummy); @@ -1355,37 +1361,37 @@ namespace DoFTools - template + template void - make_flux_sparsity_pattern(const DoFHandlerType & dof, - SparsityPatternType & sparsity, - const Table<2, Coupling> &int_mask, - const Table<2, Coupling> &flux_mask, - const types::subdomain_id subdomain_id) + make_flux_sparsity_pattern(const DoFHandler &dof, + SparsityPatternType & sparsity, + const Table<2, Coupling> & int_mask, + const Table<2, Coupling> & flux_mask, + const types::subdomain_id subdomain_id) { AffineConstraints dummy; const bool keep_constrained_dofs = true; - make_flux_sparsity_pattern( - dof, - sparsity, - dummy, - keep_constrained_dofs, - int_mask, - flux_mask, - subdomain_id, - internal::always_couple_on_faces); + make_flux_sparsity_pattern(dof, + sparsity, + dummy, + keep_constrained_dofs, + int_mask, + flux_mask, + subdomain_id, + internal::always_couple_on_faces); } - template void make_flux_sparsity_pattern( - const DoFHandlerType & dof, + const DoFHandler &dof, SparsityPatternType & sparsity, const AffineConstraints &constraints, const bool keep_constrained_dofs, @@ -1393,7 +1399,7 @@ namespace DoFTools const Table<2, Coupling> & flux_mask, const types::subdomain_id subdomain_id, const std::function< - bool(const typename DoFHandlerType::active_cell_iterator &, + bool(const typename DoFHandler::active_cell_iterator &, const unsigned int)> &face_has_flux_coupling) { // do the error checking and frame code here, and then pass on to more diff --git a/source/dofs/dof_tools_sparsity.inst.in b/source/dofs/dof_tools_sparsity.inst.in index 7b73d8c401..235223deca 100644 --- a/source/dofs/dof_tools_sparsity.inst.in +++ b/source/dofs/dof_tools_sparsity.inst.in @@ -13,25 +13,26 @@ // // --------------------------------------------------------------------- -for (DoFHandler : DOFHANDLER_TEMPLATES; scalar : REAL_SCALARS; - SP : SPARSITY_PATTERNS; +for (scalar : REAL_SCALARS; SP : SPARSITY_PATTERNS; deal_II_dimension : DIMENSIONS) { - template void DoFTools:: - make_boundary_sparsity_pattern, SP, scalar>( - const DoFHandler &dof, - const std::map *> - & boundary_ids, - const std::vector &dof_to_boundary_mapping, - SP & sparsity); + template void DoFTools::make_boundary_sparsity_pattern( + const DoFHandler & dof, + const std::map *> &boundary_ids, + const std::vector &dof_to_boundary_mapping, + SP & sparsity); #if deal_II_dimension < 3 - template void DoFTools::make_boundary_sparsity_pattern< - DoFHandler, - SP, - scalar>( + template void + DoFTools::make_boundary_sparsity_pattern( const DoFHandler &dof, const std::map *> @@ -42,10 +43,11 @@ for (DoFHandler : DOFHANDLER_TEMPLATES; scalar : REAL_SCALARS; #endif #if deal_II_dimension == 1 - template void DoFTools::make_boundary_sparsity_pattern< - DoFHandler, - SP, - scalar>( + template void + DoFTools::make_boundary_sparsity_pattern( const DoFHandler &dof, const std::map *> @@ -55,24 +57,25 @@ for (DoFHandler : DOFHANDLER_TEMPLATES; scalar : REAL_SCALARS; #endif } -for (DoFHandler : DOFHANDLER_TEMPLATES; scalar : COMPLEX_SCALARS; - SP : SPARSITY_PATTERNS; +for (scalar : COMPLEX_SCALARS; SP : SPARSITY_PATTERNS; deal_II_dimension : DIMENSIONS) { - template void DoFTools:: - make_boundary_sparsity_pattern, SP, scalar>( - const DoFHandler &dof, - const std::map *> - & boundary_ids, - const std::vector &dof_to_boundary_mapping, - SP & sparsity); + template void DoFTools::make_boundary_sparsity_pattern( + const DoFHandler & dof, + const std::map *> &boundary_ids, + const std::vector &dof_to_boundary_mapping, + SP & sparsity); #if deal_II_dimension < 3 - template void DoFTools::make_boundary_sparsity_pattern< - DoFHandler, - SP, - scalar>( + template void + DoFTools::make_boundary_sparsity_pattern( const DoFHandler &dof, const std::map *> @@ -83,79 +86,78 @@ for (DoFHandler : DOFHANDLER_TEMPLATES; scalar : COMPLEX_SCALARS; #endif } -for (DoFHandler : DOFHANDLER_TEMPLATES; SP : SPARSITY_PATTERNS; - deal_II_dimension : DIMENSIONS; +for (SP : SPARSITY_PATTERNS; deal_II_dimension : DIMENSIONS; S : REAL_AND_COMPLEX_SCALARS) { - template void DoFTools::make_sparsity_pattern< - DoFHandler, - SP>(const DoFHandler &dof, - SP & sparsity, - const AffineConstraints &, - const bool, - const types::subdomain_id); - - template void DoFTools::make_sparsity_pattern< - DoFHandler, - SP>(const DoFHandler &, - const Table<2, Coupling> &, - SP &, - const AffineConstraints &, - const bool, - const types::subdomain_id); - template void - DoFTools::make_flux_sparsity_pattern, SP>( - const DoFHandler &dof, - SP & sparsity, + DoFTools::make_sparsity_pattern( + const DoFHandler &dof, + SP & sparsity, const AffineConstraints &, const bool, - const Table<2, Coupling> &, - const Table<2, Coupling> &, - const types::subdomain_id, - const std::function::active_cell_iterator &, - const unsigned int)> &); + const types::subdomain_id); template void - DoFTools::make_flux_sparsity_pattern, SP>( - const DoFHandler &dof, - SP & sparsity, + DoFTools::make_sparsity_pattern( + const DoFHandler &, + const Table<2, Coupling> &, + SP &, const AffineConstraints &, const bool, const types::subdomain_id); + template void DoFTools:: + make_flux_sparsity_pattern( + const DoFHandler &dof, + SP & sparsity, + const AffineConstraints &, + const bool, + const Table<2, Coupling> &, + const Table<2, Coupling> &, + const types::subdomain_id, + const std::function::active_cell_iterator &, + const unsigned int)> &); + + template void DoFTools:: + make_flux_sparsity_pattern( + const DoFHandler &dof, + SP & sparsity, + const AffineConstraints &, + const bool, + const types::subdomain_id); + #if deal_II_dimension < 3 - template void DoFTools::make_sparsity_pattern< - DoFHandler, - SP>(const DoFHandler &dof, - SP & sparsity, - const AffineConstraints &, - const bool, - const types::subdomain_id); - - template void DoFTools::make_sparsity_pattern< - DoFHandler, - SP>(const DoFHandler &, - const Table<2, Coupling> &, - SP &, - const AffineConstraints &, - const bool, - const types::subdomain_id); + template void DoFTools:: + make_sparsity_pattern( + const DoFHandler &dof, + SP & sparsity, + const AffineConstraints &, + const bool, + const types::subdomain_id); + + template void DoFTools:: + make_sparsity_pattern( + const DoFHandler &, + const Table<2, Coupling> &, + SP &, + const AffineConstraints &, + const bool, + const types::subdomain_id); #endif #if deal_II_dimension == 3 - template void DoFTools::make_sparsity_pattern, SP>( + template void DoFTools::make_sparsity_pattern<1, 3, SP>( const DoFHandler<1, 3> &dof, SP & sparsity, const AffineConstraints &, const bool, const types::subdomain_id); - template void DoFTools::make_sparsity_pattern, SP>( + template void DoFTools::make_sparsity_pattern<1, 3, SP>( const DoFHandler<1, 3> &, const Table<2, Coupling> &, SP &, @@ -166,56 +168,56 @@ for (DoFHandler : DOFHANDLER_TEMPLATES; SP : SPARSITY_PATTERNS; #endif } -for (DoFHandler : DOFHANDLER_TEMPLATES; SP : SPARSITY_PATTERNS; - deal_II_dimension : DIMENSIONS) +for (SP : SPARSITY_PATTERNS; deal_II_dimension : DIMENSIONS) { - template void DoFTools::make_sparsity_pattern< - DoFHandler, - SP>(const DoFHandler &dof_row, - const DoFHandler &dof_col, - SP & sparsity); - template void - DoFTools::make_boundary_sparsity_pattern, SP>( - const DoFHandler &dof, - const std::vector &, - SP &); + DoFTools::make_sparsity_pattern( + const DoFHandler &dof_row, + const DoFHandler &dof_col, + SP & sparsity); - template void - DoFTools::make_flux_sparsity_pattern, SP>( - const DoFHandler &dof, SP &sparsity); + template void DoFTools:: + make_boundary_sparsity_pattern( + const DoFHandler &dof, + const std::vector &, + SP &); - template void - DoFTools::make_flux_sparsity_pattern, SP>( - const DoFHandler &dof, - SP & sparsity, - const Table<2, Coupling> &, - const Table<2, Coupling> &, - const types::subdomain_id); + template void DoFTools:: + make_flux_sparsity_pattern( + const DoFHandler &dof, SP &sparsity); + + template void DoFTools:: + make_flux_sparsity_pattern( + const DoFHandler &dof, + SP & sparsity, + const Table<2, Coupling> &, + const Table<2, Coupling> &, + const types::subdomain_id); #if deal_II_dimension < 3 - template void DoFTools::make_flux_sparsity_pattern< - DoFHandler, - SP>(const DoFHandler &dof, - SP & sparsity); + template void DoFTools:: + make_flux_sparsity_pattern( + const DoFHandler &dof, + SP & sparsity); - template void DoFTools::make_flux_sparsity_pattern< - DoFHandler, - SP>(const DoFHandler &dof, - SP & sparsity, - const Table<2, Coupling> &, - const Table<2, Coupling> &, - const types::subdomain_id); + template void DoFTools:: + make_flux_sparsity_pattern( + const DoFHandler &dof, + SP & sparsity, + const Table<2, Coupling> &, + const Table<2, Coupling> &, + const types::subdomain_id); - template void DoFTools::make_sparsity_pattern< - DoFHandler, - SP>(const DoFHandler &dof_row, - const DoFHandler &dof_col, - SP & sparsity); + template void DoFTools:: + make_sparsity_pattern( + const DoFHandler &dof_row, + const DoFHandler &dof_col, + SP & sparsity); template void DoFTools::make_boundary_sparsity_pattern< - DoFHandler, + deal_II_dimension, + deal_II_dimension + 1, SP>(const DoFHandler &dof, const std::vector &, SP &); @@ -225,21 +227,20 @@ for (DoFHandler : DOFHANDLER_TEMPLATES; SP : SPARSITY_PATTERNS; #if deal_II_dimension == 3 - template void DoFTools::make_sparsity_pattern, SP>( + template void DoFTools::make_sparsity_pattern<1, 3, SP>( const DoFHandler<1, 3> &dof_row, const DoFHandler<1, 3> &dof_col, SP & sparsity); - template void - DoFTools::make_boundary_sparsity_pattern, SP>( + template void DoFTools::make_boundary_sparsity_pattern<1, 3, SP>( const DoFHandler<1, 3> &dof, const std::vector &, SP &); - template void DoFTools::make_flux_sparsity_pattern, SP>( + template void DoFTools::make_flux_sparsity_pattern<1, 3, SP>( const DoFHandler<1, 3> &dof, SP &sparsity); - template void DoFTools::make_flux_sparsity_pattern, SP>( + template void DoFTools::make_flux_sparsity_pattern<1, 3, SP>( const DoFHandler<1, 3> &dof, SP & sparsity, const Table<2, Coupling> &, diff --git a/source/multigrid/mg_tools.cc b/source/multigrid/mg_tools.cc index e519ef601b..e33c86e778 100644 --- a/source/multigrid/mg_tools.cc +++ b/source/multigrid/mg_tools.cc @@ -1105,7 +1105,7 @@ namespace MGTools const DoFHandler &, const ComponentMask &, std::vector &) = - &DoFTools::extract_level_dofs>; + &DoFTools::extract_level_dofs; std::vector tmp(n_components, false); tmp[i] = true; @@ -1216,7 +1216,8 @@ namespace MGTools const DoFHandlerType &, const BlockMask &, std::vector &) = - &DoFTools::extract_level_dofs; + &DoFTools::extract_level_dofs; std::vector tmp(n_blocks, false); tmp[i] = true; diff --git a/tests/hp/step-13.cc b/tests/hp/step-13.cc index 69f0e6ba5e..6397acbae7 100644 --- a/tests/hp/step-13.cc +++ b/tests/hp/step-13.cc @@ -443,7 +443,7 @@ namespace LaplaceSolver { hanging_node_constraints.clear(); - void (*mhnc_p)(const hp::DoFHandler &, AffineConstraints &) = + void (*mhnc_p)(const DoFHandler &, AffineConstraints &) = &DoFTools::make_hanging_node_constraints; Threads::Thread<> mhnc_thread = -- 2.39.5