From 34390451541282936c98c4e57ccbc131209e8c3d Mon Sep 17 00:00:00 2001 From: Jean-Paul Pelteret Date: Fri, 10 May 2019 22:30:18 +0200 Subject: [PATCH] Change std::is_arithmetic to std::is_floating_point in ad_number_traits.h --- .../differentiation/ad/ad_number_traits.h | 35 +++++++++++-------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/include/deal.II/differentiation/ad/ad_number_traits.h b/include/deal.II/differentiation/ad/ad_number_traits.h index 8cf3c9866b..e8ea1f8264 100644 --- a/include/deal.II/differentiation/ad/ad_number_traits.h +++ b/include/deal.II/differentiation/ad/ad_number_traits.h @@ -317,12 +317,13 @@ namespace Differentiation /** * Specialization to detect whether the input AD number * is internally supported or not. In particular, we - * check to see that it has been assigned a type_code and - * has other basic characteristics necessary for the - * internal interface of both the AD and SD drivers. + * check to see that it is not an floating point type, that it + * has been assigned a type_code and has other basic + * characteristics necessary for the internal interface of + * the AD drivers. * * The implementation of this struct follows this suggestion: - * https://stackoverflow.com/a/16000226 + * https://stackoverflow.com/a/16000226 */ template struct HasRequiredADInfo< @@ -331,7 +332,11 @@ namespace Differentiation (void)ADNumberTrait::is_taped, (void)std::declval(), (void)std::declval(), - void())> : std::true_type + void())> + : std::conditional< + std::is_floating_point::value, + std::false_type, + std::true_type>::type {}; @@ -359,9 +364,9 @@ namespace Differentiation * mechanism can be employed (e.g. Sacado types). */ template - struct Marking< - ScalarType, - typename std::enable_if::value>::type> + struct Marking::value>::type> { /** * Initialize the state of an independent variable. @@ -554,9 +559,9 @@ namespace Differentiation * mechanism can be employed (e.g. Sacado types). */ template - struct ExtractData< - NumberType, - typename std::enable_if::value>::type> + struct ExtractData::value>::type> { /** * Extract the floating point value. @@ -669,8 +674,8 @@ namespace Differentiation static T value(const F &f, typename std::enable_if::value && - std::is_arithmetic::value>::type * = - nullptr) + std::is_floating_point::value>::type + * = nullptr) { // We recursively call this function in case the AD number is a // nested one. The recursion ends when the extracted value is @@ -721,8 +726,8 @@ namespace Differentiation static std::complex value(const F &f, typename std::enable_if::value && - std::is_arithmetic::value>::type * = - nullptr) + std::is_floating_point::value>::type + * = nullptr) { // We recursively call this function in case the AD number is a // nested one. The recursion ends when the extracted value is -- 2.39.5