From: Martin Kronbichler Date: Sat, 17 Jul 2021 10:16:28 +0000 (+0200) Subject: Use faster process_dof_indices in one more place X-Git-Tag: v9.4.0-rc1~1138^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a957d002a5db46d9dbca7034b23b176dc9a9dede;p=dealii.git Use faster process_dof_indices in one more place --- diff --git a/source/dofs/dof_handler_policy.cc b/source/dofs/dof_handler_policy.cc index b3be8df833..6c511e1f66 100644 --- a/source/dofs/dof_handler_policy.cc +++ b/source/dofs/dof_handler_policy.cc @@ -3675,22 +3675,28 @@ namespace internal Assert(cell->is_ghost(), ExcInternalError()); - std::vector dof_indices( - cell->get_fe().n_dofs_per_cell()); - internal::DoFAccessorImplementation::Implementation:: - get_dof_indices(*cell, dof_indices, cell->active_fe_index()); - + // Use a combined read/set function on the entities of the dof + // indices to speed things up against get_dof_indices + + // set_dof_indices bool complete = true; - for (unsigned int i = 0; i < dof_indices.size(); ++i) - if (dofs[i] != numbers::invalid_dof_index) - { - Assert((dof_indices[i] == (numbers::invalid_dof_index)) || - (dof_indices[i] == dofs[i]), - ExcInternalError()); - dof_indices[i] = dofs[i]; - } - else - complete = false; + DoFAccessorImplementation::Implementation::process_dof_indices( + *cell, + dofs, + cell->active_fe_index(), + DoFAccessorImplementation::Implementation:: + DoFIndexProcessor(), + [&complete](auto &stored_index, auto &received_index) { + if (received_index != numbers::invalid_unsigned_int) + { + Assert((stored_index == (numbers::invalid_dof_index)) || + (stored_index == received_index), + ExcInternalError()); + stored_index = received_index; + } + else + complete = false; + }, + false); if (!complete) const_cast< @@ -3702,10 +3708,6 @@ namespace internal typename DoFHandler::active_cell_iterator &>( cell) ->clear_user_flag(); - - const_cast< - typename DoFHandler::active_cell_iterator &>(cell) - ->set_dof_indices(dof_indices); }; const auto filter = [](const auto &cell) {