From 84c10291f4dbf6b9f80842008c032e21de79c6c6 Mon Sep 17 00:00:00 2001 From: Jean-Paul Pelteret Date: Thu, 12 Apr 2018 14:39:01 +0200 Subject: [PATCH] Update ADNumberTraits The addition of the scalar_type to the default definition for arithmetic types increases the usefulness of this class for generic programming. --- .../deal.II/differentiation/ad/ad_number_traits.h | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/include/deal.II/differentiation/ad/ad_number_traits.h b/include/deal.II/differentiation/ad/ad_number_traits.h index 564523cae5..302923c741 100644 --- a/include/deal.II/differentiation/ad/ad_number_traits.h +++ b/include/deal.II/differentiation/ad/ad_number_traits.h @@ -641,7 +641,7 @@ namespace Differentiation typename std::enable_if< is_ad_number::value && std::is_arithmetic::value - >::type * = 0) + >::type * = nullptr) { // We recursively call this function in case the AD number is a // nested one. The recursion ends when the extracted value is @@ -661,7 +661,7 @@ namespace Differentiation typename std::enable_if< is_ad_number::value && is_ad_number::value - >::type * = 0) + >::type * = nullptr) { return T(f); } @@ -678,7 +678,7 @@ namespace Differentiation value (const F &f, typename std::enable_if< !is_ad_number::value - >::type * = 0) + >::type * = nullptr) -> decltype (dealii::internal::NumberType< std::complex >::value(f)) { // We call the other function defined in the numbers @@ -697,7 +697,7 @@ namespace Differentiation typename std::enable_if< is_ad_number::value && std::is_arithmetic::value - >::type * = 0) + >::type * = nullptr) { // We recursively call this function in case the AD number is a // nested one. The recursion ends when the extracted value is @@ -1021,6 +1021,12 @@ namespace Differentiation std::is_arithmetic::value >::type> { + /** + * Underlying floating point value type. + * This could real-valued or complex-valued. + */ + typedef ScalarType scalar_type; + static ScalarType get_directional_derivative(const ScalarType &/*x*/, const unsigned int /*direction*/) -- 2.39.5