diff options
-rw-r--r-- | Source/Laser/LaserParticleContainer.cpp | 8 | ||||
-rw-r--r-- | Source/Utils/WarpXConst.H | 6 |
2 files changed, 7 insertions, 7 deletions
diff --git a/Source/Laser/LaserParticleContainer.cpp b/Source/Laser/LaserParticleContainer.cpp index ba06ba3b5..3db847644 100644 --- a/Source/Laser/LaserParticleContainer.cpp +++ b/Source/Laser/LaserParticleContainer.cpp @@ -617,13 +617,14 @@ LaserParticleContainer::gaussian_laser_profile ( const int np, Real const * const Xp, Real const * const Yp, Real t, Real * const amplitude) { + Complex I(0,1); // Calculate a few factors which are independent of the macroparticle const Real k0 = 2.*MathConst::pi/wavelength; const Real inv_tau2 = 1. / (profile_duration * profile_duration); const Real oscillation_phase = k0 * PhysConst::c * ( t - profile_t_peak ); // The coefficients below contain info about Gouy phase, // laser diffraction, and phase front curvature - const Complex diffract_factor = 1. + MathConst::I * profile_focal_distance + const Complex diffract_factor = 1. + I * profile_focal_distance * 2./( k0 * profile_waist * profile_waist ); const Complex inv_complex_waist_2 = 1./( profile_waist*profile_waist * diffract_factor ); @@ -632,10 +633,10 @@ LaserParticleContainer::gaussian_laser_profile ( const Complex stretch_factor = 1. + 4. * (zeta+beta*profile_focal_distance) * (zeta+beta*profile_focal_distance) * (inv_tau2*inv_complex_waist_2) + - 2.*MathConst::I*(phi2 - beta*beta*k0*profile_focal_distance) * inv_tau2; + 2.*I*(phi2 - beta*beta*k0*profile_focal_distance) * inv_tau2; // Amplitude and monochromatic oscillations - Complex prefactor = e_max * MathFunc::exp( MathConst::I * oscillation_phase ); + Complex prefactor = e_max * MathFunc::exp( I * oscillation_phase ); // Because diffract_factor is a complex, the code below takes into // account the impact of the dimensionality on both the Gouy phase @@ -650,7 +651,6 @@ LaserParticleContainer::gaussian_laser_profile ( Real tmp_profile_t_peak = profile_t_peak; Real tmp_beta = beta; Real tmp_zeta = zeta; - Complex I(0,1); // Loop through the macroparticle to calculate the proper amplitude amrex::ParallelFor( np, diff --git a/Source/Utils/WarpXConst.H b/Source/Utils/WarpXConst.H index be6bfd0e3..f721b5655 100644 --- a/Source/Utils/WarpXConst.H +++ b/Source/Utils/WarpXConst.H @@ -7,7 +7,7 @@ namespace MathFunc { template<typename T> - __host__ __device__ T exp (const T& val){ + AMREX_GPU_HOST_DEVICE T exp (const T& val){ #ifdef AMREX_USE_GPU return thrust::exp(val); #else @@ -16,7 +16,7 @@ namespace MathFunc } template<typename T> - __host__ __device__ T sqrt (const T& val){ + AMREX_GPU_HOST_DEVICE T sqrt (const T& val){ #ifdef AMREX_USE_GPU return thrust::sqrt(val); #else @@ -25,7 +25,7 @@ namespace MathFunc } template<typename T1, typename T2> - __host__ __device__ T1 pow (const T1& val, const T2& power){ + AMREX_GPU_HOST_DEVICE T1 pow (const T1& val, const T2& power){ #ifdef AMREX_USE_GPU return thrust::pow(val, power); #else |