From 471a4e01c2d64bd054b7bd0451320a99d94538b7 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Fri, 14 Jul 2023 22:12:48 -0600 Subject: [PATCH] Manually fix up some std::is_same<...> places. --- include/deal.II/base/array_view.h | 8 +- include/deal.II/base/hdf5.h | 12 +-- include/deal.II/base/mpi.templates.h | 16 ++-- include/deal.II/base/numbers.h | 12 +-- include/deal.II/base/partitioner.templates.h | 17 ++-- include/deal.II/base/vectorization.h | 6 +- .../differentiation/ad/sacado_number_types.h | 77 +++++++++---------- .../sd/symengine_tensor_operations.h | 13 ++-- include/deal.II/fe/fe_system.h | 6 +- include/deal.II/lac/affine_constraints.h | 4 +- .../lac/la_parallel_vector.templates.h | 3 +- include/deal.II/lac/linear_operator.h | 9 +-- include/deal.II/lac/precondition.h | 28 ++++--- include/deal.II/lac/solver_cg.h | 8 +- include/deal.II/lac/solver_gmres.h | 8 +- .../lac/trilinos_block_sparse_matrix.h | 4 +- .../deal.II/matrix_free/evaluation_kernels.h | 3 +- include/deal.II/matrix_free/tools.h | 8 +- source/dofs/dof_accessor_set.cc | 20 ++--- 19 files changed, 124 insertions(+), 138 deletions(-) diff --git a/include/deal.II/base/array_view.h b/include/deal.II/base/array_view.h index 84e23f18b0..61453aeb25 100644 --- a/include/deal.II/base/array_view.h +++ b/include/deal.II/base/array_view.h @@ -704,12 +704,12 @@ ArrayView::iterator_category, - typename std::random_access_iterator_tag>::value + std::is_same_v::iterator_category, + typename std::random_access_iterator_tag> #ifdef DEAL_II_HAVE_CXX20 || - std::is_same::iterator_category, - typename std::contiguous_iterator_tag>::value + std::is_same_v::iterator_category, + typename std::contiguous_iterator_tag> #endif , "The provided iterator needs to be a random access iterator."); diff --git a/include/deal.II/base/hdf5.h b/include/deal.II/base/hdf5.h index 1986d7459f..990f9e541f 100644 --- a/include/deal.II/base/hdf5.h +++ b/include/deal.II/base/hdf5.h @@ -1211,8 +1211,7 @@ namespace HDF5 */ template std::enable_if_t< - std::is_same>::value, + std::is_same_v>, Container> initialize_container(const std::vector &dimensions); @@ -1230,8 +1229,7 @@ namespace HDF5 */ template std::enable_if_t< - std::is_same>::value, + std::is_same_v>, Container> initialize_container(const std::vector &dimensions); @@ -1419,8 +1417,7 @@ namespace HDF5 template std::enable_if_t< - std::is_same>::value, + std::is_same_v>, Container> initialize_container(const std::vector &dimensions) { @@ -1444,8 +1441,7 @@ namespace HDF5 template std::enable_if_t< - std::is_same>::value, + std::is_same_v>, Container> initialize_container(const std::vector &dimensions) { diff --git a/include/deal.II/base/mpi.templates.h b/include/deal.II/base/mpi.templates.h index 64a93dd632..e38c42252e 100644 --- a/include/deal.II/base/mpi.templates.h +++ b/include/deal.II/base/mpi.templates.h @@ -157,8 +157,8 @@ namespace Utilities void sum(const T &values, const MPI_Comm mpi_communicator, U &sums) { - static_assert(std::is_same::type, - typename std::decay::type>::value, + static_assert(std::is_same_v::type, + typename std::decay::type>, "Input and output arguments must have the same type!"); const auto array_view_values = make_array_view(values); using const_type = @@ -272,8 +272,8 @@ namespace Utilities void max(const T &values, const MPI_Comm mpi_communicator, U &maxima) { - static_assert(std::is_same::type, - typename std::decay::type>::value, + static_assert(std::is_same_v::type, + typename std::decay::type>, "Input and output arguments must have the same type!"); const auto array_view_values = make_array_view(values); using const_type = @@ -314,8 +314,8 @@ namespace Utilities void min(const T &values, const MPI_Comm mpi_communicator, U &minima) { - static_assert(std::is_same::type, - typename std::decay::type>::value, + static_assert(std::is_same_v::type, + typename std::decay::type>, "Input and output arguments must have the same type!"); const auto array_view_values = make_array_view(values); using const_type = @@ -359,8 +359,8 @@ namespace Utilities void logical_or(const T &values, const MPI_Comm mpi_communicator, U &results) { - static_assert(std::is_same::type, - typename std::decay::type>::value, + static_assert(std::is_same_v::type, + typename std::decay::type>, "Input and output arguments must have the same type!"); static_assert(std::is_integral::value, diff --git a/include/deal.II/base/numbers.h b/include/deal.II/base/numbers.h index 3ee466495a..9378caa00c 100644 --- a/include/deal.II/base/numbers.h +++ b/include/deal.II/base/numbers.h @@ -715,8 +715,8 @@ namespace internal template static constexpr DEAL_II_HOST_DEVICE_ALWAYS_INLINE T value(const F &f, - std::enable_if_t::type, - typename std::decay::type>::value && + std::enable_if_t::type, + typename std::decay::type> && std::is_constructible::value> * = nullptr) { return T(f); @@ -726,8 +726,8 @@ namespace internal template static constexpr DEAL_II_HOST_DEVICE_ALWAYS_INLINE T value(const F &f, - std::enable_if_t::type, - typename std::decay::type>::value && + std::enable_if_t::type, + typename std::decay::type> && !std::is_constructible::value && is_explicitly_convertible::value> * = nullptr) @@ -743,8 +743,8 @@ namespace internal static T value( const F &f, - std::enable_if_t::type, - typename std::decay::type>::value && + std::enable_if_t::type, + typename std::decay::type> && !std::is_constructible::value && !is_explicitly_convertible::value && Differentiation::AD::is_ad_number::value> * = nullptr) diff --git a/include/deal.II/base/partitioner.templates.h b/include/deal.II/base/partitioner.templates.h index 43b04893fe..63bed49262 100644 --- a/include/deal.II/base/partitioner.templates.h +++ b/include/deal.II/base/partitioner.templates.h @@ -119,8 +119,7 @@ namespace Utilities for (unsigned int i = 0; i < n_import_targets; ++i) { # if defined(DEAL_II_MPI_WITH_DEVICE_SUPPORT) - if constexpr (std::is_same::value) + if constexpr (std::is_same_v) { const auto chunk_size = import_indices_plain_dev[i].size(); using IndexType = decltype(chunk_size); @@ -218,8 +217,8 @@ namespace Utilities { const unsigned int chunk_size = ghost_range.second - ghost_range.first; - if constexpr (std::is_same::value) + if constexpr (std::is_same_v) { // If source and destination are overlapping, we must be // careful to use an appropriate copy function. @@ -390,8 +389,8 @@ namespace Utilities if (ghost_array_ptr + offset != ghost_array.data() + my_ghosts->first) { - if constexpr (std::is_same::value) + if constexpr (std::is_same_v) { if (offset > my_ghosts->first) std::copy_backward(ghost_array.data() + @@ -596,8 +595,7 @@ namespace Utilities const Number *read_position = temporary_storage.data(); # if defined(DEAL_II_MPI_WITH_DEVICE_SUPPORT) - if constexpr (std::is_same::value) + if constexpr (std::is_same_v) { if (vector_operation == VectorOperation::add) { @@ -775,8 +773,7 @@ namespace Utilities Assert(ghost_array.begin() != nullptr, ExcInternalError()); # if defined(DEAL_II_MPI_WITH_DEVICE_SUPPORT) - if constexpr (std::is_same::value) + if constexpr (std::is_same_v) { Kokkos::deep_copy( Kokkos::View( diff --git a/include/deal.II/base/vectorization.h b/include/deal.II/base/vectorization.h index 8f3f2ed826..20059d4f88 100644 --- a/include/deal.II/base/vectorization.h +++ b/include/deal.II/base/vectorization.h @@ -780,9 +780,9 @@ inline DEAL_II_ALWAYS_INLINE VectorizedArrayType make_vectorized_array(const typename VectorizedArrayType::value_type &u) { static_assert( - std::is_same>::value, + std::is_same_v>, "VectorizedArrayType is not a VectorizedArray."); VectorizedArrayType result = u; diff --git a/include/deal.II/differentiation/ad/sacado_number_types.h b/include/deal.II/differentiation/ad/sacado_number_types.h index 1ddc22f0a7..bc12093491 100644 --- a/include/deal.II/differentiation/ad/sacado_number_types.h +++ b/include/deal.II/differentiation/ad/sacado_number_types.h @@ -143,9 +143,9 @@ namespace Differentiation template struct SacadoNumberInfo< SacadoNumber, - std::enable_if_t>::value>> + std::enable_if_t< + std::is_same_v>>> { using ad_type = SacadoNumber; using scalar_type = typename ad_type::scalar_type; @@ -163,9 +163,9 @@ namespace Differentiation template struct SacadoNumberInfo< SacadoNumber, - std::enable_if_t>::value>> + Sacado::Rad::ADvar>>> { using ad_type = SacadoNumber; using scalar_type = typename ad_type::ADVari::scalar_type; @@ -477,9 +477,9 @@ namespace Differentiation template struct ADNumberTraits< ADNumberType, - std::enable_if_t>::value>> + std::enable_if_t< + std::is_same_v>>> : NumberTraits {}; @@ -494,10 +494,10 @@ namespace Differentiation template struct ADNumberTraits< ADNumberType, - std::enable_if_t>>::value>> + std::enable_if_t< + std::is_same_v>>>> : NumberTraits< std::complex, NumberTypes::sacado_dfad> @@ -566,9 +566,9 @@ namespace Differentiation template struct ADNumberTraits< ADNumberType, - std::enable_if_t>::value>> + Sacado::Rad::ADvar>>> : NumberTraits {}; @@ -610,10 +610,10 @@ namespace Differentiation template struct ADNumberTraits< ADNumberType, - std::enable_if_t>>::value>> + typename ADNumberType::value_type::ADVari::scalar_type>>>>> : NumberTraits< std::complex, NumberTypes::sacado_rad> @@ -659,11 +659,11 @@ namespace Differentiation * a floating point type. */ template - struct ADNumberTraits>>::value>> + struct ADNumberTraits< + ADNumberType, + std::enable_if_t>>>> : NumberTraits {}; @@ -679,10 +679,10 @@ namespace Differentiation template struct ADNumberTraits< ADNumberType, - std::enable_if_t>>>::value>> + std::enable_if_t< + std::is_same_v>>>>> : NumberTraits< std::complex, NumberTypes::sacado_dfad_dfad> @@ -753,12 +753,11 @@ namespace Differentiation * a floating point type. */ template - struct ADNumberTraits< - ADNumberType, - std::enable_if_t< - std::is_same>>::value>> + struct ADNumberTraits>>>> : NumberTraits {}; @@ -803,10 +802,10 @@ namespace Differentiation template struct ADNumberTraits< ADNumberType, - std::enable_if_t>>>::value>> + typename ADNumberType::value_type::ADVari::scalar_type>>>>>> : NumberTraits< std::complex, NumberTypes::sacado_rad_dfad> @@ -861,9 +860,9 @@ namespace Differentiation template struct is_sacado_dfad_number< NumberType, - std::enable_if_t>::value>> + std::enable_if_t< + std::is_same_v>>> : std::true_type {}; @@ -883,9 +882,9 @@ namespace Differentiation struct is_sacado_rad_number< NumberType, std::enable_if_t< - std::is_same>>::value>> + std::is_same_v>>>> : std::true_type {}; diff --git a/include/deal.II/differentiation/sd/symengine_tensor_operations.h b/include/deal.II/differentiation/sd/symengine_tensor_operations.h index 0c1b18be56..7386fdd1c6 100644 --- a/include/deal.II/differentiation/sd/symengine_tensor_operations.h +++ b/include/deal.II/differentiation/sd/symengine_tensor_operations.h @@ -1020,18 +1020,19 @@ namespace Differentiation out[indices_out] *= 0.5; // TODO: Implement for SymmetricTensor<4,dim,...> - if (std::is_same, - SymmetricTensor<2, dim, ValueType>>:: - value) // Symmetric function + if (std::is_same_v< + TensorType_1, + SymmetricTensor<2, dim, ValueType>>) // Symmetric function { const TableIndices indices_out_t = concatenate_indices(transpose_indices(indices_i), indices_j); out[indices_out_t] = out[indices_out]; } - else if (std::is_same, - SymmetricTensor<2, dim, ValueType>>:: - value) // Symmetric operator + else if (std::is_same_v< + TensorType_2, + SymmetricTensor<2, dim, ValueType>>) // Symmetric + // operator { const TableIndices indices_out_t = concatenate_indices(indices_i, diff --git a/include/deal.II/fe/fe_system.h b/include/deal.II/fe/fe_system.h index 651f0a44cb..7b8be45ed6 100644 --- a/include/deal.II/fe/fe_system.h +++ b/include/deal.II/fe/fe_system.h @@ -537,9 +537,9 @@ public: template < class... FEPairs, typename = enable_if_all_t< - (std::is_same::type, - std::pair>, - unsigned int>>::value || + (std::is_same_v::type, + std::pair>, + unsigned int>> || std::is_base_of_v, typename std::decay::type>)...>> FESystem(FEPairs &&...fe_pairs); diff --git a/include/deal.II/lac/affine_constraints.h b/include/deal.II/lac/affine_constraints.h index 49c1b64259..e1882a8f83 100644 --- a/include/deal.II/lac/affine_constraints.h +++ b/include/deal.II/lac/affine_constraints.h @@ -2433,8 +2433,8 @@ namespace internal * types). */ static const bool value = - std::is_same())), - std::true_type>::value; + std::is_same_v())), + std::true_type>; }; // instantiation of the static member diff --git a/include/deal.II/lac/la_parallel_vector.templates.h b/include/deal.II/lac/la_parallel_vector.templates.h index 546a2536c5..4cf33eda3f 100644 --- a/include/deal.II/lac/la_parallel_vector.templates.h +++ b/include/deal.II/lac/la_parallel_vector.templates.h @@ -978,8 +978,7 @@ namespace LinearAlgebra if (partitioner->n_import_indices() > 0) { # if !defined(DEAL_II_MPI_WITH_DEVICE_SUPPORT) - if (std::is_same::value) + if (std::is_same_v) { if (import_data.values_host_buffer.size() == 0) Kokkos::resize(import_data.values_host_buffer, diff --git a/include/deal.II/lac/linear_operator.h b/include/deal.II/lac/linear_operator.h index 018c06b1be..1b15cdab58 100644 --- a/include/deal.II/lac/linear_operator.h +++ b/include/deal.II/lac/linear_operator.h @@ -1503,8 +1503,7 @@ template < typename = std::enable_if_t::value>, typename = std::enable_if_t< - !std::is_same>::value>> + !std::is_same_v>>> LinearOperator linear_operator(OperatorExemplar &&, const Matrix &) = delete; @@ -1518,8 +1517,7 @@ template < typename = std::enable_if_t::value>, typename = std::enable_if_t< - !std::is_same>::value>> + !std::is_same_v>>> LinearOperator linear_operator(OperatorExemplar &&, Matrix &&) = delete; @@ -1552,8 +1550,7 @@ template < typename = std::enable_if_t>, typename = std::enable_if_t< - !std::is_same>::value>> + !std::is_same_v>>> LinearOperator inverse_operator(const LinearOperator &, Solver &, diff --git a/include/deal.II/lac/precondition.h b/include/deal.II/lac/precondition.h index d95443b8b3..a0cb0f2eec 100644 --- a/include/deal.II/lac/precondition.h +++ b/include/deal.II/lac/precondition.h @@ -543,14 +543,13 @@ namespace internal typename PreconditionerType> constexpr bool has_vmult_with_std_functions = is_supported_operation && - std::is_same>::value && - (std::is_same>::value || - std::is_same< + std::is_same_v> && + (std::is_same_v> || + std::is_same_v< VectorType, LinearAlgebra::distributed::Vector>::value); + MemorySpace::Host>>); template @@ -3664,17 +3663,16 @@ PreconditionChebyshev:: // We do not need the second temporary vector in case we have a // DiagonalMatrix as preconditioner and use deal.II's own vectors using NumberType = typename VectorType::value_type; - if (std::is_same>::value == false || + if (std::is_same_v> == + false || (std::is_same_v> == false && - ((std::is_same>::value == + ((std::is_same_v< + VectorType, + LinearAlgebra::distributed::Vector> == false) || - (std::is_same>::value == - false)))) + (std::is_same_v> == false)))) temp_vector2.reinit(src, true); else { diff --git a/include/deal.II/lac/solver_cg.h b/include/deal.II/lac/solver_cg.h index 3d10be24cd..8099ffbbcf 100644 --- a/include/deal.II/lac/solver_cg.h +++ b/include/deal.II/lac/solver_cg.h @@ -705,10 +705,10 @@ namespace internal std::enable_if_t && (has_apply_to_subrange || has_apply)&&std:: - is_same>::value, + is_same_v>, int>> : public IterationWorkerBase { diff --git a/include/deal.II/lac/solver_gmres.h b/include/deal.II/lac/solver_gmres.h index 9c86964b5d..b842915b9f 100644 --- a/include/deal.II/lac/solver_gmres.h +++ b/include/deal.II/lac/solver_gmres.h @@ -736,10 +736,10 @@ namespace internal VectorType, typename std::enable_if>::type> { - static constexpr bool value = std::is_same< + static constexpr bool value = std::is_same_v< VectorType, LinearAlgebra::distributed::Vector>::value; + MemorySpace::Host>>; }; @@ -749,10 +749,10 @@ namespace internal VectorType, typename std::enable_if>::type> { - static constexpr bool value = std::is_same< + static constexpr bool value = std::is_same_v< typename VectorType::BlockType, LinearAlgebra::distributed::Vector>::value; + MemorySpace::Host>>; }; diff --git a/include/deal.II/lac/trilinos_block_sparse_matrix.h b/include/deal.II/lac/trilinos_block_sparse_matrix.h index bbae8efda9..7a367039fb 100644 --- a/include/deal.II/lac/trilinos_block_sparse_matrix.h +++ b/include/deal.II/lac/trilinos_block_sparse_matrix.h @@ -601,9 +601,9 @@ namespace TrilinosWrappers TrilinosBlockPayload(const Args &...) { static_assert( - std::is_same< + std::is_same_v< PayloadBlockType, - internal::LinearOperatorImplementation::TrilinosPayload>::value, + internal::LinearOperatorImplementation::TrilinosPayload>, "TrilinosBlockPayload can only accept a payload of type TrilinosPayload."); } }; diff --git a/include/deal.II/matrix_free/evaluation_kernels.h b/include/deal.II/matrix_free/evaluation_kernels.h index 1d10a6e1af..28a36ef5a1 100644 --- a/include/deal.II/matrix_free/evaluation_kernels.h +++ b/include/deal.II/matrix_free/evaluation_kernels.h @@ -2286,8 +2286,7 @@ namespace internal // `OtherNumber` is either `const Number` (evaluate()) or `Number` // (integrate()) static_assert( - std::is_same::type>::value, + std::is_same_v::type>, "Type of Number and of OtherNumber do not match."); const auto element_type = fe_eval.get_shape_info().element_type; diff --git a/include/deal.II/matrix_free/tools.h b/include/deal.II/matrix_free/tools.h index 0afcd0992b..54df1070c0 100644 --- a/include/deal.II/matrix_free/tools.h +++ b/include/deal.II/matrix_free/tools.h @@ -1112,11 +1112,11 @@ namespace MatrixFreeTools */ template ::type>::type, typename std::remove_const::type>::type>::value> * = nullptr> + Number>::type>::type>> * = nullptr> const AffineConstraints & create_new_affine_constraints_if_needed( const MatrixType &, @@ -1133,11 +1133,11 @@ namespace MatrixFreeTools */ template ::type>::type, typename std::remove_const::type>::type>::value> * = nullptr> + Number>::type>::type>> * = nullptr> const AffineConstraints & create_new_affine_constraints_if_needed( const MatrixType &, diff --git a/source/dofs/dof_accessor_set.cc b/source/dofs/dof_accessor_set.cc index 3ca8d4f04f..e4b80d21af 100644 --- a/source/dofs/dof_accessor_set.cc +++ b/source/dofs/dof_accessor_set.cc @@ -76,16 +76,16 @@ namespace internal */ template constexpr bool is_dealii_vector = - std::is_same>::value || - std::is_same>::value || - std::is_same>::value || - std::is_same>::value; + std::is_same_v> || + std::is_same_v> || + std::is_same_v> || + std::is_same_v>; /** * Helper functions that call set_ghost_state() if the vector supports this -- 2.39.5