roystgnr / MetaPhysicL

Metaprogramming and operator-overloaded classes for numerical simulations
Other
22 stars 12 forks source link

DualNumber construction/assignment from DualNumberSurrogate #21

Closed lindsayad closed 5 years ago

lindsayad commented 5 years ago

Needed for operations like:

DualNumber<double> new_dn = NotADuckDualNumber<TensorValue<double>>(TensorValue<double>())(0, 0)
roystgnr commented 5 years ago

You're certain this needs to be an implicit rather than explicit constructor? I'm tempted to agree but I've gotten myself in trouble that way before.

lindsayad commented 5 years ago

Hmm...this was motivated by some work I was doing in libMesh last week, and I think the work I was doing there could have used explicit. And I definitely agree that explicit would eliminate some possible unintended consequences. I would be tempted to make it explicit for now, and then see if I run into a use case later that requires implicit.

roystgnr commented 5 years ago

I would be tempted to make it explicit for now, and then see if I run into a use case later that requires implicit.

Let's try that? Thanks for indulging my paranoia.

lindsayad commented 5 years ago

I made the change to explicit...just squashed into the original commit

roystgnr commented 5 years ago

Thanks!