From: Martin Kronbichler Date: Fri, 3 Jun 2022 07:08:16 +0000 (+0200) Subject: Use self-documenting empty type: std::tuple<> X-Git-Tag: v9.4.0-rc1~59^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5e155c4004e5a331b0b59e500d030baf5170f05d;p=dealii.git Use self-documenting empty type: std::tuple<> --- diff --git a/include/deal.II/dofs/dof_accessor.templates.h b/include/deal.II/dofs/dof_accessor.templates.h index 66129d1792..05f1c156bf 100644 --- a/include/deal.II/dofs/dof_accessor.templates.h +++ b/include/deal.II/dofs/dof_accessor.templates.h @@ -493,7 +493,7 @@ namespace internal // The next few internal helper functions are needed to support various - // DoFIndicesType kinds, e.g. actual vectors of DoFIndices or dummy + // DoFIndicesType kinds, e.g. actual vectors of DoFIndices or empty // types that we use when we only want to work on the internally stored // DoFs and never extract any number. static unsigned int @@ -503,7 +503,7 @@ namespace internal } static unsigned int - get_array_length(const int &) + get_array_length(const std::tuple<> &) { return 0; } @@ -524,10 +524,10 @@ namespace internal return array[index]; } - static unsigned int - get_array_entry(const int &, const unsigned int) + static types::global_dof_index + get_array_entry(const std::tuple<> &, const unsigned int) { - return 0; + return numbers::invalid_dof_index; } @@ -1021,9 +1021,12 @@ namespace internal const auto &fe = accessor.get_fe(fe_index); - // we want to pass in rvalue 'int' types as `DoFIndicesType`, but we - // need non-const references for std::vector<> types, so get in a - // const reference here and immediately cast it away + // we want to pass in rvalue 'std::tuple<>' types as `DoFIndicesType`, + // but we need non-const references for std::vector<> types, so get in + // a const reference here and immediately cast the constness away - + // note that we prevent the use of the dereferenced invalid type, as + // we only return an rvalue `types::global_dof_index` into the lambda + // function DoFOperation that operates on it DoFIndicesType &dof_indices = const_cast(const_dof_indices); diff --git a/source/dofs/dof_handler_policy.cc b/source/dofs/dof_handler_policy.cc index c8ab7b57b2..91334cf40d 100644 --- a/source/dofs/dof_handler_policy.cc +++ b/source/dofs/dof_handler_policy.cc @@ -1763,12 +1763,12 @@ namespace internal ((subdomain_id == numbers::invalid_subdomain_id) || (cell->subdomain_id() == subdomain_id))) { - // need to create a dummy int reference to feed the - // process_dof_indices function for the case we do want want - // to retrieve any index + // feed the process_dof_indices function with an empty type + // `std::tuple<>`, as we do not want to retrieve any DoF + // indices here and rather modify the stored ones DoFAccessorImplementation::Implementation::process_dof_indices( *cell, - 0, + std::make_tuple(), cell->active_fe_index(), DoFAccessorImplementation::Implementation:: DoFIndexProcessor(), @@ -1868,7 +1868,7 @@ namespace internal { DoFAccessorImplementation::Implementation::process_dof_indices( *cell, - 0, + std::make_tuple(), 0, DoFAccessorImplementation::Implementation:: MGDoFIndexProcessor(level), @@ -4276,7 +4276,7 @@ namespace internal { DoFAccessorImplementation::Implementation::process_dof_indices( *cell, - 0, + std::make_tuple(), cell->active_fe_index(), DoFAccessorImplementation::Implementation:: DoFIndexProcessor(), @@ -4411,7 +4411,7 @@ namespace internal { DoFAccessorImplementation::Implementation::process_dof_indices( *cell, - 0, + std::make_tuple(), 0, DoFAccessorImplementation::Implementation:: MGDoFIndexProcessor(cell->level()),