diff --git a/dune/elasticity/common/hyperdual.hh b/dune/elasticity/common/hyperdual.hh index 524b785f58c9122ef5bdfa3488c133d1231e68d0..7c97fbbcd515aaeada31edbff73a0b0c05040d34 100644 --- a/dune/elasticity/common/hyperdual.hh +++ b/dune/elasticity/common/hyperdual.hh @@ -605,6 +605,15 @@ bool operator!= (hyperdual lhs, double rhs) } +namespace std +{ + // Register the type hyperdual for std::numeric_limits by forwarding to std::numeric_limits<double> + template<> + struct numeric_limits<hyperdual> : std::numeric_limits<double> + {}; +} + + // Dune related definitions with hyperdual numbers namespace Dune { @@ -628,6 +637,15 @@ namespace Dune { using PromotedType = hyperdual; }; + + + /* Generate constants like "pi", "e", etc. directly from double values + * since calls like "pi = acos(-1)" are not differentiable + */ + template <> + struct MathematicalConstants<hyperdual> + : MathematicalConstants<double> + {}; }