From: Wolfgang Bangerth Date: Fri, 24 Jan 2020 22:53:09 +0000 (-0700) Subject: Avoid the use of deprecated functions in DoFTools. X-Git-Tag: v9.2.0-rc1~572^2~2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3704d5e8d5febd161e8888e98cfaef0f4577dc73;p=dealii.git Avoid the use of deprecated functions in DoFTools. --- diff --git a/include/deal.II/multigrid/mg_transfer_component.templates.h b/include/deal.II/multigrid/mg_transfer_component.templates.h index ca5aad0d72..bbac4b6e98 100644 --- a/include/deal.II/multigrid/mg_transfer_component.templates.h +++ b/include/deal.II/multigrid/mg_transfer_component.templates.h @@ -112,10 +112,8 @@ MGTransferSelect::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 dofs_per_block(n_blocks); - DoFTools::count_dofs_per_block(mg_dof_handler, - dofs_per_block, - target_component); + const std::vector dofs_per_block = + DoFTools::count_dofs_per_fe_block(mg_dof_handler, target_component); BlockVector tmp; tmp.reinit(n_blocks); for (unsigned int b = 0; b < n_blocks; ++b) diff --git a/source/dofs/block_info.cc b/source/dofs/block_info.cc index bed5853c97..8475491909 100644 --- a/source/dofs/block_info.cc +++ b/source/dofs/block_info.cc @@ -33,9 +33,8 @@ BlockInfo::initialize(const DoFHandler &dof, { if (!levels_only && dof.has_active_dofs()) { - const FiniteElement & fe = dof.get_fe(); - std::vector sizes(fe.n_blocks()); - DoFTools::count_dofs_per_block(dof, sizes); + const std::vector sizes = + DoFTools::count_dofs_per_fe_block(dof); bi_global.reinit(sizes); } diff --git a/source/dofs/dof_tools_constraints.cc b/source/dofs/dof_tools_constraints.cc index 4c85b91b3e..841278a274 100644 --- a/source/dofs/dof_tools_constraints.cc +++ b/source/dofs/dof_tools_constraints.cc @@ -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 coarse_dof_is_parameter(coarse_grid.n_dofs()); - if (true) - { - std::vector mask(coarse_grid.get_fe(0).n_components(), false); - mask[coarse_component] = true; + IndexSet coarse_dof_is_parameter; + { + std::vector mask(coarse_grid.get_fe(0).n_components(), false); + mask[coarse_component] = true; + + coarse_dof_is_parameter = extract_dofs>(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 diff --git a/source/multigrid/mg_transfer_block.cc b/source/multigrid/mg_transfer_block.cc index da99f90a95..c6fd4de1c7 100644 --- a/source/multigrid/mg_transfer_block.cc +++ b/source/multigrid/mg_transfer_block.cc @@ -256,9 +256,8 @@ MGTransferBlockBase::build(const DoFHandler &dof_handler) } } - block_start.resize(n_blocks); - DoFTools::count_dofs_per_block( - static_cast &>(dof_handler), block_start); + block_start = DoFTools::count_dofs_per_fe_block( + static_cast &>(dof_handler)); types::global_dof_index k = 0; for (types::global_dof_index &first_index : block_start) diff --git a/source/multigrid/mg_transfer_component.cc b/source/multigrid/mg_transfer_component.cc index 6bfe926ffd..5fabff84aa 100644 --- a/source/multigrid/mg_transfer_component.cc +++ b/source/multigrid/mg_transfer_component.cc @@ -348,9 +348,7 @@ MGTransferComponentBase::build(const DoFHandler &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)