From d611b18c39f811339ea23c66c156844fb5c967de Mon Sep 17 00:00:00 2001 From: Oliver Sander <sander@igpm.rwth-aachen.de> Date: Thu, 3 Jul 2014 19:07:15 +0000 Subject: [PATCH] Don't use library methods 'min' and 'max', because ADOL-C doesn't implement them in vector mode [[Imported from SVN: r9814]] --- dune/gfe/adolcnamespaceinjections.hh | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/dune/gfe/adolcnamespaceinjections.hh b/dune/gfe/adolcnamespaceinjections.hh index df89097b..8540dcbe 100644 --- a/dune/gfe/adolcnamespaceinjections.hh +++ b/dune/gfe/adolcnamespaceinjections.hh @@ -3,14 +3,6 @@ #include <limits> -adouble min_hack(const adouble& a, const adouble& b) { - return fmin(a,b); -} - -adouble max_hack(const adouble& a, const adouble& b) { - return fmax(a,b); -} - adouble sqrt_hack(adouble a) { return sqrt(a); } @@ -43,11 +35,13 @@ adouble acos_hack(adouble a) { namespace std { adouble min(adouble a, adouble b) { - return min_hack(a,b); + // Do not use 'min', because ADOL-C lacks support for that in vector-mode + return (a + b - abs_hack(a - b))*0.5; } adouble max(adouble a, adouble b) { - return max_hack(a,b); + // Do not use 'max', because ADOL-C lacks support for that in vector-mode + return - min(-a,-b); } adouble sqrt(adouble a) { -- GitLab