aboutsummaryrefslogtreecommitdiff
path: root/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmJLinearInTime.cpp
diff options
context:
space:
mode:
authorGravatar Luca Fedeli <luca.fedeli@cea.fr> 2023-04-20 18:56:20 +0200
committerGravatar GitHub <noreply@github.com> 2023-04-20 09:56:20 -0700
commit7771d25e8cb7ec8115c4e0cec24eee13a5bf9032 (patch)
treedc0fd88c71dc33645163f07df0138363e88d2ad7 /Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmJLinearInTime.cpp
parent18e9ca3fd9e55651a39cc54d9fc31a8300756021 (diff)
downloadWarpX-7771d25e8cb7ec8115c4e0cec24eee13a5bf9032.tar.gz
WarpX-7771d25e8cb7ec8115c4e0cec24eee13a5bf9032.tar.zst
WarpX-7771d25e8cb7ec8115c4e0cec24eee13a5bf9032.zip
Use amrex::Math::powi<N>(x) in WarpX (#3846)
* use_powi * fix bug * fix bug * fix bug * fix bug
Diffstat (limited to 'Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmJLinearInTime.cpp')
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmJLinearInTime.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmJLinearInTime.cpp b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmJLinearInTime.cpp
index b0580422b..ecdd6169c 100644
--- a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmJLinearInTime.cpp
+++ b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmJLinearInTime.cpp
@@ -18,6 +18,7 @@
#include <AMReX_GpuLaunch.H>
#include <AMReX_GpuQualifiers.H>
#include <AMReX_IntVect.H>
+#include <AMReX_Math.H>
#include <AMReX_MFIter.H>
#include <AMReX_PODVector.H>
@@ -291,21 +292,21 @@ void PsatdAlgorithmJLinearInTime::InitializeSpectralCoefficients (
{
// Calculate norm of k vector
const amrex::Real knorm_s = std::sqrt(
- std::pow(kx_s[i], 2) +
+ amrex::Math::powi<2>(kx_s[i]) +
#if defined(WARPX_DIM_3D)
- std::pow(ky_s[j], 2) + std::pow(kz_s[k], 2));
+ amrex::Math::powi<2>(ky_s[j]) + amrex::Math::powi<2>(kz_s[k]));
#else
- std::pow(kz_s[j], 2));
+ amrex::Math::powi<2>(kz_s[j]));
#endif
// Physical constants and imaginary unit
constexpr amrex::Real c = PhysConst::c;
constexpr amrex::Real ep0 = PhysConst::ep0;
- const amrex::Real c2 = std::pow(c, 2);
- const amrex::Real dt2 = std::pow(dt, 2);
+ const amrex::Real c2 = amrex::Math::powi<2>(c);
+ const amrex::Real dt2 = amrex::Math::powi<2>(dt);
const amrex::Real om_s = c * knorm_s;
- const amrex::Real om2_s = std::pow(om_s, 2);
+ const amrex::Real om2_s = amrex::Math::powi<2>(om_s);
// C
C(i,j,k) = std::cos(om_s * dt);
@@ -383,11 +384,11 @@ void PsatdAlgorithmJLinearInTime::InitializeSpectralCoefficientsAveraging (
{
// Calculate norm of k vector
const amrex::Real knorm_s = std::sqrt(
- std::pow(kx_s[i], 2) +
+ amrex::Math::powi<2>(kx_s[i]) +
#if defined(WARPX_DIM_3D)
- std::pow(ky_s[j], 2) + std::pow(kz_s[k], 2));
+ amrex::Math::powi<2>(ky_s[j]) + amrex::Math::powi<2>(kz_s[k]));
#else
- std::pow(kz_s[j], 2));
+ amrex::Math::powi<2>(kz_s[j]));
#endif
// Physical constants and imaginary unit
constexpr amrex::Real c = PhysConst::c;