From 141e3d1954c3989cc854d025c3e4dfdca09fa8e9 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Thu, 13 Jul 2023 11:24:08 -0600 Subject: [PATCH] Use std::is_same_v instead of std::is_same<...>::value. --- examples/step-67/step-67.cc | 4 +- examples/step-76/step-76.cc | 4 +- include/deal.II/base/aligned_vector.h | 2 +- include/deal.II/base/hdf5.h | 32 +++++----- include/deal.II/base/partitioner.templates.h | 10 +-- include/deal.II/base/patterns.h | 25 ++++---- include/deal.II/base/template_constraints.h | 4 +- include/deal.II/base/tensor.h | 8 +-- include/deal.II/base/utilities.h | 16 ++--- include/deal.II/base/vectorization.h | 2 +- .../differentiation/ad/ad_number_traits.h | 4 +- .../differentiation/ad/adolc_number_types.h | 17 +++--- .../differentiation/sd/symengine_math.h | 20 +++--- .../differentiation/sd/symengine_optimizer.h | 20 +++--- .../lac/affine_constraints.templates.h | 6 +- include/deal.II/lac/full_matrix.templates.h | 26 ++++---- include/deal.II/lac/la_parallel_vector.h | 12 ++-- .../lac/la_parallel_vector.templates.h | 22 +++---- include/deal.II/lac/linear_operator.h | 4 +- include/deal.II/lac/precondition.h | 16 ++--- include/deal.II/lac/read_write_vector.h | 6 +- .../deal.II/lac/read_write_vector.templates.h | 8 +-- include/deal.II/lac/solver_cg.h | 5 +- .../lac/sparse_decomposition.templates.h | 2 +- include/deal.II/lac/trilinos_sparse_matrix.h | 10 +-- .../deal.II/lac/vector_operations_internal.h | 16 ++--- .../matrix_free/cuda_matrix_free.templates.h | 4 +- .../deal.II/matrix_free/evaluation_kernels.h | 6 +- include/deal.II/matrix_free/fe_evaluation.h | 14 ++--- .../matrix_free/mapping_info.templates.h | 2 +- include/deal.II/matrix_free/matrix_free.h | 32 ++++------ include/deal.II/matrix_free/operators.h | 6 +- .../matrix_free/shape_info.templates.h | 4 +- include/deal.II/matrix_free/type_traits.h | 2 +- include/deal.II/multigrid/mg_coarse.h | 30 +++++---- .../deal.II/numerics/adaptation_strategies.h | 8 +-- include/deal.II/sundials/arkode.h | 9 ++- include/deal.II/sundials/ida.h | 9 ++- source/base/mpi.cc | 9 ++- .../differentiation/ad/adolc_number_types.cc | 2 +- source/lac/lapack_full_matrix.cc | 5 +- source/lac/trilinos_sparse_matrix.cc | 10 +-- source/matrix_free/dof_info.cc | 2 +- tests/base/functions_13.cc | 14 ++--- tests/base/hdf5_03.cc | 61 +++++++++---------- tests/base/hdf5_04.cc | 61 +++++++++---------- tests/base/hdf5_05.cc | 26 ++++---- tests/base/hdf5_06.cc | 26 ++++---- tests/base/ndarray.cc | 7 +-- tests/base/transpose_table_iterators_1.cc | 14 ++--- ...w_get_function_from_local_dof_values_01.cc | 12 ++-- tests/grid/filtered_iterator_08.cc | 2 +- tests/lac/gmres_eigenvalues.cc | 2 +- tests/lac/gmres_reorthogonalize_01.cc | 2 +- tests/lac/gmres_reorthogonalize_03.cc | 2 +- .../la_parallel_vector_add_and_dot_complex.cc | 2 +- tests/lac/sparse_matrices.cc | 2 +- tests/lac/vector_add_and_dot.cc | 2 +- tests/lac/vector_add_and_dot_complex.cc | 2 +- tests/matrix_free/dof_info_01.cc | 2 +- tests/matrix_free/dof_info_02.cc | 2 +- tests/matrix_free/get_functions_common.h | 4 +- tests/matrix_free/get_functions_multife.cc | 4 +- tests/matrix_free/get_functions_multife2.cc | 4 +- .../interpolate_functions_common.h | 2 +- .../matrix_free/matrix_vector_faces_common.h | 4 +- tests/matrix_free/parallel_multigrid.cc | 4 +- tests/matrix_free/parallel_multigrid_02.cc | 4 +- .../parallel_multigrid_adaptive_01.cc | 4 +- .../parallel_multigrid_adaptive_02.cc | 4 +- .../parallel_multigrid_adaptive_04.cc | 4 +- .../parallel_multigrid_adaptive_06.cc | 4 +- .../parallel_multigrid_adaptive_06ref.cc | 4 +- .../parallel_multigrid_adaptive_07.cc | 4 +- tests/matrix_free/point_evaluation_01.cc | 2 +- tests/matrix_free/point_evaluation_21.cc | 2 +- tests/matrix_free/point_evaluation_22.cc | 2 +- tests/matrix_free/point_evaluation_25.cc | 2 +- tests/matrix_free/thread_correctness.cc | 3 +- tests/matrix_free/thread_correctness_dg.cc | 4 +- tests/multithreading/work_stream_01b.cc | 2 +- tests/petsc/step-67-with-petsc-ts.cc | 2 +- tests/simplex/step-67.cc | 2 +- tests/tensors/project_orthogonal.cc | 4 +- tests/tensors/symmetric_tensor_46.cc | 2 +- 85 files changed, 361 insertions(+), 412 deletions(-) diff --git a/examples/step-67/step-67.cc b/examples/step-67/step-67.cc index fb127ff0bd..f2108ae9f4 100644 --- a/examples/step-67/step-67.cc +++ b/examples/step-67/step-67.cc @@ -2202,8 +2202,8 @@ namespace Euler_DG << Utilities::MPI::n_mpi_processes(MPI_COMM_WORLD) << " MPI processes" << std::endl; pcout << "Vectorization over " << n_vect_number << ' ' - << (std::is_same::value ? "doubles" : "floats") - << " = " << n_vect_bits << " bits (" + << (std::is_same_v ? "doubles" : "floats") << " = " + << n_vect_bits << " bits (" << Utilities::System::get_current_vectorization_level() << ')' << std::endl; } diff --git a/examples/step-76/step-76.cc b/examples/step-76/step-76.cc index c8d2763fc5..2eb53674f7 100644 --- a/examples/step-76/step-76.cc +++ b/examples/step-76/step-76.cc @@ -1521,8 +1521,8 @@ namespace Euler_DG << Utilities::MPI::n_mpi_processes(MPI_COMM_WORLD) << " MPI processes" << std::endl; pcout << "Vectorization over " << n_vect_number << ' ' - << (std::is_same::value ? "doubles" : "floats") - << " = " << n_vect_bits << " bits (" + << (std::is_same_v ? "doubles" : "floats") << " = " + << n_vect_bits << " bits (" << Utilities::System::get_current_vectorization_level() << ')' << std::endl; } diff --git a/include/deal.II/base/aligned_vector.h b/include/deal.II/base/aligned_vector.h index de0d6fdb26..04067ff708 100644 --- a/include/deal.II/base/aligned_vector.h +++ b/include/deal.II/base/aligned_vector.h @@ -890,7 +890,7 @@ namespace internal // completely fill its memory and may lead to false positives in // e.g. valgrind if (std::is_trivial::value == true && - std::is_same::value == false) + std::is_same_v == false) { const unsigned char zero[sizeof(T)] = {}; // cast element to (void*) to silence compiler warning for virtual diff --git a/include/deal.II/base/hdf5.h b/include/deal.II/base/hdf5.h index 9af59f410e..1986d7459f 100644 --- a/include/deal.II/base/hdf5.h +++ b/include/deal.II/base/hdf5.h @@ -1221,7 +1221,7 @@ namespace HDF5 */ template std::enable_if_t< - std::is_same>::value, + std::is_same_v>, Container> initialize_container(const std::vector &dimensions); @@ -1277,37 +1277,37 @@ namespace HDF5 std::shared_ptr get_hdf5_datatype() { - static_assert(std::is_same::value || - std::is_same::value || - std::is_same::value || - std::is_same::value || - std::is_same::value || - std::is_same>::value || - std::is_same>::value, + static_assert(std::is_same_v || + std::is_same_v || + std::is_same_v || + std::is_same_v || + std::is_same_v || + std::is_same_v> || + std::is_same_v>, "The data type you are trying to get the HDF5 tag for " "is not supported by this function."); - if (std::is_same::value) + if (std::is_same_v) { return std::make_shared(H5T_NATIVE_FLOAT); } - else if (std::is_same::value) + else if (std::is_same_v) { return std::make_shared(H5T_NATIVE_DOUBLE); } - else if (std::is_same::value) + else if (std::is_same_v) { return std::make_shared(H5T_NATIVE_INT); } - else if (std::is_same::value) + else if (std::is_same_v) { return std::make_shared(H5T_NATIVE_UINT); } - else if (std::is_same::value) + else if (std::is_same_v) { return std::make_shared(H5T_NATIVE_HBOOL); } - else if (std::is_same>::value) + else if (std::is_same_v>) { std::shared_ptr t_type = std::shared_ptr(new hid_t, [](hid_t *pointer) { @@ -1330,7 +1330,7 @@ namespace HDF5 (void)ret; return t_type; } - else if (std::is_same>::value) + else if (std::is_same_v>) { std::shared_ptr t_type = std::shared_ptr(new hid_t, [](hid_t *pointer) { @@ -1432,7 +1432,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/partitioner.templates.h b/include/deal.II/base/partitioner.templates.h index 1edc4b2b3a..43b04893fe 100644 --- a/include/deal.II/base/partitioner.templates.h +++ b/include/deal.II/base/partitioner.templates.h @@ -111,8 +111,8 @@ namespace Utilities // performance reasons as this can significantly decrease the number of // kernel launched. The indices are expanded the first time the function // is called. - if ((std::is_same::value) && - (import_indices_plain_dev.size() == 0)) + if ((std::is_same_v)&&( + import_indices_plain_dev.size() == 0)) initialize_import_indices_plain_dev(); # endif @@ -449,7 +449,7 @@ namespace Utilities ExcMessage("Index overflow: Maximum message size in MPI is 2GB. " "The number of ghost entries times the size of 'Number' " "exceeds this value. This is not supported.")); - if (std::is_same::value) + if (std::is_same_v) Kokkos::fence(); const int ierr = MPI_Isend(ghost_array_ptr, @@ -579,8 +579,8 @@ namespace Utilities // performance reasons as this can significantly decrease the number of // kernel launched. The indices are expanded the first time the function // is called. - if ((std::is_same::value) && - (import_indices_plain_dev.size() == 0)) + if ((std::is_same_v)&&( + import_indices_plain_dev.size() == 0)) initialize_import_indices_plain_dev(); # endif diff --git a/include/deal.II/base/patterns.h b/include/deal.II/base/patterns.h index 95e3026057..0bfcd2d347 100644 --- a/include/deal.II/base/patterns.h +++ b/include/deal.II/base/patterns.h @@ -1484,8 +1484,8 @@ namespace Patterns struct Convert::value>> { template - static std::enable_if_t::value && - std::is_same::value, + static std::enable_if_t && + std::is_same_v, std::unique_ptr> to_pattern() { @@ -1493,8 +1493,8 @@ namespace Patterns } template - static std::enable_if_t::value && - !std::is_same::value && + static std::enable_if_t && + !std::is_same_v && std::is_integral::value, std::unique_ptr> to_pattern() @@ -1504,8 +1504,8 @@ namespace Patterns } template - static std::enable_if_t::value && - !std::is_same::value && + static std::enable_if_t && + !std::is_same_v && std::is_floating_point::value, std::unique_ptr> to_pattern() @@ -1519,10 +1519,10 @@ namespace Patterns const Patterns::PatternBase &p = *Convert::to_pattern()) { std::stringstream str; - if (std::is_same::value || - std::is_same::value || std::is_same::value) + if (std::is_same_v || + std::is_same_v || std::is_same_v) str << static_cast(value); - else if (std::is_same::value) + else if (std::is_same_v) str << (static_cast(value) ? "true" : "false"); else str << value; @@ -1536,14 +1536,13 @@ namespace Patterns { AssertThrow(p.match(s), ExcNoMatch(s, p.description())); T value; - if (std::is_same::value) + if (std::is_same_v) value = (s == "true"); else { std::istringstream is(s); - if (std::is_same::value || - std::is_same::value || - std::is_same::value) + if (std::is_same_v || + std::is_same_v || std::is_same_v) { int i; is >> i; diff --git a/include/deal.II/base/template_constraints.h b/include/deal.II/base/template_constraints.h index 1856d0dfa4..f6395994c8 100644 --- a/include/deal.II/base/template_constraints.h +++ b/include/deal.II/base/template_constraints.h @@ -217,7 +217,7 @@ template struct all_same_as { static constexpr bool value = internal::TemplateConstraints::all_true< - std::is_same::value...>::value; + std::is_same_v...>::value; }; @@ -232,7 +232,7 @@ template struct is_same_as_any_of { static constexpr bool value = internal::TemplateConstraints::any_true< - std::is_same::value...>::value; + std::is_same_v...>::value; }; diff --git a/include/deal.II/base/tensor.h b/include/deal.II/base/tensor.h index df6bfc8762..ea7798e66f 100644 --- a/include/deal.II/base/tensor.h +++ b/include/deal.II/base/tensor.h @@ -1125,8 +1125,8 @@ constexpr inline bool Tensor<0, dim, Number>::operator==(const Tensor<0, dim, OtherNumber> &p) const { # ifdef DEAL_II_ADOLC_WITH_ADVANCED_BRANCHING - Assert(!(std::is_same::value || - std::is_same::value), + Assert(!(std::is_same_v || + std::is_same_v), ExcMessage( "The Tensor equality operator for ADOL-C taped numbers has not yet " "been extended to support advanced branching.")); @@ -1681,7 +1681,7 @@ namespace internal std::enable_if_t< !std::is_integral< typename ProductType::type>::value && - !std::is_same::value, + !std::is_same_v, int> = 0> constexpr DEAL_II_HOST_DEVICE inline DEAL_II_ALWAYS_INLINE void division_operator(Tensor (&t)[dim], @@ -1701,7 +1701,7 @@ namespace internal std::enable_if_t< std::is_integral< typename ProductType::type>::value || - std::is_same::value, + std::is_same_v, int> = 0> constexpr DEAL_II_HOST_DEVICE inline DEAL_II_ALWAYS_INLINE void division_operator(Tensor (&t)[dim], diff --git a/include/deal.II/base/utilities.h b/include/deal.II/base/utilities.h index 879fa0276e..b0f0317d51 100644 --- a/include/deal.II/base/utilities.h +++ b/include/deal.II/base/utilities.h @@ -1137,7 +1137,7 @@ namespace Utilities struct IsVectorOfTriviallyCopyable> { static constexpr bool value = - std::is_trivially_copyable::value && !std::is_same::value; + std::is_trivially_copyable::value && !std::is_same_v; }; @@ -1146,7 +1146,7 @@ namespace Utilities struct IsVectorOfTriviallyCopyable>> { static constexpr bool value = - std::is_trivially_copyable::value && !std::is_same::value; + std::is_trivially_copyable::value && !std::is_same_v; }; @@ -1171,7 +1171,7 @@ namespace Utilities template ::value && + typename = std::enable_if_t && std::is_trivially_copyable::value>> inline void append_vector_of_trivially_copyable_to_buffer( @@ -1201,7 +1201,7 @@ namespace Utilities template ::value && + typename = std::enable_if_t && std::is_trivially_copyable::value>> inline void append_vector_of_trivially_copyable_to_buffer( @@ -1261,7 +1261,7 @@ namespace Utilities template ::value && + typename = std::enable_if_t && std::is_trivially_copyable::value>> inline void create_vector_of_trivially_copyable_from_buffer( @@ -1296,7 +1296,7 @@ namespace Utilities template ::value && + typename = std::enable_if_t && std::is_trivially_copyable::value>> inline void create_vector_of_trivially_copyable_from_buffer( @@ -1366,7 +1366,7 @@ namespace Utilities // sizeof(...) because that is the minimum possible for objects -- // objects need to have distinct addresses, so they need to have a size // of at least one. But we can special case this situation. - size = (std::is_same>::value ? 0 : sizeof(T)); + size = (std::is_same_v> ? 0 : sizeof(T)); (void)allow_compression; const std::size_t previous_size = dest_buffer.size(); @@ -1450,7 +1450,7 @@ namespace Utilities // objects need to have distinct addresses, so they need to have a size // of at least one. But we can special case this situation. const std::size_t size = - (std::is_same>::value ? 0 : sizeof(T)); + (std::is_same_v> ? 0 : sizeof(T)); T object; diff --git a/include/deal.II/base/vectorization.h b/include/deal.II/base/vectorization.h index 7a069c6e39..8f3f2ed826 100644 --- a/include/deal.II/base/vectorization.h +++ b/include/deal.II/base/vectorization.h @@ -155,7 +155,7 @@ public: * current lane. */ template - std::enable_if_t::value, typename T::value_type> & + std::enable_if_t, typename T::value_type> & operator*() { AssertIndexRange(lane, T::size()); diff --git a/include/deal.II/differentiation/ad/ad_number_traits.h b/include/deal.II/differentiation/ad/ad_number_traits.h index c10e2bb1d8..d8cfe8c419 100644 --- a/include/deal.II/differentiation/ad/ad_number_traits.h +++ b/include/deal.II/differentiation/ad/ad_number_traits.h @@ -922,8 +922,8 @@ namespace Differentiation static_assert((is_real_valued == true ? - std::is_same::value : - std::is_same::value), + std::is_same_v : + std::is_same_v), "Incorrect template type selected for ad_type"); static_assert((is_complex_valued == true ? diff --git a/include/deal.II/differentiation/ad/adolc_number_types.h b/include/deal.II/differentiation/ad/adolc_number_types.h index c80230def3..c2f5e70c01 100644 --- a/include/deal.II/differentiation/ad/adolc_number_types.h +++ b/include/deal.II/differentiation/ad/adolc_number_types.h @@ -330,10 +330,10 @@ namespace Differentiation template struct ADNumberTraits< ADNumberType, - std::enable_if_t::value>> + std::enable_if_t>> : NumberTraits { - static_assert(std::is_same::value, + static_assert(std::is_same_v, "Incorrect template type selected for taped ad_type"); static_assert(is_taped == true, "Incorrect setting for taping"); }; @@ -352,11 +352,10 @@ namespace Differentiation template struct ADNumberTraits< ADNumberType, - std::enable_if_t< - std::is_same>::value>> + std::enable_if_t>>> : NumberTraits, NumberTypes::adolc_taped> { - static_assert(std::is_same>::value, + static_assert(std::is_same_v>, "Incorrect template type selected for taped ad_type"); static_assert(is_taped == true, "Incorrect setting for taping"); }; @@ -374,10 +373,10 @@ namespace Differentiation template struct ADNumberTraits< ADNumberType, - std::enable_if_t::value>> + std::enable_if_t>> : NumberTraits { - static_assert(std::is_same::value, + static_assert(std::is_same_v, "Incorrect template type selected for tapeless ad_type"); static_assert(is_tapeless == true, "Incorrect setting for taping"); }; @@ -397,10 +396,10 @@ namespace Differentiation struct ADNumberTraits< ADNumberType, std::enable_if_t< - std::is_same>::value>> + std::is_same_v>>> : NumberTraits, NumberTypes::adolc_tapeless> { - static_assert(std::is_same>::value, + static_assert(std::is_same_v>, "Incorrect template type selected for tapeless ad_type"); static_assert(is_tapeless == true, "Incorrect setting for taping"); }; diff --git a/include/deal.II/differentiation/sd/symengine_math.h b/include/deal.II/differentiation/sd/symengine_math.h index d67e29050c..3e06f7c3b1 100644 --- a/include/deal.II/differentiation/sd/symengine_math.h +++ b/include/deal.II/differentiation/sd/symengine_math.h @@ -69,7 +69,7 @@ namespace Differentiation */ template < typename NumberType, - typename = std::enable_if_t::value>> + typename = std::enable_if_t>> Expression pow(const Expression &base, const NumberType &exponent) { @@ -88,7 +88,7 @@ namespace Differentiation */ template < typename NumberType, - typename = std::enable_if_t::value>> + typename = std::enable_if_t>> Expression pow(const NumberType &base, const Expression &exponent) { @@ -154,7 +154,7 @@ namespace Differentiation */ template < typename NumberType, - typename = std::enable_if_t::value>> + typename = std::enable_if_t>> Expression log(const Expression &x, const NumberType &base) { @@ -173,7 +173,7 @@ namespace Differentiation */ template < typename NumberType, - typename = std::enable_if_t::value>> + typename = std::enable_if_t>> Expression log(const NumberType &x, const Expression &base) { @@ -313,7 +313,7 @@ namespace Differentiation */ template < typename NumberType, - typename = std::enable_if_t::value>> + typename = std::enable_if_t>> Expression atan2(const NumberType &y, const Expression &x) { @@ -333,7 +333,7 @@ namespace Differentiation */ template < typename NumberType, - typename = std::enable_if_t::value>> + typename = std::enable_if_t>> Expression atan2(const Expression &y, const NumberType &x) { @@ -602,7 +602,7 @@ namespace Differentiation */ template < typename NumberType, - typename = std::enable_if_t::value>> + typename = std::enable_if_t>> Expression max(const Expression &a, const NumberType &b) { @@ -621,7 +621,7 @@ namespace Differentiation */ template < typename NumberType, - typename = std::enable_if_t::value>> + typename = std::enable_if_t>> Expression max(const NumberType &a, const Expression &b) { @@ -650,7 +650,7 @@ namespace Differentiation */ template < typename NumberType, - typename = std::enable_if_t::value>> + typename = std::enable_if_t>> Expression min(const Expression &a, const NumberType &b) { @@ -669,7 +669,7 @@ namespace Differentiation */ template < typename NumberType, - typename = std::enable_if_t::value>> + typename = std::enable_if_t>> Expression min(const NumberType &a, const Expression &b) { diff --git a/include/deal.II/differentiation/sd/symengine_optimizer.h b/include/deal.II/differentiation/sd/symengine_optimizer.h index e9caa8b832..20b2040a70 100644 --- a/include/deal.II/differentiation/sd/symengine_optimizer.h +++ b/include/deal.II/differentiation/sd/symengine_optimizer.h @@ -372,10 +372,8 @@ namespace Differentiation { static const bool is_supported = true; - using ReturnType = - typename std::conditional::value, - float, - double>::type; + using ReturnType = typename std:: + conditional, float, double>::type; }; @@ -391,7 +389,7 @@ namespace Differentiation static const bool is_supported = true; using ReturnType = typename std::conditional< - std::is_same>::value, + std::is_same_v>, std::complex, std::complex>::type; }; @@ -601,12 +599,10 @@ namespace Differentiation ReturnType_, std::enable_if_t::value>> { - using ReturnType = - typename std::conditional::value, - float, - double>::type; + using ReturnType = typename std:: + conditional, float, double>::type; using OptimizerType = - typename std::conditional::value, + typename std::conditional, SymEngine::LLVMFloatVisitor, SymEngine::LLVMDoubleVisitor>::type; @@ -819,7 +815,7 @@ namespace Differentiation ReturnType, Optimizer, std::enable_if_t< - std::is_same::value>> + std::is_same_v>> { /** * Initialize an instance of an optimizer. @@ -961,7 +957,7 @@ namespace Differentiation ReturnType, Optimizer, std::enable_if_t< - !std::is_same::value>> + !std::is_same_v>> { /** * Initialize an instance of an optimizer. diff --git a/include/deal.II/lac/affine_constraints.templates.h b/include/deal.II/lac/affine_constraints.templates.h index a86a0fc3d6..4934baf884 100644 --- a/include/deal.II/lac/affine_constraints.templates.h +++ b/include/deal.II/lac/affine_constraints.templates.h @@ -3947,7 +3947,7 @@ AffineConstraints::distribute_local_to_global( const bool use_vectors = (local_vector.size() == 0 && global_vector.size() == 0) ? false : true; const bool use_dealii_matrix = - std::is_same>::value; + std::is_same_v>; AssertDimension(local_matrix.n(), local_dof_indices.size()); AssertDimension(local_matrix.m(), local_dof_indices.size()); @@ -4060,7 +4060,7 @@ AffineConstraints::distribute_local_to_global( // add must be equal if we have a Trilinos or PETSc vector but do not have to // be if we have a deal.II native vector: one could further optimize this for // Vector, LinearAlgebra::distributed::vector, etc. - if (std::is_same::value) + if (std::is_same_v) { global_vector.add(vector_indices, *reinterpret_cast *>( @@ -4104,7 +4104,7 @@ AffineConstraints::distribute_local_to_global( const bool use_vectors = (local_vector.size() == 0 && global_vector.size() == 0) ? false : true; const bool use_dealii_matrix = - std::is_same>::value; + std::is_same_v>; AssertDimension(local_matrix.n(), local_dof_indices.size()); AssertDimension(local_matrix.m(), local_dof_indices.size()); diff --git a/include/deal.II/lac/full_matrix.templates.h b/include/deal.II/lac/full_matrix.templates.h index c51d46d4e4..18be843e26 100644 --- a/include/deal.II/lac/full_matrix.templates.h +++ b/include/deal.II/lac/full_matrix.templates.h @@ -519,9 +519,8 @@ FullMatrix::mmult(FullMatrix & dst, // matrices): #ifdef DEAL_II_WITH_LAPACK const size_type max_blas_int = std::numeric_limits::max(); - if ((std::is_same::value || - std::is_same::value) && - std::is_same::value) + if ((std::is_same_v || + std::is_same_v)&&std::is_same_v) if (this->n() * this->m() * src.n() > 300 && src.n() <= max_blas_int && this->m() <= max_blas_int && this->n() <= max_blas_int) { @@ -602,9 +601,8 @@ FullMatrix::Tmmult(FullMatrix & dst, // matrices): #ifdef DEAL_II_WITH_LAPACK const size_type max_blas_int = std::numeric_limits::max(); - if ((std::is_same::value || - std::is_same::value) && - std::is_same::value) + if ((std::is_same_v || + std::is_same_v)&&std::is_same_v) if (this->n() * this->m() * src.n() > 300 && src.n() <= max_blas_int && this->n() <= max_blas_int && this->m() <= max_blas_int) { @@ -706,9 +704,8 @@ FullMatrix::mTmult(FullMatrix & dst, // matrices): #ifdef DEAL_II_WITH_LAPACK const size_type max_blas_int = std::numeric_limits::max(); - if ((std::is_same::value || - std::is_same::value) && - std::is_same::value) + if ((std::is_same_v || + std::is_same_v)&&std::is_same_v) if (this->n() * this->m() * src.m() > 300 && src.m() <= max_blas_int && this->n() <= max_blas_int && this->m() <= max_blas_int) { @@ -808,9 +805,8 @@ FullMatrix::TmTmult(FullMatrix & dst, // matrices): #ifdef DEAL_II_WITH_LAPACK const size_type max_blas_int = std::numeric_limits::max(); - if ((std::is_same::value || - std::is_same::value) && - std::is_same::value) + if ((std::is_same_v || + std::is_same_v)&&std::is_same_v) if (this->n() * this->m() * src.m() > 300 && src.m() <= max_blas_int && this->n() <= max_blas_int && this->m() <= max_blas_int) { @@ -1218,8 +1214,8 @@ namespace internal // floats and doubles template struct Determinant::value || - std::is_same::value>> + std::enable_if_t || + std::is_same_v>> { #ifdef DEAL_II_WITH_LAPACK static number @@ -1755,7 +1751,7 @@ FullMatrix::gauss_jordan() // efficient to use Lapack for very small // matrices): #ifdef DEAL_II_WITH_LAPACK - if (std::is_same::value || std::is_same::value) + if (std::is_same_v || std::is_same_v) if (this->n_cols() > 15 && static_cast(this->n_cols()) <= std::numeric_limits::max()) { diff --git a/include/deal.II/lac/la_parallel_vector.h b/include/deal.II/lac/la_parallel_vector.h index 55001fbc57..2b43d7832f 100644 --- a/include/deal.II/lac/la_parallel_vector.h +++ b/include/deal.II/lac/la_parallel_vector.h @@ -262,8 +262,8 @@ namespace LinearAlgebra using real_type = typename numbers::NumberTraits::real_type; static_assert( - std::is_same::value || - std::is_same::value, + std::is_same_v || + std::is_same_v, "MemorySpace should be Host or Default"); /** @@ -1549,7 +1549,7 @@ namespace LinearAlgebra inline Number Vector::operator()(const size_type global_index) const { - Assert((std::is_same::value), + Assert((std::is_same_v), ExcMessage( "This function is only implemented for the Host memory space")); Assert( @@ -1575,7 +1575,7 @@ namespace LinearAlgebra inline Number & Vector::operator()(const size_type global_index) { - Assert((std::is_same::value), + Assert((std::is_same_v), ExcMessage( "This function is only implemented for the Host memory space")); Assert( @@ -1621,7 +1621,7 @@ namespace LinearAlgebra Vector::local_element( const size_type local_index) const { - Assert((std::is_same::value), + Assert((std::is_same_v), ExcMessage( "This function is only implemented for the Host memory space")); AssertIndexRange(local_index, @@ -1641,7 +1641,7 @@ namespace LinearAlgebra inline Number & Vector::local_element(const size_type local_index) { - Assert((std::is_same::value), + Assert((std::is_same_v), ExcMessage( "This function is only implemented for the Host memory space")); diff --git a/include/deal.II/lac/la_parallel_vector.templates.h b/include/deal.II/lac/la_parallel_vector.templates.h index 8be03ade57..546a2536c5 100644 --- a/include/deal.II/lac/la_parallel_vector.templates.h +++ b/include/deal.II/lac/la_parallel_vector.templates.h @@ -84,10 +84,9 @@ namespace LinearAlgebra template struct la_parallel_vector_templates_functions { - static_assert( - std::is_same::value || - std::is_same::value, - "MemorySpace should be Host or Default"); + static_assert(std::is_same_v || + std::is_same_v, + "MemorySpace should be Host or Default"); static void resize_val( @@ -334,8 +333,7 @@ namespace LinearAlgebra (void)comm_sm; static_assert( - std::is_same::value || - std::is_same::value, + std::is_same_v || std::is_same_v, "Number should be float or double for Default memory space"); if (new_alloc_size > allocated_size) @@ -470,7 +468,7 @@ namespace LinearAlgebra const unsigned int size, RealType & result) { - static_assert(std::is_same::value, + static_assert(std::is_same_v, "RealType should be the same type as Number"); typename ::dealii::MemorySpace::Default::kokkos_space::execution_space @@ -997,7 +995,7 @@ namespace LinearAlgebra } # if !defined(DEAL_II_MPI_WITH_DEVICE_SUPPORT) - if (std::is_same::value) + if (std::is_same_v) { // Move the data to the host and then move it back to the // device. We use values to store the elements because the function @@ -1059,7 +1057,7 @@ namespace LinearAlgebra // make this function thread safe std::lock_guard lock(mutex); # if !defined(DEAL_II_MPI_WITH_DEVICE_SUPPORT) - if (std::is_same::value) + if (std::is_same_v) { Assert(partitioner->n_import_indices() == 0 || import_data.values_host_buffer.size() != 0, @@ -1129,7 +1127,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, @@ -1145,7 +1143,7 @@ namespace LinearAlgebra } # if !defined(DEAL_II_MPI_WITH_DEVICE_SUPPORT) - if (std::is_same::value) + if (std::is_same_v) { // Move the data to the host and then move it back to the // device. We use values to store the elements because the function @@ -1212,7 +1210,7 @@ namespace LinearAlgebra std::lock_guard lock(mutex); # if !defined(DEAL_II_MPI_WITH_DEVICE_SUPPORT) - if (std::is_same::value) + if (std::is_same_v) { partitioner->export_to_ghosted_array_finish( ArrayView( diff --git a/include/deal.II/lac/linear_operator.h b/include/deal.II/lac/linear_operator.h index 1bfd0a6b0e..acf83936e4 100644 --- a/include/deal.II/lac/linear_operator.h +++ b/include/deal.II/lac/linear_operator.h @@ -1551,8 +1551,8 @@ template < typename Range = typename Solver::vector_type, typename Domain = Range, typename = std::enable_if_t::value>, - typename = std::enable_if_t< - !std::is_same::value>, + typename = + std::enable_if_t>, typename = std::enable_if_t< !std::is_same>::value>> diff --git a/include/deal.II/lac/precondition.h b/include/deal.II/lac/precondition.h index 264fc8d717..d95443b8b3 100644 --- a/include/deal.II/lac/precondition.h +++ b/include/deal.II/lac/precondition.h @@ -2363,7 +2363,7 @@ inline void PreconditionRichardson::vmult(VectorType &dst, const VectorType &src) const { static_assert( - std::is_same::value, + std::is_same_v, "PreconditionRichardson and VectorType must have the same size_type."); dst.equ(relaxation, src); @@ -2376,7 +2376,7 @@ inline void PreconditionRichardson::Tvmult(VectorType &dst, const VectorType &src) const { static_assert( - std::is_same::value, + std::is_same_v, "PreconditionRichardson and VectorType must have the same size_type."); dst.equ(relaxation, src); @@ -2387,7 +2387,7 @@ inline void PreconditionRichardson::vmult_add(VectorType &dst, const VectorType &src) const { static_assert( - std::is_same::value, + std::is_same_v, "PreconditionRichardson and VectorType must have the same size_type."); dst.add(relaxation, src); @@ -2400,7 +2400,7 @@ inline void PreconditionRichardson::Tvmult_add(VectorType &dst, const VectorType &src) const { static_assert( - std::is_same::value, + std::is_same_v, "PreconditionRichardson and VectorType must have the same size_type."); dst.add(relaxation, src); @@ -3420,11 +3420,11 @@ namespace internal eigenvector /= eigenvector.l2_norm(); VectorType vector1, vector2; vector1.reinit(eigenvector, true); - if (!std::is_same::value) + if (!std::is_same_v) vector2.reinit(eigenvector, true); for (unsigned int i = 0; i < n_iterations; ++i) { - if (!std::is_same::value) + if (!std::is_same_v) { matrix.vmult(vector2, eigenvector); preconditioner.vmult(vector1, vector2); @@ -3494,7 +3494,7 @@ inline PreconditionChebyshev:: , eigenvalues_are_initialized(false) { static_assert( - std::is_same::value, + std::is_same_v, "PreconditionChebyshev and VectorType must have the same size_type."); } @@ -3666,7 +3666,7 @@ PreconditionChebyshev:: using NumberType = typename VectorType::value_type; if (std::is_same>::value == false || - (std::is_same>::value == false && + (std::is_same_v> == false && ((std::is_same>::value == diff --git a/include/deal.II/lac/read_write_vector.h b/include/deal.II/lac/read_write_vector.h index fbbb36e70f..47857b8e07 100644 --- a/include/deal.II/lac/read_write_vector.h +++ b/include/deal.II/lac/read_write_vector.h @@ -418,7 +418,7 @@ namespace LinearAlgebra * performance. */ template - std::enable_if_t::value && + std::enable_if_t && dealii::is_tpetra_type::value> import_elements( const TpetraWrappers::Vector &tpetra_vec, @@ -430,7 +430,7 @@ namespace LinearAlgebra * @deprecated Use import_elements() instead. */ template - DEAL_II_DEPRECATED std::enable_if_t::value && + DEAL_II_DEPRECATED std::enable_if_t && dealii::is_tpetra_type::value> import(const TpetraWrappers::Vector &V, VectorOperation::values operation, @@ -742,7 +742,7 @@ namespace LinearAlgebra * used directly. */ template - std::enable_if_t::value && + std::enable_if_t && dealii::is_tpetra_type::value> import_elements( const Tpetra::Vector diff --git a/include/deal.II/lac/read_write_vector.templates.h b/include/deal.II/lac/read_write_vector.templates.h index 95f71b0862..711ccd331f 100644 --- a/include/deal.II/lac/read_write_vector.templates.h +++ b/include/deal.II/lac/read_write_vector.templates.h @@ -108,8 +108,8 @@ namespace LinearAlgebra (void)rw_vector; static_assert( - std::is_same::value || - std::is_same::value, + std::is_same_v || + std::is_same_v, "MemorySpace should be Host or Default"); } }; @@ -563,7 +563,7 @@ namespace LinearAlgebra # ifdef DEAL_II_TRILINOS_WITH_TPETRA template template - std::enable_if_t::value && + std::enable_if_t && dealii::is_tpetra_type::value> ReadWriteVector::import_elements( const Tpetra::Vector &vector, @@ -848,7 +848,7 @@ namespace LinearAlgebra # ifdef DEAL_II_TRILINOS_WITH_TPETRA template template - std::enable_if_t::value && + std::enable_if_t && dealii::is_tpetra_type::value> ReadWriteVector::import_elements( const LinearAlgebra::TpetraWrappers::Vector &trilinos_vec, diff --git a/include/deal.II/lac/solver_cg.h b/include/deal.II/lac/solver_cg.h index 82b2791025..3d10be24cd 100644 --- a/include/deal.II/lac/solver_cg.h +++ b/include/deal.II/lac/solver_cg.h @@ -603,8 +603,7 @@ namespace internal const Number previous_r_dot_preconditioner_dot_r = r_dot_preconditioner_dot_r; - if (std::is_same::value == - false) + if (std::is_same_v == false) { preconditioner.vmult(v, r); r_dot_preconditioner_dot_r = r * v; @@ -613,7 +612,7 @@ namespace internal r_dot_preconditioner_dot_r = residual_norm * residual_norm; const VectorType &direction = - std::is_same::value ? r : v; + std::is_same_v ? r : v; if (iteration_index > 1) { diff --git a/include/deal.II/lac/sparse_decomposition.templates.h b/include/deal.II/lac/sparse_decomposition.templates.h index ad858150ef..d13a6ed70e 100644 --- a/include/deal.II/lac/sparse_decomposition.templates.h +++ b/include/deal.II/lac/sparse_decomposition.templates.h @@ -171,7 +171,7 @@ SparseLUDecomposition::copy_from(const SparseMatrix &matrix) const somenumber * input_ptr = matrix.val.get(); number * this_ptr = this->val.get(); const number *const end_ptr = this_ptr + this->n_nonzero_elements(); - if (std::is_same::value == true) + if (std::is_same_v == true) std::memcpy(this_ptr, input_ptr, this->n_nonzero_elements() * sizeof(number)); diff --git a/include/deal.II/lac/trilinos_sparse_matrix.h b/include/deal.II/lac/trilinos_sparse_matrix.h index 90d38d138e..2d6168c674 100644 --- a/include/deal.II/lac/trilinos_sparse_matrix.h +++ b/include/deal.II/lac/trilinos_sparse_matrix.h @@ -845,7 +845,7 @@ namespace TrilinosWrappers */ template std::enable_if_t< - !std::is_same>::value> + !std::is_same_v>> reinit(const IndexSet & row_parallel_partitioning, const IndexSet & col_parallel_partitioning, const SparsityPatternType &sparsity_pattern, @@ -1442,7 +1442,7 @@ namespace TrilinosWrappers */ template std::enable_if_t< - std::is_same::value> + std::is_same_v> vmult(VectorType &dst, const VectorType &src) const; /** @@ -1453,7 +1453,7 @@ namespace TrilinosWrappers */ template std::enable_if_t< - !std::is_same::value> + !std::is_same_v> vmult(VectorType &dst, const VectorType &src) const; /** @@ -1472,7 +1472,7 @@ namespace TrilinosWrappers */ template std::enable_if_t< - std::is_same::value> + std::is_same_v> Tvmult(VectorType &dst, const VectorType &src) const; /** @@ -1483,7 +1483,7 @@ namespace TrilinosWrappers */ template std::enable_if_t< - !std::is_same::value> + !std::is_same_v> Tvmult(VectorType &dst, const VectorType &src) const; /** diff --git a/include/deal.II/lac/vector_operations_internal.h b/include/deal.II/lac/vector_operations_internal.h index 47c90bde0a..79b93d50d1 100644 --- a/include/deal.II/lac/vector_operations_internal.h +++ b/include/deal.II/lac/vector_operations_internal.h @@ -242,7 +242,7 @@ namespace internal Assert(end >= begin, ExcInternalError()); if constexpr (std::is_trivially_copyable() && - std::is_same::value) + std::is_same_v) std::memcpy(dst + begin, src + begin, (end - begin) * sizeof(Number)); else { @@ -753,7 +753,7 @@ namespace internal template struct Dot { - static constexpr bool vectorizes = std::is_same::value && + static constexpr bool vectorizes = std::is_same_v && (VectorizedArray::size() > 1); Dot(const Number *const X, const Number2 *const Y) @@ -1473,8 +1473,8 @@ namespace internal ::dealii::MemorySpace::MemorySpaceData & /*data*/) { static_assert( - std::is_same::value && - std::is_same::value, + std::is_same_v && + std::is_same_v, "For the Default MemorySpace Number and Number2 should be the same type"); } @@ -2069,7 +2069,7 @@ namespace internal ::dealii::MemorySpace::Host> &data, std::enable_if_t< - std::is_same::value, + std::is_same_v, int> = 0) { if (operation == VectorOperation::insert) @@ -2099,7 +2099,7 @@ namespace internal ::dealii::MemorySpace::Host> &data, std::enable_if_t< - std::is_same::value, + std::is_same_v, int> = 0) { if (operation == VectorOperation::insert) @@ -2606,7 +2606,7 @@ namespace internal ::dealii::MemorySpace::Default> &data, std::enable_if_t< - std::is_same::value, + std::is_same_v, int> = 0) { if (operation == VectorOperation::insert) @@ -2636,7 +2636,7 @@ namespace internal ::dealii::MemorySpace::Default> &data, std::enable_if_t< - std::is_same::value, + std::is_same_v, int> = 0) { if (operation == VectorOperation::insert) diff --git a/include/deal.II/matrix_free/cuda_matrix_free.templates.h b/include/deal.II/matrix_free/cuda_matrix_free.templates.h index 7b578e301a..fb8b6b4fdb 100644 --- a/include/deal.II/matrix_free/cuda_matrix_free.templates.h +++ b/include/deal.II/matrix_free/cuda_matrix_free.templates.h @@ -506,7 +506,7 @@ namespace CUDAWrappers VectorType & dst) const { static_assert( - std::is_same::value, + std::is_same_v, "VectorType::value_type and Number should be of the same type."); Assert(src.size() == dst.size(), ExcMessage("src and dst vectors have different size.")); @@ -539,7 +539,7 @@ namespace CUDAWrappers VectorType &dst) const { static_assert( - std::is_same::value, + std::is_same_v, "VectorType::value_type and Number should be of the same type."); Number *dst_ptr = dst.get_values(); // FIXME When using C++17, we can use KOKKOS_CLASS_LAMBDA and this diff --git a/include/deal.II/matrix_free/evaluation_kernels.h b/include/deal.II/matrix_free/evaluation_kernels.h index 9ed4bc5f67..1d10a6e1af 100644 --- a/include/deal.II/matrix_free/evaluation_kernels.h +++ b/include/deal.II/matrix_free/evaluation_kernels.h @@ -3099,8 +3099,7 @@ namespace internal const std::size_t n_dofs_normal = n_dofs_tangent - Utilities::pow(fe_degree, dim - 2); const std::size_t dofs_stride = - (std::is_same::value) ? n_dofs_normal : - n_dofs_tangent; + (std::is_same_v) ? n_dofs_normal : n_dofs_tangent; static constexpr dealii::ndarray component_table = { {{{1, 2, 0}}, {{2, 0, 1}}, {{0, 1, 2}}}}; @@ -3304,8 +3303,7 @@ namespace internal const std::size_t n_dofs_normal = n_dofs_tangent - Utilities::pow(fe_degree, dim - 2); const std::size_t dofs_stride = - (std::is_same::value) ? n_dofs_normal : - n_dofs_tangent; + (std::is_same_v) ? n_dofs_normal : n_dofs_tangent; static constexpr dealii::ndarray component_table = { {{{1, 2, 0}}, {{2, 0, 1}}, {{0, 1, 2}}}}; diff --git a/include/deal.II/matrix_free/fe_evaluation.h b/include/deal.II/matrix_free/fe_evaluation.h index f6ae1ed2db..2ee5c3696f 100644 --- a/include/deal.II/matrix_free/fe_evaluation.h +++ b/include/deal.II/matrix_free/fe_evaluation.h @@ -763,7 +763,7 @@ class FEEvaluationAccess : public FEEvaluationBase { static_assert( - std::is_same::value, + std::is_same_v, "Type of Number and of VectorizedArrayType do not match."); public: @@ -835,7 +835,7 @@ class FEEvaluationAccess : public FEEvaluationBase { static_assert( - std::is_same::value, + std::is_same_v, "Type of Number and of VectorizedArrayType do not match."); public: @@ -993,7 +993,7 @@ class FEEvaluationAccess : public FEEvaluationBase { static_assert( - std::is_same::value, + std::is_same_v, "Type of Number and of VectorizedArrayType do not match."); public: @@ -1169,7 +1169,7 @@ class FEEvaluationAccess<1, 1, Number, is_face, VectorizedArrayType> : public FEEvaluationBase<1, 1, Number, is_face, VectorizedArrayType> { static_assert( - std::is_same::value, + std::is_same_v, "Type of Number and of VectorizedArrayType do not match."); public: @@ -1914,7 +1914,7 @@ class FEEvaluation : public FEEvaluationAccess { static_assert( - std::is_same::value, + std::is_same_v, "Type of Number and of VectorizedArrayType do not match."); public: @@ -2378,7 +2378,7 @@ class FEFaceEvaluation : public FEEvaluationAccess { static_assert( - std::is_same::value, + std::is_same_v, "Type of Number and of VectorizedArrayType do not match."); public: @@ -7900,7 +7900,7 @@ namespace internal // into the vector to the evaluate() and integrate() calls, without // reading the vector entries into a separate data field. This saves some // operations. - if (std::is_same::value && + if (std::is_same_v && dof_info.index_storage_variants [internal::MatrixFreeFunctions::DoFInfo::dof_access_cell][cell] == internal::MatrixFreeFunctions::DoFInfo::IndexStorageVariants:: diff --git a/include/deal.II/matrix_free/mapping_info.templates.h b/include/deal.II/matrix_free/mapping_info.templates.h index 757097ff9b..8e17a11433 100644 --- a/include/deal.II/matrix_free/mapping_info.templates.h +++ b/include/deal.II/matrix_free/mapping_info.templates.h @@ -2685,7 +2685,7 @@ namespace internal using VectorizedDouble = VectorizedArray::value && + ((std::is_same_v && VectorizedArrayType::size() > 1) ? VectorizedArrayType::size() / 2 : VectorizedArrayType::size())>; diff --git a/include/deal.II/matrix_free/matrix_free.h b/include/deal.II/matrix_free/matrix_free.h index 592e964158..d1e0f0ada1 100644 --- a/include/deal.II/matrix_free/matrix_free.h +++ b/include/deal.II/matrix_free/matrix_free.h @@ -113,7 +113,7 @@ template ::value, + std::is_same_v, "Type of Number and of VectorizedArrayType do not match."); public: @@ -3458,9 +3458,8 @@ namespace internal update_ghost_values_start(const unsigned int component_in_block_vector, const VectorType & vec) { - static_assert( - std::is_same::value, - "Type mismatch between VectorType and VectorDataExchange"); + static_assert(std::is_same_v, + "Type mismatch between VectorType and VectorDataExchange"); (void)component_in_block_vector; const bool ghosts_set = vec.has_ghost_elements(); @@ -3552,9 +3551,8 @@ namespace internal update_ghost_values_finish(const unsigned int component_in_block_vector, const VectorType & vec) { - static_assert( - std::is_same::value, - "Type mismatch between VectorType and VectorDataExchange"); + static_assert(std::is_same_v, + "Type mismatch between VectorType and VectorDataExchange"); (void)component_in_block_vector; if (vec.size() != 0) @@ -3658,9 +3656,8 @@ namespace internal compress_start(const unsigned int component_in_block_vector, VectorType & vec) { - static_assert( - std::is_same::value, - "Type mismatch between VectorType and VectorDataExchange"); + static_assert(std::is_same_v, + "Type mismatch between VectorType and VectorDataExchange"); (void)component_in_block_vector; Assert(vec.has_ghost_elements() == false, ExcNotImplemented()); @@ -3745,9 +3742,8 @@ namespace internal compress_finish(const unsigned int component_in_block_vector, VectorType & vec) { - static_assert( - std::is_same::value, - "Type mismatch between VectorType and VectorDataExchange"); + static_assert(std::is_same_v, + "Type mismatch between VectorType and VectorDataExchange"); (void)component_in_block_vector; if (vec.size() != 0) { @@ -3833,9 +3829,8 @@ namespace internal void reset_ghost_values(const VectorType &vec) const { - static_assert( - std::is_same::value, - "Type mismatch between VectorType and VectorDataExchange"); + static_assert(std::is_same_v, + "Type mismatch between VectorType and VectorDataExchange"); if (ghosts_were_set == true) return; @@ -3877,9 +3872,8 @@ namespace internal void zero_vector_region(const unsigned int range_index, VectorType &vec) const { - static_assert( - std::is_same::value, - "Type mismatch between VectorType and VectorDataExchange"); + static_assert(std::is_same_v, + "Type mismatch between VectorType and VectorDataExchange"); if (range_index == numbers::invalid_unsigned_int) vec = Number(); else diff --git a/include/deal.II/matrix_free/operators.h b/include/deal.II/matrix_free/operators.h index fbe9a594f3..4df398bed2 100644 --- a/include/deal.II/matrix_free/operators.h +++ b/include/deal.II/matrix_free/operators.h @@ -622,7 +622,7 @@ namespace MatrixFreeOperators class CellwiseInverseMassMatrix { static_assert( - std::is_same::value, + std::is_same_v, "Type of Number and of VectorizedArrayType do not match."); public: @@ -1838,7 +1838,7 @@ namespace MatrixFreeOperators { #ifndef DEAL_II_MSVC static_assert( - std::is_same::value, + std::is_same_v, "The vector type must be based on the same value type as this " "operator"); #endif @@ -1858,7 +1858,7 @@ namespace MatrixFreeOperators { #ifndef DEAL_II_MSVC static_assert( - std::is_same::value, + std::is_same_v, "The vector type must be based on the same value type as this " "operator"); #endif diff --git a/include/deal.II/matrix_free/shape_info.templates.h b/include/deal.II/matrix_free/shape_info.templates.h index f453d5b150..634800f15a 100644 --- a/include/deal.II/matrix_free/shape_info.templates.h +++ b/include/deal.II/matrix_free/shape_info.templates.h @@ -1086,7 +1086,7 @@ namespace internal univariate_shape_data.inverse_shape_values_eo; const double zero_tol = - std::is_same::value == true ? 1e-12 : 1e-7; + std::is_same_v == true ? 1e-12 : 1e-7; // symmetry for values const unsigned int n_dofs_1d = fe_degree + 1; for (unsigned int i = 0; i < (n_dofs_1d + 1) / 2; ++i) @@ -1206,7 +1206,7 @@ namespace internal auto & shape_values = univariate_shape_data.shape_values; const double zero_tol = - std::is_same::value == true ? 1e-12 : 1e-7; + std::is_same_v == true ? 1e-12 : 1e-7; // check: identity operation for shape values const unsigned int n_points_1d = fe_degree + 1; for (unsigned int i = 0; i < n_points_1d; ++i) diff --git a/include/deal.II/matrix_free/type_traits.h b/include/deal.II/matrix_free/type_traits.h index 7b29f84478..c65c601b7f 100644 --- a/include/deal.II/matrix_free/type_traits.h +++ b/include/deal.II/matrix_free/type_traits.h @@ -117,7 +117,7 @@ namespace internal has_begin && (has_local_element || is_serial_vector::type>::value) && - std::is_same::value; + std::is_same_v; }; // We need to have a separate declaration for static const members diff --git a/include/deal.II/multigrid/mg_coarse.h b/include/deal.II/multigrid/mg_coarse.h index 719df58291..3e42cb7f9d 100644 --- a/include/deal.II/multigrid/mg_coarse.h +++ b/include/deal.II/multigrid/mg_coarse.h @@ -362,14 +362,13 @@ namespace internal { namespace MGCoarseGridIterativeSolver { - template < - typename VectorType, - typename SolverType, - typename MatrixType, - typename PreconditionerType, - std::enable_if_t< - std::is_same::value, - VectorType> * = nullptr> + template , + VectorType> * = nullptr> void solve(SolverType & solver, const MatrixType & matrix, @@ -380,14 +379,13 @@ namespace internal solver.solve(matrix, dst, src, preconditioner); } - template < - typename VectorType, - typename SolverType, - typename MatrixType, - typename PreconditionerType, - std::enable_if_t< - !std::is_same::value, - VectorType> * = nullptr> + template , + VectorType> * = nullptr> void solve(SolverType & solver, const MatrixType & matrix, diff --git a/include/deal.II/numerics/adaptation_strategies.h b/include/deal.II/numerics/adaptation_strategies.h index e95e458bc1..3e05d83452 100644 --- a/include/deal.II/numerics/adaptation_strategies.h +++ b/include/deal.II/numerics/adaptation_strategies.h @@ -230,7 +230,7 @@ namespace AdaptationStrategies const value_type parent_value) { static_assert(std::is_arithmetic::value && - !std::is_same::value, + !std::is_same_v, "The provided value_type may not meet the requirements " "of this function."); @@ -248,7 +248,7 @@ namespace AdaptationStrategies const value_type parent_value) { static_assert(std::is_arithmetic::value && - !std::is_same::value, + !std::is_same_v, "The provided value_type may not meet the requirements " "of this function."); @@ -290,7 +290,7 @@ namespace AdaptationStrategies const std::vector &children_values) { static_assert(std::is_arithmetic::value && - !std::is_same::value, + !std::is_same_v, "The provided value_type may not meet the requirements " "of this function."); @@ -309,7 +309,7 @@ namespace AdaptationStrategies const std::vector &children_values) { static_assert(std::is_arithmetic::value && - !std::is_same::value, + !std::is_same_v, "The provided value_type may not meet the requirements " "of this function."); diff --git a/include/deal.II/sundials/arkode.h b/include/deal.II/sundials/arkode.h index 15b6a16dc6..e1a54fbe88 100644 --- a/include/deal.II/sundials/arkode.h +++ b/include/deal.II/sundials/arkode.h @@ -1099,14 +1099,13 @@ namespace SUNDIALS # ifdef DEAL_II_WITH_PETSC # ifdef PETSC_USE_COMPLEX - static_assert(!std::is_same::value, + static_assert(!std::is_same_v, "Sundials does not support complex scalar types, " "but PETSc is configured to use a complex scalar type!"); - static_assert( - !std::is_same::value, - "Sundials does not support complex scalar types, " - "but PETSc is configured to use a complex scalar type!"); + static_assert(!std::is_same_v, + "Sundials does not support complex scalar types, " + "but PETSc is configured to use a complex scalar type!"); # endif // PETSC_USE_COMPLEX # endif // DEAL_II_WITH_PETSC }; diff --git a/include/deal.II/sundials/ida.h b/include/deal.II/sundials/ida.h index d9ae292715..b6c7d2486d 100644 --- a/include/deal.II/sundials/ida.h +++ b/include/deal.II/sundials/ida.h @@ -874,14 +874,13 @@ namespace SUNDIALS # ifdef DEAL_II_WITH_PETSC # ifdef PETSC_USE_COMPLEX - static_assert(!std::is_same::value, + static_assert(!std::is_same_v, "Sundials does not support complex scalar types, " "but PETSc is configured to use a complex scalar type!"); - static_assert( - !std::is_same::value, - "Sundials does not support complex scalar types, " - "but PETSc is configured to use a complex scalar type!"); + static_assert(!std::is_same_v, + "Sundials does not support complex scalar types, " + "but PETSc is configured to use a complex scalar type!"); # endif // PETSC_USE_COMPLEX # endif // DEAL_II_WITH_PETSC }; diff --git a/source/base/mpi.cc b/source/base/mpi.cc index 61e6801461..619f40af33 100644 --- a/source/base/mpi.cc +++ b/source/base/mpi.cc @@ -81,10 +81,9 @@ namespace Utilities const unsigned int n_partitions, const types::global_dof_index total_size) { - static_assert( - std::is_same::value, - "IndexSet::size_type must match types::global_dof_index for " - "using this function"); + static_assert(std::is_same_v, + "IndexSet::size_type must match types::global_dof_index for " + "using this function"); const unsigned int remain = total_size % n_partitions; const IndexSet::size_type min_size = total_size / n_partitions; @@ -237,7 +236,7 @@ namespace Utilities const types::global_dof_index locally_owned_size) { static_assert( - std::is_same::value, + std::is_same_v, "IndexSet::size_type must match types::global_dof_index for " "using this function"); const unsigned int n_proc = n_mpi_processes(comm); diff --git a/source/differentiation/ad/adolc_number_types.cc b/source/differentiation/ad/adolc_number_types.cc index f8a7bf7050..4bb9e357c7 100644 --- a/source/differentiation/ad/adolc_number_types.cc +++ b/source/differentiation/ad/adolc_number_types.cc @@ -50,7 +50,7 @@ namespace numbers double, Differentiation::AD::NumberTypes::adolc_taped>::ad_type; static_assert( - std::is_same::value, + std::is_same_v, "The type of the AD number is not that which was expected."); const ad_type result = comparator(value_1, value_2); return !(Differentiation::AD::ADNumberTraits::get_scalar_value( diff --git a/source/lac/lapack_full_matrix.cc b/source/lac/lapack_full_matrix.cc index aa00cbcaf7..f90d59c8d5 100644 --- a/source/lac/lapack_full_matrix.cc +++ b/source/lac/lapack_full_matrix.cc @@ -57,8 +57,7 @@ namespace internal const types::blas_int work_flag, types::blas_int & info) { - static_assert(std::is_same::value || - std::is_same::value, + static_assert(std::is_same_v || std::is_same_v, "Only implemented for double and float"); Assert(matrix.size() == static_cast(n_rows * n_rows), ExcInternalError()); @@ -113,7 +112,7 @@ namespace internal types::blas_int & info) { static_assert( - std::is_same::value || std::is_same::value, + std::is_same_v || std::is_same_v, "Only implemented for std::complex and std::complex"); Assert(matrix.size() == static_cast(n_rows * n_rows), ExcInternalError()); diff --git a/source/lac/trilinos_sparse_matrix.cc b/source/lac/trilinos_sparse_matrix.cc index f4e631a04e..971b7ccca2 100644 --- a/source/lac/trilinos_sparse_matrix.cc +++ b/source/lac/trilinos_sparse_matrix.cc @@ -796,7 +796,7 @@ namespace TrilinosWrappers template inline std::enable_if_t< - !std::is_same>::value> + !std::is_same_v>> SparseMatrix::reinit(const IndexSet & row_parallel_partitioning, const IndexSet & col_parallel_partitioning, const SparsityPatternType &sparsity_pattern, @@ -1972,7 +1972,7 @@ namespace TrilinosWrappers template std::enable_if_t< - std::is_same::value> + std::is_same_v> SparseMatrix::vmult(VectorType &dst, const VectorType &src) const { Assert(&src != &dst, ExcSourceEqualsDestination()); @@ -2006,7 +2006,7 @@ namespace TrilinosWrappers template std::enable_if_t< - !std::is_same::value> + !std::is_same_v> SparseMatrix::vmult(VectorType & /*dst*/, const VectorType & /*src*/) const { AssertThrow(false, ExcNotImplemented()); @@ -2016,7 +2016,7 @@ namespace TrilinosWrappers template std::enable_if_t< - std::is_same::value> + std::is_same_v> SparseMatrix::Tvmult(VectorType &dst, const VectorType &src) const { Assert(&src != &dst, ExcSourceEqualsDestination()); @@ -2047,7 +2047,7 @@ namespace TrilinosWrappers template std::enable_if_t< - !std::is_same::value> + !std::is_same_v> SparseMatrix::Tvmult(VectorType & /*dst*/, const VectorType & /*src*/) const { AssertThrow(false, ExcNotImplemented()); diff --git a/source/matrix_free/dof_info.cc b/source/matrix_free/dof_info.cc index 530c670f18..3997820e6c 100644 --- a/source/matrix_free/dof_info.cc +++ b/source/matrix_free/dof_info.cc @@ -34,7 +34,7 @@ namespace internal { // ensure that the type defined in both dof_info.h and // hanging_nodes_internal.h is consistent - static_assert(std::is_same::value, + static_assert(std::is_same_v, "Unexpected type for compressed hanging node indicators!"); diff --git a/tests/base/functions_13.cc b/tests/base/functions_13.cc index 29e7c8b5e9..6395306eff 100644 --- a/tests/base/functions_13.cc +++ b/tests/base/functions_13.cc @@ -50,20 +50,18 @@ main() "Wrong return type for FunctionTime::get_time()."); MyFunction<1, std::complex> function_1; - static_assert(std::is_same::value, + static_assert(std::is_same_v, "Wrong return type for Function::get_time()."); MyFunction<2, std::complex> function_2; - static_assert(std::is_same::value, + static_assert(std::is_same_v, "Wrong return type for Function::get_time()."); MyTensorFunction<1, 1, std::complex> tensor_function_1; - static_assert( - std::is_same::value, - "Wrong return type for TensorFunction::get_time()."); + static_assert(std::is_same_v, + "Wrong return type for TensorFunction::get_time()."); MyTensorFunction<2, 2, std::complex> tensor_function_2; - static_assert( - std::is_same::value, - "Wrong return type for TensorFunction::get_time()."); + static_assert(std::is_same_v, + "Wrong return type for TensorFunction::get_time()."); deallog << "OK" << std::endl; } diff --git a/tests/base/hdf5_03.cc b/tests/base/hdf5_03.cc index 52e260f4d8..6df3987456 100644 --- a/tests/base/hdf5_03.cc +++ b/tests/base/hdf5_03.cc @@ -29,7 +29,7 @@ // This function initializes a container of Number type template