]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Update ADNumberTraits
authorJean-Paul Pelteret <jppelteret@gmail.com>
Thu, 12 Apr 2018 12:39:01 +0000 (14:39 +0200)
committerJean-Paul Pelteret <jppelteret@gmail.com>
Thu, 12 Apr 2018 16:43:10 +0000 (18:43 +0200)
The addition of the scalar_type to the default definition for arithmetic
types increases the usefulness of this class for generic programming.

include/deal.II/differentiation/ad/ad_number_traits.h

index 564523cae5b2ae141dfe5610c235738320d1d7f6..302923c741eb6c62614f691981c94a6f2cdbe3d1 100644 (file)
@@ -641,7 +641,7 @@ namespace Differentiation
                typename std::enable_if<
                is_ad_number<F>::value &&
                std::is_arithmetic<T>::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<F>::value &&
                is_ad_number<T>::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<F>::value
-               >::type * = 0)
+               >::type * = nullptr)
         -> decltype (dealii::internal::NumberType< std::complex<T> >::value(f))
         {
           // We call the other function defined in the numbers
@@ -697,7 +697,7 @@ namespace Differentiation
                typename std::enable_if<
                is_ad_number<F>::value &&
                std::is_arithmetic<T>::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<ScalarType>::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*/)

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.