Skip to content
Snippets Groups Projects
Commit 4490c5bc authored by Ansgar Burchardt's avatar Ansgar Burchardt
Browse files

Merge branch 'bugfix/IsNumber-for-adouble' into 'master'

add `Dune::IsNumber` trait for ADOLC's `adouble`

See merge request !33
parents dc2d8d9e 7bf99337
Branches
No related tags found
1 merge request!33add `Dune::IsNumber` trait for ADOLC's `adouble`
Pipeline #
...@@ -2,8 +2,10 @@ ...@@ -2,8 +2,10 @@
#define DUNE_FUFEM_UTILITIES_ADOLC_NAMESPACE_INJECTIONS_HH #define DUNE_FUFEM_UTILITIES_ADOLC_NAMESPACE_INJECTIONS_HH
#include <limits> #include <limits>
#include <type_traits>
#include <dune/common/promotiontraits.hh> #include <dune/common/promotiontraits.hh>
#include <dune/common/typetraits.hh>
#ifdef HAVE_ADOLC #ifdef HAVE_ADOLC
#include <adolc/adouble.h> #include <adolc/adouble.h>
...@@ -120,15 +122,20 @@ namespace std ...@@ -120,15 +122,20 @@ namespace std
}; };
} }
/* Specializations of the PromotionTraits class from dune-common for the adouble type.
* This is needed, e.g., to be able to use the FieldVector implementation of dot products
* between a FieldVector<double> and a FieldVector<adouble>. The standard C++ return type
* deduction mechanism doesn't help here, because the product of a double and an adouble
* is actually a proxy class called 'adub', which is not to be used outside of the ADOL-C
* library.
*/
namespace Dune namespace Dune
{ {
template<>
struct IsNumber<adouble>
: std::true_type
{};
/* Specializations of the PromotionTraits class from dune-common for the adouble type.
* This is needed, e.g., to be able to use the FieldVector implementation of dot products
* between a FieldVector<double> and a FieldVector<adouble>. The standard C++ return type
* deduction mechanism doesn't help here, because the product of a double and an adouble
* is actually a proxy class called 'adub', which is not to be used outside of the ADOL-C
* library.
*/
template <> template <>
struct PromotionTraits<double,adouble> struct PromotionTraits<double,adouble>
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment