From: Wolfgang Bangerth Date: Mon, 18 Jul 2022 21:39:35 +0000 (-0600) Subject: Replace std::enable_if by std::enable_if_t throughout. X-Git-Tag: v9.5.0-rc1~1078^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F14148%2Fhead;p=dealii.git Replace std::enable_if by std::enable_if_t throughout. --- diff --git a/include/deal.II/base/complex_overloads.h b/include/deal.II/base/complex_overloads.h index 64336a4228..357dac1773 100644 --- a/include/deal.II/base/complex_overloads.h +++ b/include/deal.II/base/complex_overloads.h @@ -37,9 +37,9 @@ struct ProductType; * @relatesalso ProductType */ template -inline typename std::enable_if< +inline std::enable_if_t< std::is_floating_point::value && std::is_floating_point::value, - typename ProductType, std::complex>::type>::type + typename ProductType, std::complex>::type> operator*(const std::complex &left, const std::complex &right) { using result_type = @@ -55,9 +55,9 @@ operator*(const std::complex &left, const std::complex &right) * @relatesalso ProductType */ template -inline typename std::enable_if< +inline std::enable_if_t< std::is_floating_point::value && std::is_floating_point::value, - typename ProductType, std::complex>::type>::type + typename ProductType, std::complex>::type> operator/(const std::complex &left, const std::complex &right) { using result_type = @@ -73,11 +73,10 @@ operator/(const std::complex &left, const std::complex &right) * @relatesalso ProductType */ template -inline - typename std::enable_if::value && - std::is_floating_point::value, - typename ProductType, U>::type>::type - operator*(const std::complex &left, const U &right) +inline std::enable_if_t::value && + std::is_floating_point::value, + typename ProductType, U>::type> +operator*(const std::complex &left, const U &right) { using result_type = typename ProductType, U>::type; return static_cast(left) * static_cast(right); @@ -91,11 +90,10 @@ inline * @relatesalso ProductType */ template -inline - typename std::enable_if::value && - std::is_floating_point::value, - typename ProductType, U>::type>::type - operator/(const std::complex &left, const U &right) +inline std::enable_if_t::value && + std::is_floating_point::value, + typename ProductType, U>::type> +operator/(const std::complex &left, const U &right) { using result_type = typename ProductType, U>::type; return static_cast(left) / static_cast(right); @@ -109,12 +107,10 @@ inline * @relatesalso ProductType */ template -inline typename - - std::enable_if::value && - std::is_floating_point::value, - typename ProductType>::type>::type - operator*(const T &left, const std::complex &right) +inline std::enable_if_t::value && + std::is_floating_point::value, + typename ProductType>::type> +operator*(const T &left, const std::complex &right) { using result_type = typename ProductType>::type; return static_cast(left) * static_cast(right); @@ -128,11 +124,10 @@ inline typename * @relatesalso ProductType */ template -inline - typename std::enable_if::value && - std::is_floating_point::value, - typename ProductType>::type>::type - operator/(const T &left, const std::complex &right) +inline std::enable_if_t::value && + std::is_floating_point::value, + typename ProductType>::type> +operator/(const T &left, const std::complex &right) { using result_type = typename ProductType>::type; return static_cast(left) / static_cast(right); diff --git a/include/deal.II/base/hdf5.h b/include/deal.II/base/hdf5.h index 0d75117d05..c7e15ba4f0 100644 --- a/include/deal.II/base/hdf5.h +++ b/include/deal.II/base/hdf5.h @@ -1210,29 +1210,29 @@ namespace HDF5 * of the FullMatrix will be FullMatrix(dim_0,dim_2) */ template - typename std::enable_if< + std::enable_if_t< std::is_same>::value, - Container>::type + Container> initialize_container(const std::vector &dimensions); /** * Same as above. */ template - typename std::enable_if< + std::enable_if_t< std::is_same>::value, - Container>::type + Container> initialize_container(const std::vector &dimensions); /** * Same as above. */ template - typename std::enable_if< + std::enable_if_t< std::is_same>::value, - Container>::type + Container> initialize_container(const std::vector &dimensions); /** @@ -1418,10 +1418,10 @@ namespace HDF5 template - typename std::enable_if< + std::enable_if_t< std::is_same>::value, - Container>::type + Container> initialize_container(const std::vector &dimensions) { return Container(std::accumulate( @@ -1431,9 +1431,9 @@ namespace HDF5 template - typename std::enable_if< + std::enable_if_t< std::is_same>::value, - Container>::type + Container> initialize_container(const std::vector &dimensions) { return Container(std::accumulate( @@ -1443,10 +1443,10 @@ namespace HDF5 template - typename std::enable_if< + std::enable_if_t< std::is_same>::value, - Container>::type + Container> initialize_container(const std::vector &dimensions) { // If the rank is higher than 2, then remove single-dimensional entries diff --git a/include/deal.II/base/linear_index_iterator.h b/include/deal.II/base/linear_index_iterator.h index 4a00068860..2714c35f73 100644 --- a/include/deal.II/base/linear_index_iterator.h +++ b/include/deal.II/base/linear_index_iterator.h @@ -250,9 +250,9 @@ public: * the same entry in the same container. */ template - friend typename std::enable_if< + friend std::enable_if_t< std::is_convertible::value, - bool>::type + bool> operator==(const LinearIndexIterator &left, const OtherIterator &right) { const auto &right_2 = static_cast(right); @@ -263,9 +263,9 @@ public: * Opposite of operator==(). */ template - friend typename std::enable_if< + friend std::enable_if_t< std::is_convertible::value, - bool>::type + bool> operator!=(const LinearIndexIterator &left, const OtherIterator &right) { return !(left == right); diff --git a/include/deal.II/base/memory_consumption.h b/include/deal.II/base/memory_consumption.h index 7cfc06cb42..d55b6348e4 100644 --- a/include/deal.II/base/memory_consumption.h +++ b/include/deal.II/base/memory_consumption.h @@ -89,9 +89,8 @@ namespace MemoryConsumption * implemented. */ template - inline - typename std::enable_if::value, std::size_t>::type - memory_consumption(const T &t); + inline std::enable_if_t::value, std::size_t> + memory_consumption(const T &t); /** * Estimate the memory consumption of an object. If no further template @@ -100,9 +99,9 @@ namespace MemoryConsumption * t.memory_consumption()'s value. */ template - inline typename std::enable_if::value || - std::is_pointer::value), - std::size_t>::type + inline std::enable_if_t::value || + std::is_pointer::value), + std::size_t> memory_consumption(const T &t); /** @@ -261,9 +260,8 @@ namespace MemoryConsumption namespace MemoryConsumption { template - inline - typename std::enable_if::value, std::size_t>::type - memory_consumption(const T &) + inline std::enable_if_t::value, std::size_t> + memory_consumption(const T &) { return sizeof(T); } @@ -411,9 +409,9 @@ namespace MemoryConsumption template - inline typename std::enable_if::value || - std::is_pointer::value), - std::size_t>::type + inline std::enable_if_t::value || + std::is_pointer::value), + std::size_t> memory_consumption(const T &t) { return t.memory_consumption(); diff --git a/include/deal.II/base/mpi.h b/include/deal.II/base/mpi.h index f89e80b42d..f66c7f4cfa 100644 --- a/include/deal.II/base/mpi.h +++ b/include/deal.II/base/mpi.h @@ -1215,7 +1215,7 @@ namespace Utilities * the @p root_process. */ template - typename std::enable_if == false, T>::type + std::enable_if_t == false, T> broadcast(const MPI_Comm & comm, const T & object_to_send, const unsigned int root_process = 0); @@ -1243,7 +1243,7 @@ namespace Utilities * the @p root_process. */ template - typename std::enable_if == true, T>::type + std::enable_if_t == true, T> broadcast(const MPI_Comm & comm, const T & object_to_send, const unsigned int root_process = 0); @@ -1925,7 +1925,7 @@ namespace Utilities template - typename std::enable_if == false, T>::type + std::enable_if_t == false, T> broadcast(const MPI_Comm & comm, const T & object_to_send, const unsigned int root_process) @@ -1975,7 +1975,7 @@ namespace Utilities template - typename std::enable_if == true, T>::type + std::enable_if_t == true, T> broadcast(const MPI_Comm & comm, const T & object_to_send, const unsigned int root_process) diff --git a/include/deal.II/base/numbers.h b/include/deal.II/base/numbers.h index f53f6b6cc1..2832dad638 100644 --- a/include/deal.II/base/numbers.h +++ b/include/deal.II/base/numbers.h @@ -455,17 +455,16 @@ namespace numbers */ template static constexpr DEAL_II_CUDA_HOST_DEV - typename std::enable_if::value && - is_cuda_compatible::value, - real_type>::type + std::enable_if_t::value && + is_cuda_compatible::value, + real_type> abs_square(const number &x); template - static constexpr - typename std::enable_if::value && - !is_cuda_compatible::value, - real_type>::type - abs_square(const number &x); + static constexpr std::enable_if_t::value && + !is_cuda_compatible::value, + real_type> + abs_square(const number &x); /** * Return the absolute value of a number. @@ -583,9 +582,9 @@ namespace numbers template template constexpr DEAL_II_CUDA_HOST_DEV - typename std::enable_if::value && - is_cuda_compatible::value, - typename NumberTraits::real_type>::type + std::enable_if_t::value && + is_cuda_compatible::value, + typename NumberTraits::real_type> NumberTraits::abs_square(const number &x) { return x * x; @@ -595,11 +594,10 @@ namespace numbers template template - constexpr - typename std::enable_if::value && - !is_cuda_compatible::value, - typename NumberTraits::real_type>::type - NumberTraits::abs_square(const number &x) + constexpr std::enable_if_t::value && + !is_cuda_compatible::value, + typename NumberTraits::real_type> + NumberTraits::abs_square(const number &x) { return x * x; } @@ -718,10 +716,9 @@ namespace internal template static constexpr DEAL_II_ALWAYS_INLINE DEAL_II_CUDA_HOST_DEV T value(const F &f, - typename std::enable_if< - !std::is_same::type, - typename std::decay::type>::value && - std::is_constructible::value>::type * = nullptr) + std::enable_if_t::type, + typename std::decay::type>::value && + std::is_constructible::value> * = nullptr) { return T(f); } @@ -730,11 +727,11 @@ namespace internal template static constexpr DEAL_II_ALWAYS_INLINE T value(const F &f, - typename std::enable_if< - !std::is_same::type, - typename std::decay::type>::value && - !std::is_constructible::value && - is_explicitly_convertible::value>::type * = nullptr) + std::enable_if_t::type, + typename std::decay::type>::value && + !std::is_constructible::value && + is_explicitly_convertible::value> * = + nullptr) { return static_cast(f); } @@ -745,13 +742,13 @@ namespace internal // might fall into the same category. template static T - value(const F &f, - typename std::enable_if< - !std::is_same::type, - typename std::decay::type>::value && - !std::is_constructible::value && - !is_explicitly_convertible::value && - Differentiation::AD::is_ad_number::value>::type * = nullptr) + value( + const F &f, + std::enable_if_t::type, + typename std::decay::type>::value && + !std::is_constructible::value && + !is_explicitly_convertible::value && + Differentiation::AD::is_ad_number::value> * = nullptr) { return Differentiation::AD::internal::NumberType::value(f); } diff --git a/include/deal.II/base/partitioner.templates.h b/include/deal.II/base/partitioner.templates.h index 4358feeb94..67097adb61 100644 --- a/include/deal.II/base/partitioner.templates.h +++ b/include/deal.II/base/partitioner.templates.h @@ -440,16 +440,15 @@ namespace Utilities // standards. To avoid this, we use std::abs on default types but // simply return the number on unsigned types template - typename std::enable_if< - !std::is_unsigned::value, - typename numbers::NumberTraits::real_type>::type + std::enable_if_t::value, + typename numbers::NumberTraits::real_type> get_abs(const Number a) { return std::abs(a); } template - typename std::enable_if::value, Number>::type + std::enable_if_t::value, Number> get_abs(const Number a) { return a; diff --git a/include/deal.II/base/patterns.h b/include/deal.II/base/patterns.h index 082ddf93f8..a011377071 100644 --- a/include/deal.II/base/patterns.h +++ b/include/deal.II/base/patterns.h @@ -1482,38 +1482,34 @@ namespace Patterns // Arithmetic types template - struct Convert::value>::type> + struct Convert::value>> { template - static - typename std::enable_if::value && - std::is_same::value, - std::unique_ptr>::type - to_pattern() + static std::enable_if_t::value && + std::is_same::value, + std::unique_ptr> + to_pattern() { return std::make_unique(); } template - static - typename std::enable_if::value && - !std::is_same::value && - std::is_integral::value, - std::unique_ptr>::type - to_pattern() + static std::enable_if_t::value && + !std::is_same::value && + std::is_integral::value, + std::unique_ptr> + to_pattern() { return std::make_unique( std::numeric_limits::lowest(), std::numeric_limits::max()); } template - static - typename std::enable_if::value && - !std::is_same::value && - std::is_floating_point::value, - std::unique_ptr>::type - to_pattern() + static std::enable_if_t::value && + !std::is_same::value && + std::is_floating_point::value, + std::unique_ptr> + to_pattern() { return std::make_unique( std::numeric_limits::lowest(), std::numeric_limits::max()); @@ -1679,9 +1675,7 @@ namespace Patterns // Rank of vector types template - struct RankInfo< - T, - typename std::enable_if::value>::type> + struct RankInfo::value>> { static constexpr int list_rank = RankInfo::list_rank + 1; @@ -1691,9 +1685,7 @@ namespace Patterns // Rank of map types template - struct RankInfo< - T, - typename std::enable_if::value>::type> + struct RankInfo::value>> { static constexpr int list_rank = max_list_rank() + 1; @@ -1766,8 +1758,7 @@ namespace Patterns // stl containers template - struct Convert::value>::type> + struct Convert::value>> { static std::unique_ptr to_pattern() @@ -1834,8 +1825,7 @@ namespace Patterns // stl maps template - struct Convert::value>::type> + struct Convert::value>> { static std::unique_ptr to_pattern() diff --git a/include/deal.II/base/point.h b/include/deal.II/base/point.h index 785935bc05..980acdbda8 100644 --- a/include/deal.II/base/point.h +++ b/include/deal.II/base/point.h @@ -164,8 +164,7 @@ public: * Convert a boost::geometry::point to a dealii::Point. */ template ::type = 0> + std::enable_if_t<(dim == dummy_dim) && (dummy_dim != 0), int> = 0> Point(const boost::geometry::model:: point &boost_pt); @@ -437,9 +436,8 @@ Point::Point(const Number x, const Number y, const Number z) template -template < - std::size_t dummy_dim, - typename std::enable_if<(dim == dummy_dim) && (dummy_dim != 0), int>::type> +template > inline Point::Point( const boost::geometry::model:: point &boost_pt) diff --git a/include/deal.II/base/symmetric_tensor.h b/include/deal.II/base/symmetric_tensor.h index e8afc5fc6d..bd6c92434f 100644 --- a/include/deal.II/base/symmetric_tensor.h +++ b/include/deal.II/base/symmetric_tensor.h @@ -2598,10 +2598,9 @@ namespace internal // this function is for tensors of a rank not already handled // above template - constexpr inline - typename std::enable_if>::type - unrolled_to_component_indices(const unsigned int i, - const std::integral_constant &) + constexpr inline std::enable_if_t> + unrolled_to_component_indices(const unsigned int i, + const std::integral_constant &) { (void)i; Assert( diff --git a/include/deal.II/base/tensor.h b/include/deal.II/base/tensor.h index 43c6a6163e..c9798ba383 100644 --- a/include/deal.II/base/tensor.h +++ b/include/deal.II/base/tensor.h @@ -1661,11 +1661,11 @@ namespace internal int dim, typename Number, typename OtherNumber, - typename std::enable_if< + std::enable_if_t< !std::is_integral< typename ProductType::type>::value && !std::is_same::value, - int>::type = 0> + int> = 0> constexpr DEAL_II_CUDA_HOST_DEV inline DEAL_II_ALWAYS_INLINE void division_operator(Tensor (&t)[dim], const OtherNumber &factor) @@ -1681,11 +1681,11 @@ namespace internal int dim, typename Number, typename OtherNumber, - typename std::enable_if< + std::enable_if_t< std::is_integral< typename ProductType::type>::value || std::is_same::value, - int>::type = 0> + int> = 0> constexpr DEAL_II_CUDA_HOST_DEV inline DEAL_II_ALWAYS_INLINE void division_operator(Tensor (&t)[dim], const OtherNumber &factor) @@ -2111,10 +2111,10 @@ namespace internal int dim, typename Number, typename OtherNumber, - typename std::enable_if< + std::enable_if_t< !std::is_integral< typename ProductType::type>::value, - int>::type = 0> + int> = 0> constexpr DEAL_II_CUDA_HOST_DEV inline DEAL_II_ALWAYS_INLINE Tensor::type> division_operator(const Tensor &t, @@ -2133,10 +2133,10 @@ namespace internal int dim, typename Number, typename OtherNumber, - typename std::enable_if< + std::enable_if_t< std::is_integral< typename ProductType::type>::value, - int>::type = 0> + int> = 0> constexpr DEAL_II_CUDA_HOST_DEV inline DEAL_II_ALWAYS_INLINE Tensor::type> division_operator(const Tensor &t, @@ -2318,7 +2318,7 @@ template = 1 && rank_2 >= 1>::type> + typename = std::enable_if_t= 1 && rank_2 >= 1>> constexpr inline DEAL_II_ALWAYS_INLINE typename Tensor - typename std::enable_if::value, - typename T::value_type>::type & + std::enable_if_t::value, typename T::value_type> & operator*() { AssertIndexRange(lane, T::size()); diff --git a/include/deal.II/base/work_stream.h b/include/deal.II/base/work_stream.h index c58c15a378..78034ce041 100644 --- a/include/deal.II/base/work_stream.h +++ b/include/deal.II/base/work_stream.h @@ -1212,8 +1212,7 @@ namespace WorkStream typename IteratorRangeType, typename ScratchData, typename CopyData, - typename = typename std::enable_if< - has_begin_and_end>::type> + typename = std::enable_if_t>> void run(IteratorRangeType iterator_range, Worker worker, @@ -1436,8 +1435,7 @@ namespace WorkStream typename IteratorRangeType, typename ScratchData, typename CopyData, - typename = typename std::enable_if< - has_begin_and_end>::type> + typename = std::enable_if_t>> void run(IteratorRangeType iterator_range, MainClass & main_object, diff --git a/include/deal.II/differentiation/ad/ad_drivers.h b/include/deal.II/differentiation/ad/ad_drivers.h index b57db4fe1b..d6820f2c0f 100644 --- a/include/deal.II/differentiation/ad/ad_drivers.h +++ b/include/deal.II/differentiation/ad/ad_drivers.h @@ -693,10 +693,9 @@ namespace Differentiation * Specialization for taped ADOL-C auto-differentiable numbers. */ template - struct Types< - ADNumberType, - typename std::enable_if::type_code == - NumberTypes::adolc_taped>::type> + struct Types::type_code == + NumberTypes::adolc_taped>> { /** * Typedef for tape indices. ADOL-C uses short integers, so @@ -715,10 +714,9 @@ namespace Differentiation * Specialization for taped ADOL-C auto-differentiable numbers. */ template - struct Numbers< - ADNumberType, - typename std::enable_if::type_code == - NumberTypes::adolc_taped>::type> + struct Numbers::type_code == + NumberTypes::adolc_taped>> { /** * A tape index that is unusable and can be used to invalidate recording @@ -765,8 +763,8 @@ namespace Differentiation struct TapedDrivers< ADNumberType, double, - typename std::enable_if::type_code == - NumberTypes::adolc_taped>::type> + std::enable_if_t::type_code == + NumberTypes::adolc_taped>> { using scalar_type = double; @@ -972,8 +970,8 @@ namespace Differentiation struct TapedDrivers< ADNumberType, double, - typename std::enable_if::type_code == - NumberTypes::adolc_taped>::type> + std::enable_if_t::type_code == + NumberTypes::adolc_taped>> { using scalar_type = double; @@ -1090,8 +1088,8 @@ namespace Differentiation struct TapedDrivers< ADNumberType, float, - typename std::enable_if::type_code == - NumberTypes::adolc_taped>::type> + std::enable_if_t::type_code == + NumberTypes::adolc_taped>> { using scalar_type = float; @@ -1224,10 +1222,10 @@ namespace Differentiation struct TapelessDrivers< ADNumberType, ScalarType, - typename std::enable_if::type_code == - NumberTypes::sacado_rad || - ADNumberTraits::type_code == - NumberTypes::sacado_rad_dfad>::type> + std::enable_if_t::type_code == + NumberTypes::sacado_rad || + ADNumberTraits::type_code == + NumberTypes::sacado_rad_dfad>> { /** * Constructor @@ -1314,12 +1312,12 @@ namespace Differentiation struct TapelessDrivers< ADNumberType, ScalarType, - typename std::enable_if::type_code == - NumberTypes::adolc_tapeless || - ADNumberTraits::type_code == - NumberTypes::sacado_dfad || - ADNumberTraits::type_code == - NumberTypes::sacado_dfad_dfad>::type> + std::enable_if_t::type_code == + NumberTypes::adolc_tapeless || + ADNumberTraits::type_code == + NumberTypes::sacado_dfad || + ADNumberTraits::type_code == + NumberTypes::sacado_dfad_dfad>> { /** * Constructor diff --git a/include/deal.II/differentiation/ad/ad_number_traits.h b/include/deal.II/differentiation/ad/ad_number_traits.h index 1d3cf5e3a5..11fa846138 100644 --- a/include/deal.II/differentiation/ad/ad_number_traits.h +++ b/include/deal.II/differentiation/ad/ad_number_traits.h @@ -324,8 +324,7 @@ namespace Differentiation struct ADNumberInfoFromEnum< ScalarType, Differentiation::AD::NumberTypes::none, - typename std::enable_if< - std::is_floating_point::value>::type> + std::enable_if_t::value>> { static const bool is_taped = false; using real_type = ScalarType; @@ -340,9 +339,9 @@ namespace Differentiation * mechanism can be employed (e.g. Sacado types). */ template - struct Marking::value>::type> + struct Marking< + ScalarType, + std::enable_if_t::value>> { /** * Initialize the state of an independent variable. @@ -380,9 +379,8 @@ namespace Differentiation * A specialization of the marking strategy for complex numbers. */ template - struct Marking< - ADNumberType, - typename std::enable_if::value>::type> + struct Marking::value>> { /* * Initialize the state of an independent variable. @@ -457,8 +455,8 @@ namespace Differentiation template struct is_taped_ad_number< NumberType, - typename std::enable_if< - ADNumberTraits::type>::is_taped>::type> + std::enable_if_t< + ADNumberTraits::type>::is_taped>> : std::true_type {}; @@ -470,8 +468,8 @@ namespace Differentiation template struct is_tapeless_ad_number< NumberType, - typename std::enable_if::type>::is_tapeless>::type> + std::enable_if_t< + ADNumberTraits::type>::is_tapeless>> : std::true_type {}; @@ -484,8 +482,8 @@ namespace Differentiation template struct is_real_valued_ad_number< NumberType, - typename std::enable_if::type>::is_real_valued>::type> + std::enable_if_t< + ADNumberTraits::type>::is_real_valued>> : std::true_type {}; @@ -498,8 +496,8 @@ namespace Differentiation template struct is_complex_valued_ad_number< NumberType, - typename std::enable_if::type>::is_complex_valued>::type> + std::enable_if_t::type>::is_complex_valued>> : std::true_type {}; @@ -535,9 +533,9 @@ namespace Differentiation * mechanism can be employed (e.g. Sacado types). */ template - struct ExtractData::value>::type> + struct ExtractData< + NumberType, + std::enable_if_t::value>> { /** * Extract the floating point value. @@ -631,9 +629,8 @@ namespace Differentiation */ template static auto - value(const F &f, - typename std::enable_if::value>::type * = - nullptr) -> decltype(dealii::internal::NumberType::value(f)) + value(const F &f, std::enable_if_t::value> * = nullptr) + -> decltype(dealii::internal::NumberType::value(f)) { // We call the other function defined in the numbers // header to take care of all of the usual cases. @@ -649,9 +646,8 @@ namespace Differentiation template static T value(const F &f, - typename std::enable_if::value && - std::is_floating_point::value>::type - * = nullptr) + std::enable_if_t::value && + std::is_floating_point::value> * = nullptr) { // We recursively call this function in case the AD number is a // nested one. The recursion ends when the extracted value is @@ -668,8 +664,8 @@ namespace Differentiation template static T value(const F &f, - typename std::enable_if::value && - is_ad_number::value>::type * = nullptr) + std::enable_if_t::value && is_ad_number::value> + * = nullptr) { return T(f); } @@ -683,9 +679,7 @@ namespace Differentiation */ template static auto - value( - const F &f, - typename std::enable_if::value>::type * = nullptr) + value(const F &f, std::enable_if_t::value> * = nullptr) -> decltype(dealii::internal::NumberType>::value(f)) { // We call the other function defined in the numbers @@ -701,9 +695,8 @@ namespace Differentiation template static std::complex value(const F &f, - typename std::enable_if::value && - std::is_floating_point::value>::type - * = nullptr) + std::enable_if_t::value && + std::is_floating_point::value> * = nullptr) { // We recursively call this function in case the AD number is a // nested one. The recursion ends when the extracted value is @@ -751,11 +744,11 @@ namespace Differentiation struct NumberTraits< ScalarType, ADNumberTypeCode, - typename std::enable_if< + std::enable_if_t< std::is_floating_point::value || (boost::is_complex::value && - std::is_floating_point::type>::value)>::type> + std::is_floating_point< + typename internal::RemoveComplexWrapper::type>::value)>> { /** * The type of taping used @@ -950,11 +943,11 @@ namespace Differentiation const bool NumberTraits< ScalarType, ADNumberTypeCode, - typename std::enable_if< + std::enable_if_t< std::is_floating_point::value || (boost::is_complex::value && std::is_floating_point::type>::value)>::type>::is_taped = + ScalarType>::type>::value)>>::is_taped = internal::ADNumberInfoFromEnum< typename internal::RemoveComplexWrapper::type, ADNumberTypeCode>::is_taped; @@ -964,11 +957,11 @@ namespace Differentiation const bool NumberTraits< ScalarType, ADNumberTypeCode, - typename std::enable_if< + std::enable_if_t< std::is_floating_point::value || (boost::is_complex::value && std::is_floating_point::type>::value)>::type>::is_tapeless = + ScalarType>::type>::value)>>::is_tapeless = !(NumberTraits::is_taped); @@ -976,11 +969,11 @@ namespace Differentiation const bool NumberTraits< ScalarType, ADNumberTypeCode, - typename std::enable_if< + std::enable_if_t< std::is_floating_point::value || (boost::is_complex::value && std::is_floating_point::type>::value)>::type>::is_real_valued = + ScalarType>::type>::value)>>::is_real_valued = (!boost::is_complex::value); @@ -988,11 +981,11 @@ namespace Differentiation const bool NumberTraits< ScalarType, ADNumberTypeCode, - typename std::enable_if< + std::enable_if_t< std::is_floating_point::value || (boost::is_complex::value && std::is_floating_point::type>::value)>::type>::is_complex_valued = + ScalarType>::type>::value)>>::is_complex_valued = !(NumberTraits::is_real_valued); @@ -1000,11 +993,11 @@ namespace Differentiation const unsigned int NumberTraits< ScalarType, ADNumberTypeCode, - typename std::enable_if< + std::enable_if_t< std::is_floating_point::value || (boost::is_complex::value && std::is_floating_point::type>::value)>::type>::n_supported_derivative_levels = + ScalarType>::type>::value)>>::n_supported_derivative_levels = internal::ADNumberInfoFromEnum< typename internal::RemoveComplexWrapper::type, ADNumberTypeCode>::n_supported_derivative_levels; @@ -1015,55 +1008,55 @@ namespace Differentiation constexpr bool NumberTraits< ScalarType, ADNumberTypeCode, - typename std::enable_if< + std::enable_if_t< std::is_floating_point::value || (boost::is_complex::value && std::is_floating_point::type>::value)>::type>::is_taped; + ScalarType>::type>::value)>>::is_taped; template constexpr bool NumberTraits< ScalarType, ADNumberTypeCode, - typename std::enable_if< + std::enable_if_t< std::is_floating_point::value || (boost::is_complex::value && std::is_floating_point::type>::value)>::type>::is_tapeless; + ScalarType>::type>::value)>>::is_tapeless; template constexpr bool NumberTraits< ScalarType, ADNumberTypeCode, - typename std::enable_if< + std::enable_if_t< std::is_floating_point::value || (boost::is_complex::value && std::is_floating_point::type>::value)>::type>::is_real_valued; + ScalarType>::type>::value)>>::is_real_valued; template constexpr bool NumberTraits< ScalarType, ADNumberTypeCode, - typename std::enable_if< + std::enable_if_t< std::is_floating_point::value || (boost::is_complex::value && std::is_floating_point::type>::value)>::type>::is_complex_valued; + ScalarType>::type>::value)>>::is_complex_valued; template constexpr unsigned int NumberTraits< ScalarType, ADNumberTypeCode, - typename std::enable_if< + std::enable_if_t< std::is_floating_point::value || (boost::is_complex::value && std::is_floating_point::type>::value)>::type>::n_supported_derivative_levels; + ScalarType>::type>::value)>>::n_supported_derivative_levels; # endif @@ -1082,11 +1075,11 @@ namespace Differentiation struct NumberTraits< ScalarType, NumberTypes::none, - typename std::enable_if< + std::enable_if_t< std::is_floating_point::value || (boost::is_complex::value && - std::is_floating_point::type>::value)>::type> + std::is_floating_point< + typename internal::RemoveComplexWrapper::type>::value)>> { /** * The internal number type code. @@ -1251,33 +1244,33 @@ namespace Differentiation const bool NumberTraits< ScalarType, NumberTypes::none, - typename std::enable_if< + std::enable_if_t< std::is_floating_point::value || (boost::is_complex::value && std::is_floating_point::type>::value)>::type>::is_taped = false; + ScalarType>::type>::value)>>::is_taped = false; template const bool NumberTraits< ScalarType, NumberTypes::none, - typename std::enable_if< + std::enable_if_t< std::is_floating_point::value || (boost::is_complex::value && std::is_floating_point::type>::value)>::type>::is_tapeless = false; + ScalarType>::type>::value)>>::is_tapeless = false; template const bool NumberTraits< ScalarType, NumberTypes::none, - typename std::enable_if< + std::enable_if_t< std::is_floating_point::value || (boost::is_complex::value && std::is_floating_point::type>::value)>::type>::is_real_valued = + ScalarType>::type>::value)>>::is_real_valued = (!boost::is_complex::value); @@ -1285,11 +1278,11 @@ namespace Differentiation const bool NumberTraits< ScalarType, NumberTypes::none, - typename std::enable_if< + std::enable_if_t< std::is_floating_point::value || (boost::is_complex::value && std::is_floating_point::type>::value)>::type>::is_complex_valued = + ScalarType>::type>::value)>>::is_complex_valued = !(NumberTraits::is_real_valued); @@ -1297,12 +1290,11 @@ namespace Differentiation const unsigned int NumberTraits< ScalarType, NumberTypes::none, - typename std::enable_if< + std::enable_if_t< std::is_floating_point::value || (boost::is_complex::value && std::is_floating_point::type>::value)>::type>::n_supported_derivative_levels = - 0; + ScalarType>::type>::value)>>::n_supported_derivative_levels = 0; # else @@ -1310,55 +1302,55 @@ namespace Differentiation constexpr bool NumberTraits< ScalarType, NumberTypes::none, - typename std::enable_if< + std::enable_if_t< std::is_floating_point::value || (boost::is_complex::value && std::is_floating_point::type>::value)>::type>::is_taped; + ScalarType>::type>::value)>>::is_taped; template constexpr bool NumberTraits< ScalarType, NumberTypes::none, - typename std::enable_if< + std::enable_if_t< std::is_floating_point::value || (boost::is_complex::value && std::is_floating_point::type>::value)>::type>::is_tapeless; + ScalarType>::type>::value)>>::is_tapeless; template constexpr bool NumberTraits< ScalarType, NumberTypes::none, - typename std::enable_if< + std::enable_if_t< std::is_floating_point::value || (boost::is_complex::value && std::is_floating_point::type>::value)>::type>::is_real_valued; + ScalarType>::type>::value)>>::is_real_valued; template constexpr bool NumberTraits< ScalarType, NumberTypes::none, - typename std::enable_if< + std::enable_if_t< std::is_floating_point::value || (boost::is_complex::value && std::is_floating_point::type>::value)>::type>::is_complex_valued; + ScalarType>::type>::value)>>::is_complex_valued; template constexpr unsigned int NumberTraits< ScalarType, NumberTypes::none, - typename std::enable_if< + std::enable_if_t< std::is_floating_point::value || (boost::is_complex::value && std::is_floating_point::type>::value)>::type>::n_supported_derivative_levels; + ScalarType>::type>::value)>>::n_supported_derivative_levels; # endif @@ -1384,7 +1376,7 @@ namespace Differentiation template struct ADNumberTraits< ScalarType, - typename std::enable_if::value>::type> + std::enable_if_t::value>> : NumberTraits {}; @@ -1394,10 +1386,10 @@ namespace Differentiation template struct ADNumberTraits< ComplexScalarType, - typename std::enable_if< + std::enable_if_t< boost::is_complex::value && - std::is_floating_point::value>:: - type> : NumberTraits + std::is_floating_point::value>> + : NumberTraits {}; } // namespace AD diff --git a/include/deal.II/differentiation/ad/adolc_number_types.h b/include/deal.II/differentiation/ad/adolc_number_types.h index da96b165f8..a4e3160c37 100644 --- a/include/deal.II/differentiation/ad/adolc_number_types.h +++ b/include/deal.II/differentiation/ad/adolc_number_types.h @@ -110,8 +110,7 @@ namespace Differentiation struct ADNumberInfoFromEnum< ScalarType, Differentiation::AD::NumberTypes::adolc_taped, - typename std::enable_if< - std::is_floating_point::value>::type> + std::enable_if_t::value>> { static const bool is_taped = true; using real_type = adouble; @@ -129,8 +128,7 @@ namespace Differentiation struct ADNumberInfoFromEnum< ScalarType, Differentiation::AD::NumberTypes::adolc_tapeless, - typename std::enable_if< - std::is_floating_point::value>::type> + std::enable_if_t::value>> { static const bool is_taped = false; using real_type = adtl::adouble; @@ -142,9 +140,9 @@ namespace Differentiation template struct Marking< ADNumberType, - typename std::enable_if< - ADNumberTraits::type_code == NumberTypes::adolc_taped && - ADNumberTraits::is_real_valued>::type> + std::enable_if_t::type_code == + NumberTypes::adolc_taped && + ADNumberTraits::is_real_valued>> { using scalar_type = typename ADNumberTraits::scalar_type; @@ -178,11 +176,11 @@ namespace Differentiation }; template - struct Marking::type_code == - NumberTypes::adolc_tapeless && - ADNumberTraits::is_real_valued>::type> + struct Marking< + ADNumberType, + std::enable_if_t::type_code == + NumberTypes::adolc_tapeless && + ADNumberTraits::is_real_valued>> { using scalar_type = typename ADNumberTraits::scalar_type; @@ -331,7 +329,7 @@ namespace Differentiation template struct ADNumberTraits< ADNumberType, - typename std::enable_if::value>::type> + std::enable_if_t::value>> : NumberTraits { static_assert(std::is_same::value, @@ -353,8 +351,8 @@ namespace Differentiation template struct ADNumberTraits< ADNumberType, - typename std::enable_if< - std::is_same>::value>::type> + std::enable_if_t< + std::is_same>::value>> : NumberTraits, NumberTypes::adolc_taped> { static_assert(std::is_same>::value, @@ -375,8 +373,7 @@ namespace Differentiation template struct ADNumberTraits< ADNumberType, - typename std::enable_if< - std::is_same::value>::type> + std::enable_if_t::value>> : NumberTraits { static_assert(std::is_same::value, @@ -398,8 +395,8 @@ namespace Differentiation template struct ADNumberTraits< ADNumberType, - typename std::enable_if< - std::is_same>::value>::type> + std::enable_if_t< + std::is_same>::value>> : NumberTraits, NumberTypes::adolc_tapeless> { static_assert(std::is_same>::value, @@ -463,9 +460,9 @@ namespace Differentiation template struct is_adolc_taped_number< NumberType, - typename std::enable_if< - ADNumberTraits::type>::type_code == - NumberTypes::adolc_taped>::type> : std::true_type + std::enable_if_t::type>:: + type_code == NumberTypes::adolc_taped>> + : std::true_type {}; @@ -476,9 +473,9 @@ namespace Differentiation template struct is_adolc_tapeless_number< NumberType, - typename std::enable_if< - ADNumberTraits::type>::type_code == - NumberTypes::adolc_tapeless>::type> : std::true_type + std::enable_if_t::type>:: + type_code == NumberTypes::adolc_tapeless>> + : std::true_type {}; @@ -487,10 +484,10 @@ namespace Differentiation * parameter is a (real or complex; taped or tapeless) ADOL-C number. */ template - struct is_adolc_number::value || - is_adolc_tapeless_number::value>::type> + struct is_adolc_number< + NumberType, + std::enable_if_t::value || + is_adolc_tapeless_number::value>> : std::true_type {}; diff --git a/include/deal.II/differentiation/ad/sacado_math.h b/include/deal.II/differentiation/ad/sacado_math.h index 792ce45fdf..655d281ce7 100644 --- a/include/deal.II/differentiation/ad/sacado_math.h +++ b/include/deal.II/differentiation/ad/sacado_math.h @@ -38,10 +38,10 @@ namespace std */ template < typename ADNumberType, - typename = typename std::enable_if< + typename = std::enable_if_t< dealii::Differentiation::AD::is_sacado_number::value && dealii::Differentiation::AD::is_real_valued_ad_number< - ADNumberType>::value>::type> + ADNumberType>::value>> inline ADNumberType erf(ADNumberType x) { @@ -89,8 +89,8 @@ namespace std */ template < typename ADNumberType, - typename = typename std::enable_if< - dealii::Differentiation::AD::is_sacado_number::value>::type> + typename = std::enable_if_t< + dealii::Differentiation::AD::is_sacado_number::value>> inline ADNumberType erfc(const ADNumberType &x) { diff --git a/include/deal.II/differentiation/ad/sacado_number_types.h b/include/deal.II/differentiation/ad/sacado_number_types.h index 12e089f935..f55e0de9ca 100644 --- a/include/deal.II/differentiation/ad/sacado_number_types.h +++ b/include/deal.II/differentiation/ad/sacado_number_types.h @@ -147,9 +147,9 @@ namespace Differentiation template struct SacadoNumberInfo< SacadoNumber, - typename std::enable_if>::value>::type> + Sacado::Fad::DFad>::value>> { using ad_type = SacadoNumber; using scalar_type = typename ad_type::scalar_type; @@ -167,9 +167,9 @@ namespace Differentiation template struct SacadoNumberInfo< SacadoNumber, - typename std::enable_if>::value>::type> + Sacado::Rad::ADvar>::value>> { using ad_type = SacadoNumber; using scalar_type = typename ad_type::ADVari::scalar_type; @@ -188,10 +188,9 @@ namespace Differentiation * templates used in the above specializations. */ template - struct SacadoNumberInfo< - Number, - typename std::enable_if< - std::is_arithmetic::type>::value>::type> + struct SacadoNumberInfo::type>::value>> { static const unsigned int n_supported_derivative_levels = 0; }; @@ -205,8 +204,7 @@ namespace Differentiation struct ADNumberInfoFromEnum< ScalarType, Differentiation::AD::NumberTypes::sacado_dfad, - typename std::enable_if< - std::is_floating_point::value>::type> + std::enable_if_t::value>> { static const bool is_taped = false; using real_type = Sacado::Fad::DFad; @@ -225,8 +223,7 @@ namespace Differentiation struct ADNumberInfoFromEnum< ScalarType, Differentiation::AD::NumberTypes::sacado_dfad_dfad, - typename std::enable_if< - std::is_floating_point::value>::type> + std::enable_if_t::value>> { static const bool is_taped = false; using real_type = Sacado::Fad::DFad>; @@ -245,8 +242,7 @@ namespace Differentiation struct ADNumberInfoFromEnum< ScalarType, Differentiation::AD::NumberTypes::sacado_rad, - typename std::enable_if< - std::is_floating_point::value>::type> + std::enable_if_t::value>> { static const bool is_taped = false; using real_type = Sacado::Rad::ADvar; @@ -265,8 +261,7 @@ namespace Differentiation struct ADNumberInfoFromEnum< ScalarType, Differentiation::AD::NumberTypes::sacado_rad_dfad, - typename std::enable_if< - std::is_floating_point::value>::type> + std::enable_if_t::value>> { static const bool is_taped = false; using real_type = Sacado::Rad::ADvar>; @@ -486,9 +481,9 @@ namespace Differentiation template struct ADNumberTraits< ADNumberType, - typename std::enable_if>::value>::type> + Sacado::Fad::DFad>::value>> : NumberTraits {}; @@ -503,10 +498,10 @@ namespace Differentiation template struct ADNumberTraits< ADNumberType, - typename std::enable_if>>::value>::type> + typename ADNumberType::value_type::scalar_type>>>::value>> : NumberTraits< std::complex, NumberTypes::sacado_dfad> @@ -575,10 +570,9 @@ namespace Differentiation template struct ADNumberTraits< ADNumberType, - typename std::enable_if>:: - value>::type> + Sacado::Rad::ADvar>::value>> : NumberTraits {}; @@ -620,10 +614,10 @@ namespace Differentiation template struct ADNumberTraits< ADNumberType, - typename std::enable_if>>::value>::type> + std::complex>>::value>> : NumberTraits< std::complex, NumberTypes::sacado_rad> @@ -669,12 +663,11 @@ namespace Differentiation * a floating point type. */ template - struct ADNumberTraits< - ADNumberType, - typename std::enable_if< - std::is_same>>::value>::type> + struct ADNumberTraits>>::value>> : NumberTraits {}; @@ -690,10 +683,10 @@ namespace Differentiation template struct ADNumberTraits< ADNumberType, - typename std::enable_if>>>::value>::type> + typename ADNumberType::value_type::scalar_type>>>>::value>> : NumberTraits< std::complex, NumberTypes::sacado_dfad_dfad> @@ -766,10 +759,10 @@ namespace Differentiation template struct ADNumberTraits< ADNumberType, - typename std::enable_if>>::value>::type> + std::enable_if_t< + std::is_same>>::value>> : NumberTraits {}; @@ -814,11 +807,10 @@ namespace Differentiation template struct ADNumberTraits< ADNumberType, - typename std::enable_if>>>::value>:: - type> + typename ADNumberType::value_type::ADVari::scalar_type>>>>::value>> : NumberTraits< std::complex, NumberTypes::sacado_rad_dfad> @@ -862,20 +854,20 @@ namespace Differentiation template struct is_sacado_dfad_number< NumberType, - typename std::enable_if< + std::enable_if_t< ADNumberTraits::type>::type_code == NumberTypes::sacado_dfad || ADNumberTraits::type>::type_code == - NumberTypes::sacado_dfad_dfad>::type> : std::true_type + NumberTypes::sacado_dfad_dfad>> : std::true_type {}; template struct is_sacado_dfad_number< NumberType, - typename std::enable_if>::value>::type> + Sacado::Fad::Expr>::value>> : std::true_type {}; @@ -883,21 +875,21 @@ namespace Differentiation template struct is_sacado_rad_number< NumberType, - typename std::enable_if< + std::enable_if_t< ADNumberTraits::type>::type_code == NumberTypes::sacado_rad || ADNumberTraits::type>::type_code == - NumberTypes::sacado_rad_dfad>::type> : std::true_type + NumberTypes::sacado_rad_dfad>> : std::true_type {}; template struct is_sacado_rad_number< NumberType, - typename std::enable_if>>::value>::type> + std::enable_if_t< + std::is_same>>::value>> : std::true_type {}; @@ -905,8 +897,8 @@ namespace Differentiation template struct is_sacado_number< NumberType, - typename std::enable_if::value || - is_sacado_rad_number::value>::type> + std::enable_if_t::value || + is_sacado_rad_number::value>> : std::true_type {}; @@ -919,8 +911,9 @@ namespace numbers template struct is_cuda_compatible< NumberType, - typename std::enable_if::value>::type> : std::false_type + std::enable_if_t< + dealii::Differentiation::AD::is_sacado_rad_number::value>> + : std::false_type {}; } // namespace numbers diff --git a/include/deal.II/differentiation/sd/symengine_math.h b/include/deal.II/differentiation/sd/symengine_math.h index ac0db7c884..38b7c7e471 100644 --- a/include/deal.II/differentiation/sd/symengine_math.h +++ b/include/deal.II/differentiation/sd/symengine_math.h @@ -67,9 +67,9 @@ namespace Differentiation * * This variant is used when the @p exponent is not a Expression. */ - template ::value>::type> + template < + typename NumberType, + typename = std::enable_if_t::value>> Expression pow(const Expression &base, const NumberType &exponent) { @@ -86,9 +86,9 @@ namespace Differentiation * * This variant is used when the @p base is not a Expression. */ - template ::value>::type> + template < + typename NumberType, + typename = std::enable_if_t::value>> Expression pow(const NumberType &base, const Expression &exponent) { @@ -152,9 +152,9 @@ namespace Differentiation * * This variant is used when the @p base is not a Expression. */ - template ::value>::type> + template < + typename NumberType, + typename = std::enable_if_t::value>> Expression log(const Expression &x, const NumberType &base) { @@ -171,9 +171,9 @@ namespace Differentiation * * This variant is used when the @p value is not a Expression. */ - template ::value>::type> + template < + typename NumberType, + typename = std::enable_if_t::value>> Expression log(const NumberType &x, const Expression &base) { @@ -311,9 +311,9 @@ namespace Differentiation * * This variant is used when the numerator @p y is not a Expression. */ - template ::value>::type> + template < + typename NumberType, + typename = std::enable_if_t::value>> Expression atan2(const NumberType &y, const Expression &x) { @@ -331,9 +331,9 @@ namespace Differentiation * * This variant is used when the denominator @p x is not a Expression. */ - template ::value>::type> + template < + typename NumberType, + typename = std::enable_if_t::value>> Expression atan2(const Expression &y, const NumberType &x) { @@ -600,9 +600,9 @@ namespace Differentiation * * This variant is used when @p b is not a Expression. */ - template ::value>::type> + template < + typename NumberType, + typename = std::enable_if_t::value>> Expression max(const Expression &a, const NumberType &b) { @@ -619,9 +619,9 @@ namespace Differentiation * * This variant is used when @p a is not a Expression. */ - template ::value>::type> + template < + typename NumberType, + typename = std::enable_if_t::value>> Expression max(const NumberType &a, const Expression &b) { @@ -648,9 +648,9 @@ namespace Differentiation * * This variant is used when @p b is not a Expression. */ - template ::value>::type> + template < + typename NumberType, + typename = std::enable_if_t::value>> Expression min(const Expression &a, const NumberType &b) { @@ -667,9 +667,9 @@ namespace Differentiation * * This variant is used when @p a is not a Expression. */ - template ::value>::type> + template < + typename NumberType, + typename = std::enable_if_t::value>> Expression min(const NumberType &a, const Expression &b) { diff --git a/include/deal.II/differentiation/sd/symengine_number_types.h b/include/deal.II/differentiation/sd/symengine_number_types.h index 7470ecdd55..a90c29470b 100644 --- a/include/deal.II/differentiation/sd/symengine_number_types.h +++ b/include/deal.II/differentiation/sd/symengine_number_types.h @@ -203,9 +203,9 @@ namespace Differentiation * potential ambiguities related to implicit conversions in either user * code or math functions that are loaded into the standard namespace. */ - template ::value>::type> + template < + typename NumberType, + typename = std::enable_if_t::value>> explicit Expression(const NumberType &value); /** @@ -215,9 +215,9 @@ namespace Differentiation * potential ambiguities related to implicit conversions in either user * code or math functions that are loaded into the standard namespace. */ - template ::value>::type> + template < + typename NumberType, + typename = std::enable_if_t::value>> explicit Expression(const std::complex &value); /** @@ -231,9 +231,9 @@ namespace Differentiation * It is expected that both the @p numerator and @p denominator * be integral types. */ - template ::value>::type> + template < + typename NumberType, + typename = std::enable_if_t::value>> Expression(const NumberType &numerator, const NumberType &denominator); /** @@ -1084,8 +1084,8 @@ namespace Differentiation * scalar expressions using Expression more natural. */ template ::value>::type> + typename = std::enable_if_t< + std::is_constructible::value>> inline Expression operator+(const NumberType &lhs, const Expression &rhs) { @@ -1101,8 +1101,8 @@ namespace Differentiation * scalar expressions using Expression more natural. */ template ::value>::type> + typename = std::enable_if_t< + std::is_constructible::value>> inline Expression operator+(const Expression &lhs, const NumberType &rhs) { @@ -1118,8 +1118,8 @@ namespace Differentiation * scalar expressions using Expression more natural. */ template ::value>::type> + typename = std::enable_if_t< + std::is_constructible::value>> inline Expression operator-(const NumberType &lhs, const Expression &rhs) { @@ -1135,8 +1135,8 @@ namespace Differentiation * scalar expressions using Expression more natural. */ template ::value>::type> + typename = std::enable_if_t< + std::is_constructible::value>> inline Expression operator-(const Expression &lhs, const NumberType &rhs) { @@ -1152,8 +1152,8 @@ namespace Differentiation * scalar expressions using Expression more natural. */ template ::value>::type> + typename = std::enable_if_t< + std::is_constructible::value>> inline Expression operator*(const NumberType &lhs, const Expression &rhs) { @@ -1169,8 +1169,8 @@ namespace Differentiation * scalar expressions using Expression more natural. */ template ::value>::type> + typename = std::enable_if_t< + std::is_constructible::value>> inline Expression operator*(const Expression &lhs, const NumberType &rhs) { @@ -1186,8 +1186,8 @@ namespace Differentiation * scalar expressions using Expression more natural. */ template ::value>::type> + typename = std::enable_if_t< + std::is_constructible::value>> inline Expression operator/(const NumberType &lhs, const Expression &rhs) { @@ -1203,8 +1203,8 @@ namespace Differentiation * scalar expressions using Expression more natural. */ template ::value>::type> + typename = std::enable_if_t< + std::is_constructible::value>> inline Expression operator/(const Expression &lhs, const NumberType &rhs) { @@ -1376,27 +1376,24 @@ namespace internal return t; } - template < - typename T, - typename = typename std::enable_if::value>::type> + template ::value>> static Differentiation::SD::Expression value(const T &t) { return Differentiation::SD::Expression(t); } - template < - typename T, - typename = typename std::enable_if::value>::type> + template ::value>> static Differentiation::SD::Expression value(T &&t) { return Differentiation::SD::Expression(t); } - template < - typename T, - typename = typename std::enable_if::value>::type> + template ::value>> static Differentiation::SD::Expression value(const std::complex &t) { diff --git a/include/deal.II/differentiation/sd/symengine_optimizer.h b/include/deal.II/differentiation/sd/symengine_optimizer.h index 07f76f579e..caeddd3d81 100644 --- a/include/deal.II/differentiation/sd/symengine_optimizer.h +++ b/include/deal.II/differentiation/sd/symengine_optimizer.h @@ -372,7 +372,7 @@ namespace Differentiation template struct SupportedOptimizerTypeTraits< ReturnType_, - typename std::enable_if::value>::type> + std::enable_if_t::value>> { static const bool is_supported = true; @@ -388,9 +388,9 @@ namespace Differentiation template struct SupportedOptimizerTypeTraits< ReturnType_, - typename std::enable_if< + std::enable_if_t< boost::is_complex::value && - std::is_arithmetic::value>::type> + std::is_arithmetic::value>> { static const bool is_supported = true; @@ -403,10 +403,9 @@ namespace Differentiation template - struct DictionaryOptimizer< - ReturnType_, - typename std::enable_if< - SupportedOptimizerTypeTraits::is_supported>::type> + struct DictionaryOptimizer::is_supported>> { using ReturnType = typename SupportedOptimizerTypeTraits::ReturnType; @@ -502,10 +501,9 @@ namespace Differentiation template - struct LambdaOptimizer< - ReturnType_, - typename std::enable_if< - SupportedOptimizerTypeTraits::is_supported>::type> + struct LambdaOptimizer::is_supported>> { using ReturnType = typename std::conditional::value, @@ -605,7 +603,7 @@ namespace Differentiation template struct LLVMOptimizer< ReturnType_, - typename std::enable_if::value>::type> + std::enable_if_t::value>> { using ReturnType = typename std::conditional::value, @@ -719,9 +717,9 @@ namespace Differentiation template struct LLVMOptimizer< ReturnType_, - typename std::enable_if< + std::enable_if_t< boost::is_complex::value && - std::is_arithmetic::value>::type> + std::is_arithmetic::value>> { // Since there is no working implementation, these are dummy types // that help with templating in the calling function. @@ -821,11 +819,11 @@ namespace Differentiation template - struct OptimizerHelper::value>::type> + struct OptimizerHelper< + ReturnType, + Optimizer, + std::enable_if_t< + std::is_same::value>> { /** * Initialize an instance of an optimizer. @@ -963,11 +961,11 @@ namespace Differentiation }; template - struct OptimizerHelper::value>::type> + struct OptimizerHelper< + ReturnType, + Optimizer, + std::enable_if_t< + !std::is_same::value>> { /** * Initialize an instance of an optimizer. diff --git a/include/deal.II/differentiation/sd/symengine_product_types.h b/include/deal.II/differentiation/sd/symengine_product_types.h index 5947f79916..c4eeeef252 100644 --- a/include/deal.II/differentiation/sd/symengine_product_types.h +++ b/include/deal.II/differentiation/sd/symengine_product_types.h @@ -67,7 +67,7 @@ namespace internal struct GeneralProductTypeImpl< T, Differentiation::SD::Expression, - typename std::enable_if::value>::type> + std::enable_if_t::value>> { using type = Differentiation::SD::Expression; }; @@ -76,9 +76,8 @@ namespace internal struct GeneralProductTypeImpl< T, Differentiation::SD::Expression, - typename std::enable_if< - boost::is_complex::value && - std::is_arithmetic::value>::type> + std::enable_if_t::value && + std::is_arithmetic::value>> { using type = Differentiation::SD::Expression; }; diff --git a/include/deal.II/differentiation/sd/symengine_scalar_operations.h b/include/deal.II/differentiation/sd/symengine_scalar_operations.h index 07d9d3ad51..505376e77d 100644 --- a/include/deal.II/differentiation/sd/symengine_scalar_operations.h +++ b/include/deal.II/differentiation/sd/symengine_scalar_operations.h @@ -303,11 +303,11 @@ namespace Differentiation template ::value && dealii::internal::is_explicitly_convertible< SymbolicType, - const SymEngine::RCP &>::value>::type> + const SymEngine::RCP &>::value>> void add_to_symbol_map(types::substitution_map &symbol_map, const SymbolicType & symbol); @@ -460,11 +460,11 @@ namespace Differentiation */ template &>::value && - std::is_constructible::value>::type> + std::is_constructible::value>> void set_value_in_symbol_map(types::substitution_map &substitution_map, const SymbolicType & symbol, @@ -649,11 +649,11 @@ namespace Differentiation */ template &>::value && - std::is_constructible::value>::type> + std::is_constructible::value>> types::substitution_map make_substitution_map(const ExpressionType &symbol, const ValueType &value); @@ -892,11 +892,11 @@ namespace Differentiation template &>::value && - std::is_constructible::value>::type> + std::is_constructible::value>> void add_to_substitution_map(types::substitution_map &substitution_map, const ExpressionType & symbol, @@ -938,11 +938,11 @@ namespace Differentiation template &>::value && - std::is_constructible::value>::type> + std::is_constructible::value>> void add_to_substitution_map(types::substitution_map & substitution_map, const std::vector &symbols, diff --git a/include/deal.II/fe/fe_tools_extrapolate.templates.h b/include/deal.II/fe/fe_tools_extrapolate.templates.h index 1cd1838cd7..e3615b0963 100644 --- a/include/deal.II/fe/fe_tools_extrapolate.templates.h +++ b/include/deal.II/fe/fe_tools_extrapolate.templates.h @@ -1469,9 +1469,8 @@ namespace FETools }; template - struct BlockTypeHelper< - VectorType, - typename std::enable_if::value>::type> + struct BlockTypeHelper::value>> { using type = typename VectorType::BlockType; }; diff --git a/include/deal.II/fe/fe_tools_interpolate.templates.h b/include/deal.II/fe/fe_tools_interpolate.templates.h index b5e6c7ff92..3c0dd8113f 100644 --- a/include/deal.II/fe/fe_tools_interpolate.templates.h +++ b/include/deal.II/fe/fe_tools_interpolate.templates.h @@ -350,7 +350,7 @@ namespace FETools namespace internal { template - typename std::enable_if::value>::type + std::enable_if_t::value> back_interpolate( const DoFHandler & dof1, const AffineConstraints &constraints1, diff --git a/include/deal.II/grid/tria_iterator.h b/include/deal.II/grid/tria_iterator.h index 27c0ff14d9..bfed183f29 100644 --- a/include/deal.II/grid/tria_iterator.h +++ b/include/deal.II/grid/tria_iterator.h @@ -381,8 +381,7 @@ public: * Compare for equality. */ template - typename std::enable_if::value, - bool>::type + std::enable_if_t::value, bool> operator==(const TriaRawIterator &) const; /** diff --git a/include/deal.II/grid/tria_iterator.templates.h b/include/deal.II/grid/tria_iterator.templates.h index 3a16dcfb92..31a9c944a5 100644 --- a/include/deal.II/grid/tria_iterator.templates.h +++ b/include/deal.II/grid/tria_iterator.templates.h @@ -83,11 +83,10 @@ TriaRawIterator::operator=(const TriaRawIterator &i) template template -inline - typename std::enable_if::value, - bool>::type - TriaRawIterator::operator==( - const TriaRawIterator &other) const +inline std::enable_if_t::value, + bool> +TriaRawIterator::operator==( + const TriaRawIterator &other) const { return accessor == other.accessor; } diff --git a/include/deal.II/lac/full_matrix.templates.h b/include/deal.II/lac/full_matrix.templates.h index 60e3accda8..81d4a11a03 100644 --- a/include/deal.II/lac/full_matrix.templates.h +++ b/include/deal.II/lac/full_matrix.templates.h @@ -1216,10 +1216,9 @@ namespace internal // LAPACKFullMatrix is only implemented for // floats and doubles template - struct Determinant< - number, - typename std::enable_if::value || - std::is_same::value>::type> + struct Determinant::value || + std::is_same::value>> { #ifdef DEAL_II_WITH_LAPACK static number diff --git a/include/deal.II/lac/la_parallel_vector.h b/include/deal.II/lac/la_parallel_vector.h index 37f8d5c897..a2bdced59a 100644 --- a/include/deal.II/lac/la_parallel_vector.h +++ b/include/deal.II/lac/la_parallel_vector.h @@ -1933,18 +1933,18 @@ namespace internal is_supported_operation; // Used for (Trilinos/PETSc)Wrappers::SparseMatrix - template < - typename MatrixType, + template = 1900 - typename std::enable_if && - has_locally_owned_domain_indices, + std::enable_if_t && + has_locally_owned_domain_indices, #else - // workaround for Intel 18 - typename std::enable_if< - is_supported_operation && - is_supported_operation, + // workaround for Intel 18 + std::enable_if_t< + is_supported_operation && + is_supported_operation, #endif - MatrixType>::type * = nullptr> + MatrixType> * = nullptr> static void reinit_domain_vector(MatrixType & mat, LinearAlgebra::distributed::Vector &vec, @@ -1957,13 +1957,13 @@ namespace internal // Used for MatrixFree and DiagonalMatrix template = 1900 - typename std::enable_if, + std::enable_if_t, #else // workaround for Intel 18 - typename std::enable_if< + std::enable_if_t< is_supported_operation, #endif - MatrixType>::type * = nullptr> + MatrixType> * = nullptr> static void reinit_domain_vector(MatrixType & mat, LinearAlgebra::distributed::Vector &vec, @@ -1975,18 +1975,18 @@ namespace internal } // Used for (Trilinos/PETSc)Wrappers::SparseMatrix - template < - typename MatrixType, + template = 1900 - typename std::enable_if && - has_locally_owned_range_indices, + std::enable_if_t && + has_locally_owned_range_indices, #else - // workaround for Intel 18 - typename std::enable_if< - is_supported_operation && - is_supported_operation, + // workaround for Intel 18 + std::enable_if_t< + is_supported_operation && + is_supported_operation, #endif - MatrixType>::type * = nullptr> + MatrixType> * = nullptr> static void reinit_range_vector(MatrixType & mat, LinearAlgebra::distributed::Vector &vec, @@ -1999,13 +1999,13 @@ namespace internal // Used for MatrixFree and DiagonalMatrix template = 1900 - typename std::enable_if, + std::enable_if_t, #else // workaround for Intel 18 - typename std::enable_if< + std::enable_if_t< is_supported_operation, #endif - MatrixType>::type * = nullptr> + MatrixType> * = nullptr> static void reinit_range_vector(MatrixType & mat, LinearAlgebra::distributed::Vector &vec, diff --git a/include/deal.II/lac/linear_operator.h b/include/deal.II/lac/linear_operator.h index 137edca19b..321724d443 100644 --- a/include/deal.II/lac/linear_operator.h +++ b/include/deal.II/lac/linear_operator.h @@ -238,10 +238,10 @@ public: * object @p op for which the conversion function * linear_operator is defined. */ - template , - Op>::value>::type> + template < + typename Op, + typename = std::enable_if_t< + !std::is_base_of, Op>::value>> LinearOperator(const Op &op) { *this = linear_operator(op); @@ -257,10 +257,10 @@ public: * Templated copy assignment operator for an object @p op for which the * conversion function linear_operator is defined. */ - template , - Op>::value>::type> + template < + typename Op, + typename = std::enable_if_t< + !std::is_base_of, Op>::value>> LinearOperator & operator=(const Op &op) { @@ -1492,8 +1492,7 @@ template < typename Payload = internal::LinearOperatorImplementation::EmptyPayload, typename OperatorExemplar, typename Matrix, - typename = - typename std::enable_if::value>::type> + typename = std::enable_if_t::value>> LinearOperator linear_operator(const OperatorExemplar &, Matrix &&) = delete; @@ -1503,11 +1502,11 @@ template < typename Payload = internal::LinearOperatorImplementation::EmptyPayload, typename OperatorExemplar, typename Matrix, - typename = typename std::enable_if< - !std::is_lvalue_reference::value>::type, - typename = typename std::enable_if< + typename = + std::enable_if_t::value>, + typename = std::enable_if_t< !std::is_same>::value>::type> + LinearOperator>::value>> LinearOperator linear_operator(OperatorExemplar &&, const Matrix &) = delete; @@ -1517,13 +1516,12 @@ template < typename Payload = internal::LinearOperatorImplementation::EmptyPayload, typename OperatorExemplar, typename Matrix, + typename = std::enable_if_t::value>, typename = - typename std::enable_if::value>::type, - typename = typename std::enable_if< - !std::is_lvalue_reference::value>::type, - typename = typename std::enable_if< + std::enable_if_t::value>, + typename = std::enable_if_t< !std::is_same>::value>::type> + LinearOperator>::value>> LinearOperator linear_operator(OperatorExemplar &&, Matrix &&) = delete; @@ -1532,8 +1530,7 @@ template < typename Domain = Range, typename Payload = internal::LinearOperatorImplementation::EmptyPayload, typename Matrix, - typename = - typename std::enable_if::value>::type> + typename = std::enable_if_t::value>> LinearOperator linear_operator(const LinearOperator &, Matrix &&) = delete; @@ -1543,23 +1540,22 @@ template < typename Domain = Range, typename Payload = internal::LinearOperatorImplementation::EmptyPayload, typename Matrix, - typename = - typename std::enable_if::value>::type> + typename = std::enable_if_t::value>> LinearOperator linear_operator(Matrix &&) = delete; -template ::value>::type, - typename = typename std::enable_if< - !std::is_same::value>::type, - typename = typename std::enable_if< - !std::is_same>::value>::type> +template < + typename Payload, + typename Solver, + typename Preconditioner, + 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< + !std::is_same>::value>> LinearOperator inverse_operator(const LinearOperator &, Solver &, diff --git a/include/deal.II/lac/packaged_operation.h b/include/deal.II/lac/packaged_operation.h index 60ccc18afe..13a86bb1d1 100644 --- a/include/deal.II/lac/packaged_operation.h +++ b/include/deal.II/lac/packaged_operation.h @@ -523,10 +523,10 @@ namespace internal * @ingroup LAOperators */ -template ::type::value>::type> +template < + typename Range, + typename = std::enable_if_t::type::value>> PackagedOperation operator+(const Range &u, const Range &v) { @@ -568,10 +568,10 @@ operator+(const Range &u, const Range &v) * @ingroup LAOperators */ -template ::type::value>::type> +template < + typename Range, + typename = std::enable_if_t::type::value>> PackagedOperation operator-(const Range &u, const Range &v) { @@ -612,10 +612,10 @@ operator-(const Range &u, const Range &v) * * @ingroup LAOperators */ -template ::type::value>::type> +template < + typename Range, + typename = std::enable_if_t::type::value>> PackagedOperation operator*(const Range &u, typename Range::value_type number) { @@ -637,10 +637,10 @@ operator*(const Range &u, typename Range::value_type number) * * @ingroup LAOperators */ -template ::type::value>::type> +template < + typename Range, + typename = std::enable_if_t::type::value>> PackagedOperation operator*(typename Range::value_type number, const Range &u) { diff --git a/include/deal.II/lac/precondition.h b/include/deal.II/lac/precondition.h index beacf721b6..f52fb17246 100644 --- a/include/deal.II/lac/precondition.h +++ b/include/deal.II/lac/precondition.h @@ -625,18 +625,17 @@ namespace internal } template , - MatrixType>::type * = nullptr> + std::enable_if_t, + MatrixType> * = nullptr> void step(VectorType &dst, const VectorType &src) const { this->A->Jacobi_step(dst, src, this->relaxation); } - template < - typename VectorType, - typename std::enable_if, - MatrixType>::type * = nullptr> + template , + MatrixType> * = nullptr> void step(VectorType &, const VectorType &) const { @@ -682,8 +681,8 @@ namespace internal } template , - MatrixType>::type * = nullptr> + std::enable_if_t, + MatrixType> * = nullptr> void step(VectorType &dst, const VectorType &src) const { @@ -691,8 +690,8 @@ namespace internal } template , - MatrixType>::type * = nullptr> + std::enable_if_t, + MatrixType> * = nullptr> void step(VectorType &, const VectorType &) const { @@ -702,8 +701,8 @@ namespace internal } template , - MatrixType>::type * = nullptr> + std::enable_if_t, + MatrixType> * = nullptr> void Tstep(VectorType &dst, const VectorType &src) const { @@ -711,8 +710,8 @@ namespace internal } template , - MatrixType>::type * = nullptr> + std::enable_if_t, + MatrixType> * = nullptr> void Tstep(VectorType &, const VectorType &) const { @@ -785,8 +784,8 @@ namespace internal } template , - MatrixType>::type * = nullptr> + std::enable_if_t, + MatrixType> * = nullptr> void step(VectorType &dst, const VectorType &src) const { @@ -794,8 +793,8 @@ namespace internal } template , - MatrixType>::type * = nullptr> + std::enable_if_t, + MatrixType> * = nullptr> void step(VectorType &, const VectorType &) const { @@ -863,12 +862,11 @@ namespace internal const std::vector &inverse_permutation; }; - template < - typename MatrixType, - typename PreconditionerType, - typename VectorType, - typename std::enable_if, - PreconditionerType>::type * = nullptr> + template , + PreconditionerType> * = nullptr> void step(const MatrixType &, const PreconditionerType &preconditioner, @@ -885,9 +883,9 @@ namespace internal typename MatrixType, typename PreconditionerType, typename VectorType, - typename std::enable_if && - has_step, - PreconditionerType>::type * = nullptr> + std::enable_if_t && + has_step, + PreconditionerType> * = nullptr> void step(const MatrixType &, const PreconditionerType &preconditioner, @@ -908,9 +906,9 @@ namespace internal typename MatrixType, typename PreconditionerType, typename VectorType, - typename std::enable_if && - !has_step, - PreconditionerType>::type * = nullptr> + std::enable_if_t && + !has_step, + PreconditionerType> * = nullptr> void step(const MatrixType & A, const PreconditionerType &preconditioner, @@ -930,12 +928,11 @@ namespace internal dst.add(relaxation, tmp); } - template < - typename MatrixType, - typename PreconditionerType, - typename VectorType, - typename std::enable_if, - PreconditionerType>::type * = nullptr> + template , + PreconditionerType> * = nullptr> void Tstep(const MatrixType &, const PreconditionerType &preconditioner, @@ -948,13 +945,13 @@ namespace internal preconditioner.Tstep(dst, src, relaxation); } - template && - has_Tstep, - PreconditionerType>::type * = nullptr> + template < + typename MatrixType, + typename PreconditionerType, + typename VectorType, + std::enable_if_t && + has_Tstep, + PreconditionerType> * = nullptr> void Tstep(const MatrixType &, const PreconditionerType &preconditioner, @@ -973,8 +970,8 @@ namespace internal template , - MatrixType>::type * = nullptr> + std::enable_if_t, MatrixType> + * = nullptr> void Tvmult(const MatrixType &A, VectorType &dst, const VectorType &src) { @@ -983,8 +980,8 @@ namespace internal template , - MatrixType>::type * = nullptr> + std::enable_if_t, MatrixType> + * = nullptr> void Tvmult(const MatrixType &, VectorType &, const VectorType &) { @@ -992,13 +989,13 @@ namespace internal ExcMessage("Matrix A does not provide a Tvmult() function!")); } - template && - !has_Tstep, - PreconditionerType>::type * = nullptr> + template < + typename MatrixType, + typename PreconditionerType, + typename VectorType, + std::enable_if_t && + !has_Tstep, + PreconditionerType> * = nullptr> void Tstep(const MatrixType & A, const PreconditionerType &preconditioner, @@ -1053,8 +1050,8 @@ namespace internal template ::value, - VectorType>::type * = nullptr> + std::enable_if_t::value, VectorType> + * = nullptr> void step_operations(const MatrixType & A, const DiagonalMatrix &preconditioner, @@ -2567,10 +2564,10 @@ namespace internal typename MatrixType, typename VectorType, typename PreconditionerType, - typename std::enable_if, - int>::type * = nullptr> + std::enable_if_t, + int> * = nullptr> inline void vmult_and_update(const MatrixType & matrix, const PreconditionerType &preconditioner, @@ -2596,14 +2593,13 @@ namespace internal solution); } - template < - typename MatrixType, - typename VectorType, - typename PreconditionerType, - typename std::enable_if, - int>::type * = nullptr> + template , + int> * = nullptr> inline void vmult_and_update(const MatrixType & matrix, const PreconditionerType &preconditioner, diff --git a/include/deal.II/lac/solver_cg.h b/include/deal.II/lac/solver_cg.h index 3e832c15f9..5aa2d1d338 100644 --- a/include/deal.II/lac/solver_cg.h +++ b/include/deal.II/lac/solver_cg.h @@ -703,14 +703,14 @@ namespace internal VectorType, MatrixType, PreconditionerType, - typename std::enable_if && - (has_apply_to_subrange || - has_apply)&&std:: - is_same>::value, - int>::type> + std::enable_if_t && + (has_apply_to_subrange || + has_apply)&&std:: + is_same>::value, + int>> : public IterationWorkerBase { using Number = typename VectorType::value_type; @@ -791,7 +791,7 @@ namespace internal // Function that we use if the PreconditionerType implements an apply() // function template - typename std::enable_if, U>::type + std::enable_if_t, U> operation_before_loop(const unsigned int iteration_index, const unsigned int start_range, const unsigned int end_range) const @@ -897,7 +897,7 @@ namespace internal // Function that we use if the PreconditionerType implements an apply() // function template - typename std::enable_if, U>::type + std::enable_if_t, U> operation_after_loop( const unsigned int start_range, const unsigned int end_range, @@ -949,7 +949,7 @@ namespace internal // Function that we use if the PreconditionerType implements an apply() // function template - typename std::enable_if, U>::type + std::enable_if_t, U> finalize_after_convergence(const unsigned int iteration_index) { if (iteration_index % 2 == 1 || iteration_index == 2) @@ -986,7 +986,7 @@ namespace internal // apply() function, where we instead need to choose the // apply_to_subrange function template - typename std::enable_if, U>::type + std::enable_if_t, U> operation_before_loop(const unsigned int iteration_index, const unsigned int start_range, const unsigned int end_range) const @@ -1084,7 +1084,7 @@ namespace internal // apply() function and where we instead need to use the // apply_to_subrange function template - typename std::enable_if, U>::type + std::enable_if_t, U> operation_after_loop( const unsigned int start_range, const unsigned int end_range, @@ -1158,7 +1158,7 @@ namespace internal // apply() function, where we instead need to choose the // apply_to_subrange function template - typename std::enable_if, U>::type + std::enable_if_t, U> finalize_after_convergence(const unsigned int iteration_index) { if (iteration_index % 2 == 1 || iteration_index == 2) diff --git a/include/deal.II/lac/sparse_matrix.templates.h b/include/deal.II/lac/sparse_matrix.templates.h index 2a16da3246..8e1370e635 100644 --- a/include/deal.II/lac/sparse_matrix.templates.h +++ b/include/deal.II/lac/sparse_matrix.templates.h @@ -168,14 +168,14 @@ namespace internal using size_type = types::global_dof_index; template - typename std::enable_if::value>::type + std::enable_if_t::value> zero_subrange(const size_type begin, const size_type end, T *dst) { std::memset(dst + begin, 0, (end - begin) * sizeof(T)); } template - typename std::enable_if::value>::type + std::enable_if_t::value> zero_subrange(const size_type begin, const size_type end, T *dst) { std::fill(dst + begin, dst + end, 0); diff --git a/include/deal.II/lac/trilinos_sparse_matrix.h b/include/deal.II/lac/trilinos_sparse_matrix.h index 62b8452d85..cdea737e40 100644 --- a/include/deal.II/lac/trilinos_sparse_matrix.h +++ b/include/deal.II/lac/trilinos_sparse_matrix.h @@ -840,9 +840,8 @@ namespace TrilinosWrappers * processors in order to avoid a dead lock. */ template - typename std::enable_if< - !std::is_same>::value>::type + std::enable_if_t< + !std::is_same>::value> reinit(const IndexSet & row_parallel_partitioning, const IndexSet & col_parallel_partitioning, const SparsityPatternType &sparsity_pattern, @@ -1438,8 +1437,8 @@ namespace TrilinosWrappers * distributed. Otherwise, an exception will be thrown. */ template - typename std::enable_if::value>::type + std::enable_if_t< + std::is_same::value> vmult(VectorType &dst, const VectorType &src) const; /** @@ -1449,8 +1448,8 @@ namespace TrilinosWrappers * Despite looking complicated, the return type is just `void`. */ template - typename std::enable_if::value>::type + std::enable_if_t< + !std::is_same::value> vmult(VectorType &dst, const VectorType &src) const; /** @@ -1468,8 +1467,8 @@ namespace TrilinosWrappers * Despite looking complicated, the return type is just `void`. */ template - typename std::enable_if::value>::type + std::enable_if_t< + std::is_same::value> Tvmult(VectorType &dst, const VectorType &src) const; /** @@ -1479,8 +1478,8 @@ namespace TrilinosWrappers * Despite looking complicated, the return type is just `void`. */ template - typename std::enable_if::value>::type + std::enable_if_t< + !std::is_same::value> Tvmult(VectorType &dst, const VectorType &src) const; /** @@ -2182,11 +2181,11 @@ namespace TrilinosWrappers * 2. the @p Preconditioner derives from TrilinosWrappers::PreconditionBase. */ template - typename std::enable_if< + std::enable_if_t< std::is_base_of::value && std::is_base_of::value, - TrilinosPayload>::type + TrilinosPayload> inverse_payload(Solver &, const Preconditioner &) const; /** @@ -2207,11 +2206,11 @@ namespace TrilinosWrappers * TrilinosWrappers::PreconditionBase. */ template - typename std::enable_if< + std::enable_if_t< !(std::is_base_of::value && std::is_base_of::value), - TrilinosPayload>::type + TrilinosPayload> inverse_payload(Solver &, const Preconditioner &) const; //@} @@ -3210,11 +3209,11 @@ namespace TrilinosWrappers template - typename std::enable_if< + std::enable_if_t< std::is_base_of::value && std::is_base_of::value, - TrilinosPayload>::type + TrilinosPayload> TrilinosPayload::inverse_payload( Solver & solver, const Preconditioner &preconditioner) const @@ -3265,11 +3264,11 @@ namespace TrilinosWrappers } template - typename std::enable_if< + std::enable_if_t< !(std::is_base_of::value && std::is_base_of::value), - TrilinosPayload>::type + TrilinosPayload> TrilinosPayload::inverse_payload(Solver &, const Preconditioner &) const { TrilinosPayload return_op(*this); diff --git a/include/deal.II/lac/vector_operations_internal.h b/include/deal.II/lac/vector_operations_internal.h index 1b6a963135..e4ee1deec4 100644 --- a/include/deal.II/lac/vector_operations_internal.h +++ b/include/deal.II/lac/vector_operations_internal.h @@ -2006,9 +2006,9 @@ namespace internal ::dealii::MemorySpace::MemorySpaceData &data, - typename std::enable_if< + std::enable_if_t< std::is_same::value, - int>::type = 0) + int> = 0) { if (operation == VectorOperation::insert) { @@ -2037,9 +2037,9 @@ namespace internal ::dealii::MemorySpace::MemorySpaceData &data, - typename std::enable_if< + std::enable_if_t< std::is_same::value, - int>::type = 0) + int> = 0) { if (operation == VectorOperation::insert) { @@ -2524,9 +2524,9 @@ namespace internal ::dealii::MemorySpace::MemorySpaceData &data, - typename std::enable_if< + std::enable_if_t< std::is_same::value, - int>::type = 0) + int> = 0) { if (operation == VectorOperation::insert) { @@ -2554,9 +2554,9 @@ namespace internal ::dealii::MemorySpace::MemorySpaceData &data, - typename std::enable_if< + std::enable_if_t< std::is_same::value, - int>::type = 0) + int> = 0) { if (operation == VectorOperation::insert) { diff --git a/include/deal.II/matrix_free/evaluation_kernels.h b/include/deal.II/matrix_free/evaluation_kernels.h index e9774f0af5..3b7ca98d19 100644 --- a/include/deal.II/matrix_free/evaluation_kernels.h +++ b/include/deal.II/matrix_free/evaluation_kernels.h @@ -5594,7 +5594,7 @@ namespace internal const FEEvaluationData &fe_eval, const Number * in_array, Number * out_array, - typename std::enable_if::type * = nullptr) + std::enable_if_t * = nullptr) { constexpr unsigned int dofs_per_component = Utilities::pow(fe_degree + 1, dim); @@ -5650,7 +5650,7 @@ namespace internal const FEEvaluationData &fe_eval, const Number * in_array, Number * out_array, - typename std::enable_if::type * = nullptr) + std::enable_if_t * = nullptr) { static_assert(fe_degree == -1, "Only usable for degree -1"); const unsigned int dofs_per_component = @@ -5712,7 +5712,7 @@ namespace internal const AlignedVector &inverse_coefficients, const Number * in_array, Number * out_array, - typename std::enable_if::type * = nullptr) + std::enable_if_t * = nullptr) { constexpr unsigned int dofs_per_component = Utilities::pow(fe_degree + 1, dim); @@ -5775,7 +5775,7 @@ namespace internal const AlignedVector &, const Number *, Number *, - typename std::enable_if::type * = nullptr) + std::enable_if_t * = nullptr) { static_assert(fe_degree == -1, "Only usable for degree -1"); Assert(false, ExcNotImplemented()); diff --git a/include/deal.II/matrix_free/fe_evaluation.h b/include/deal.II/matrix_free/fe_evaluation.h index 1c65917e73..2ed29508a4 100644 --- a/include/deal.II/matrix_free/fe_evaluation.h +++ b/include/deal.II/matrix_free/fe_evaluation.h @@ -4094,20 +4094,20 @@ FEEvaluationBase:: namespace internal { - template ::value, - VectorType>::type * = nullptr> + template < + typename Number, + typename VectorType, + std::enable_if_t::value, VectorType> * = nullptr> decltype(std::declval().begin()) get_beginning(VectorType &vec) { return vec.begin(); } - template ::value, - VectorType>::type * = nullptr> + template < + typename Number, + typename VectorType, + std::enable_if_t::value, VectorType> * = nullptr> typename VectorType::value_type * get_beginning(VectorType &) { @@ -4115,8 +4115,8 @@ namespace internal } template , - VectorType>::type * = nullptr> + std::enable_if_t, VectorType> * = + nullptr> const std::vector> * get_shared_vector_data(VectorType & vec, const bool is_valid_mode_for_sm, @@ -4134,8 +4134,8 @@ namespace internal } template , - VectorType>::type * = nullptr> + std::enable_if_t, VectorType> + * = nullptr> const std::vector> * get_shared_vector_data(VectorType &, const bool, @@ -7911,9 +7911,9 @@ namespace internal typename VectorizedArrayType, typename VectorType, typename EvaluatorType, - typename std::enable_if && - !IsBlockVector::value, - VectorType>::type * = nullptr> + std::enable_if_t && + !IsBlockVector::value, + VectorType> * = nullptr> VectorizedArrayType * check_vector_access_inplace(const EvaluatorType &fe_eval, VectorType &vector) { @@ -7963,9 +7963,9 @@ namespace internal typename VectorizedArrayType, typename VectorType, typename EvaluatorType, - typename std::enable_if || - IsBlockVector::value, - VectorType>::type * = nullptr> + std::enable_if_t || + IsBlockVector::value, + VectorType> * = nullptr> VectorizedArrayType * check_vector_access_inplace(const EvaluatorType &, VectorType &) { diff --git a/include/deal.II/matrix_free/matrix_free.h b/include/deal.II/matrix_free/matrix_free.h index d8e519ab6d..55113dbb6e 100644 --- a/include/deal.II/matrix_free/matrix_free.h +++ b/include/deal.II/matrix_free/matrix_free.h @@ -3120,8 +3120,8 @@ namespace internal * Start update_ghost_value for serial vectors */ template , - VectorType>::type * = nullptr> + std::enable_if_t, VectorType> + * = nullptr> void update_ghost_values_start(const unsigned int /*component_in_block_vector*/, const VectorType & /*vec*/) @@ -3132,11 +3132,10 @@ namespace internal * Start update_ghost_value for vectors that do not support * the split into _start() and finish() stages */ - template < - typename VectorType, - typename std::enable_if && - !is_not_parallel_vector, - VectorType>::type * = nullptr> + template && + !is_not_parallel_vector, + VectorType> * = nullptr> void update_ghost_values_start(const unsigned int component_in_block_vector, const VectorType & vec) @@ -3161,11 +3160,10 @@ namespace internal * the split into _start() and finish() stages, but don't support * exchange on a subset of DoFs */ - template < - typename VectorType, - typename std::enable_if && - !has_exchange_on_subset, - VectorType>::type * = nullptr> + template && + !has_exchange_on_subset, + VectorType> * = nullptr> void update_ghost_values_start(const unsigned int component_in_block_vector, const VectorType & vec) @@ -3191,11 +3189,10 @@ namespace internal * exchange on a subset of DoFs, * i.e. LinearAlgebra::distributed::Vector */ - template < - typename VectorType, - typename std::enable_if && - has_exchange_on_subset, - VectorType>::type * = nullptr> + template && + has_exchange_on_subset, + VectorType> * = nullptr> void update_ghost_values_start(const unsigned int component_in_block_vector, const VectorType & vec) @@ -3251,10 +3248,9 @@ namespace internal * Finish update_ghost_value for vectors that do not support * the split into _start() and finish() stages and serial vectors */ - template < - typename VectorType, - typename std::enable_if, - VectorType>::type * = nullptr> + template , + VectorType> * = nullptr> void update_ghost_values_finish(const unsigned int /*component_in_block_vector*/, const VectorType & /*vec*/) @@ -3267,11 +3263,10 @@ namespace internal * the split into _start() and finish() stages, but don't support * exchange on a subset of DoFs */ - template < - typename VectorType, - typename std::enable_if && - !has_exchange_on_subset, - VectorType>::type * = nullptr> + template && + !has_exchange_on_subset, + VectorType> * = nullptr> void update_ghost_values_finish(const unsigned int component_in_block_vector, const VectorType & vec) @@ -3288,11 +3283,10 @@ namespace internal * exchange on a subset of DoFs, * i.e. LinearAlgebra::distributed::Vector */ - template < - typename VectorType, - typename std::enable_if && - has_exchange_on_subset, - VectorType>::type * = nullptr> + template && + has_exchange_on_subset, + VectorType> * = nullptr> void update_ghost_values_finish(const unsigned int component_in_block_vector, const VectorType & vec) @@ -3341,8 +3335,8 @@ namespace internal * Start compress for serial vectors */ template , - VectorType>::type * = nullptr> + std::enable_if_t, VectorType> + * = nullptr> void compress_start(const unsigned int /*component_in_block_vector*/, VectorType & /*vec*/) @@ -3355,9 +3349,9 @@ namespace internal * the split into _start() and finish() stages */ template && - !is_not_parallel_vector, - VectorType>::type * = nullptr> + std::enable_if_t && + !is_not_parallel_vector, + VectorType> * = nullptr> void compress_start(const unsigned int component_in_block_vector, VectorType & vec) @@ -3375,9 +3369,9 @@ namespace internal * exchange on a subset of DoFs */ template && - !has_exchange_on_subset, - VectorType>::type * = nullptr> + std::enable_if_t && + !has_exchange_on_subset, + VectorType> * = nullptr> void compress_start(const unsigned int component_in_block_vector, VectorType & vec) @@ -3396,9 +3390,9 @@ namespace internal * i.e. LinearAlgebra::distributed::Vector */ template && - has_exchange_on_subset, - VectorType>::type * = nullptr> + std::enable_if_t && + has_exchange_on_subset, + VectorType> * = nullptr> void compress_start(const unsigned int component_in_block_vector, VectorType & vec) @@ -3447,9 +3441,9 @@ namespace internal * Finish compress for vectors that do not support * the split into _start() and finish() stages and serial vectors */ - template , - VectorType>::type * = nullptr> + template < + typename VectorType, + std::enable_if_t, VectorType> * = nullptr> void compress_finish(const unsigned int /*component_in_block_vector*/, VectorType & /*vec*/) @@ -3463,9 +3457,9 @@ namespace internal * exchange on a subset of DoFs */ template && - !has_exchange_on_subset, - VectorType>::type * = nullptr> + std::enable_if_t && + !has_exchange_on_subset, + VectorType> * = nullptr> void compress_finish(const unsigned int component_in_block_vector, VectorType & vec) @@ -3483,9 +3477,9 @@ namespace internal * i.e. LinearAlgebra::distributed::Vector */ template && - has_exchange_on_subset, - VectorType>::type * = nullptr> + std::enable_if_t && + has_exchange_on_subset, + VectorType> * = nullptr> void compress_finish(const unsigned int component_in_block_vector, VectorType & vec) @@ -3540,8 +3534,8 @@ namespace internal * Reset all ghost values for serial vectors */ template , - VectorType>::type * = nullptr> + std::enable_if_t, VectorType> + * = nullptr> void reset_ghost_values(const VectorType & /*vec*/) const {} @@ -3553,9 +3547,9 @@ namespace internal * exchange on a subset of DoFs */ template && - !is_not_parallel_vector, - VectorType>::type * = nullptr> + std::enable_if_t && + !is_not_parallel_vector, + VectorType> * = nullptr> void reset_ghost_values(const VectorType &vec) const { @@ -3573,8 +3567,8 @@ namespace internal * LinearAlgebra::distributed::Vector */ template , - VectorType>::type * = nullptr> + std::enable_if_t, VectorType> + * = nullptr> void reset_ghost_values(const VectorType &vec) const { @@ -3617,8 +3611,8 @@ namespace internal * i.e. LinearAlgebra::distributed::Vector */ template , - VectorType>::type * = nullptr> + std::enable_if_t, VectorType> + * = nullptr> void zero_vector_region(const unsigned int range_index, VectorType &vec) const { @@ -3659,9 +3653,9 @@ namespace internal * vector type */ template , - VectorType>::type * = nullptr, - typename VectorType::value_type * = nullptr> + std::enable_if_t, VectorType> + * = nullptr, + typename VectorType::value_type * = nullptr> void zero_vector_region(const unsigned int range_index, VectorType &vec) const { @@ -3757,8 +3751,8 @@ namespace internal // default value for vectors that do not have communication_block_size template , - VectorStruct>::type * = nullptr> + std::enable_if_t, + VectorStruct> * = nullptr> constexpr unsigned int get_communication_block_size(const VectorStruct &) { @@ -3768,8 +3762,8 @@ namespace internal template , - VectorStruct>::type * = nullptr> + std::enable_if_t, + VectorStruct> * = nullptr> constexpr unsigned int get_communication_block_size(const VectorStruct &) { @@ -3791,8 +3785,8 @@ namespace internal typename VectorStruct, typename Number, typename VectorizedArrayType, - typename std::enable_if::value, - VectorStruct>::type * = nullptr> + std::enable_if_t::value, VectorStruct> + * = nullptr> void update_ghost_values_start( const VectorStruct & vec, @@ -3820,8 +3814,8 @@ namespace internal typename VectorStruct, typename Number, typename VectorizedArrayType, - typename std::enable_if::value, - VectorStruct>::type * = nullptr> + std::enable_if_t::value, VectorStruct> + * = nullptr> void update_ghost_values_start( const VectorStruct & vec, @@ -3882,8 +3876,8 @@ namespace internal typename VectorStruct, typename Number, typename VectorizedArrayType, - typename std::enable_if::value, - VectorStruct>::type * = nullptr> + std::enable_if_t::value, VectorStruct> + * = nullptr> void update_ghost_values_finish( const VectorStruct & vec, @@ -3907,8 +3901,8 @@ namespace internal typename VectorStruct, typename Number, typename VectorizedArrayType, - typename std::enable_if::value, - VectorStruct>::type * = nullptr> + std::enable_if_t::value, VectorStruct> + * = nullptr> void update_ghost_values_finish( const VectorStruct & vec, @@ -3969,8 +3963,8 @@ namespace internal typename VectorStruct, typename Number, typename VectorizedArrayType, - typename std::enable_if::value, - VectorStruct>::type * = nullptr> + std::enable_if_t::value, VectorStruct> + * = nullptr> inline void compress_start( VectorStruct & vec, @@ -3991,8 +3985,8 @@ namespace internal typename VectorStruct, typename Number, typename VectorizedArrayType, - typename std::enable_if::value, - VectorStruct>::type * = nullptr> + std::enable_if_t::value, VectorStruct> + * = nullptr> inline void compress_start( VectorStruct & vec, @@ -4053,8 +4047,8 @@ namespace internal typename VectorStruct, typename Number, typename VectorizedArrayType, - typename std::enable_if::value, - VectorStruct>::type * = nullptr> + std::enable_if_t::value, VectorStruct> + * = nullptr> inline void compress_finish( VectorStruct & vec, @@ -4078,8 +4072,8 @@ namespace internal typename VectorStruct, typename Number, typename VectorizedArrayType, - typename std::enable_if::value, - VectorStruct>::type * = nullptr> + std::enable_if_t::value, VectorStruct> + * = nullptr> inline void compress_finish( VectorStruct & vec, @@ -4144,8 +4138,8 @@ namespace internal typename VectorStruct, typename Number, typename VectorizedArrayType, - typename std::enable_if::value, - VectorStruct>::type * = nullptr> + std::enable_if_t::value, VectorStruct> + * = nullptr> inline void reset_ghost_values( const VectorStruct & vec, @@ -4166,8 +4160,8 @@ namespace internal typename VectorStruct, typename Number, typename VectorizedArrayType, - typename std::enable_if::value, - VectorStruct>::type * = nullptr> + std::enable_if_t::value, VectorStruct> + * = nullptr> inline void reset_ghost_values( const VectorStruct & vec, @@ -4227,8 +4221,8 @@ namespace internal typename VectorStruct, typename Number, typename VectorizedArrayType, - typename std::enable_if::value, - VectorStruct>::type * = nullptr> + std::enable_if_t::value, VectorStruct> + * = nullptr> inline void zero_vector_region( const unsigned int range_index, @@ -4246,8 +4240,8 @@ namespace internal typename VectorStruct, typename Number, typename VectorizedArrayType, - typename std::enable_if::value, - VectorStruct>::type * = nullptr> + std::enable_if_t::value, VectorStruct> + * = nullptr> inline void zero_vector_region( const unsigned int range_index, diff --git a/include/deal.II/matrix_free/operators.h b/include/deal.II/matrix_free/operators.h index 771fa19713..34543d1c3c 100644 --- a/include/deal.II/matrix_free/operators.h +++ b/include/deal.II/matrix_free/operators.h @@ -45,24 +45,22 @@ namespace MatrixFreeOperators // a non-block vector has one block and the only subblock is the vector // itself template - typename std::enable_if::value, - unsigned int>::type + std::enable_if_t::value, unsigned int> n_blocks(const VectorType &vector) { return vector.n_blocks(); } template - typename std::enable_if::value, - unsigned int>::type + std::enable_if_t::value, unsigned int> n_blocks(const VectorType &) { return 1; } template - typename std::enable_if::value, - typename VectorType::BlockType &>::type + std::enable_if_t::value, + typename VectorType::BlockType &> subblock(VectorType &vector, unsigned int block_no) { AssertIndexRange(block_no, vector.n_blocks()); @@ -70,8 +68,8 @@ namespace MatrixFreeOperators } template - typename std::enable_if::value, - const typename VectorType::BlockType &>::type + std::enable_if_t::value, + const typename VectorType::BlockType &> subblock(const VectorType &vector, unsigned int block_no) { AssertIndexRange(block_no, vector.n_blocks()); @@ -79,30 +77,28 @@ namespace MatrixFreeOperators } template - typename std::enable_if::value, - VectorType &>::type + std::enable_if_t::value, VectorType &> subblock(VectorType &vector, unsigned int) { return vector; } template - typename std::enable_if::value, - const VectorType &>::type + std::enable_if_t::value, const VectorType &> subblock(const VectorType &vector, unsigned int) { return vector; } template - typename std::enable_if::value, void>::type + std::enable_if_t::value, void> collect_sizes(VectorType &vector) { vector.collect_sizes(); } template - typename std::enable_if::value, void>::type + std::enable_if_t::value, void> collect_sizes(const VectorType &) {} } // namespace BlockHelper diff --git a/include/deal.II/matrix_free/tools.h b/include/deal.II/matrix_free/tools.h index 252ddd282e..c5b34249d0 100644 --- a/include/deal.II/matrix_free/tools.h +++ b/include/deal.II/matrix_free/tools.h @@ -950,11 +950,11 @@ namespace MatrixFreeTools */ template ::type>::type, typename std::remove_const::type>::type>::value>::type * = nullptr> + Number>::type>::type>::value> * = nullptr> const AffineConstraints & create_new_affine_constraints_if_needed( const MatrixType &, @@ -971,11 +971,11 @@ namespace MatrixFreeTools */ template ::type>::type, typename std::remove_const::type>::type>::value>::type * = nullptr> + Number>::type>::type>::value> * = nullptr> const AffineConstraints & create_new_affine_constraints_if_needed( const MatrixType &, diff --git a/include/deal.II/matrix_free/type_traits.h b/include/deal.II/matrix_free/type_traits.h index 69ad23153d..6a3c37a37a 100644 --- a/include/deal.II/matrix_free/type_traits.h +++ b/include/deal.II/matrix_free/type_traits.h @@ -202,8 +202,8 @@ namespace internal * indeed a serial vector. */ template - using is_serial_vector_type = decltype( - typename std::enable_if::value, int>::type()); + using is_serial_vector_type = + decltype(std::enable_if_t::value, int>()); /** * A variable that indicates that the type `T` is either (i) not diff --git a/include/deal.II/matrix_free/vector_access_internal.h b/include/deal.II/matrix_free/vector_access_internal.h index 3975b12067..80b1161d49 100644 --- a/include/deal.II/matrix_free/vector_access_internal.h +++ b/include/deal.II/matrix_free/vector_access_internal.h @@ -39,9 +39,9 @@ namespace internal // access to generic const vectors that have operator (). // FIXME: this is wrong for Trilinos/Petsc MPI vectors // where we should first do Partitioner::local_to_global() - template , - VectorType>::type * = nullptr> + template < + typename VectorType, + std::enable_if_t, VectorType> * = nullptr> inline typename VectorType::value_type vector_access(const VectorType &vec, const unsigned int entry) { @@ -53,9 +53,9 @@ namespace internal // access to generic non-const vectors that have operator (). // FIXME: this is wrong for Trilinos/Petsc MPI vectors // where we should first do Partitioner::local_to_global() - template , - VectorType>::type * = nullptr> + template < + typename VectorType, + std::enable_if_t, VectorType> * = nullptr> inline typename VectorType::value_type & vector_access(VectorType &vec, const unsigned int entry) { @@ -67,9 +67,9 @@ namespace internal // access to distributed MPI vectors that have a local_element(uint) // method to access data in local index space, which is what we use in // DoFInfo and hence in read_dof_values etc. - template , - VectorType>::type * = nullptr> + template < + typename VectorType, + std::enable_if_t, VectorType> * = nullptr> inline typename VectorType::value_type & vector_access(VectorType &vec, const unsigned int entry) { @@ -79,9 +79,9 @@ namespace internal // same for const access - template , - VectorType>::type * = nullptr> + template < + typename VectorType, + std::enable_if_t, VectorType> * = nullptr> inline typename VectorType::value_type vector_access(const VectorType &vec, const unsigned int entry) { @@ -90,9 +90,9 @@ namespace internal - template , - VectorType>::type * = nullptr> + template < + typename VectorType, + std::enable_if_t, VectorType> * = nullptr> inline void vector_access_add(VectorType & vec, const unsigned int entry, @@ -104,8 +104,8 @@ namespace internal template , - VectorType>::type * = nullptr> + std::enable_if_t, VectorType> * = + nullptr> inline void vector_access_add(VectorType & vec, const unsigned int entry, @@ -116,9 +116,9 @@ namespace internal - template , - VectorType>::type * = nullptr> + template < + typename VectorType, + std::enable_if_t, VectorType> * = nullptr> inline void vector_access_add_global(VectorType & vec, const types::global_dof_index entry, @@ -130,8 +130,8 @@ namespace internal template , - VectorType>::type * = nullptr> + std::enable_if_t, VectorType> * = + nullptr> inline void vector_access_add_global(VectorType & vec, const types::global_dof_index entry, @@ -142,9 +142,9 @@ namespace internal - template , - VectorType>::type * = nullptr> + template < + typename VectorType, + std::enable_if_t, VectorType> * = nullptr> inline void vector_access_set(VectorType & vec, const unsigned int entry, @@ -156,8 +156,8 @@ namespace internal template , - VectorType>::type * = nullptr> + std::enable_if_t, VectorType> * = + nullptr> inline void vector_access_set(VectorType & vec, const unsigned int entry, @@ -172,13 +172,12 @@ namespace internal // is really the same as stored in MatrixFree. // version below is when has_partitioners_are_compatible == false // FIXME: this is incorrect for PETSc/Trilinos MPI vectors - template < - int dim, - typename Number, - typename VectorizedArrayType, - typename VectorType, - typename std::enable_if, - VectorType>::type * = nullptr> + template , + VectorType> * = nullptr> inline void check_vector_compatibility( const VectorType & vec, @@ -199,8 +198,8 @@ namespace internal typename Number, typename VectorizedArrayType, typename VectorType, - typename std::enable_if, - VectorType>::type * = nullptr> + std::enable_if_t, + VectorType> * = nullptr> inline void check_vector_compatibility( const VectorType & vec, diff --git a/include/deal.II/multigrid/mg_coarse.h b/include/deal.II/multigrid/mg_coarse.h index 67c349bcc5..bb0e327d6b 100644 --- a/include/deal.II/multigrid/mg_coarse.h +++ b/include/deal.II/multigrid/mg_coarse.h @@ -365,9 +365,9 @@ namespace internal class SolverType, class MatrixType, class PreconditionerType, - typename std::enable_if< + std::enable_if_t< std::is_same::value, - VectorType>::type * = nullptr> + VectorType> * = nullptr> void solve(SolverType & solver, const MatrixType & matrix, @@ -383,9 +383,9 @@ namespace internal class SolverType, class MatrixType, class PreconditionerType, - typename std::enable_if< + std::enable_if_t< !std::is_same::value, - VectorType>::type * = nullptr> + VectorType> * = nullptr> void solve(SolverType & solver, const MatrixType & matrix, diff --git a/include/deal.II/multigrid/multigrid.h b/include/deal.II/multigrid/multigrid.h index 9d95fc0617..23a6b6d18f 100644 --- a/include/deal.II/multigrid/multigrid.h +++ b/include/deal.II/multigrid/multigrid.h @@ -706,7 +706,7 @@ namespace internal typename VectorType, class TRANSFER, typename OtherVectorType> - typename std::enable_if::type + std::enable_if_t vmult( const std::vector *> &dof_handler_vector, dealii::Multigrid & multigrid, @@ -767,7 +767,7 @@ namespace internal typename VectorType, class TRANSFER, typename OtherVectorType> - typename std::enable_if::type + std::enable_if_t vmult_add( const std::vector *> &dof_handler_vector, dealii::Multigrid & multigrid, diff --git a/include/deal.II/numerics/data_out_dof_data.templates.h b/include/deal.II/numerics/data_out_dof_data.templates.h index 1f0d657ea9..c1af92f0d9 100644 --- a/include/deal.II/numerics/data_out_dof_data.templates.h +++ b/include/deal.II/numerics/data_out_dof_data.templates.h @@ -913,8 +913,8 @@ namespace internal int spacedim, typename VectorType, typename Number, - typename std::enable_if::value, - VectorType>::type * = nullptr> + std::enable_if_t::value, VectorType> + * = nullptr> void create_dof_vector(const DoFHandler &dof_handler, const VectorType & src, @@ -975,8 +975,8 @@ namespace internal int spacedim, typename VectorType, typename Number, - typename std::enable_if::value, - VectorType>::type * = nullptr> + std::enable_if_t::value, VectorType> + * = nullptr> void create_dof_vector(const DoFHandler &dof_handler, const VectorType & src, @@ -1009,8 +1009,8 @@ namespace internal */ template ::value, - VectorType>::type * = nullptr> + std::enable_if_t::value, VectorType> + * = nullptr> void create_cell_vector(const VectorType & src, LinearAlgebra::distributed::BlockVector &dst) @@ -1032,8 +1032,8 @@ namespace internal */ template ::value, - VectorType>::type * = nullptr> + std::enable_if_t::value, VectorType> + * = nullptr> void create_cell_vector(const VectorType & src, LinearAlgebra::distributed::BlockVector &dst) diff --git a/include/deal.II/numerics/vector_tools_boundary.templates.h b/include/deal.II/numerics/vector_tools_boundary.templates.h index 938a8018bc..5d4e0a3455 100644 --- a/include/deal.II/numerics/vector_tools_boundary.templates.h +++ b/include/deal.II/numerics/vector_tools_boundary.templates.h @@ -990,7 +990,7 @@ namespace VectorTools namespace internals { template - typename std::enable_if::type + std::enable_if_t compute_edge_projection_l2(const cell_iterator & cell, const unsigned int face, const unsigned int line, @@ -1280,7 +1280,7 @@ namespace VectorTools template - typename std::enable_if::type + std::enable_if_t compute_edge_projection_l2(const cell_iterator &, const unsigned int, const unsigned int, diff --git a/include/deal.II/numerics/vector_tools_mean_value.templates.h b/include/deal.II/numerics/vector_tools_mean_value.templates.h index 0bc528690e..1ed260647c 100644 --- a/include/deal.II/numerics/vector_tools_mean_value.templates.h +++ b/include/deal.II/numerics/vector_tools_mean_value.templates.h @@ -44,8 +44,7 @@ namespace VectorTools namespace internal { template - typename std::enable_if::value == - true>::type + std::enable_if_t::value == true> subtract_mean_value(VectorType &v, const std::vector &p_select) { if (p_select.size() == 0) @@ -85,8 +84,7 @@ namespace VectorTools template - typename std::enable_if::value == - false>::type + std::enable_if_t::value == false> subtract_mean_value(VectorType &v, const std::vector &p_select) { (void)p_select; diff --git a/include/deal.II/particles/particle_handler.h b/include/deal.II/particles/particle_handler.h index c435983718..f09497ab9a 100644 --- a/include/deal.II/particles/particle_handler.h +++ b/include/deal.II/particles/particle_handler.h @@ -482,9 +482,8 @@ namespace Particles * positions. */ template - typename std::enable_if< - std::is_convertible *>::value == - false>::type + std::enable_if_t< + std::is_convertible *>::value == false> set_particle_positions(const VectorType &input_vector, const bool displace_particles = true); @@ -1333,9 +1332,8 @@ namespace Particles template template - inline typename std::enable_if< - std::is_convertible *>::value == - false>::type + inline std::enable_if_t< + std::is_convertible *>::value == false> ParticleHandler::set_particle_positions( const VectorType &input_vector, const bool displace_particles) diff --git a/source/differentiation/ad/ad_drivers.cc b/source/differentiation/ad/ad_drivers.cc index 8369eb81e3..7222824802 100644 --- a/source/differentiation/ad/ad_drivers.cc +++ b/source/differentiation/ad/ad_drivers.cc @@ -260,11 +260,10 @@ namespace Differentiation // Specialization for taped ADOL-C auto-differentiable numbers. template - TapedDrivers< - ADNumberType, - double, - typename std::enable_if::type_code == - NumberTypes::adolc_taped>::type>::TapedDrivers() + TapedDrivers::type_code == + NumberTypes::adolc_taped>>::TapedDrivers() : active_tape(Numbers::invalid_tape_index) , keep_values(true) , is_recording_flag(false) @@ -279,11 +278,10 @@ namespace Differentiation template bool - TapedDrivers< - ADNumberType, - double, - typename std::enable_if::type_code == - NumberTypes::adolc_taped>::type>::is_recording() + TapedDrivers::type_code == + NumberTypes::adolc_taped>>::is_recording() const { return is_recording_flag; @@ -292,11 +290,11 @@ namespace Differentiation template typename Types::tape_index - TapedDrivers::type_code == - NumberTypes::adolc_taped>::type>::active_tape_index() const + TapedDrivers< + ADNumberType, + double, + std::enable_if_t::type_code == + NumberTypes::adolc_taped>>::active_tape_index() const { return active_tape; } @@ -306,10 +304,9 @@ namespace Differentiation bool TapedDrivers::type_code == - NumberTypes::adolc_taped>::type>::keep_independent_values() - const + std::enable_if_t::type_code == + NumberTypes::adolc_taped>>:: + keep_independent_values() const { return keep_values; } @@ -317,11 +314,10 @@ namespace Differentiation template bool - TapedDrivers< - ADNumberType, - double, - typename std::enable_if::type_code == - NumberTypes::adolc_taped>::type>:: + TapedDrivers::type_code == + NumberTypes::adolc_taped>>:: is_registered_tape( const typename Types::tape_index tape_index) const { @@ -391,11 +387,10 @@ namespace Differentiation template void - TapedDrivers< - ADNumberType, - double, - typename std::enable_if::type_code == - NumberTypes::adolc_taped>::type>:: + TapedDrivers::type_code == + NumberTypes::adolc_taped>>:: set_tape_buffer_sizes( const typename Types::tape_buffer_sizes in_obufsize, const typename Types::tape_buffer_sizes in_lbufsize, @@ -414,11 +409,10 @@ namespace Differentiation template void - TapedDrivers< - ADNumberType, - double, - typename std::enable_if::type_code == - NumberTypes::adolc_taped>::type>:: + TapedDrivers::type_code == + NumberTypes::adolc_taped>>:: start_taping(const typename Types::tape_index tape_index, const bool keep_independent_values) { @@ -440,11 +434,10 @@ namespace Differentiation template void - TapedDrivers< - ADNumberType, - double, - typename std::enable_if::type_code == - NumberTypes::adolc_taped>::type>:: + TapedDrivers::type_code == + NumberTypes::adolc_taped>>:: stop_taping( const typename Types::tape_index active_tape_index, const bool write_tapes_to_file) @@ -469,11 +462,10 @@ namespace Differentiation template std::vector::tape_index> - TapedDrivers< - ADNumberType, - double, - typename std::enable_if::type_code == - NumberTypes::adolc_taped>::type>:: + TapedDrivers::type_code == + NumberTypes::adolc_taped>>:: get_registered_tape_indices() const { // We've chosen to use unsigned shorts for the tape @@ -490,11 +482,10 @@ namespace Differentiation template void - TapedDrivers< - ADNumberType, - double, - typename std::enable_if::type_code == - NumberTypes::adolc_taped>::type>:: + TapedDrivers::type_code == + NumberTypes::adolc_taped>>:: activate_tape(const typename Types::tape_index tape_index) { active_tape = tape_index; @@ -503,11 +494,10 @@ namespace Differentiation template bool - TapedDrivers< - ADNumberType, - double, - typename std::enable_if::type_code == - NumberTypes::adolc_taped>::type>:: + TapedDrivers::type_code == + NumberTypes::adolc_taped>>:: requires_retaping( const typename Types::tape_index tape_index) const { @@ -545,11 +535,10 @@ namespace Differentiation template bool - TapedDrivers< - ADNumberType, - double, - typename std::enable_if::type_code == - NumberTypes::adolc_taped>::type>:: + TapedDrivers::type_code == + NumberTypes::adolc_taped>>:: last_action_requires_retaping() const { return requires_retaping(active_tape); @@ -558,11 +547,10 @@ namespace Differentiation template void - TapedDrivers< - ADNumberType, - double, - typename std::enable_if::type_code == - NumberTypes::adolc_taped>::type>:: + TapedDrivers::type_code == + NumberTypes::adolc_taped>>:: remove_tape(const typename Types::tape_index tape_index) { Assert(is_registered_tape(tape_index), @@ -574,11 +562,10 @@ namespace Differentiation template void - TapedDrivers< - ADNumberType, - double, - typename std::enable_if::type_code == - NumberTypes::adolc_taped>::type>:: + TapedDrivers::type_code == + NumberTypes::adolc_taped>>:: reset(const bool clear_registered_tapes) { active_tape = Numbers::invalid_tape_index; @@ -598,9 +585,9 @@ namespace Differentiation void TapedDrivers::type_code == - NumberTypes::adolc_taped>::type>::print(std::ostream &stream) + std::enable_if_t::type_code == + NumberTypes::adolc_taped>>::print(std::ostream + &stream) const { const std::vector::tape_index> @@ -630,11 +617,10 @@ namespace Differentiation template void - TapedDrivers< - ADNumberType, - double, - typename std::enable_if::type_code == - NumberTypes::adolc_taped>::type>:: + TapedDrivers::type_code == + NumberTypes::adolc_taped>>:: print_tape_stats( const typename Types::tape_index tape_index, std::ostream & stream) const @@ -675,13 +661,12 @@ namespace Differentiation typename TapedDrivers< ADNumberType, double, - typename std::enable_if::type_code == - NumberTypes::adolc_taped>::type>::scalar_type - TapedDrivers< - ADNumberType, - double, - typename std::enable_if::type_code == - NumberTypes::adolc_taped>::type>:: + std::enable_if_t::type_code == + NumberTypes::adolc_taped>>::scalar_type + TapedDrivers::type_code == + NumberTypes::adolc_taped>>:: value(const typename Types::tape_index active_tape_index, const std::vector &independent_variables) const { @@ -703,11 +688,10 @@ namespace Differentiation template void - TapedDrivers< - ADNumberType, - double, - typename std::enable_if::type_code == - NumberTypes::adolc_taped>::type>:: + TapedDrivers::type_code == + NumberTypes::adolc_taped>>:: gradient(const typename Types::tape_index active_tape_index, const std::vector &independent_variables, Vector & gradient) const @@ -736,11 +720,10 @@ namespace Differentiation template void - TapedDrivers< - ADNumberType, - double, - typename std::enable_if::type_code == - NumberTypes::adolc_taped>::type>:: + TapedDrivers::type_code == + NumberTypes::adolc_taped>>:: hessian(const typename Types::tape_index active_tape_index, const std::vector &independent_variables, FullMatrix & hessian) const @@ -779,11 +762,10 @@ namespace Differentiation template void - TapedDrivers< - ADNumberType, - double, - typename std::enable_if::type_code == - NumberTypes::adolc_taped>::type>:: + TapedDrivers::type_code == + NumberTypes::adolc_taped>>:: values(const typename Types::tape_index active_tape_index, const unsigned int n_dependent_variables, const std::vector &independent_variables, @@ -808,11 +790,10 @@ namespace Differentiation template void - TapedDrivers< - ADNumberType, - double, - typename std::enable_if::type_code == - NumberTypes::adolc_taped>::type>:: + TapedDrivers::type_code == + NumberTypes::adolc_taped>>:: jacobian(const typename Types::tape_index active_tape_index, const unsigned int n_dependent_variables, const std::vector &independent_variables, @@ -847,11 +828,10 @@ namespace Differentiation template bool - TapedDrivers< - ADNumberType, - double, - typename std::enable_if::type_code == - NumberTypes::adolc_taped>::type>::is_recording() + TapedDrivers::type_code == + NumberTypes::adolc_taped>>::is_recording() const { AssertThrow(false, ExcRequiresADOLC()); @@ -861,11 +841,11 @@ namespace Differentiation template typename Types::tape_index - TapedDrivers::type_code == - NumberTypes::adolc_taped>::type>::active_tape_index() const + TapedDrivers< + ADNumberType, + double, + std::enable_if_t::type_code == + NumberTypes::adolc_taped>>::active_tape_index() const { AssertThrow(false, ExcRequiresADOLC()); return Numbers::invalid_tape_index; @@ -876,10 +856,9 @@ namespace Differentiation bool TapedDrivers::type_code == - NumberTypes::adolc_taped>::type>::keep_independent_values() - const + std::enable_if_t::type_code == + NumberTypes::adolc_taped>>:: + keep_independent_values() const { AssertThrow(false, ExcRequiresADOLC()); return false; @@ -888,11 +867,10 @@ namespace Differentiation template bool - TapedDrivers< - ADNumberType, - double, - typename std::enable_if::type_code == - NumberTypes::adolc_taped>::type>:: + TapedDrivers::type_code == + NumberTypes::adolc_taped>>:: is_registered_tape(const typename Types::tape_index) const { AssertThrow(false, ExcRequiresADOLC()); @@ -902,11 +880,10 @@ namespace Differentiation template void - TapedDrivers< - ADNumberType, - double, - typename std::enable_if::type_code == - NumberTypes::adolc_taped>::type>:: + TapedDrivers::type_code == + NumberTypes::adolc_taped>>:: set_tape_buffer_sizes( const typename Types::tape_buffer_sizes, const typename Types::tape_buffer_sizes, @@ -919,11 +896,10 @@ namespace Differentiation template void - TapedDrivers< - ADNumberType, - double, - typename std::enable_if::type_code == - NumberTypes::adolc_taped>::type>:: + TapedDrivers::type_code == + NumberTypes::adolc_taped>>:: start_taping(const typename Types::tape_index, const bool) { AssertThrow(false, ExcRequiresADOLC()); @@ -932,11 +908,10 @@ namespace Differentiation template void - TapedDrivers< - ADNumberType, - double, - typename std::enable_if::type_code == - NumberTypes::adolc_taped>::type>:: + TapedDrivers::type_code == + NumberTypes::adolc_taped>>:: stop_taping(const typename Types::tape_index, const bool) { AssertThrow(false, ExcRequiresADOLC()); @@ -945,11 +920,10 @@ namespace Differentiation template std::vector::tape_index> - TapedDrivers< - ADNumberType, - double, - typename std::enable_if::type_code == - NumberTypes::adolc_taped>::type>:: + TapedDrivers::type_code == + NumberTypes::adolc_taped>>:: get_registered_tape_indices() const { AssertThrow(false, ExcRequiresADOLC()); @@ -959,11 +933,10 @@ namespace Differentiation template void - TapedDrivers< - ADNumberType, - double, - typename std::enable_if::type_code == - NumberTypes::adolc_taped>::type>:: + TapedDrivers::type_code == + NumberTypes::adolc_taped>>:: activate_tape(const typename Types::tape_index) { AssertThrow(false, ExcRequiresADOLC()); @@ -972,11 +945,10 @@ namespace Differentiation template bool - TapedDrivers< - ADNumberType, - double, - typename std::enable_if::type_code == - NumberTypes::adolc_taped>::type>:: + TapedDrivers::type_code == + NumberTypes::adolc_taped>>:: requires_retaping(const typename Types::tape_index) const { AssertThrow(false, ExcRequiresADOLC()); @@ -986,11 +958,10 @@ namespace Differentiation template bool - TapedDrivers< - ADNumberType, - double, - typename std::enable_if::type_code == - NumberTypes::adolc_taped>::type>:: + TapedDrivers::type_code == + NumberTypes::adolc_taped>>:: last_action_requires_retaping() const { AssertThrow(false, ExcRequiresADOLC()); @@ -1000,11 +971,10 @@ namespace Differentiation template void - TapedDrivers< - ADNumberType, - double, - typename std::enable_if::type_code == - NumberTypes::adolc_taped>::type>:: + TapedDrivers::type_code == + NumberTypes::adolc_taped>>:: remove_tape(const typename Types::tape_index) { AssertThrow(false, ExcRequiresADOLC()); @@ -1015,9 +985,8 @@ namespace Differentiation void TapedDrivers::type_code == - NumberTypes::adolc_taped>::type>::reset(const bool) + std::enable_if_t::type_code == + NumberTypes::adolc_taped>>::reset(const bool) { AssertThrow(false, ExcRequiresADOLC()); } @@ -1027,9 +996,9 @@ namespace Differentiation void TapedDrivers::type_code == - NumberTypes::adolc_taped>::type>::print(std::ostream &) const + std::enable_if_t::type_code == + NumberTypes::adolc_taped>>::print(std::ostream + &) const { AssertThrow(false, ExcRequiresADOLC()); } @@ -1037,11 +1006,10 @@ namespace Differentiation template void - TapedDrivers< - ADNumberType, - double, - typename std::enable_if::type_code == - NumberTypes::adolc_taped>::type>:: + TapedDrivers::type_code == + NumberTypes::adolc_taped>>:: print_tape_stats(const typename Types::tape_index, std::ostream &) const { @@ -1053,13 +1021,12 @@ namespace Differentiation typename TapedDrivers< ADNumberType, double, - typename std::enable_if::type_code == - NumberTypes::adolc_taped>::type>::scalar_type - TapedDrivers< - ADNumberType, - double, - typename std::enable_if::type_code == - NumberTypes::adolc_taped>::type>:: + std::enable_if_t::type_code == + NumberTypes::adolc_taped>>::scalar_type + TapedDrivers::type_code == + NumberTypes::adolc_taped>>:: value(const typename Types::tape_index, const std::vector &) const { @@ -1070,11 +1037,10 @@ namespace Differentiation template void - TapedDrivers< - ADNumberType, - double, - typename std::enable_if::type_code == - NumberTypes::adolc_taped>::type>:: + TapedDrivers::type_code == + NumberTypes::adolc_taped>>:: gradient(const typename Types::tape_index, const std::vector &, Vector &) const @@ -1085,11 +1051,10 @@ namespace Differentiation template void - TapedDrivers< - ADNumberType, - double, - typename std::enable_if::type_code == - NumberTypes::adolc_taped>::type>:: + TapedDrivers::type_code == + NumberTypes::adolc_taped>>:: hessian(const typename Types::tape_index, const std::vector &, FullMatrix &) const @@ -1100,11 +1065,10 @@ namespace Differentiation template void - TapedDrivers< - ADNumberType, - double, - typename std::enable_if::type_code == - NumberTypes::adolc_taped>::type>:: + TapedDrivers::type_code == + NumberTypes::adolc_taped>>:: values(const typename Types::tape_index, const unsigned int, const std::vector &, @@ -1116,11 +1080,10 @@ namespace Differentiation template void - TapedDrivers< - ADNumberType, - double, - typename std::enable_if::type_code == - NumberTypes::adolc_taped>::type>:: + TapedDrivers::type_code == + NumberTypes::adolc_taped>>:: jacobian(const typename Types::tape_index, const unsigned int, const std::vector &, @@ -1137,11 +1100,10 @@ namespace Differentiation template bool - TapedDrivers< - ADNumberType, - float, - typename std::enable_if::type_code == - NumberTypes::adolc_taped>::type>::is_recording() + TapedDrivers::type_code == + NumberTypes::adolc_taped>>::is_recording() const { // ADOL-C only supports 'double', not 'float', so we can forward to @@ -1152,11 +1114,11 @@ namespace Differentiation template typename Types::tape_index - TapedDrivers::type_code == - NumberTypes::adolc_taped>::type>::active_tape_index() const + TapedDrivers< + ADNumberType, + float, + std::enable_if_t::type_code == + NumberTypes::adolc_taped>>::active_tape_index() const { // ADOL-C only supports 'double', not 'float', so we can forward to // the 'double' implementation of this function @@ -1168,10 +1130,9 @@ namespace Differentiation bool TapedDrivers::type_code == - NumberTypes::adolc_taped>::type>::keep_independent_values() - const + std::enable_if_t::type_code == + NumberTypes::adolc_taped>>:: + keep_independent_values() const { return taped_driver.keep_independent_values(); } @@ -1179,11 +1140,10 @@ namespace Differentiation template bool - TapedDrivers< - ADNumberType, - float, - typename std::enable_if::type_code == - NumberTypes::adolc_taped>::type>:: + TapedDrivers::type_code == + NumberTypes::adolc_taped>>:: is_registered_tape( const typename Types::tape_index tape_index) const { @@ -1195,11 +1155,10 @@ namespace Differentiation template void - TapedDrivers< - ADNumberType, - float, - typename std::enable_if::type_code == - NumberTypes::adolc_taped>::type>:: + TapedDrivers::type_code == + NumberTypes::adolc_taped>>:: set_tape_buffer_sizes( const typename Types::tape_buffer_sizes obufsize, const typename Types::tape_buffer_sizes lbufsize, @@ -1217,11 +1176,10 @@ namespace Differentiation template void - TapedDrivers< - ADNumberType, - float, - typename std::enable_if::type_code == - NumberTypes::adolc_taped>::type>:: + TapedDrivers::type_code == + NumberTypes::adolc_taped>>:: start_taping(const typename Types::tape_index tape_index, const bool keep_independent_values) { @@ -1233,11 +1191,10 @@ namespace Differentiation template void - TapedDrivers< - ADNumberType, - float, - typename std::enable_if::type_code == - NumberTypes::adolc_taped>::type>:: + TapedDrivers::type_code == + NumberTypes::adolc_taped>>:: stop_taping( const typename Types::tape_index active_tape_index, const bool write_tapes_to_file) @@ -1250,11 +1207,10 @@ namespace Differentiation template std::vector::tape_index> - TapedDrivers< - ADNumberType, - float, - typename std::enable_if::type_code == - NumberTypes::adolc_taped>::type>:: + TapedDrivers::type_code == + NumberTypes::adolc_taped>>:: get_registered_tape_indices() const { return taped_driver.get_registered_tape_indices(); @@ -1263,11 +1219,10 @@ namespace Differentiation template void - TapedDrivers< - ADNumberType, - float, - typename std::enable_if::type_code == - NumberTypes::adolc_taped>::type>:: + TapedDrivers::type_code == + NumberTypes::adolc_taped>>:: activate_tape(const typename Types::tape_index tape_index) { taped_driver.activate_tape(tape_index); @@ -1276,11 +1231,10 @@ namespace Differentiation template bool - TapedDrivers< - ADNumberType, - float, - typename std::enable_if::type_code == - NumberTypes::adolc_taped>::type>:: + TapedDrivers::type_code == + NumberTypes::adolc_taped>>:: requires_retaping( const typename Types::tape_index tape_index) const { @@ -1290,11 +1244,10 @@ namespace Differentiation template bool - TapedDrivers< - ADNumberType, - float, - typename std::enable_if::type_code == - NumberTypes::adolc_taped>::type>:: + TapedDrivers::type_code == + NumberTypes::adolc_taped>>:: last_action_requires_retaping() const { return taped_driver.last_action_requires_retaping(); @@ -1303,11 +1256,10 @@ namespace Differentiation template void - TapedDrivers< - ADNumberType, - float, - typename std::enable_if::type_code == - NumberTypes::adolc_taped>::type>:: + TapedDrivers::type_code == + NumberTypes::adolc_taped>>:: remove_tape(const typename Types::tape_index tape_index) { taped_driver.remove_tape(tape_index); @@ -1316,11 +1268,10 @@ namespace Differentiation template void - TapedDrivers< - ADNumberType, - float, - typename std::enable_if::type_code == - NumberTypes::adolc_taped>::type>:: + TapedDrivers::type_code == + NumberTypes::adolc_taped>>:: reset(const bool clear_registered_tapes) { taped_driver.reset(clear_registered_tapes); @@ -1331,9 +1282,9 @@ namespace Differentiation void TapedDrivers::type_code == - NumberTypes::adolc_taped>::type>::print(std::ostream &stream) + std::enable_if_t::type_code == + NumberTypes::adolc_taped>>::print(std::ostream + &stream) const { taped_driver.print(stream); @@ -1342,11 +1293,10 @@ namespace Differentiation template void - TapedDrivers< - ADNumberType, - float, - typename std::enable_if::type_code == - NumberTypes::adolc_taped>::type>:: + TapedDrivers::type_code == + NumberTypes::adolc_taped>>:: print_tape_stats( const typename Types::tape_index tape_index, std::ostream & stream) const @@ -1361,13 +1311,12 @@ namespace Differentiation typename TapedDrivers< ADNumberType, float, - typename std::enable_if::type_code == - NumberTypes::adolc_taped>::type>::scalar_type - TapedDrivers< - ADNumberType, - float, - typename std::enable_if::type_code == - NumberTypes::adolc_taped>::type>:: + std::enable_if_t::type_code == + NumberTypes::adolc_taped>>::scalar_type + TapedDrivers::type_code == + NumberTypes::adolc_taped>>:: value(const typename Types::tape_index active_tape_index, const std::vector &independent_variables) const { @@ -1380,11 +1329,10 @@ namespace Differentiation template void - TapedDrivers< - ADNumberType, - float, - typename std::enable_if::type_code == - NumberTypes::adolc_taped>::type>:: + TapedDrivers::type_code == + NumberTypes::adolc_taped>>:: gradient(const typename Types::tape_index active_tape_index, const std::vector &independent_variables, Vector & gradient) const @@ -1401,11 +1349,10 @@ namespace Differentiation template void - TapedDrivers< - ADNumberType, - float, - typename std::enable_if::type_code == - NumberTypes::adolc_taped>::type>:: + TapedDrivers::type_code == + NumberTypes::adolc_taped>>:: hessian(const typename Types::tape_index active_tape_index, const std::vector &independent_variables, FullMatrix & hessian) const @@ -1422,11 +1369,10 @@ namespace Differentiation template void - TapedDrivers< - ADNumberType, - float, - typename std::enable_if::type_code == - NumberTypes::adolc_taped>::type>:: + TapedDrivers::type_code == + NumberTypes::adolc_taped>>:: values(const typename Types::tape_index active_tape_index, const unsigned int n_dependent_variables, const std::vector &independent_variables, @@ -1445,11 +1391,10 @@ namespace Differentiation template void - TapedDrivers< - ADNumberType, - float, - typename std::enable_if::type_code == - NumberTypes::adolc_taped>::type>:: + TapedDrivers::type_code == + NumberTypes::adolc_taped>>:: jacobian(const typename Types::tape_index active_tape_index, const unsigned int n_dependent_variables, const std::vector &independent_variables, @@ -1469,11 +1414,10 @@ namespace Differentiation # ifndef DOXYGEN template std::vector - TapedDrivers< - ADNumberType, - float, - typename std::enable_if::type_code == - NumberTypes::adolc_taped>::type>:: + TapedDrivers::type_code == + NumberTypes::adolc_taped>>:: vector_float_to_double(const std::vector &in) const { std::vector out(in.size()); @@ -1580,10 +1524,10 @@ namespace Differentiation * reverse-mode AD. */ template - typename std::enable_if::type_code == - NumberTypes::sacado_rad || - ADNumberTraits::type_code == - NumberTypes::sacado_rad_dfad)>::type + std::enable_if_t::type_code == + NumberTypes::sacado_rad || + ADNumberTraits::type_code == + NumberTypes::sacado_rad_dfad)> reverse_mode_dependent_variable_activation(ADNumberType &) {} @@ -1599,10 +1543,9 @@ namespace Differentiation * to. This function broadcasts this information. */ template - typename std::enable_if::type_code == - NumberTypes::sacado_rad || - ADNumberTraits::type_code == - NumberTypes::sacado_rad_dfad>::type + std::enable_if_t< + ADNumberTraits::type_code == NumberTypes::sacado_rad || + ADNumberTraits::type_code == NumberTypes::sacado_rad_dfad> reverse_mode_dependent_variable_activation( ADNumberType &dependent_variable) { @@ -1625,8 +1568,8 @@ namespace Differentiation * auto-differentiable numbers. */ template - typename std::enable_if::type_code == - NumberTypes::adolc_tapeless)>::type + std::enable_if_t::type_code == + NumberTypes::adolc_tapeless)> configure_tapeless_mode(const unsigned int) {} @@ -1642,8 +1585,8 @@ namespace Differentiation * If not then it throws an error. */ template - typename std::enable_if::type_code == - NumberTypes::adolc_tapeless>::type + std::enable_if_t::type_code == + NumberTypes::adolc_tapeless> configure_tapeless_mode(const unsigned int n_directional_derivatives) { # ifdef DEAL_II_ADOLC_WITH_TAPELESS_REFCOUNTING @@ -1702,8 +1645,8 @@ namespace Differentiation # else // DEAL_II_WITH_ADOLC template - typename std::enable_if::type_code == - NumberTypes::adolc_tapeless>::type + std::enable_if_t::type_code == + NumberTypes::adolc_tapeless> configure_tapeless_mode(const unsigned int /*n_directional_derivatives*/) { AssertThrow(false, ExcRequiresADOLC()); @@ -1724,10 +1667,10 @@ namespace Differentiation TapelessDrivers< ADNumberType, ScalarType, - typename std::enable_if< - ADNumberTraits::type_code == NumberTypes::sacado_rad || - ADNumberTraits::type_code == - NumberTypes::sacado_rad_dfad>::type>::TapelessDrivers() + std::enable_if_t::type_code == + NumberTypes::sacado_rad || + ADNumberTraits::type_code == + NumberTypes::sacado_rad_dfad>>::TapelessDrivers() : dependent_variable_marking_safe(false) {} # endif @@ -1735,13 +1678,12 @@ namespace Differentiation template void - TapelessDrivers< - ADNumberType, - ScalarType, - typename std::enable_if::type_code == - NumberTypes::sacado_rad || - ADNumberTraits::type_code == - NumberTypes::sacado_rad_dfad>::type>:: + TapelessDrivers::type_code == + NumberTypes::sacado_rad || + ADNumberTraits::type_code == + NumberTypes::sacado_rad_dfad>>:: initialize_global_environment(const unsigned int n_independent_variables) { internal::configure_tapeless_mode(n_independent_variables); @@ -1753,11 +1695,10 @@ namespace Differentiation TapelessDrivers< ADNumberType, ScalarType, - typename std::enable_if::type_code == - NumberTypes::sacado_rad || - ADNumberTraits::type_code == - NumberTypes::sacado_rad_dfad>::type>:: - allow_dependent_variable_marking() + std::enable_if_t< + ADNumberTraits::type_code == NumberTypes::sacado_rad || + ADNumberTraits::type_code == + NumberTypes::sacado_rad_dfad>>::allow_dependent_variable_marking() { dependent_variable_marking_safe = true; } @@ -1768,11 +1709,10 @@ namespace Differentiation TapelessDrivers< ADNumberType, ScalarType, - typename std::enable_if::type_code == - NumberTypes::sacado_rad || - ADNumberTraits::type_code == - NumberTypes::sacado_rad_dfad>::type>:: - prevent_dependent_variable_marking() + std::enable_if_t< + ADNumberTraits::type_code == NumberTypes::sacado_rad || + ADNumberTraits::type_code == + NumberTypes::sacado_rad_dfad>>::prevent_dependent_variable_marking() { dependent_variable_marking_safe = false; } @@ -1780,13 +1720,12 @@ namespace Differentiation template bool - TapelessDrivers< - ADNumberType, - ScalarType, - typename std::enable_if::type_code == - NumberTypes::sacado_rad || - ADNumberTraits::type_code == - NumberTypes::sacado_rad_dfad>::type>:: + TapelessDrivers::type_code == + NumberTypes::sacado_rad || + ADNumberTraits::type_code == + NumberTypes::sacado_rad_dfad>>:: is_dependent_variable_marking_allowed() const { return dependent_variable_marking_safe; @@ -1795,13 +1734,12 @@ namespace Differentiation template ScalarType - TapelessDrivers< - ADNumberType, - ScalarType, - typename std::enable_if::type_code == - NumberTypes::sacado_rad || - ADNumberTraits::type_code == - NumberTypes::sacado_rad_dfad>::type>:: + TapelessDrivers::type_code == + NumberTypes::sacado_rad || + ADNumberTraits::type_code == + NumberTypes::sacado_rad_dfad>>:: value(const std::vector &dependent_variables) const { Assert(dependent_variables.size() == 1, @@ -1813,13 +1751,12 @@ namespace Differentiation template void - TapelessDrivers< - ADNumberType, - ScalarType, - typename std::enable_if::type_code == - NumberTypes::sacado_rad || - ADNumberTraits::type_code == - NumberTypes::sacado_rad_dfad>::type>:: + TapelessDrivers::type_code == + NumberTypes::sacado_rad || + ADNumberTraits::type_code == + NumberTypes::sacado_rad_dfad>>:: gradient(const std::vector &independent_variables, const std::vector &dependent_variables, Vector & gradient) const @@ -1849,13 +1786,12 @@ namespace Differentiation template void - TapelessDrivers< - ADNumberType, - ScalarType, - typename std::enable_if::type_code == - NumberTypes::sacado_rad || - ADNumberTraits::type_code == - NumberTypes::sacado_rad_dfad>::type>:: + TapelessDrivers::type_code == + NumberTypes::sacado_rad || + ADNumberTraits::type_code == + NumberTypes::sacado_rad_dfad>>:: hessian(const std::vector &independent_variables, const std::vector &dependent_variables, FullMatrix & hessian) const @@ -1904,13 +1840,12 @@ namespace Differentiation template void - TapelessDrivers< - ADNumberType, - ScalarType, - typename std::enable_if::type_code == - NumberTypes::sacado_rad || - ADNumberTraits::type_code == - NumberTypes::sacado_rad_dfad>::type>:: + TapelessDrivers::type_code == + NumberTypes::sacado_rad || + ADNumberTraits::type_code == + NumberTypes::sacado_rad_dfad>>:: values(const std::vector &dependent_variables, Vector & values) const { @@ -1926,13 +1861,12 @@ namespace Differentiation template void - TapelessDrivers< - ADNumberType, - ScalarType, - typename std::enable_if::type_code == - NumberTypes::sacado_rad || - ADNumberTraits::type_code == - NumberTypes::sacado_rad_dfad>::type>:: + TapelessDrivers::type_code == + NumberTypes::sacado_rad || + ADNumberTraits::type_code == + NumberTypes::sacado_rad_dfad>>:: jacobian(const std::vector &independent_variables, const std::vector &dependent_variables, FullMatrix & jacobian) const @@ -1994,12 +1928,12 @@ namespace Differentiation TapelessDrivers< ADNumberType, ScalarType, - typename std::enable_if< - ADNumberTraits::type_code == - NumberTypes::adolc_tapeless || - ADNumberTraits::type_code == NumberTypes::sacado_dfad || - ADNumberTraits::type_code == - NumberTypes::sacado_dfad_dfad>::type>::TapelessDrivers() + std::enable_if_t::type_code == + NumberTypes::adolc_tapeless || + ADNumberTraits::type_code == + NumberTypes::sacado_dfad || + ADNumberTraits::type_code == + NumberTypes::sacado_dfad_dfad>>::TapelessDrivers() : dependent_variable_marking_safe(false) {} # endif @@ -2007,15 +1941,14 @@ namespace Differentiation template void - TapelessDrivers< - ADNumberType, - ScalarType, - typename std::enable_if::type_code == - NumberTypes::adolc_tapeless || - ADNumberTraits::type_code == - NumberTypes::sacado_dfad || - ADNumberTraits::type_code == - NumberTypes::sacado_dfad_dfad>::type>:: + TapelessDrivers::type_code == + NumberTypes::adolc_tapeless || + ADNumberTraits::type_code == + NumberTypes::sacado_dfad || + ADNumberTraits::type_code == + NumberTypes::sacado_dfad_dfad>>:: initialize_global_environment(const unsigned int n_independent_variables) { internal::configure_tapeless_mode(n_independent_variables); @@ -2027,13 +1960,12 @@ namespace Differentiation TapelessDrivers< ADNumberType, ScalarType, - typename std::enable_if::type_code == - NumberTypes::adolc_tapeless || - ADNumberTraits::type_code == - NumberTypes::sacado_dfad || - ADNumberTraits::type_code == - NumberTypes::sacado_dfad_dfad>::type>:: - allow_dependent_variable_marking() + std::enable_if_t< + ADNumberTraits::type_code == + NumberTypes::adolc_tapeless || + ADNumberTraits::type_code == NumberTypes::sacado_dfad || + ADNumberTraits::type_code == + NumberTypes::sacado_dfad_dfad>>::allow_dependent_variable_marking() { dependent_variable_marking_safe = true; } @@ -2044,13 +1976,12 @@ namespace Differentiation TapelessDrivers< ADNumberType, ScalarType, - typename std::enable_if::type_code == - NumberTypes::adolc_tapeless || - ADNumberTraits::type_code == - NumberTypes::sacado_dfad || - ADNumberTraits::type_code == - NumberTypes::sacado_dfad_dfad>::type>:: - prevent_dependent_variable_marking() + std::enable_if_t< + ADNumberTraits::type_code == + NumberTypes::adolc_tapeless || + ADNumberTraits::type_code == NumberTypes::sacado_dfad || + ADNumberTraits::type_code == + NumberTypes::sacado_dfad_dfad>>::prevent_dependent_variable_marking() { dependent_variable_marking_safe = false; } @@ -2058,15 +1989,14 @@ namespace Differentiation template bool - TapelessDrivers< - ADNumberType, - ScalarType, - typename std::enable_if::type_code == - NumberTypes::adolc_tapeless || - ADNumberTraits::type_code == - NumberTypes::sacado_dfad || - ADNumberTraits::type_code == - NumberTypes::sacado_dfad_dfad>::type>:: + TapelessDrivers::type_code == + NumberTypes::adolc_tapeless || + ADNumberTraits::type_code == + NumberTypes::sacado_dfad || + ADNumberTraits::type_code == + NumberTypes::sacado_dfad_dfad>>:: is_dependent_variable_marking_allowed() const { return dependent_variable_marking_safe; @@ -2075,15 +2005,14 @@ namespace Differentiation template ScalarType - TapelessDrivers< - ADNumberType, - ScalarType, - typename std::enable_if::type_code == - NumberTypes::adolc_tapeless || - ADNumberTraits::type_code == - NumberTypes::sacado_dfad || - ADNumberTraits::type_code == - NumberTypes::sacado_dfad_dfad>::type>:: + TapelessDrivers::type_code == + NumberTypes::adolc_tapeless || + ADNumberTraits::type_code == + NumberTypes::sacado_dfad || + ADNumberTraits::type_code == + NumberTypes::sacado_dfad_dfad>>:: value(const std::vector &dependent_variables) const { Assert(dependent_variables.size() == 1, @@ -2095,15 +2024,14 @@ namespace Differentiation template void - TapelessDrivers< - ADNumberType, - ScalarType, - typename std::enable_if::type_code == - NumberTypes::adolc_tapeless || - ADNumberTraits::type_code == - NumberTypes::sacado_dfad || - ADNumberTraits::type_code == - NumberTypes::sacado_dfad_dfad>::type>:: + TapelessDrivers::type_code == + NumberTypes::adolc_tapeless || + ADNumberTraits::type_code == + NumberTypes::sacado_dfad || + ADNumberTraits::type_code == + NumberTypes::sacado_dfad_dfad>>:: gradient(const std::vector &independent_variables, const std::vector &dependent_variables, Vector & gradient) const @@ -2131,15 +2059,14 @@ namespace Differentiation template void - TapelessDrivers< - ADNumberType, - ScalarType, - typename std::enable_if::type_code == - NumberTypes::adolc_tapeless || - ADNumberTraits::type_code == - NumberTypes::sacado_dfad || - ADNumberTraits::type_code == - NumberTypes::sacado_dfad_dfad>::type>:: + TapelessDrivers::type_code == + NumberTypes::adolc_tapeless || + ADNumberTraits::type_code == + NumberTypes::sacado_dfad || + ADNumberTraits::type_code == + NumberTypes::sacado_dfad_dfad>>:: hessian(const std::vector &independent_variables, const std::vector &dependent_variables, FullMatrix & hessian) const @@ -2186,15 +2113,14 @@ namespace Differentiation template void - TapelessDrivers< - ADNumberType, - ScalarType, - typename std::enable_if::type_code == - NumberTypes::adolc_tapeless || - ADNumberTraits::type_code == - NumberTypes::sacado_dfad || - ADNumberTraits::type_code == - NumberTypes::sacado_dfad_dfad>::type>:: + TapelessDrivers::type_code == + NumberTypes::adolc_tapeless || + ADNumberTraits::type_code == + NumberTypes::sacado_dfad || + ADNumberTraits::type_code == + NumberTypes::sacado_dfad_dfad>>:: values(const std::vector &dependent_variables, Vector & values) const { @@ -2210,15 +2136,14 @@ namespace Differentiation template void - TapelessDrivers< - ADNumberType, - ScalarType, - typename std::enable_if::type_code == - NumberTypes::adolc_tapeless || - ADNumberTraits::type_code == - NumberTypes::sacado_dfad || - ADNumberTraits::type_code == - NumberTypes::sacado_dfad_dfad>::type>:: + TapelessDrivers::type_code == + NumberTypes::adolc_tapeless || + ADNumberTraits::type_code == + NumberTypes::sacado_dfad || + ADNumberTraits::type_code == + NumberTypes::sacado_dfad_dfad>>:: jacobian(const std::vector &independent_variables, const std::vector &dependent_variables, FullMatrix & jacobian) const diff --git a/source/dofs/dof_accessor_set.cc b/source/dofs/dof_accessor_set.cc index 8c1fd4d35f..6ff52a32cd 100644 --- a/source/dofs/dof_accessor_set.cc +++ b/source/dofs/dof_accessor_set.cc @@ -102,18 +102,18 @@ namespace internal constexpr bool has_set_ghost_state = is_supported_operation; - template , - VectorType>::type * = nullptr> + template < + typename VectorType, + std::enable_if_t, VectorType> * = nullptr> void set_ghost_state(VectorType &vector, const bool ghosted) { vector.set_ghost_state(ghosted); } - template , - VectorType>::type * = nullptr> + template < + typename VectorType, + std::enable_if_t, VectorType> * = nullptr> void set_ghost_state(VectorType &, const bool) { diff --git a/source/fe/fe_values.cc b/source/fe/fe_values.cc index ff4b20d696..5d1e7b9d0c 100644 --- a/source/fe/fe_values.cc +++ b/source/fe/fe_values.cc @@ -125,8 +125,7 @@ namespace internal template struct CheckForZero< Number, - typename std::enable_if< - Differentiation::AD::is_ad_number::value>::type> + std::enable_if_t::value>> { static bool value(const Number & /*value*/) diff --git a/source/grid/grid_generator_from_name.cc b/source/grid/grid_generator_from_name.cc index eee2ff4537..a6aa62a15b 100644 --- a/source/grid/grid_generator_from_name.cc +++ b/source/grid/grid_generator_from_name.cc @@ -50,7 +50,7 @@ namespace GridGenerator * Return true if a grid was actually generated, false otherwise. */ template - typename std::enable_if::type + std::enable_if_t generate_codimension_zero_grid(const std::string &, const std::string &, Triangulation &) @@ -243,7 +243,7 @@ namespace GridGenerator * Return true if a grid was actually generated, false otherwise. */ template - typename std::enable_if::type + std::enable_if_t generate_codimension_one_grid(const std::string &, const std::string &, Triangulation &) diff --git a/source/lac/trilinos_sparse_matrix.cc b/source/lac/trilinos_sparse_matrix.cc index 685c233e3b..47730d4c01 100644 --- a/source/lac/trilinos_sparse_matrix.cc +++ b/source/lac/trilinos_sparse_matrix.cc @@ -797,9 +797,8 @@ namespace TrilinosWrappers template - inline typename std::enable_if< - !std::is_same>::value>::type + inline std::enable_if_t< + !std::is_same>::value> SparseMatrix::reinit(const IndexSet & row_parallel_partitioning, const IndexSet & col_parallel_partitioning, const SparsityPatternType &sparsity_pattern, @@ -1976,8 +1975,8 @@ namespace TrilinosWrappers template - typename std::enable_if< - std::is_same::value>::type + std::enable_if_t< + std::is_same::value> SparseMatrix::vmult(VectorType &dst, const VectorType &src) const { Assert(&src != &dst, ExcSourceEqualsDestination()); @@ -2010,8 +2009,8 @@ namespace TrilinosWrappers template - typename std::enable_if< - !std::is_same::value>::type + std::enable_if_t< + !std::is_same::value> SparseMatrix::vmult(VectorType & /*dst*/, const VectorType & /*src*/) const { AssertThrow(false, ExcNotImplemented()); @@ -2020,8 +2019,8 @@ namespace TrilinosWrappers template - typename std::enable_if< - std::is_same::value>::type + std::enable_if_t< + std::is_same::value> SparseMatrix::Tvmult(VectorType &dst, const VectorType &src) const { Assert(&src != &dst, ExcSourceEqualsDestination()); @@ -2051,8 +2050,8 @@ namespace TrilinosWrappers template - typename std::enable_if< - !std::is_same::value>::type + std::enable_if_t< + !std::is_same::value> SparseMatrix::Tvmult(VectorType & /*dst*/, const VectorType & /*src*/) const { AssertThrow(false, ExcNotImplemented()); diff --git a/tests/base/hdf5_03.cc b/tests/base/hdf5_03.cc index 261ddc6a3e..276ca2e7c1 100644 --- a/tests/base/hdf5_03.cc +++ b/tests/base/hdf5_03.cc @@ -29,9 +29,8 @@ // This function initializes a container of Number type template