diff options
author | 2020-08-24 23:14:30 +0200 | |
---|---|---|
committer | 2020-08-24 14:14:30 -0700 | |
commit | bb58c764f9f21f8baac5e2fb1d81fed4983d1242 (patch) | |
tree | 3e1f5914d8f1e2be1168b79509718719745ebb93 /Source/FieldSolver/SpectralSolver/SpectralKSpace.cpp | |
parent | 78f9be325d894bbae867aa279efdfd2212690825 (diff) | |
download | WarpX-bb58c764f9f21f8baac5e2fb1d81fed4983d1242.tar.gz WarpX-bb58c764f9f21f8baac5e2fb1d81fed4983d1242.tar.zst WarpX-bb58c764f9f21f8baac5e2fb1d81fed4983d1242.zip |
Fix some warnings (#1239)
This PR fixes the source of several compilation warnings.
Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
Diffstat (limited to 'Source/FieldSolver/SpectralSolver/SpectralKSpace.cpp')
-rw-r--r-- | Source/FieldSolver/SpectralSolver/SpectralKSpace.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/Source/FieldSolver/SpectralSolver/SpectralKSpace.cpp b/Source/FieldSolver/SpectralSolver/SpectralKSpace.cpp index 480e915a9..2c60cdc38 100644 --- a/Source/FieldSolver/SpectralSolver/SpectralKSpace.cpp +++ b/Source/FieldSolver/SpectralSolver/SpectralKSpace.cpp @@ -149,8 +149,10 @@ SpectralKSpace::getSpectralShiftFactor( const DistributionMapping& dm, case ShiftType::TransformToCellCentered: sign = 1.; } const Complex I{0,1}; - for (int i=0; i<k.size(); i++ ){ - shift[i] = exp( I*sign*k[i]*0.5_rt*dx[i_dim]); + int i = 0; + for (auto const& kv : k){ + shift[i] = exp( I*sign*kv*0.5_rt*dx[i_dim]); + i++; } } return shift_factor; @@ -187,8 +189,10 @@ SpectralKSpace::getModifiedKComponent( const DistributionMapping& dm, modified_k.resize( k.size() ); // Fill the modified k vector - for (int i=0; i<k.size(); i++ ){ + int i = 0; + for (auto const& kv : k){ modified_k[i] = k[i]; // infinite-order case. + i++; } } } else { @@ -207,7 +211,8 @@ SpectralKSpace::getModifiedKComponent( const DistributionMapping& dm, modified_k.resize( k.size() ); // Fill the modified k vector - for (int i=0; i<k.size(); i++ ){ + int i = 0; + for (auto const& kv : k){ modified_k[i] = 0; for (int n=1; n<stencil_coef.size(); n++){ if (nodal){ @@ -218,6 +223,7 @@ SpectralKSpace::getModifiedKComponent( const DistributionMapping& dm, std::sin( k[i]*(n-0.5)*delta_x )/( (n-0.5)*delta_x ); } } + i++; } // By construction, at finite order and for a nodal grid, |