Skip to content

Commit 850a0fb

Browse files
WeiqunZhangax3l
andauthored
Fix amrex::Math for Microphysics (#4570)
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. --------- Co-authored-by: Axel Huebl <[email protected]>
1 parent 2211077 commit 850a0fb

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

Src/Base/AMReX_Math.H

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,11 @@ namespace detail {
134134
}
135135

136136
//! Return sine and cosine of given number
137-
template<typename T_Real>
137+
template<typename T_Real
138+
#ifndef AMREX_USE_SIMD
139+
, std::enable_if_t<std::is_floating_point_v<T_Real>,int> = 0
140+
#endif
141+
>
138142
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
139143
std::pair<T_Real,T_Real> sincos (T_Real x)
140144
{
@@ -181,7 +185,11 @@ std::pair<float,float> sincos (float x)
181185
}
182186

183187
//! Return sin(pi*x) and cos(pi*x) given x
184-
template<typename T_Real>
188+
template<typename T_Real
189+
#ifndef AMREX_USE_SIMD
190+
, std::enable_if_t<std::is_floating_point_v<T_Real>,int> = 0
191+
#endif
192+
>
185193
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
186194
std::pair<T_Real,T_Real> sincospi (T_Real x)
187195
{

0 commit comments

Comments
 (0)