]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Avoid the use of deprecated functions in DoFTools.
authorWolfgang Bangerth <bangerth@colostate.edu>
Fri, 24 Jan 2020 22:53:09 +0000 (15:53 -0700)
committerWolfgang Bangerth <bangerth@colostate.edu>
Wed, 5 Feb 2020 00:25:25 +0000 (17:25 -0700)
include/deal.II/multigrid/mg_transfer_component.templates.h
source/dofs/block_info.cc
source/dofs/dof_tools_constraints.cc
source/multigrid/mg_transfer_block.cc
source/multigrid/mg_transfer_component.cc

index ca5aad0d722cfdc4d453ea5ff3b8708ccf3496ed..bbac4b6e981fbff91b23fdf889890f3bd257176d 100644 (file)
@@ -112,10 +112,8 @@ MGTransferSelect<number>::copy_from_mg(
       // the block back to dst.
       const unsigned int n_blocks =
         *std::max_element(target_component.begin(), target_component.end()) + 1;
-      std::vector<types::global_dof_index> dofs_per_block(n_blocks);
-      DoFTools::count_dofs_per_block(mg_dof_handler,
-                                     dofs_per_block,
-                                     target_component);
+      const std::vector<types::global_dof_index> dofs_per_block =
+        DoFTools::count_dofs_per_fe_block(mg_dof_handler, target_component);
       BlockVector<number> tmp;
       tmp.reinit(n_blocks);
       for (unsigned int b = 0; b < n_blocks; ++b)
index bed5853c97be9e342772a0192506c7b7c94aa3d8..8475491909bd9b392efaa88338de7c6b069d209e 100644 (file)
@@ -33,9 +33,8 @@ BlockInfo::initialize(const DoFHandler<dim, spacedim> &dof,
 {
   if (!levels_only && dof.has_active_dofs())
     {
-      const FiniteElement<dim, spacedim> & fe = dof.get_fe();
-      std::vector<types::global_dof_index> sizes(fe.n_blocks());
-      DoFTools::count_dofs_per_block(dof, sizes);
+      const std::vector<types::global_dof_index> sizes =
+        DoFTools::count_dofs_per_fe_block(dof);
       bi_global.reinit(sizes);
     }
 
index 4c85b91b3ed6a176ccf849a608b93a5ca3d5092c..841278a274f611f50bdc5fc2744a4cab1bfdf823 100644 (file)
@@ -3186,15 +3186,15 @@ namespace DoFTools
 
     // get an array in which we store which dof on the coarse grid is a
     // parameter and which is not
-    std::vector<bool> coarse_dof_is_parameter(coarse_grid.n_dofs());
-    if (true)
-      {
-        std::vector<bool> mask(coarse_grid.get_fe(0).n_components(), false);
-        mask[coarse_component] = true;
+    IndexSet coarse_dof_is_parameter;
+    {
+      std::vector<bool> mask(coarse_grid.get_fe(0).n_components(), false);
+      mask[coarse_component] = true;
+
+      coarse_dof_is_parameter =
         extract_dofs<DoFHandler<dim, spacedim>>(coarse_grid,
-                                                ComponentMask(mask),
-                                                coarse_dof_is_parameter);
-      }
+                                                ComponentMask(mask));
+    }
 
     // now we know that the weights in each row constitute a constraint. enter
     // this into the constraints object
@@ -3210,7 +3210,7 @@ namespace DoFTools
     for (types::global_dof_index parameter_dof = 0;
          parameter_dof < n_coarse_dofs;
          ++parameter_dof)
-      if (coarse_dof_is_parameter[parameter_dof] == true)
+      if (coarse_dof_is_parameter.is_element(parameter_dof))
         {
           // if this is the line of a parameter dof on the coarse grid, then it
           // should have at least one dependent node on the fine grid
index da99f90a95ab5bb93d5b2a2cf8ec8a2e320d3d51..c6fd4de1c7fa2b2b80b7771c98f4955741b2489e 100644 (file)
@@ -256,9 +256,8 @@ MGTransferBlockBase::build(const DoFHandler<dim, spacedim> &dof_handler)
         }
     }
 
-  block_start.resize(n_blocks);
-  DoFTools::count_dofs_per_block(
-    static_cast<const DoFHandler<dim, spacedim> &>(dof_handler), block_start);
+  block_start = DoFTools::count_dofs_per_fe_block(
+    static_cast<const DoFHandler<dim, spacedim> &>(dof_handler));
 
   types::global_dof_index k = 0;
   for (types::global_dof_index &first_index : block_start)
index 6bfe926ffd9b6e4e62f91693afc456ead66f55f5..5fabff84aa79441e0677d3f3496a9be0ff9d007e 100644 (file)
@@ -348,9 +348,7 @@ MGTransferComponentBase::build(const DoFHandler<dim, spacedim> &mg_dof)
         }
     }
 
-  component_start.resize(
-    *std::max_element(target_component.begin(), target_component.end()) + 1);
-  DoFTools::count_dofs_per_block(mg_dof, component_start, target_component);
+  component_start = DoFTools::count_dofs_per_fe_block(mg_dof, target_component);
 
   types::global_dof_index k = 0;
   for (types::global_dof_index &first_index : component_start)

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.