Dealii: Compatibility issues with DoFTools::count_dofs_per_block()

Created on 27 Jan 2020  路  6Comments  路  Source: dealii/dealii

@masterleinad points out in https://github.com/dealii/dealii/pull/9435#issuecomment-578894957 that the deprecation and replacement of DoFTools::count_dofs_per_block() made in #9272 is problematic, and consequently leads to a test failure in #9435. Specifically, the old and new signatures are as follows:

  // NEW ****************
  template <typename DoFHandlerType>
  std::vector<types::global_dof_index>
  count_dofs_per_block(const DoFHandlerType &           dof,
                       const std::vector<unsigned int> &target_block =
                         std::vector<unsigned int>());

  // OLD ****************
  template <typename DoFHandlerType>
  DEAL_II_DEPRECATED void
  count_dofs_per_block(const DoFHandlerType &                dof,
                       std::vector<types::global_dof_index> &dofs_per_block,
                       const std::vector<unsigned int> &     target_block =
                         std::vector<unsigned int>());

The issue is that if one calls count_dofs_per_block (dof_handler, target_block) with 32-bit indices (where types::global_dof_index == unsigned int), then the call is ambiguous. We want the first of these two functions.

I see now other way than using a different name. I would suggest using count_dofs_per_fe_block() instead. What do others think?

(For consistency, I would then also rename count_dofs_per_component() to count_dofs_per_fe_component().)

Most helpful comment

compute_n_dofs_per_block sounds OK to me.

All 6 comments

made in #9272 is problematic

Yes, I was also confused about the error messages when updating a code using the old formulation last week.

I would suggest using count_dofs_per_fe_block() instead. What do others think?

n_dofs_per_block() or compute_n_dofs_per_block() would also work.

Have a preference for the name?

(I'll add that in most cases, the functions we have that start with n_ return something pre-computed. Not sure whether that's a fixed rule, but it seems to be a pattern.)

compute_n_dofs_per_block sounds OK to me.

Anyone else wants to chime in?

This was fixed by #9435.

Was this page helpful?
0 / 5 - 0 ratings