]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Remove deprecated DoFTools::extract_boundary_dofs 15578/head
authorDaniel Arndt <arndtd@ornl.gov>
Sun, 2 Jul 2023 02:04:54 +0000 (22:04 -0400)
committerDaniel Arndt <arndtd@ornl.gov>
Sun, 2 Jul 2023 02:31:16 +0000 (22:31 -0400)
doc/news/changes/incompatibilities/20230702DanielArndt [new file with mode: 0644]
include/deal.II/dofs/dof_tools.h
source/dofs/dof_tools.cc
tests/bits/anna_4.cc
tests/bits/anna_6.cc
tests/bits/step-11.cc
tests/dofs/dof_tools_05.cc
tests/dofs/interpolate_boundary_values_01.cc
tests/hp/step-11.cc
tests/meshworker/step-11-mesh_loop.cc

diff --git a/doc/news/changes/incompatibilities/20230702DanielArndt b/doc/news/changes/incompatibilities/20230702DanielArndt
new file mode 100644 (file)
index 0000000..2a568c5
--- /dev/null
@@ -0,0 +1,4 @@
+Removed: The deprecated overloads for DoFTools::extract_boundary_dofs
+returning void have been removed.
+<br>
+(Daniel Arndt, 2023/07/02)
index 4b603120d1e1f3d96c19baf65cc328fd9334af49..e36b7043a786bf772ddc74dd0c6b7c75e56dd992 100644 (file)
@@ -1260,67 +1260,6 @@ namespace DoFTools
                      const BlockMask &                component_mask,
                      std::vector<bool> &              selected_dofs);
 
-  /**
-   * Extract all degrees of freedom which are at the boundary and belong to
-   * specified components of the solution. The function returns its results in
-   * the last non-default-valued parameter which contains @p true if a degree
-   * of freedom is at the boundary and belongs to one of the selected
-   * components, and @p false otherwise.
-   *
-   * By specifying the @p boundary_ids variable, you can select which boundary
-   * indicators the faces have to have on which the degrees of freedom are
-   * located that shall be extracted. If it is an empty list, then all
-   * boundary indicators are accepted.
-   *
-   * The size of @p component_mask (see
-   * @ref GlossComponentMask)
-   * shall equal the number of components in the finite element used by @p
-   * dof. The size of @p selected_dofs shall equal
-   * <tt>dof_handler.n_dofs()</tt>. Previous contents of this array are
-   * overwritten.
-   *
-   * Using the usual convention, if a shape function is non-zero in more than
-   * one component (i.e. it is non-primitive), then the element in the
-   * component mask is used that corresponds to the first non-zero components.
-   * Elements in the mask corresponding to later components are ignored.
-   *
-   * @deprecated This function will not work for DoFHandler objects that are built
-   * on a parallel::distributed::Triangulation object. The reasons is that the
-   * output argument @p selected_dofs has to have a length equal to <i>all</i>
-   * global degrees of freedom. Consequently, this does not scale to very
-   * large problems, and this is also why the function is deprecated. If you
-   * need the functionality of this function for
-   * parallel triangulations, then you need to use the other
-   * DoFTools::extract_boundary_dofs() function that returns its information
-   * via an IndexSet object.
-   *
-   * @param[in] dof_handler The object that describes which degrees of freedom
-   * live on which cell.
-   * @param[in] component_mask A mask denoting the vector components of the
-   * finite element that should be considered (see also
-   * @ref GlossComponentMask).
-   * @param[out] selected_dofs A vector of booleans that is returned and for
-   * which
-   * an element will be @p true if the corresponding index is a
-   * degree of freedom that is located on the
-   * boundary (and correspond to the selected vector components and boundary
-   * indicators, depending on the values of the @p component_mask and @p
-   * boundary_ids arguments).
-   * @param[in] boundary_ids If empty, this function extracts the indices of the
-   * degrees of freedom for all parts of the boundary. If it is a non- empty
-   * list, then the function only considers boundary faces with the boundary
-   * indicators listed in this argument.
-   *
-   * @see
-   * @ref GlossBoundaryIndicator "Glossary entry on boundary indicators"
-   */
-  template <int dim, int spacedim>
-  DEAL_II_DEPRECATED void
-  extract_boundary_dofs(const DoFHandler<dim, spacedim> &   dof_handler,
-                        const ComponentMask &               component_mask,
-                        std::vector<bool> &                 selected_dofs,
-                        const std::set<types::boundary_id> &boundary_ids = {});
-
   /**
    * Extract all degrees of freedom which are at the boundary and belong to
    * specified components of the solution. The function returns its results in
@@ -1369,19 +1308,6 @@ namespace DoFTools
                         const ComponentMask &component_mask = ComponentMask(),
                         const std::set<types::boundary_id> &boundary_ids = {});
 
-  /**
-   * The same as the previous function, except that it returns its information
-   * via the third argument.
-   *
-   * @deprecated Use the previous function instead.
-   */
-  template <int dim, int spacedim>
-  DEAL_II_DEPRECATED void
-  extract_boundary_dofs(const DoFHandler<dim, spacedim> &   dof_handler,
-                        const ComponentMask &               component_mask,
-                        IndexSet &                          selected_dofs,
-                        const std::set<types::boundary_id> &boundary_ids = {});
-
   /**
    * This function is similar to the extract_boundary_dofs() function but it
    * extracts those degrees of freedom whose shape functions are nonzero on at
index d460e6cd4fccca721751d33dc2cafc7c7a702894..bd2f44dae1b286776a423d7147a62c4d2048199d 100644 (file)
@@ -554,8 +554,8 @@ namespace DoFTools
              "This function can not be used with distributed triangulations. "
              "See the documentation for more information."));
 
-    IndexSet indices;
-    extract_boundary_dofs(dof_handler, component_mask, indices, boundary_ids);
+    IndexSet indices =
+      extract_boundary_dofs(dof_handler, component_mask, boundary_ids);
 
     // clear and reset array by default values
     selected_dofs.clear();
index 6fa2f1e416aa3d3f20c8536bc3f71ec145a799f0..78ec8bc811f69c777c2a1c70b6b251289eb74f9a 100644 (file)
@@ -189,15 +189,12 @@ FindBug<dim>::dirichlet_conditions()
                                            component_mask);
 
 
-  std::vector<bool>                  fixed_dofs(dof_handler.n_dofs());
   const std::set<types::boundary_id> boundary_ids = {0};
 
   // get a list of those boundary DoFs which
   // we want to be fixed:
-  DoFTools::extract_boundary_dofs(dof_handler,
-                                  component_mask,
-                                  fixed_dofs,
-                                  boundary_ids);
+  const IndexSet fixed_dofs =
+    DoFTools::extract_boundary_dofs(dof_handler, component_mask, boundary_ids);
 
   // (Primitive) Check if the DoFs
   // where adjusted correctly (note
@@ -207,7 +204,7 @@ FindBug<dim>::dirichlet_conditions()
   // component 0 by 0)
   for (unsigned int i = 0; i < dof_handler.n_dofs(); ++i)
     {
-      if (fixed_dofs[i] == true)
+      if (fixed_dofs.is_element(i))
         {
           AssertThrow(dirichlet_dofs[i] == 0, ExcInternalError());
         }
@@ -226,9 +223,8 @@ FindBug<dim>::dirichlet_conditions()
                                            VectorBoundaryValues<dim>(),
                                            dirichlet_dofs,
                                            component_mask);
-  for (unsigned int i = 0; i < dof_handler.n_dofs(); ++i)
-    if (fixed_dofs[i] == true)
-      deallog << i << ' ' << dirichlet_dofs[i] << std::endl;
+  for (const types::global_dof_index dof : fixed_dofs)
+    deallog << dof << ' ' << dirichlet_dofs[dof] << std::endl;
 }
 
 
index e4d1e2e336b01d9833e754d68497c9054e47763a..e6ba0617ecce3f4141f8420ffc904ac225e63c65 100644 (file)
@@ -180,16 +180,15 @@ ImposeBC<dim>::test_extract_boundary_DoFs()
   bc_component_select[1] = true;
   bc_component_select[2] = false;
 
-  std::vector<bool>                  ned_boundary_dofs(dof_handler.n_dofs());
   const std::set<types::boundary_id> boundary_ids = {0};
-  DoFTools::extract_boundary_dofs(dof_handler,
-                                  bc_component_select,
-                                  ned_boundary_dofs,
-                                  boundary_ids);
+  const IndexSet                     ned_boundary_dofs =
+    DoFTools::extract_boundary_dofs(dof_handler,
+                                    bc_component_select,
+                                    boundary_ids);
 
 
   for (unsigned int i = 0; i < dof_handler.n_dofs(); ++i)
-    if (ned_boundary_dofs[i] == true)
+    if (ned_boundary_dofs.is_element(i))
       boundary_values[i] = 0.;
 }
 
@@ -218,12 +217,11 @@ ImposeBC<dim>::test_interpolate_BC()
   // check
   // (the pressure is assumed to be set to 1
   // on the boundary)
-  std::vector<bool>                  p_boundary_dofs(dof_handler.n_dofs());
   const std::set<types::boundary_id> boundary_ids = {0};
-  DoFTools::extract_boundary_dofs(dof_handler,
-                                  bc_component_select,
-                                  p_boundary_dofs,
-                                  boundary_ids);
+  const IndexSet                     p_boundary_dofs =
+    DoFTools::extract_boundary_dofs(dof_handler,
+                                    bc_component_select,
+                                    boundary_ids);
   for (unsigned int i = 0; i < dof_handler.n_dofs(); ++i)
     {
       // error: pressure boundary DoF
@@ -235,8 +233,9 @@ ImposeBC<dim>::test_interpolate_BC()
       // nedelec boundary DoF i has
       // wrongly been set to some
       // value
-      AssertThrow((p_boundary_dofs[i] && boundary_values[i] == 1.) ||
-                    (!(p_boundary_dofs[i]) && boundary_values[i] != 1.),
+      AssertThrow((p_boundary_dofs.is_element(i) && boundary_values[i] == 1.) ||
+                    (!(p_boundary_dofs.is_element(i)) &&
+                     boundary_values[i] != 1.),
                   ExcInternalError());
 
       deallog << boundary_values[i] << ' ';
index 41bd948a1d5529ed097a5888cdd2e71bb1055cbd..452cb69e01d95f7e7dbd5f9f4194640362009217 100644 (file)
@@ -104,19 +104,15 @@ LaplaceProblem<dim>::setup_system()
   solution.reinit(dof_handler.n_dofs());
   system_rhs.reinit(dof_handler.n_dofs());
 
-  std::vector<bool> boundary_dofs(dof_handler.n_dofs(), false);
-  DoFTools::extract_boundary_dofs(dof_handler,
-                                  std::vector<bool>(1, true),
-                                  boundary_dofs);
+  const IndexSet boundary_dofs =
+    DoFTools::extract_boundary_dofs(dof_handler, std::vector<bool>(1, true));
 
-  const unsigned int first_boundary_dof =
-    std::distance(boundary_dofs.begin(),
-                  std::find(boundary_dofs.begin(), boundary_dofs.end(), true));
+  const unsigned int first_boundary_dof = *boundary_dofs.begin();
 
   mean_value_constraints.clear();
   mean_value_constraints.add_line(first_boundary_dof);
   for (unsigned int i = first_boundary_dof + 1; i < dof_handler.n_dofs(); ++i)
-    if (boundary_dofs[i] == true)
+    if (boundary_dofs.is_element(i))
       mean_value_constraints.add_entry(first_boundary_dof, i, -1);
   mean_value_constraints.close();
 
index 57222c0877e9865428157fbbe1d9e071053bc61c..3c65f295eb9a387bed4cb83959dcdfb4d3959872 100644 (file)
@@ -28,13 +28,12 @@ void
 check_this(const DoFHandler<dim> &dof_handler)
 {
   std::vector<bool> component_select(dof_handler.get_fe().n_components(), true);
-  std::vector<bool> boundary_dofs(dof_handler.n_dofs());
+  IndexSet          boundary_dofs(dof_handler.n_dofs());
 
   // first with all components
   {
-    DoFTools::extract_boundary_dofs(dof_handler,
-                                    component_select,
-                                    boundary_dofs);
+    boundary_dofs =
+      DoFTools::extract_boundary_dofs(dof_handler, component_select);
     output_bool_vector(boundary_dofs);
   }
 
@@ -43,9 +42,8 @@ check_this(const DoFHandler<dim> &dof_handler)
   for (unsigned int i = 1; i < component_select.size(); i += 2)
     component_select[i] = false;
   {
-    DoFTools::extract_boundary_dofs(dof_handler,
-                                    component_select,
-                                    boundary_dofs);
+    boundary_dofs =
+      DoFTools::extract_boundary_dofs(dof_handler, component_select);
     output_bool_vector(boundary_dofs);
   }
 
@@ -53,10 +51,9 @@ check_this(const DoFHandler<dim> &dof_handler)
   // boundary indicator 0
   {
     const std::set<types::boundary_id> boundary_ids = {0};
-    DoFTools::extract_boundary_dofs(dof_handler,
-                                    component_select,
-                                    boundary_dofs,
-                                    boundary_ids);
+    boundary_dofs = DoFTools::extract_boundary_dofs(dof_handler,
+                                                    component_select,
+                                                    boundary_ids);
     output_bool_vector(boundary_dofs);
   }
 }
index e6c1713cacef6af9b7bf8ae8448b4a9645b588fd..787e76f51f8091b69998482215a36c853a6b33fd 100644 (file)
@@ -151,15 +151,12 @@ FindBug<dim>::dirichlet_conditions()
                                            component_mask);
 
 
-  std::vector<bool>                  fixed_dofs(dof_handler.n_dofs());
   const std::set<types::boundary_id> boundary_ids = {0};
 
   // get a list of those boundary DoFs which
   // we want to be fixed:
-  DoFTools::extract_boundary_dofs(dof_handler,
-                                  component_mask,
-                                  fixed_dofs,
-                                  boundary_ids);
+  const IndexSet fixed_dofs =
+    DoFTools::extract_boundary_dofs(dof_handler, component_mask, boundary_ids);
 
   // (Primitive) Check if the DoFs
   // where adjusted correctly (note
@@ -169,7 +166,7 @@ FindBug<dim>::dirichlet_conditions()
   // component 0 by 0)
   for (unsigned int i = 0; i < dof_handler.n_dofs(); ++i)
     {
-      if (fixed_dofs[i] == true)
+      if (fixed_dofs.is_element(i))
         {
           AssertThrow(dirichlet_dofs[i] == 13, ExcInternalError());
         }
@@ -189,7 +186,7 @@ FindBug<dim>::dirichlet_conditions()
                                            dirichlet_dofs,
                                            component_mask);
   for (unsigned int i = 0; i < dof_handler.n_dofs(); ++i)
-    if (fixed_dofs[i] == true)
+    if (fixed_dofs.is_element(i))
       deallog << i << ' ' << dirichlet_dofs[i] << std::endl;
 }
 
index 0c05abe55d92eb06449988c8ec33802d90af8b14..849939f3f7e2750f3d3daa08b522e8434c1f854d 100644 (file)
@@ -107,19 +107,15 @@ LaplaceProblem<dim>::setup_system()
   solution.reinit(dof_handler.n_dofs());
   system_rhs.reinit(dof_handler.n_dofs());
 
-  std::vector<bool> boundary_dofs(dof_handler.n_dofs(), false);
-  DoFTools::extract_boundary_dofs(dof_handler,
-                                  std::vector<bool>(1, true),
-                                  boundary_dofs);
+  const IndexSet boundary_dofs =
+    DoFTools::extract_boundary_dofs(dof_handler, std::vector<bool>(1, true));
 
-  const unsigned int first_boundary_dof =
-    std::distance(boundary_dofs.begin(),
-                  std::find(boundary_dofs.begin(), boundary_dofs.end(), true));
+  const unsigned int first_boundary_dof = *boundary_dofs.begin();
 
   mean_value_constraints.clear();
   mean_value_constraints.add_line(first_boundary_dof);
   for (unsigned int i = first_boundary_dof + 1; i < dof_handler.n_dofs(); ++i)
-    if (boundary_dofs[i] == true)
+    if (boundary_dofs.is_element(i))
       mean_value_constraints.add_entry(first_boundary_dof, i, -1);
   mean_value_constraints.close();
 
index 43728af12fdae1cd7db3062f31d469c5d3d7275f..dc3d029981eecc5f33a12fcbc4cf051f2c8f5413 100644 (file)
@@ -140,14 +140,10 @@ namespace Step11
     solution.reinit(dof_handler.n_dofs());
     system_rhs.reinit(dof_handler.n_dofs());
 
-    std::vector<bool> boundary_dofs(dof_handler.n_dofs(), false);
-    DoFTools::extract_boundary_dofs(dof_handler,
-                                    ComponentMask(),
-                                    boundary_dofs);
+    const IndexSet boundary_dofs =
+      DoFTools::extract_boundary_dofs(dof_handler, ComponentMask());
 
-    const unsigned int first_boundary_dof = std::distance(
-      boundary_dofs.begin(),
-      std::find(boundary_dofs.begin(), boundary_dofs.end(), true));
+    const unsigned int first_boundary_dof = *boundary_dofs.begin();
 
     // Then generate a constraints object with just this one constraint. First
     // clear all previous content (which might reside there from the previous
@@ -160,7 +156,7 @@ namespace Step11
     DoFTools::make_hanging_node_constraints(dof_handler, constraints);
     constraints.add_line(first_boundary_dof);
     for (unsigned int i = first_boundary_dof + 1; i < dof_handler.n_dofs(); ++i)
-      if (boundary_dofs[i] == true)
+      if (boundary_dofs.is_element(i))
         constraints.add_entry(first_boundary_dof, i, -1);
     constraints.close();
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.