Fix amrex::Math for Microphysics#4570
Conversation
PR AMReX-Codes#4520 broke Microphysics's autodiff math. It could be fixed on the Microphysics side. However, we can fix it on the amrex side and we should use std::enable_if anyway to limit the data types.
df279bb to
275ab7e
Compare
|
@ax3l Could you test this? |
|
This does not build with ImpactX: |
|
Maybe we need to use std::enable_if on the return type. |
|
Yeah, I mean for SIMD the enable_if would be float or simd then allow, otherwise I think we have nothing to specialize the float/double variant to. But I generally like to avoid enable_if because SFINAE are so costly in compile time. |
|
The last commit I pushed compiles SIMD again, but I do not know how to test the microphysics issue. |
|
Microphysics also works. |
|
@ax3l The current overloads look strange. I think we should have something like below, which is more consistent with the standard. |
|
In the current implementation with AMREX_USE_SIMD, |
|
thanks! |
|
Agreed, yes we could just overload by argument type and template the simd overload. I must have had classes in mind when I wrote this function overload 😅 |
PR #4520 broke Microphysics's autodiff math. It could be fixed on the Microphysics side. However, we can fix it on the amrex side and we should use std::enable_if anyway to limit the data types.