From: Jean-Paul Pelteret Date: Thu, 12 Apr 2018 12:39:01 +0000 (+0200) Subject: Update ADNumberTraits X-Git-Tag: v9.0.0-rc1~188^2~3 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=84c10291f4dbf6b9f80842008c032e21de79c6c6;p=dealii.git Update ADNumberTraits The addition of the scalar_type to the default definition for arithmetic types increases the usefulness of this class for generic programming. --- 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*/)