diff options
author | 2019-11-21 20:39:14 -0500 | |
---|---|---|
committer | 2019-11-21 20:39:14 -0500 | |
commit | 1fd18a4ad2da297a69e3eadec5f76e459d9b638a (patch) | |
tree | d6d79b4397dd07398abb38b4dab497a5a7e2a113 /Source/Particles/WarpXParticleContainer.cpp | |
parent | a1ba9f4c60a93d1155b7fb04adbbba9b59e5ad0e (diff) | |
download | WarpX-1fd18a4ad2da297a69e3eadec5f76e459d9b638a.tar.gz WarpX-1fd18a4ad2da297a69e3eadec5f76e459d9b638a.tar.zst WarpX-1fd18a4ad2da297a69e3eadec5f76e459d9b638a.zip |
Made similar for loop condition updates in other files. Changed an int const declaration to a const int declaration.
Diffstat (limited to 'Source/Particles/WarpXParticleContainer.cpp')
-rw-r--r-- | Source/Particles/WarpXParticleContainer.cpp | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/Source/Particles/WarpXParticleContainer.cpp b/Source/Particles/WarpXParticleContainer.cpp index c256df6aa..571de6c4e 100644 --- a/Source/Particles/WarpXParticleContainer.cpp +++ b/Source/Particles/WarpXParticleContainer.cpp @@ -1,4 +1,3 @@ - #include <limits> #include <MultiParticleContainer.H> @@ -514,7 +513,7 @@ WarpXParticleContainer::DepositCharge (Vector<std::unique_ptr<MultiFab> >& rho, bool do_rz_volume_scaling) { // Loop over the refinement levels - int const finest_level = rho.size() - 1; + const int finest_level = rho.size() - 1; for (int lev = 0; lev <= finest_level; ++lev) { // Reset the `rho` array if `reset` is True @@ -567,7 +566,7 @@ WarpXParticleContainer::DepositCharge (Vector<std::unique_ptr<MultiFab> >& rho, MultiFab coarsened_fine_data(coarsened_fine_BA, fine_dm, rho[lev+1]->nComp(), 0); coarsened_fine_data.setVal(0.0); - int const refinement_ratio = 2; + const int refinement_ratio = 2; interpolateDensityFineToCoarse( *rho[lev+1], coarsened_fine_data, refinement_ratio ); rho[lev]->ParallelAdd( coarsened_fine_data, m_gdb->Geom(lev).periodicity() ); @@ -632,7 +631,8 @@ Real WarpXParticleContainer::sumParticleCharge(bool local) { amrex::Real total_charge = 0.0; - for (int lev = 0; lev < finestLevel(); ++lev) + const int nlevels = finestLevel(); + for (int lev = 0; lev < nlevels; ++lev) { #ifdef _OPENMP @@ -662,7 +662,9 @@ std::array<Real, 3> WarpXParticleContainer::meanParticleVelocity(bool local) { amrex::Real inv_clight_sq = 1.0/PhysConst::c/PhysConst::c; - for (int lev = 0; lev <= finestLevel(); ++lev) { + const int nLevels = finestLevel(); + + for (int lev = 0; lev <= nLevels; ++lev) { #ifdef _OPENMP #pragma omp parallel reduction(+:vx_total, vy_total, vz_total, np_total) @@ -706,7 +708,9 @@ Real WarpXParticleContainer::maxParticleVelocity(bool local) { amrex::ParticleReal max_v = 0.0; - for (int lev = 0; lev <= finestLevel(); ++lev) + const int nLevels = finestLevel(); + + for (int lev = 0; lev <= nLevels; ++lev) { #ifdef _OPENMP @@ -732,7 +736,7 @@ WarpXParticleContainer::PushXES (Real dt) { BL_PROFILE("WPC::PushXES()"); - int num_levels = finestLevel() + 1; + const int num_levels = finestLevel() + 1; for (int lev = 0; lev < num_levels; ++lev) { const auto& gm = m_gdb->Geom(lev); @@ -761,7 +765,9 @@ WarpXParticleContainer::PushXES (Real dt) void WarpXParticleContainer::PushX (Real dt) { - for (int lev = 0; lev <= finestLevel(); ++lev) { + const int nLevels = finestLevel(); + + for (int lev = 0; lev <= nLevels; ++lev) { PushX(lev, dt); } } |