[Trilinos-Users] [EXTERNAL] Sacado::Fad:DFad in version 12

Phipps, Eric T etphipp at sandia.gov
Mon Aug 24 11:36:46 EDT 2015


Hi Praveen,

Sorry for your trouble.  For version 12 I made significant changes to the constructors for Sacado AD types, and as you discovered, if you pass in arguments that rely on implicit conversions, the wrong constructor can be called.  In this case, it is calling this constructor:

template <typename S> DFad(const S& x, SACADO_ENABLE_VALUE_CTOR_DECL);

instead of the one you want:

DFad(const int sz, const ValueT& x, const DerivInit zero_out = InitDerivArray)

The first one uses SFINAE to only allow types S that are convertible to ValueT (which unsigned int is) with the second argument being a pointer, which unfortunately the 0 matches.

The simplest solution is to just change your call to

const unsigned int n = 10;
Sacado::Fad::DFad<double> F(n, 0.0);

I'll have to think about the SFINAE logic to see if I can prevent the first one from ever being called for a constructor call with two arguments.

Thanks for bringing it to my attention.

-Eric

From: Trilinos-Users <trilinos-users-bounces at trilinos.org<mailto:trilinos-users-bounces at trilinos.org>> on behalf of Praveen C <trilinos at praveen.e4ward.com<mailto:trilinos at praveen.e4ward.com>>
Reply-To: Praveen C <trilinos at praveen.e4ward.com<mailto:trilinos at praveen.e4ward.com>>
Date: Sunday, August 23, 2015 at 4:09 AM
To: "trilinos-users at trilinos.org<mailto:trilinos-users at trilinos.org>" <trilinos-users at trilinos.org<mailto:trilinos-users at trilinos.org>>
Subject: [EXTERNAL] [Trilinos-Users] Sacado::Fad:DFad in version 12

Hello

I use Sacado in one of my deal.II codes to build the jacobian for newton method. Until 11.21.1 it worked fine but I am facing problem with version 12. Here is an example

const unsigned int n = 10;
Sacado::Fad::DFad<double> F(n, 0);

The above worked fine until 11.21.1 but does not in v12. Sacado seems to set the value of F to n.

If I declare n to be "int" then it seems to be ok.

Best
praveen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://trilinos.org/pipermail/trilinos-users/attachments/20150824/47dc2d5b/attachment.html>


More information about the Trilinos-Users mailing list