Skip to content
Snippets Groups Projects
Commit b5abd515 authored by oliver.sander_at_tu-dresden.de's avatar oliver.sander_at_tu-dresden.de
Browse files

Add 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.
parent a1a16e3d
No related branches found
No related tags found
No related merge requests found
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
#include <limits> #include <limits>
#include <dune/common/promotiontraits.hh>
#ifdef HAVE_ADOLC #ifdef HAVE_ADOLC
#include <adolc/adouble.h> #include <adolc/adouble.h>
...@@ -111,6 +113,29 @@ namespace std ...@@ -111,6 +113,29 @@ 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
{
template <>
struct PromotionTraits<double,adouble>
{
typedef adouble PromotedType;
};
template <>
struct PromotionTraits<adouble,double>
{
typedef adouble PromotedType;
};
}
#endif #endif
#endif #endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment