From 7771d25e8cb7ec8115c4e0cec24eee13a5bf9032 Mon Sep 17 00:00:00 2001 From: Luca Fedeli Date: Thu, 20 Apr 2023 18:56:20 +0200 Subject: Use amrex::Math::powi(x) in WarpX (#3846) * use_powi * fix bug * fix bug * fix bug * fix bug --- .../SpectralAlgorithms/PsatdAlgorithmComoving.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmComoving.cpp') diff --git a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmComoving.cpp b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmComoving.cpp index 8f576dad7..aecc754d4 100644 --- a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmComoving.cpp +++ b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmComoving.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #include #include @@ -198,21 +199,21 @@ void PsatdAlgorithmComoving::InitializeSpectralCoefficients (const SpectralKSpac { // Calculate norm of finite-order k vector const amrex::Real knorm_mod = std::sqrt( - std::pow(kx_mod[i], 2) + + amrex::Math::powi<2>(kx_mod[i]) + #if defined(WARPX_DIM_3D) - std::pow(ky_mod[j], 2) + - std::pow(kz_mod[k], 2)); + amrex::Math::powi<2>(ky_mod[j]) + + amrex::Math::powi<2>(kz_mod[k])); #else - std::pow(kz_mod[j], 2)); + amrex::Math::powi<2>(kz_mod[j])); #endif // Calculate norm of infinite-order k vector const amrex::Real knorm = std::sqrt( - std::pow(kx[i], 2) + + amrex::Math::powi<2>(kx[i]) + #if defined(WARPX_DIM_3D) - std::pow(ky[j], 2) + - std::pow(kz[k], 2)); + amrex::Math::powi<2>(ky[j]) + + amrex::Math::powi<2>(kz[k])); #else - std::pow(kz[j], 2)); + amrex::Math::powi<2>(kz[j])); #endif // Physical constants c, c**2, and epsilon_0, and imaginary unit constexpr amrex::Real c = PhysConst::c; -- cgit v1.2.3