From: Jean-Paul Pelteret Date: Thu, 12 Apr 2018 12:41:19 +0000 (+0200) Subject: Update Adol-C number types. X-Git-Tag: v9.0.0-rc1~188^2~2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c0180d762a456db765c7e3ecb335e3e17445cf7e;p=dealii.git Update Adol-C number types. Default definitions for helper functions are now given irrespective of whether deal.II is compiled with Adol-C or not. This assists in generic programming. --- diff --git a/include/deal.II/differentiation/ad/adolc_number_types.h b/include/deal.II/differentiation/ad/adolc_number_types.h index 240730c5bf..dd75c8e67d 100644 --- a/include/deal.II/differentiation/ad/adolc_number_types.h +++ b/include/deal.II/differentiation/ad/adolc_number_types.h @@ -17,22 +17,6 @@ #define dealii_differentiation_ad_adolc_number_types_h #include - -#ifdef DEAL_II_WITH_ADOLC - -#include -#include // Taped double math functions - -#include // Taped double -#include // Tapeless double - -#include -#include - -#include -#include - -#include #include DEAL_II_NAMESPACE_OPEN @@ -50,11 +34,62 @@ namespace Differentiation * @author Jean-Paul Pelteret, 2017 */ template - struct is_adolc_number; + struct is_adolc_number + : std::false_type + {}; + + + /** + * A struct to indicate whether a given @p NumberType is a taped + * Adol-C number or not. By default, numbers are not considered to + * have the necessary characteristics to fulfill this condition. + * + * @author Jean-Paul Pelteret, 2017 + */ + template + struct is_adolc_taped_number + : std::false_type + {}; + + + /** + * A struct to indicate whether a given @p NumberType is a tapeless + * Adol-C number or not. By default, numbers are not considered to + * have the necessary characteristics to fulfill this condition. + * + * @author Jean-Paul Pelteret, 2017 + */ + template + struct is_adolc_tapeless_number + : std::false_type + {}; } } +DEAL_II_NAMESPACE_CLOSE + + +#ifdef DEAL_II_WITH_ADOLC + +#include +#include // Taped double math functions + +#include // Taped double +#include // Tapeless double + +#include +#include + +#include +#include + +#include +#include + +DEAL_II_NAMESPACE_OPEN + + /* --------------------------- inline and template functions and specializations ------------------------- */ @@ -435,18 +470,29 @@ namespace Differentiation {}; - /** - * A struct to indicate whether a given @p NumberType is an - * Adol-C number or not. By default, numbers are not considered to - * have the necessary characteristics to fulfill this condition. + * Specialization of the struct for the case when the input template + * parameter is a (real or complex) taped Adol-C number. */ - template - struct is_adolc_number - : std::false_type + template + struct is_adolc_taped_number::type>::type_code == NumberTypes::adolc_taped + >::type> + : std::true_type {}; + /** + * Specialization of the struct for the case when the input template + * parameter is a (real or complex) tapeless Adol-C number. + */ + template + struct is_adolc_tapeless_number::type>::type_code == NumberTypes::adolc_tapeless + >::type> + : std::true_type + {}; + /** * Specialization of the struct for the case when the input template @@ -454,8 +500,8 @@ namespace Differentiation */ template struct is_adolc_number::type>::type_code == NumberTypes::adolc_taped || - ADNumberTraits::type>::type_code == NumberTypes::adolc_tapeless + is_adolc_taped_number::value || + is_adolc_tapeless_number::value >::type> : std::true_type {};