aboutsummaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/BoundaryConditions/PML.cpp6
-rw-r--r--Source/BoundaryConditions/WarpX_PEC.H34
-rw-r--r--Source/BoundaryConditions/WarpX_PEC.cpp7
-rw-r--r--Source/Diagnostics/BTDiagnostics.H4
-rw-r--r--Source/Diagnostics/BTDiagnostics.cpp88
-rw-r--r--Source/Diagnostics/ComputeDiagFunctors/BackTransformFunctor.cpp6
-rw-r--r--Source/Diagnostics/ComputeDiagFunctors/BackTransformParticleFunctor.cpp2
-rw-r--r--Source/Diagnostics/ComputeDiagFunctors/DivBFunctor.cpp4
-rw-r--r--Source/Diagnostics/ComputeDiagFunctors/DivEFunctor.cpp2
-rw-r--r--Source/Diagnostics/Diagnostics.cpp35
-rw-r--r--Source/Diagnostics/FlushFormats/FlushFormatOpenPMD.cpp10
-rw-r--r--Source/Diagnostics/FlushFormats/FlushFormatPlotfile.cpp6
-rw-r--r--Source/Diagnostics/FullDiagnostics.cpp15
-rw-r--r--Source/Diagnostics/MultiDiagnostics.cpp2
-rw-r--r--Source/Diagnostics/ReducedDiags/FieldEnergy.cpp4
-rw-r--r--Source/Diagnostics/ReducedDiags/FieldMomentum.cpp5
-rw-r--r--Source/Diagnostics/ReducedDiags/FieldProbe.cpp8
-rw-r--r--Source/Diagnostics/ReducedDiags/LoadBalanceCosts.cpp6
-rw-r--r--Source/Diagnostics/ReducedDiags/ParticleEnergy.cpp5
-rw-r--r--Source/Diagnostics/ReducedDiags/ParticleHistogram.cpp3
-rw-r--r--Source/Diagnostics/ReducedDiags/ParticleMomentum.cpp5
-rw-r--r--Source/Diagnostics/SliceDiagnostic.cpp14
-rw-r--r--Source/Diagnostics/WarpXOpenPMD.cpp7
-rw-r--r--Source/Evolve/WarpXEvolve.cpp4
-rw-r--r--Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceSolver.cpp2
-rw-r--r--Source/FieldSolver/FiniteDifferenceSolver/HybridPICModel/HybridPICModel.cpp18
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmFirstOrder.cpp8
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmRZ.cpp4
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralFieldData.cpp26
-rw-r--r--Source/FieldSolver/SpectralSolver/SpectralFieldDataRZ.cpp4
-rw-r--r--Source/Initialization/WarpXInitData.cpp2
-rw-r--r--Source/Parallelization/WarpXRegrid.cpp4
-rw-r--r--Source/Particles/Collision/BinaryCollision/BinaryCollision.H5
-rw-r--r--Source/Particles/LaserParticleContainer.cpp2
-rw-r--r--Source/Particles/MultiParticleContainer.H6
-rw-r--r--Source/Particles/PhysicalParticleContainer.cpp6
-rw-r--r--Source/Particles/Resampling/Resampling.cpp2
-rw-r--r--Source/Particles/WarpXParticleContainer.cpp10
-rw-r--r--Source/Utils/WarpXMovingWindow.cpp6
-rw-r--r--Source/WarpX.cpp28
40 files changed, 189 insertions, 226 deletions
diff --git a/Source/BoundaryConditions/PML.cpp b/Source/BoundaryConditions/PML.cpp
index cc6639381..d34a2f732 100644
--- a/Source/BoundaryConditions/PML.cpp
+++ b/Source/BoundaryConditions/PML.cpp
@@ -58,7 +58,7 @@ using namespace amrex;
namespace
{
- static void FillLo (Sigma& sigma, Sigma& sigma_cumsum,
+ void FillLo (Sigma& sigma, Sigma& sigma_cumsum,
Sigma& sigma_star, Sigma& sigma_star_cumsum,
const int olo, const int ohi, const int glo, Real fac,
const amrex::Real v_sigma)
@@ -87,7 +87,7 @@ namespace
});
}
- static void FillHi (Sigma& sigma, Sigma& sigma_cumsum,
+ void FillHi (Sigma& sigma, Sigma& sigma_cumsum,
Sigma& sigma_star, Sigma& sigma_star_cumsum,
const int olo, const int ohi, const int ghi, Real fac,
const amrex::Real v_sigma)
@@ -115,7 +115,7 @@ namespace
}
#if (AMREX_SPACEDIM != 1)
- static void FillZero (Sigma& sigma, Sigma& sigma_cumsum,
+ void FillZero (Sigma& sigma, Sigma& sigma_cumsum,
Sigma& sigma_star, Sigma& sigma_star_cumsum,
const int olo, const int ohi)
{
diff --git a/Source/BoundaryConditions/WarpX_PEC.H b/Source/BoundaryConditions/WarpX_PEC.H
index c6d0559d1..2f68bc70c 100644
--- a/Source/BoundaryConditions/WarpX_PEC.H
+++ b/Source/BoundaryConditions/WarpX_PEC.H
@@ -166,23 +166,22 @@ using namespace amrex;
// For 2D : for icomp==1, (Ey in XZ, Etheta in RZ),
// icomp=1 is tangential to both x and z boundaries
// The logic below ensures that the flags are set right for 2D
- const bool is_tangent_to_PEC = ( (icomp == AMREX_SPACEDIM*idim)
- ? false : true );
+ const bool is_tangent_to_PEC = (icomp != AMREX_SPACEDIM*idim);
#elif (defined WARPX_DIM_1D_Z)
// For 1D : icomp=0 and icomp=1 (Ex and Ey are tangential to the z boundary)
// The logic below ensures that the flags are set right for 1D
- const bool is_tangent_to_PEC = ( ( icomp == idim+2) ? false : true );
+ const bool is_tangent_to_PEC = (icomp != idim+2);
#else
- const bool is_tangent_to_PEC = ( ( icomp == idim) ? false : true );
+ const bool is_tangent_to_PEC = (icomp != idim);
#endif
- if (isPECBoundary == true) {
+ if (isPECBoundary) {
// grid point ijk_vec is ig number of points pass the
// domain boundary in direction, idim
const int ig = get_cell_count_to_boundary(
dom_lo, dom_hi, ijk_vec, is_nodal, idim, iside);
if (ig == 0) {
- if (is_tangent_to_PEC == true and is_nodal[idim] == 1) {
+ if (is_tangent_to_PEC && is_nodal[idim] == 1) {
OnPECBoundary = true;
}
} else if (ig > 0) {
@@ -192,15 +191,15 @@ using namespace amrex;
: (dom_hi[idim] + 1 - ig));
GuardCell = true;
// tangential components are inverted across PEC boundary
- if (is_tangent_to_PEC == true) sign *= -1._rt;
+ if (is_tangent_to_PEC) sign *= -1._rt;
}
} // is PEC boundary
} // loop over iside
} // loop over dimensions
- if (OnPECBoundary == true) {
+ if (OnPECBoundary) {
// if ijk_vec is on a PEC boundary in any direction, set Etangential to 0.
Efield(ijk_vec,n) = 0._rt;
- } else if (GuardCell == true) {
+ } else if (GuardCell) {
Efield(ijk_vec,n) = sign * Efield(ijk_mirror,n);
}
}
@@ -288,19 +287,18 @@ using namespace amrex;
const bool isPECBoundary = ( (iside == 0 )
? is_boundary_PEC(fbndry_lo, idim)
: is_boundary_PEC(fbndry_hi, idim) );
- if (isPECBoundary == true) {
+ if (isPECBoundary) {
#if (defined WARPX_DIM_XZ) || (defined WARPX_DIM_RZ)
// For 2D : for icomp==1, (By in XZ, Btheta in RZ),
// icomp=1 is not normal to x or z boundary
// The logic below ensures that the flags are set right for 2D
- const bool is_normal_to_PEC = ( (icomp == AMREX_SPACEDIM*idim)
- ? true : false );
+ const bool is_normal_to_PEC = (icomp == (AMREX_SPACEDIM*idim));
#elif (defined WARPX_DIM_1D_Z)
// For 1D : icomp=0 and icomp=1 (Bx and By are not normal to the z boundary)
// The logic below ensures that the flags are set right for 1D
- const bool is_normal_to_PEC = ( ( icomp == idim+2) ? true : false );
+ const bool is_normal_to_PEC = (icomp == (idim+2));
#else
- const bool is_normal_to_PEC = ( ( icomp == idim) ? true : false );
+ const bool is_normal_to_PEC = (icomp == idim);
#endif
// grid point ijk_vec is ig number of points pass the
@@ -310,7 +308,7 @@ using namespace amrex;
if (ig == 0) {
// Only normal component is set to 0
- if (is_normal_to_PEC == true and is_nodal[idim]==1) {
+ if (is_normal_to_PEC && is_nodal[idim]==1) {
OnPECBoundary = true;
}
} else if ( ig > 0) {
@@ -321,16 +319,16 @@ using namespace amrex;
: (dom_hi[idim] + 1 - ig));
GuardCell = true;
// Sign of the normal component in guard cell is inverted
- if (is_normal_to_PEC == true) sign *= -1._rt;
+ if (is_normal_to_PEC) sign *= -1._rt;
}
} // if PEC Boundary
} // loop over sides
} // loop of dimensions
- if (OnPECBoundary == true) {
+ if (OnPECBoundary) {
// if ijk_vec is on a PEC boundary in any direction, set Bnormal to 0.
Bfield(ijk_vec,n) = 0._rt;
- } else if (GuardCell == true) {
+ } else if (GuardCell) {
// Bnormal and Btangential is set opposite and equal to the value
// in the mirror location, respectively.
Bfield(ijk_vec,n) = sign * Bfield(ijk_mirror,n);
diff --git a/Source/BoundaryConditions/WarpX_PEC.cpp b/Source/BoundaryConditions/WarpX_PEC.cpp
index 6841fb9bc..b3986da06 100644
--- a/Source/BoundaryConditions/WarpX_PEC.cpp
+++ b/Source/BoundaryConditions/WarpX_PEC.cpp
@@ -361,15 +361,14 @@ PEC::ApplyPECtoJfield(amrex::MultiFab* Jx, amrex::MultiFab* Jy,
#if (defined WARPX_DIM_1D_Z)
// For 1D : icomp=0 and icomp=1 (Ex and Ey are tangential to the z boundary)
// The logic below ensures that the flags are set right for 1D
- is_tangent_to_bndy[icomp][idim] = ( ( icomp == idim+2) ? false : true );
+ is_tangent_to_bndy[icomp][idim] = (icomp != (idim+2));
#elif (defined WARPX_DIM_XZ) || (defined WARPX_DIM_RZ)
// For 2D : for icomp==1, (Ey in XZ, Etheta in RZ),
// icomp=1 is tangential to both x and z boundaries
// The logic below ensures that the flags are set right for 2D
- is_tangent_to_bndy[icomp][idim] = ( (icomp == AMREX_SPACEDIM*idim)
- ? false : true );
+ is_tangent_to_bndy[icomp][idim] = (icomp != AMREX_SPACEDIM*idim);
#else
- is_tangent_to_bndy[icomp][idim] = ( ( icomp == idim) ? false : true );
+ is_tangent_to_bndy[icomp][idim] = (icomp != idim);
#endif
if (is_tangent_to_bndy[icomp][idim]){
diff --git a/Source/Diagnostics/BTDiagnostics.H b/Source/Diagnostics/BTDiagnostics.H
index 348e44c29..633902dd8 100644
--- a/Source/Diagnostics/BTDiagnostics.H
+++ b/Source/Diagnostics/BTDiagnostics.H
@@ -148,7 +148,7 @@ private:
*/
bool m_do_back_transformed_particles = true;
- /** m_gamma_boost, is a copy of warpx.gamma_boost
+ /** m_gamma_boost, is a copy of WarpX::gamma_boost
* That is, the Lorentz factor of the boosted frame in which the simulation is run.
* The direction for Lorentz transformation is assumed to be along
* ``warpx.boost_direction``, which is the same as the moving window direction.
@@ -157,7 +157,7 @@ private:
*/
amrex::Real m_gamma_boost;
amrex::Real m_beta_boost;
- /** m_moving_window_dir is a copy of warpx.moving_window_dir
+ /** m_moving_window_dir is a copy of WarpX::moving_window_dir
* Currently, back-transformed diagnostics only works if moving window is
* in z-direction for both 2D and 3D simulations in the Cartesian frame of reference.
*/
diff --git a/Source/Diagnostics/BTDiagnostics.cpp b/Source/Diagnostics/BTDiagnostics.cpp
index c368d2452..71834bead 100644
--- a/Source/Diagnostics/BTDiagnostics.cpp
+++ b/Source/Diagnostics/BTDiagnostics.cpp
@@ -64,7 +64,7 @@ void BTDiagnostics::DerivedInitData ()
auto & warpx = WarpX::GetInstance();
m_gamma_boost = WarpX::gamma_boost;
m_beta_boost = std::sqrt( 1._rt - 1._rt/( m_gamma_boost * m_gamma_boost) );
- m_moving_window_dir = warpx.moving_window_dir;
+ m_moving_window_dir = WarpX::moving_window_dir;
// Currently, for BTD, all the data is averaged+coarsened to coarsest level
// and then sliced+back-transformed+filled_to_buffer.
// The number of levels to be output is nlev_output.
@@ -112,14 +112,12 @@ void BTDiagnostics::DerivedInitData ()
const amrex::ParmParse pp_diag_name(m_diag_name);
int write_species = 1;
pp_diag_name.query("write_species", write_species);
- if (m_output_species_names.size() == 0 and write_species == 1)
+ if ((m_output_species_names.size() == 0) && (write_species == 1))
m_output_species_names = mpc.GetSpeciesNames();
- if (m_output_species_names.size() > 0 and write_species == 1) {
- m_do_back_transformed_particles = true;
- } else {
- m_do_back_transformed_particles = false;
- }
+ m_do_back_transformed_particles =
+ ((m_output_species_names.size() > 0) && (write_species == 1));
+
// Turn on do_back_transformed_particles in the particle containers so that
// the tmp_particle_data is allocated and the data of the corresponding species is
// copied and stored in tmp_particle_data before particles are pushed.
@@ -136,8 +134,8 @@ void BTDiagnostics::DerivedInitData ()
// check that simulation can fill all BTD snapshots
const int lev = 0;
const amrex::Real dt_boosted_frame = warpx.getdt(lev);
- const int moving_dir = warpx.moving_window_dir;
- const amrex::Real Lz_lab = warpx.Geom(lev).ProbLength(moving_dir) / warpx.gamma_boost / (1._rt+warpx.beta_boost);
+ const int moving_dir = WarpX::moving_window_dir;
+ const amrex::Real Lz_lab = warpx.Geom(lev).ProbLength(moving_dir) / WarpX::gamma_boost / (1._rt+WarpX::beta_boost);
const int ref_ratio = 1;
const amrex::Real dz_snapshot_grid = dz_lab(dt_boosted_frame, ref_ratio);
// Need enough buffers so the snapshot length is longer than the lab frame length
@@ -163,10 +161,10 @@ void BTDiagnostics::DerivedInitData ()
// if j = final snapshot starting step, then we want to solve
// j dt_boosted_frame >= t_intersect_boost = i * dt_snapshot / gamma / (1+beta)
// j >= i / gamma / (1+beta) * dt_snapshot / dt_boosted_frame
- const int final_snapshot_starting_step = static_cast<int>(std::ceil(final_snapshot_iteration / warpx.gamma_boost / (1._rt+warpx.beta_boost) * m_dt_snapshots_lab / dt_boosted_frame));
+ const int final_snapshot_starting_step = static_cast<int>(std::ceil(final_snapshot_iteration / WarpX::gamma_boost / (1._rt+WarpX::beta_boost) * m_dt_snapshots_lab / dt_boosted_frame));
const int final_snapshot_fill_iteration = final_snapshot_starting_step + num_buffers * m_buffer_size - 1;
const amrex::Real final_snapshot_fill_time = final_snapshot_fill_iteration * dt_boosted_frame;
- if (warpx.compute_max_step_from_btd) {
+ if (WarpX::compute_max_step_from_btd) {
if (final_snapshot_fill_iteration > warpx.maxStep()) {
warpx.updateMaxStep(final_snapshot_fill_iteration);
amrex::Print()<<"max_step insufficient to fill all BTD snapshots. Automatically increased to: "
@@ -206,20 +204,19 @@ void
BTDiagnostics::ReadParameters ()
{
BaseReadParameters();
- auto & warpx = WarpX::GetInstance();
- WARPX_ALWAYS_ASSERT_WITH_MESSAGE( warpx.gamma_boost > 1.0_rt,
+ WARPX_ALWAYS_ASSERT_WITH_MESSAGE( WarpX::gamma_boost > 1.0_rt,
"gamma_boost must be > 1 to use the back-transformed diagnostics");
- WARPX_ALWAYS_ASSERT_WITH_MESSAGE( warpx.boost_direction[2] == 1,
+ WARPX_ALWAYS_ASSERT_WITH_MESSAGE( WarpX::boost_direction[2] == 1,
"The back transformed diagnostics currently only works if the boost is in the z-direction");
- WARPX_ALWAYS_ASSERT_WITH_MESSAGE( warpx.do_moving_window,
+ WARPX_ALWAYS_ASSERT_WITH_MESSAGE( WarpX::do_moving_window,
"The moving window should be on if using the boosted frame diagnostic.");
// The next two asserts could be relaxed with respect to check to current step
- WARPX_ALWAYS_ASSERT_WITH_MESSAGE( warpx.end_moving_window_step < 0,
+ WARPX_ALWAYS_ASSERT_WITH_MESSAGE( WarpX::end_moving_window_step < 0,
"The moving window must not stop when using the boosted frame diagnostic.");
- WARPX_ALWAYS_ASSERT_WITH_MESSAGE( warpx.start_moving_window_step == 0,
+ WARPX_ALWAYS_ASSERT_WITH_MESSAGE( WarpX::start_moving_window_step == 0,
"The moving window must start at step zero for the boosted frame diagnostic.");
- WARPX_ALWAYS_ASSERT_WITH_MESSAGE( warpx.moving_window_dir == WARPX_ZINDEX,
+ WARPX_ALWAYS_ASSERT_WITH_MESSAGE( WarpX::moving_window_dir == WARPX_ZINDEX,
"The boosted frame diagnostic currently only works if the moving window is in the z direction.");
WARPX_ALWAYS_ASSERT_WITH_MESSAGE(
m_format == "plotfile" || m_format == "openpmd",
@@ -236,7 +233,7 @@ BTDiagnostics::ReadParameters ()
pp_diag_name.query("do_back_transformed_fields", m_do_back_transformed_fields);
pp_diag_name.query("do_back_transformed_particles", m_do_back_transformed_particles);
AMREX_ALWAYS_ASSERT(m_do_back_transformed_fields or m_do_back_transformed_particles);
- if (m_do_back_transformed_fields == false) m_varnames.clear();
+ if (!m_do_back_transformed_fields) m_varnames.clear();
std::vector<std::string> intervals_string_vec = {"0"};
@@ -340,10 +337,10 @@ BTDiagnostics::InitializeBufferData ( int i_buffer , int lev, bool restart)
// When restarting boosted simulations, the code below needs to take
// into account the fact that the position of the box at the beginning
// of the simulation, is not the one that we had at t=0 (because of the moving window)
- const amrex::Real boosted_moving_window_v = (warpx.moving_window_v - m_beta_boost*PhysConst::c)
- / (1._rt - m_beta_boost * warpx.moving_window_v/PhysConst::c);
+ const amrex::Real boosted_moving_window_v = (WarpX::moving_window_v - m_beta_boost*PhysConst::c)
+ / (1._rt - m_beta_boost * WarpX::moving_window_v/PhysConst::c);
// Lab-frame time for the i^th snapshot
- if (restart == false) {
+ if (!restart) {
const amrex::Real zmax_0 = warpx.Geom(lev).ProbHi(m_moving_window_dir);
m_t_lab.at(i_buffer) = m_intervals.GetBTDIteration(i_buffer) * m_dt_snapshots_lab
+ m_gamma_boost*m_beta_boost*zmax_0/PhysConst::c;
@@ -470,12 +467,12 @@ BTDiagnostics::InitializeBufferData ( int i_buffer , int lev, bool restart)
// number of cells in z is modified since each buffer multifab always
// contains a minimum m_buffer_size=256 cells
const int num_z_cells_in_snapshot = m_max_buffer_multifabs[i_buffer] * m_buffer_size;
- if (restart == false) {
+ if (!restart) {
m_snapshot_domain_lab[i_buffer] = diag_dom;
m_snapshot_domain_lab[i_buffer].setLo(m_moving_window_dir,
- zmin_buffer_lab + warpx.moving_window_v * m_t_lab[i_buffer]);
+ zmin_buffer_lab + WarpX::moving_window_v * m_t_lab[i_buffer]);
m_snapshot_domain_lab[i_buffer].setHi(m_moving_window_dir,
- zmax_buffer_lab + warpx.moving_window_v * m_t_lab[i_buffer]);
+ zmax_buffer_lab + WarpX::moving_window_v * m_t_lab[i_buffer]);
// To prevent round off errors, moving the snapshot domain by half a cell so that all the slices
// lie close to the cell-centers in the lab-frame grid instead of on the edge of cell.
const amrex::Real new_hi = m_snapshot_domain_lab[i_buffer].hi(m_moving_window_dir)
@@ -499,7 +496,7 @@ BTDiagnostics::InitializeBufferData ( int i_buffer , int lev, bool restart)
m_snapshot_box[i_buffer].setSmall( m_moving_window_dir,
snapshot_kindex_hi - (num_z_cells_in_snapshot-1) );
// Setting hi k-index for the first buffer
- if (restart == false) {
+ if (!restart) {
m_buffer_k_index_hi[i_buffer] = m_snapshot_box[i_buffer].bigEnd(m_moving_window_dir);
}
}
@@ -507,7 +504,7 @@ BTDiagnostics::InitializeBufferData ( int i_buffer , int lev, bool restart)
void
BTDiagnostics::DefineCellCenteredMultiFab(int lev)
{
- if (m_do_back_transformed_fields == false) return;
+ if (!m_do_back_transformed_fields) return;
// Creating MultiFab to store cell-centered data in boosted-frame for the entire-domain
// This MultiFab will store all the user-requested fields in the boosted-frame
auto & warpx = WarpX::GetInstance();
@@ -529,7 +526,7 @@ void
BTDiagnostics::InitializeFieldFunctors (int lev)
{
// Initialize fields functors only if do_back_transformed_fields is selected
- if (m_do_back_transformed_fields == false) return;
+ if (!m_do_back_transformed_fields) return;
#ifdef WARPX_DIM_RZ
// For RZ, initialize field functors RZ for openpmd
@@ -783,7 +780,7 @@ void
BTDiagnostics::PrepareFieldDataForOutput ()
{
// Initialize fields functors only if do_back_transformed_fields is selected
- if (m_do_back_transformed_fields == false) return;
+ if (!m_do_back_transformed_fields) return;
auto & warpx = WarpX::GetInstance();
// In this function, we will get cell-centered data for every level, lev,
@@ -943,7 +940,7 @@ BTDiagnostics::DefineFieldBufferMultiFab (const int i_buffer, const int lev)
} else if (lev > 0 ) {
// Refine the geometry object defined at the previous level, lev-1
m_geom_output[i_buffer][lev] = amrex::refine( m_geom_output[i_buffer][lev-1],
- warpx.RefRatio(lev-1) );
+ WarpX::RefRatio(lev-1) );
}
m_field_buffer_multifab_defined[i_buffer] = 1;
}
@@ -953,7 +950,6 @@ void
BTDiagnostics::DefineSnapshotGeometry (const int i_buffer, const int lev)
{
if (m_snapshot_geometry_defined[i_buffer] == 1) return;
- auto & warpx = WarpX::GetInstance();
if (lev == 0) {
// Default non-periodic geometry for diags
@@ -968,7 +964,7 @@ BTDiagnostics::DefineSnapshotGeometry (const int i_buffer, const int lev)
} else if (lev > 0) {
// Refine the geometry object defined at the previous level, lev-1
m_geom_snapshot[i_buffer][lev] = amrex::refine( m_geom_snapshot[i_buffer][lev-1],
- warpx.RefRatio(lev-1) );
+ WarpX::RefRatio(lev-1) );
}
m_snapshot_geometry_defined[i_buffer] = 1;
}
@@ -980,28 +976,22 @@ BTDiagnostics::GetZSliceInDomainFlag (const int i_buffer, const int lev)
const amrex::RealBox& boost_domain = warpx.Geom(lev).ProbDomain();
const amrex::Real buffer_zmin_lab = m_snapshot_domain_lab[i_buffer].lo( m_moving_window_dir );
const amrex::Real buffer_zmax_lab = m_snapshot_domain_lab[i_buffer].hi( m_moving_window_dir );
- if ( ( m_current_z_boost[i_buffer] <= boost_domain.lo(m_moving_window_dir) ) or
- ( m_current_z_boost[i_buffer] >= boost_domain.hi(m_moving_window_dir) ) or
- ( m_current_z_lab[i_buffer] <= buffer_zmin_lab ) or
- ( m_current_z_lab[i_buffer] >= buffer_zmax_lab ) )
- {
- // the slice is not in the boosted domain or lab-frame domain
- return false;
- }
- return true;
+ const bool slice_not_in_domain =
+ ( m_current_z_boost[i_buffer] <= boost_domain.lo(m_moving_window_dir) ) ||
+ ( m_current_z_boost[i_buffer] >= boost_domain.hi(m_moving_window_dir) ) ||
+ ( m_current_z_lab[i_buffer] <= buffer_zmin_lab ) ||
+ ( m_current_z_lab[i_buffer] >= buffer_zmax_lab );
+
+ return !slice_not_in_domain;
}
bool
BTDiagnostics::GetKIndexInSnapshotBoxFlag (const int i_buffer, const int lev)
{
- if (k_index_zlab(i_buffer, lev) >= m_snapshot_box[i_buffer].smallEnd(m_moving_window_dir) and
- k_index_zlab(i_buffer, lev) <= m_snapshot_box[i_buffer].bigEnd(m_moving_window_dir)) {
- return true;
- }
-
- return false;
+ return (k_index_zlab(i_buffer, lev) >= m_snapshot_box[i_buffer].smallEnd(m_moving_window_dir) &&
+ k_index_zlab(i_buffer, lev) <= m_snapshot_box[i_buffer].bigEnd(m_moving_window_dir));
}
void
@@ -1014,7 +1004,7 @@ BTDiagnostics::Flush (int i_buffer)
file_name = file_name+"/buffer";
}
SetSnapshotFullStatus(i_buffer);
- const bool isLastBTDFlush = ( m_snapshot_full[i_buffer] == 1 ) ? true : false;
+ const bool isLastBTDFlush = ( m_snapshot_full[i_buffer] == 1 );
bool const use_pinned_pc = true;
bool const isBTD = true;
double const labtime = m_t_lab[i_buffer];
@@ -1173,7 +1163,7 @@ void BTDiagnostics::MergeBuffersForPlotfile (int i_snapshot)
std::rename(buffer_job_info_path.c_str(), snapshot_job_info_path.c_str());
}
- if (m_do_back_transformed_fields == true) {
+ if (m_do_back_transformed_fields) {
// Read the header file to get the fab on disk string
BTDMultiFabHeaderImpl Buffer_FabHeader(recent_Buffer_FabHeaderFilename);
Buffer_FabHeader.ReadMultiFabHeader();
diff --git a/Source/Diagnostics/ComputeDiagFunctors/BackTransformFunctor.cpp b/Source/Diagnostics/ComputeDiagFunctors/BackTransformFunctor.cpp
index 3e985f291..4d551a271 100644
--- a/Source/Diagnostics/ComputeDiagFunctors/BackTransformFunctor.cpp
+++ b/Source/Diagnostics/ComputeDiagFunctors/BackTransformFunctor.cpp
@@ -52,8 +52,8 @@ BackTransformFunctor::operator ()(amrex::MultiFab& mf_dst, int /*dcomp*/, const
if ( m_perform_backtransform[i_buffer] == 1) {
auto& warpx = WarpX::GetInstance();
auto geom = warpx.Geom(m_lev);
- const amrex::Real gamma_boost = warpx.gamma_boost;
- const int moving_window_dir = warpx.moving_window_dir;
+ const amrex::Real gamma_boost = WarpX::gamma_boost;
+ const int moving_window_dir = WarpX::moving_window_dir;
const amrex::Real beta_boost = std::sqrt( 1._rt - 1._rt/( gamma_boost * gamma_boost) );
const bool interpolate = true;
std::unique_ptr< amrex::MultiFab > slice = nullptr;
@@ -163,7 +163,7 @@ BackTransformFunctor::PrepareFunctorData (int i_buffer,
m_current_z_boost[i_buffer] = current_z_boost;
m_k_index_zlab[i_buffer] = k_index_zlab;
m_perform_backtransform[i_buffer] = 0;
- if (z_slice_in_domain == true and snapshot_full == 0) m_perform_backtransform[i_buffer] = 1;
+ if (z_slice_in_domain && (snapshot_full == 0)) m_perform_backtransform[i_buffer] = 1;
m_max_box_size = max_box_size;
}
diff --git a/Source/Diagnostics/ComputeDiagFunctors/BackTransformParticleFunctor.cpp b/Source/Diagnostics/ComputeDiagFunctors/BackTransformParticleFunctor.cpp
index 0442dad7a..2275ee83f 100644
--- a/Source/Diagnostics/ComputeDiagFunctors/BackTransformParticleFunctor.cpp
+++ b/Source/Diagnostics/ComputeDiagFunctors/BackTransformParticleFunctor.cpp
@@ -171,5 +171,5 @@ BackTransformParticleFunctor::PrepareFunctorData ( int i_buffer, bool z_slice_in
m_current_z_boost.at(i_buffer) = current_z_boost;
m_t_lab.at(i_buffer) = t_lab;
m_perform_backtransform.at(i_buffer) = 0;
- if (z_slice_in_domain == true and snapshot_full == 0) m_perform_backtransform.at(i_buffer) = 1;
+ if (z_slice_in_domain && (snapshot_full == 0)) m_perform_backtransform.at(i_buffer) = 1;
}
diff --git a/Source/Diagnostics/ComputeDiagFunctors/DivBFunctor.cpp b/Source/Diagnostics/ComputeDiagFunctors/DivBFunctor.cpp
index 093b4960e..b5782e76a 100644
--- a/Source/Diagnostics/ComputeDiagFunctors/DivBFunctor.cpp
+++ b/Source/Diagnostics/ComputeDiagFunctors/DivBFunctor.cpp
@@ -23,8 +23,8 @@ DivBFunctor::operator()(amrex::MultiFab& mf_dst, int dcomp, const int /*i_buffer
constexpr int ng = 1;
// A cell-centered divB multifab spanning the entire domain is generated
// and divB is computed on the cell-center, with ng=1.
- amrex::MultiFab divB( warpx.boxArray(m_lev), warpx.DistributionMap(m_lev), warpx.ncomps, ng );
- warpx.ComputeDivB(divB, 0, m_arr_mf_src, WarpX::CellSize(m_lev) );
+ amrex::MultiFab divB( warpx.boxArray(m_lev), warpx.DistributionMap(m_lev), WarpX::ncomps, ng );
+ WarpX::ComputeDivB(divB, 0, m_arr_mf_src, WarpX::CellSize(m_lev) );
// // Coarsen and Interpolate from divB to coarsened/reduced_domain mf_dst
// ablastr::coarsen::sample::Coarsen( mf_dst, divB, dcomp, 0, nComp(), 0, m_crse_ratio);
#ifdef WARPX_DIM_RZ
diff --git a/Source/Diagnostics/ComputeDiagFunctors/DivEFunctor.cpp b/Source/Diagnostics/ComputeDiagFunctors/DivEFunctor.cpp
index e0c5b755b..62801cd43 100644
--- a/Source/Diagnostics/ComputeDiagFunctors/DivEFunctor.cpp
+++ b/Source/Diagnostics/ComputeDiagFunctors/DivEFunctor.cpp
@@ -43,7 +43,7 @@ DivEFunctor::operator()(amrex::MultiFab& mf_dst, const int dcomp, const int /*i_
#endif
const amrex::BoxArray& ba = amrex::convert(warpx.boxArray(m_lev), cell_type);
- amrex::MultiFab divE(ba, warpx.DistributionMap(m_lev), warpx.ncomps, ng );
+ amrex::MultiFab divE(ba, warpx.DistributionMap(m_lev), WarpX::ncomps, ng );
warpx.ComputeDivE(divE, m_lev);
#ifdef WARPX_DIM_RZ
diff --git a/Source/Diagnostics/Diagnostics.cpp b/Source/Diagnostics/Diagnostics.cpp
index e33810e45..62c802483 100644
--- a/Source/Diagnostics/Diagnostics.cpp
+++ b/Source/Diagnostics/Diagnostics.cpp
@@ -212,7 +212,7 @@ Diagnostics::BaseReadParameters ()
}
}
// For a moving window simulation, the user-defined m_lo and m_hi must be converted.
- if (warpx.do_moving_window) {
+ if (WarpX::do_moving_window) {
#if defined(WARPX_DIM_3D)
amrex::Vector<int> dim_map {0, 1, 2};
#elif defined(WARPX_DIM_XZ) || defined(WARPX_DIM_RZ)
@@ -220,13 +220,13 @@ Diagnostics::BaseReadParameters ()
#else
amrex::Vector<int> dim_map {2};
#endif
- if (warpx.boost_direction[ dim_map[warpx.moving_window_dir] ] == 1) {
+ if (WarpX::boost_direction[ dim_map[WarpX::moving_window_dir] ] == 1) {
// Convert user-defined lo and hi for diagnostics to account for boosted-frame
// simulations with moving window
- const amrex::Real convert_factor = 1._rt/(warpx.gamma_boost * (1._rt - warpx.beta_boost) );
+ const amrex::Real convert_factor = 1._rt/(WarpX::gamma_boost * (1._rt - WarpX::beta_boost) );
// Assuming that the window travels with speed c
- m_lo[warpx.moving_window_dir] *= convert_factor;
- m_hi[warpx.moving_window_dir] *= convert_factor;
+ m_lo[WarpX::moving_window_dir] *= convert_factor;
+ m_hi[WarpX::moving_window_dir] *= convert_factor;
}
}
@@ -275,18 +275,17 @@ Diagnostics::BaseReadParameters ()
}
}
- bool checkpoint_compatibility = false;
- if (m_format == "checkpoint"){
- if ( varnames_specified == false &&
- pfield_varnames_specified == false &&
- pfield_species_specified == false &&
- lo_specified == false &&
- hi_specified == false &&
- cr_specified == false &&
- species_specified == false ) checkpoint_compatibility = true;
- }
- return checkpoint_compatibility;
+ const bool checkpoint_compatibility = (
+ m_format == "checkpoint" &&
+ !varnames_specified &&
+ !pfield_varnames_specified &&
+ !pfield_species_specified &&
+ !lo_specified &&
+ !hi_specified &&
+ !cr_specified &&
+ !species_specified );
+ return checkpoint_compatibility;
}
@@ -463,8 +462,8 @@ Diagnostics::InitBaseData ()
// For restart, move the m_lo and m_hi of the diag consistent with the
// current moving_window location
- if (warpx.do_moving_window) {
- const int moving_dir = warpx.moving_window_dir;
+ if (WarpX::do_moving_window) {
+ const int moving_dir = WarpX::moving_window_dir;
const int shift_num_base = static_cast<int>((warpx.getmoving_window_x() - m_lo[moving_dir]) / warpx.Geom(0).CellSize(moving_dir) );
m_lo[moving_dir] += shift_num_base * warpx.Geom(0).CellSize(moving_dir);
m_hi[moving_dir] += shift_num_base * warpx.Geom(0).CellSize(moving_dir);
diff --git a/Source/Diagnostics/FlushFormats/FlushFormatOpenPMD.cpp b/Source/Diagnostics/FlushFormats/FlushFormatOpenPMD.cpp
index 2c7e5350a..3832bf5e9 100644
--- a/Source/Diagnostics/FlushFormats/FlushFormatOpenPMD.cpp
+++ b/Source/Diagnostics/FlushFormats/FlushFormatOpenPMD.cpp
@@ -37,11 +37,11 @@ FlushFormatOpenPMD::FlushFormatOpenPMD (const std::string& diag_name)
const bool encodingDefined = pp_diag_name.query("openpmd_encoding", openpmd_encoding);
openPMD::IterationEncoding encoding = openPMD::IterationEncoding::groupBased;
- if ( 0 == openpmd_encoding.compare("v") )
+ if ( openpmd_encoding == "v" )
encoding = openPMD::IterationEncoding::variableBased;
- else if ( 0 == openpmd_encoding.compare("g") )
+ else if ( openpmd_encoding == "g" )
encoding = openPMD::IterationEncoding::groupBased;
- else if ( 0 == openpmd_encoding.compare("f") )
+ else if ( openpmd_encoding == "f" )
encoding = openPMD::IterationEncoding::fileBased;
std::string diag_type_str;
@@ -74,7 +74,7 @@ FlushFormatOpenPMD::FlushFormatOpenPMD (const std::string& diag_name)
pp_diag_name.query("adios2_operator.type", operator_type);
std::string const prefix = diag_name + ".adios2_operator.parameters";
const ParmParse pp;
- auto entr = pp.getEntries(prefix);
+ auto entr = amrex::ParmParse::getEntries(prefix);
std::map< std::string, std::string > operator_parameters;
auto const prefix_len = prefix.size() + 1;
@@ -90,7 +90,7 @@ FlushFormatOpenPMD::FlushFormatOpenPMD (const std::string& diag_name)
pp_diag_name.query("adios2_engine.type", engine_type);
std::string const engine_prefix = diag_name + ".adios2_engine.parameters";
const ParmParse ppe;
- auto eng_entr = ppe.getEntries(engine_prefix);
+ auto eng_entr = amrex::ParmParse::getEntries(engine_prefix);
std::map< std::string, std::string > engine_parameters;
auto const prefixlen = engine_prefix.size() + 1;
diff --git a/Source/Diagnostics/FlushFormats/FlushFormatPlotfile.cpp b/Source/Diagnostics/FlushFormats/FlushFormatPlotfile.cpp
index 0cf09ebf9..744aad019 100644
--- a/Source/Diagnostics/FlushFormats/FlushFormatPlotfile.cpp
+++ b/Source/Diagnostics/FlushFormats/FlushFormatPlotfile.cpp
@@ -577,8 +577,8 @@ FlushFormatPlotfile::WriteAllRawFields(
{
// rho_fp will have either ncomps or 2*ncomps (2 being the old and new). When 2, return the new so
// there is time synchronization.
- const int nstart = warpx.getrho_fp(lev).nComp() - warpx.ncomps;
- const MultiFab rho_new(warpx.getrho_fp(lev), amrex::make_alias, nstart, warpx.ncomps);
+ const int nstart = warpx.getrho_fp(lev).nComp() - WarpX::ncomps;
+ const MultiFab rho_new(warpx.getrho_fp(lev), amrex::make_alias, nstart, WarpX::ncomps);
WriteRawMF(rho_new, dm, raw_pltname, default_level_prefix, "rho_fp", lev, plot_raw_fields_guards);
}
if (warpx.get_pointer_phi_fp(lev) != nullptr) {
@@ -586,7 +586,7 @@ FlushFormatPlotfile::WriteAllRawFields(
}
// Averaged fields on fine patch
- if (warpx.fft_do_time_averaging)
+ if (WarpX::fft_do_time_averaging)
{
WriteRawMF(warpx.getEfield_avg_fp(lev, 0) , dm, raw_pltname, default_level_prefix,
"Ex_avg_fp", lev, plot_raw_fields_guards);
diff --git a/Source/Diagnostics/FullDiagnostics.cpp b/Source/Diagnostics/FullDiagnostics.cpp
index 742e84553..13dff5432 100644
--- a/Source/Diagnostics/FullDiagnostics.cpp
+++ b/Source/Diagnostics/FullDiagnostics.cpp
@@ -156,10 +156,7 @@ FullDiagnostics::DoComputeAndPack (int step, bool force_flush)
{
// Data must be computed and packed for full diagnostics
// whenever the data needs to be flushed.
- if (force_flush || m_intervals.contains(step+1) ){
- return true;
- }
- return false;
+ return (force_flush || m_intervals.contains(step+1));
}
void
@@ -489,7 +486,7 @@ FullDiagnostics::InitializeBufferData (int i_buffer, int lev, bool restart ) {
}
}
- if (use_warpxba == false) {
+ if (!use_warpxba) {
// Following are the steps to compute the lo and hi index corresponding to user-defined
// m_lo and m_hi using the same resolution as the simulation at level, lev.
amrex::IntVect lo(0);
@@ -539,7 +536,7 @@ FullDiagnostics::InitializeBufferData (int i_buffer, int lev, bool restart ) {
ba.coarsen(m_crse_ratio);
// Generate a new distribution map if the physical m_lo and m_hi for the output
// is different from the lo and hi physical co-ordinates of the simulation domain.
- if (use_warpxba == false) dmap = amrex::DistributionMapping{ba};
+ if (!use_warpxba) dmap = amrex::DistributionMapping{ba};
// Allocate output MultiFab for diagnostics. The data will be stored at cell-centers.
const int ngrow = (m_format == "sensei" || m_format == "ascent") ? 1 : 0;
int const ncomp = static_cast<int>(m_varnames.size());
@@ -558,7 +555,7 @@ FullDiagnostics::InitializeBufferData (int i_buffer, int lev, bool restart ) {
} else if (lev > 0) {
// Take the geom object of previous level and refine it.
m_geom_output[i_buffer][lev] = amrex::refine( m_geom_output[i_buffer][lev-1],
- warpx.RefRatio(lev-1) );
+ WarpX::RefRatio(lev-1) );
}
}
@@ -744,8 +741,8 @@ FullDiagnostics::MovingWindowAndGalileanDomainShift (int step)
m_geom_output[0][lev].ProbDomain( amrex::RealBox(new_lo, new_hi) );
}
// For Moving Window Shift
- if (warpx.moving_window_active(step+1)) {
- const int moving_dir = warpx.moving_window_dir;
+ if (WarpX::moving_window_active(step+1)) {
+ const int moving_dir = WarpX::moving_window_dir;
const amrex::Real moving_window_x = warpx.getmoving_window_x();
// Get the updated lo and hi of the geom domain
const amrex::Real* cur_lo = m_geom_output[0][0].ProbLo();
diff --git a/Source/Diagnostics/MultiDiagnostics.cpp b/Source/Diagnostics/MultiDiagnostics.cpp
index d026314ff..5a50dfb65 100644
--- a/Source/Diagnostics/MultiDiagnostics.cpp
+++ b/Source/Diagnostics/MultiDiagnostics.cpp
@@ -81,7 +81,7 @@ MultiDiagnostics::FilterComputePackFlush (int step, bool force_flush, bool BackT
{
int i = 0;
for (auto& diag : alldiags){
- if (BackTransform == true) {
+ if (BackTransform) {
if (diags_types[i] == DiagTypes::BackTransformed)
diag->FilterComputePackFlush (step, force_flush);
} else {
diff --git a/Source/Diagnostics/ReducedDiags/FieldEnergy.cpp b/Source/Diagnostics/ReducedDiags/FieldEnergy.cpp
index 9db42f77c..a88690f86 100644
--- a/Source/Diagnostics/ReducedDiags/FieldEnergy.cpp
+++ b/Source/Diagnostics/ReducedDiags/FieldEnergy.cpp
@@ -180,7 +180,7 @@ FieldEnergy::ComputeNorm2RZ(const amrex::MultiFab& field, const int lev)
amrex::Box tb = convert(tilebox, field.ixType().toIntVect());
// Lower corner of tile box physical domain
- const std::array<amrex::Real, 3>& xyzmin = warpx.LowerCorner(tilebox, lev, 0._rt);
+ const std::array<amrex::Real, 3>& xyzmin = WarpX::LowerCorner(tilebox, lev, 0._rt);
const Dim3 lo = lbound(tilebox);
const Dim3 hi = ubound(tilebox);
const Real rmin = xyzmin[0] + (tb.ixType().nodeCentered(0) ? 0._rt : 0.5_rt*dr);
@@ -190,7 +190,7 @@ FieldEnergy::ComputeNorm2RZ(const amrex::MultiFab& field, const int lev)
int const ncomp = field.nComp();
for (int idir=0 ; idir < AMREX_SPACEDIM ; idir++) {
- if (warpx.field_boundary_hi[idir] == FieldBoundaryType::Periodic) {
+ if (WarpX::field_boundary_hi[idir] == FieldBoundaryType::Periodic) {
// For periodic boundaries, do not include the data in the nodes
// on the upper edge of the domain
tb.enclosedCells(idir);
diff --git a/Source/Diagnostics/ReducedDiags/FieldMomentum.cpp b/Source/Diagnostics/ReducedDiags/FieldMomentum.cpp
index bde692a8e..b9698d5ff 100644
--- a/Source/Diagnostics/ReducedDiags/FieldMomentum.cpp
+++ b/Source/Diagnostics/ReducedDiags/FieldMomentum.cpp
@@ -94,10 +94,7 @@ FieldMomentum::FieldMomentum (std::string rd_name)
void FieldMomentum::ComputeDiags (int step)
{
// Check if the diags should be done
- if (m_intervals.contains(step+1) == false)
- {
- return;
- }
+ if (!m_intervals.contains(step+1)) return;
// Get a reference to WarpX instance
auto & warpx = WarpX::GetInstance();
diff --git a/Source/Diagnostics/ReducedDiags/FieldProbe.cpp b/Source/Diagnostics/ReducedDiags/FieldProbe.cpp
index 4f32e83b0..7749d5ecc 100644
--- a/Source/Diagnostics/ReducedDiags/FieldProbe.cpp
+++ b/Source/Diagnostics/ReducedDiags/FieldProbe.cpp
@@ -382,12 +382,12 @@ void FieldProbe::ComputeDiags (int step)
amrex::Real move_dist = 0.0;
bool const update_particles_moving_window =
do_moving_window_FP &&
- step > warpx.start_moving_window_step &&
- step <= warpx.end_moving_window_step;
+ step > WarpX::start_moving_window_step &&
+ step <= WarpX::end_moving_window_step;
if (update_particles_moving_window)
{
const int step_diff = step - m_last_compute_step;
- move_dist = dt*warpx.moving_window_v*step_diff;
+ move_dist = dt*WarpX::moving_window_v*step_diff;
}
// get MultiFab data at lev
@@ -437,7 +437,7 @@ void FieldProbe::ComputeDiags (int step)
auto const np = pti.numParticles();
if (update_particles_moving_window)
{
- const auto temp_warpx_moving_window = warpx.moving_window_dir;
+ const auto temp_warpx_moving_window = WarpX::moving_window_dir;
amrex::ParallelFor( np, [=] AMREX_GPU_DEVICE (long ip)
{
amrex::ParticleReal xp, yp, zp;
diff --git a/Source/Diagnostics/ReducedDiags/LoadBalanceCosts.cpp b/Source/Diagnostics/ReducedDiags/LoadBalanceCosts.cpp
index 3c38c0ce4..1ce88d043 100644
--- a/Source/Diagnostics/ReducedDiags/LoadBalanceCosts.cpp
+++ b/Source/Diagnostics/ReducedDiags/LoadBalanceCosts.cpp
@@ -87,7 +87,7 @@ void LoadBalanceCosts::ComputeDiags (int step)
int nBoxes = 0;
for (int lev = 0; lev < nLevels; ++lev)
{
- const auto cost = warpx.getCosts(lev);
+ const auto cost = WarpX::getCosts(lev);
WARPX_ALWAYS_ASSERT_WITH_MESSAGE(
cost, "ERROR: costs are not initialized on level " + std::to_string(lev) + " !");
nBoxes += cost->size();
@@ -110,10 +110,10 @@ void LoadBalanceCosts::ComputeDiags (int step)
costs.resize(nLevels);
for (int lev = 0; lev < nLevels; ++lev)
{
- costs[lev] = std::make_unique<LayoutData<Real>>(*warpx.getCosts(lev));
+ costs[lev] = std::make_unique<LayoutData<Real>>(*WarpX::getCosts(lev));
}
- if (warpx.load_balance_costs_update_algo == LoadBalanceCostsUpdateAlgo::Heuristic)
+ if (WarpX::load_balance_costs_update_algo == LoadBalanceCostsUpdateAlgo::Heuristic)
{
warpx.ComputeCostsHeuristic(costs);
}
diff --git a/Source/Diagnostics/ReducedDiags/ParticleEnergy.cpp b/Source/Diagnostics/ReducedDiags/ParticleEnergy.cpp
index ebf280e8f..a132c1354 100644
--- a/Source/Diagnostics/ReducedDiags/ParticleEnergy.cpp
+++ b/Source/Diagnostics/ReducedDiags/ParticleEnergy.cpp
@@ -88,10 +88,7 @@ ParticleEnergy::ParticleEnergy (std::string rd_name)
void ParticleEnergy::ComputeDiags (int step)
{
// Check if the diags should be done
- if (m_intervals.contains(step+1) == false)
- {
- return;
- }
+ if (!m_intervals.contains(step+1)) return;
// Get MultiParticleContainer class object
const auto & mypc = WarpX::GetInstance().GetPartContainer();
diff --git a/Source/Diagnostics/ReducedDiags/ParticleHistogram.cpp b/Source/Diagnostics/ReducedDiags/ParticleHistogram.cpp
index 91f0b41f9..1b34c1c7a 100644
--- a/Source/Diagnostics/ReducedDiags/ParticleHistogram.cpp
+++ b/Source/Diagnostics/ReducedDiags/ParticleHistogram.cpp
@@ -179,8 +179,7 @@ void ParticleHistogram::ComputeDiags (int step)
auto const num_bins = m_bin_num;
Real const bin_min = m_bin_min;
Real const bin_size = m_bin_size;
- const bool is_unity_particle_weight =
- (m_norm == NormalizationType::unity_particle_weight) ? true : false;
+ const bool is_unity_particle_weight = (m_norm == NormalizationType::unity_particle_weight);
bool const do_parser_filter = m_do_parser_filter;
diff --git a/Source/Diagnostics/ReducedDiags/ParticleMomentum.cpp b/Source/Diagnostics/ReducedDiags/ParticleMomentum.cpp
index 6dd2a0db3..5b370d299 100644
--- a/Source/Diagnostics/ReducedDiags/ParticleMomentum.cpp
+++ b/Source/Diagnostics/ReducedDiags/ParticleMomentum.cpp
@@ -116,10 +116,7 @@ ParticleMomentum::ParticleMomentum (std::string rd_name)
void ParticleMomentum::ComputeDiags (int step)
{
// Check if the diags should be done
- if (m_intervals.contains(step+1) == false)
- {
- return;
- }
+ if (!m_intervals.contains(step+1)) return;
// Get MultiParticleContainer class object
const auto & mypc = WarpX::GetInstance().GetPartContainer();
diff --git a/Source/Diagnostics/SliceDiagnostic.cpp b/Source/Diagnostics/SliceDiagnostic.cpp
index 138ac1d77..aede8b303 100644
--- a/Source/Diagnostics/SliceDiagnostic.cpp
+++ b/Source/Diagnostics/SliceDiagnostic.cpp
@@ -158,10 +158,10 @@ CreateSlice( const MultiFab& mf, const Vector<Geometry> &dom_geom,
}
- if (coarsen == false) {
+ if (!coarsen) {
return smf;
}
- else if ( coarsen == true ) {
+ else {
Vector<BoxArray> crse_ba(1);
crse_ba[0] = sba[0];
crse_ba[0].coarsen(slice_cr_ratio);
@@ -226,13 +226,7 @@ CreateSlice( const MultiFab& mf, const Vector<Geometry> &dom_geom,
}
return cs_mf;
-
}
-
- WARPX_ALWAYS_ASSERT_WITH_MESSAGE(
- false, "Should not hit this return statement.");
-
- return smf;
}
@@ -363,7 +357,7 @@ CheckSliceInput( const RealBox real_box, RealBox &slice_cc_nd_box,
bool modify_cr = true;
- while ( modify_cr == true) {
+ while ( modify_cr ) {
int lo_new = index_lo;
int hi_new = index_hi;
const int mod_lo = index_lo % slice_cr_ratio[idim];
@@ -400,7 +394,7 @@ CheckSliceInput( const RealBox real_box, RealBox &slice_cc_nd_box,
modify_cr = true;
}
- if ( modify_cr == false ) {
+ if ( !modify_cr ) {
index_lo = lo_new;
index_hi = hi_new;
}
diff --git a/Source/Diagnostics/WarpXOpenPMD.cpp b/Source/Diagnostics/WarpXOpenPMD.cpp
index b68cd7232..a3fc4864d 100644
--- a/Source/Diagnostics/WarpXOpenPMD.cpp
+++ b/Source/Diagnostics/WarpXOpenPMD.cpp
@@ -1205,9 +1205,8 @@ WarpXOpenPMDPlot::SetupMeshComp (openPMD::Mesh& mesh,
// - Global offset
std::vector<double> const global_offset = getReversedVec(full_geom.ProbLo());
#if defined(WARPX_DIM_RZ)
- auto & warpx = WarpX::GetInstance();
if (var_in_theta_mode) {
- global_size.emplace(global_size.begin(), warpx.ncomps);
+ global_size.emplace(global_size.begin(), WarpX::ncomps);
}
#endif
// - AxisLabels
@@ -1249,8 +1248,8 @@ WarpXOpenPMDPlot::GetMeshCompNames (int meshLevel,
std::vector< std::string > const field_components = detail::getFieldComponentLabels(var_in_theta_mode);
for( std::string const& vector_field : vector_fields ) {
for( std::string const& component : field_components ) {
- if( vector_field.compare( varname_1st ) == 0 &&
- component.compare( varname_2nd ) == 0 )
+ if( vector_field == varname_1st &&
+ component == varname_2nd )
{
field_name = varname_1st + varname.substr(2); // Strip component
comp_name = varname_2nd;
diff --git a/Source/Evolve/WarpXEvolve.cpp b/Source/Evolve/WarpXEvolve.cpp
index a97c87122..37023c8dd 100644
--- a/Source/Evolve/WarpXEvolve.cpp
+++ b/Source/Evolve/WarpXEvolve.cpp
@@ -366,7 +366,7 @@ WarpX::Evolve (int numsteps)
// inputs: unused parameters (e.g. typos) check after step 1 has finished
if (!early_params_checked) {
amrex::Print() << "\n"; // better: conditional \n based on return value
- amrex::ParmParse().QueryUnusedInputs();
+ amrex::ParmParse::QueryUnusedInputs();
//Print the warning list right after the first step.
amrex::Print() <<
@@ -540,7 +540,7 @@ void WarpX::SyncCurrentAndRho ()
// Without periodic single box, synchronize J and rho here,
// except with current correction or Vay deposition:
// in these cases, synchronize later (in WarpX::PushPSATD)
- if (current_correction == false &&
+ if (!current_correction &&
current_deposition_algo != CurrentDepositionAlgo::Vay)
{
SyncCurrent(current_fp, current_cp, current_buf);
diff --git a/Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceSolver.cpp b/Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceSolver.cpp
index 851ff1a1a..1bb557d00 100644
--- a/Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceSolver.cpp
+++ b/Source/FieldSolver/FiniteDifferenceSolver/FiniteDifferenceSolver.cpp
@@ -43,7 +43,7 @@ FiniteDifferenceSolver::FiniteDifferenceSolver (
// Calculate coefficients of finite-difference stencil
#ifdef WARPX_DIM_RZ
m_dr = cell_size[0];
- m_nmodes = WarpX::GetInstance().n_rz_azimuthal_modes;
+ m_nmodes = WarpX::n_rz_azimuthal_modes;
m_rmin = WarpX::GetInstance().Geom(0).ProbLo(0);
if (fdtd_algo == ElectromagneticSolverAlgo::Yee ||
fdtd_algo == ElectromagneticSolverAlgo::HybridPIC ) {
diff --git a/Source/FieldSolver/FiniteDifferenceSolver/HybridPICModel/HybridPICModel.cpp b/Source/FieldSolver/FiniteDifferenceSolver/HybridPICModel/HybridPICModel.cpp
index 347a0ad6c..7213e599b 100644
--- a/Source/FieldSolver/FiniteDifferenceSolver/HybridPICModel/HybridPICModel.cpp
+++ b/Source/FieldSolver/FiniteDifferenceSolver/HybridPICModel/HybridPICModel.cpp
@@ -59,8 +59,6 @@ void HybridPICModel::AllocateLevelMFs (int lev, const BoxArray& ba, const Distri
const IntVect& jz_nodal_flag,
const IntVect& rho_nodal_flag)
{
- auto & warpx = WarpX::GetInstance();
-
// The "electron_pressure_fp" multifab stores the electron pressure calculated
// from the specified equation of state.
// The "rho_fp_temp" multifab is used to store the ion charge density
@@ -69,24 +67,24 @@ void HybridPICModel::AllocateLevelMFs (int lev, const BoxArray& ba, const Distri
// interpolated or extrapolated to appropriate timesteps.
// The "current_fp_ampere" multifab stores the total current calculated as
// the curl of B.
- warpx.AllocInitMultiFab(electron_pressure_fp[lev], amrex::convert(ba, rho_nodal_flag),
+ WarpX::AllocInitMultiFab(electron_pressure_fp[lev], amrex::convert(ba, rho_nodal_flag),
dm, ncomps, ngRho, lev, "electron_pressure_fp", 0.0_rt);
- warpx.AllocInitMultiFab(rho_fp_temp[lev], amrex::convert(ba, rho_nodal_flag),
+ WarpX::AllocInitMultiFab(rho_fp_temp[lev], amrex::convert(ba, rho_nodal_flag),
dm, ncomps, ngRho, lev, "rho_fp_temp", 0.0_rt);
- warpx.AllocInitMultiFab(current_fp_temp[lev][0], amrex::convert(ba, jx_nodal_flag),
+ WarpX::AllocInitMultiFab(current_fp_temp[lev][0], amrex::convert(ba, jx_nodal_flag),
dm, ncomps, ngJ, lev, "current_fp_temp[x]", 0.0_rt);
- warpx.AllocInitMultiFab(current_fp_temp[lev][1], amrex::convert(ba, jy_nodal_flag),
+ WarpX::AllocInitMultiFab(current_fp_temp[lev][1], amrex::convert(ba, jy_nodal_flag),
dm, ncomps, ngJ, lev, "current_fp_temp[y]", 0.0_rt);
- warpx.AllocInitMultiFab(current_fp_temp[lev][2], amrex::convert(ba, jz_nodal_flag),
+ WarpX::AllocInitMultiFab(current_fp_temp[lev][2], amrex::convert(ba, jz_nodal_flag),
dm, ncomps, ngJ, lev, "current_fp_temp[z]", 0.0_rt);
- warpx.AllocInitMultiFab(current_fp_ampere[lev][0], amrex::convert(ba, jx_nodal_flag),
+ WarpX::AllocInitMultiFab(current_fp_ampere[lev][0], amrex::convert(ba, jx_nodal_flag),
dm, ncomps, ngJ, lev, "current_fp_ampere[x]", 0.0_rt);
- warpx.AllocInitMultiFab(current_fp_ampere[lev][1], amrex::convert(ba, jy_nodal_flag),
+ WarpX::AllocInitMultiFab(current_fp_ampere[lev][1], amrex::convert(ba, jy_nodal_flag),
dm, ncomps, ngJ, lev, "current_fp_ampere[y]", 0.0_rt);
- warpx.AllocInitMultiFab(current_fp_ampere[lev][2], amrex::convert(ba, jz_nodal_flag),
+ WarpX::AllocInitMultiFab(current_fp_ampere[lev][2], amrex::convert(ba, jz_nodal_flag),
dm, ncomps, ngJ, lev, "current_fp_ampere[z]", 0.0_rt);
}
diff --git a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmFirstOrder.cpp b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmFirstOrder.cpp
index 946d938c7..e396efe12 100644
--- a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmFirstOrder.cpp
+++ b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmFirstOrder.cpp
@@ -53,10 +53,10 @@ PsatdAlgorithmFirstOrder::pushSpectralFields (SpectralFieldData& f) const
{
const bool div_cleaning = m_div_cleaning;
- const bool J_constant = (m_J_in_time == JInTime::Constant) ? true : false;
- const bool J_linear = (m_J_in_time == JInTime::Linear ) ? true : false;
- const bool rho_constant = (m_rho_in_time == RhoInTime::Constant) ? true : false;
- const bool rho_linear = (m_rho_in_time == RhoInTime::Linear ) ? true : false;
+ const bool J_constant = (m_J_in_time == JInTime::Constant);
+ const bool J_linear = (m_J_in_time == JInTime::Linear);
+ const bool rho_constant = (m_rho_in_time == RhoInTime::Constant);
+ const bool rho_linear = (m_rho_in_time == RhoInTime::Linear);
const amrex::Real dt = m_dt;
const amrex::Real dt2 = dt*dt;
diff --git a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmRZ.cpp b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmRZ.cpp
index f6b3460e2..32825155f 100644
--- a/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmRZ.cpp
+++ b/Source/FieldSolver/SpectralSolver/SpectralAlgorithms/PsatdAlgorithmRZ.cpp
@@ -82,7 +82,7 @@ PsatdAlgorithmRZ::pushSpectralFields(SpectralFieldDataRZ & f)
const bool update_with_rho = m_update_with_rho;
const bool time_averaging = m_time_averaging;
- const bool J_linear = (m_J_in_time == JInTime::Linear) ? true : false;
+ const bool J_linear = (m_J_in_time == JInTime::Linear);
const bool dive_cleaning = m_dive_cleaning;
const bool divb_cleaning = m_divb_cleaning;
@@ -337,7 +337,7 @@ PsatdAlgorithmRZ::pushSpectralFields(SpectralFieldDataRZ & f)
void PsatdAlgorithmRZ::InitializeSpectralCoefficients (SpectralFieldDataRZ const & f)
{
const bool time_averaging = m_time_averaging;
- const bool J_linear = (m_J_in_time == JInTime::Linear) ? true : false;
+ const bool J_linear = (m_J_in_time == JInTime::Linear);
// Fill them with the right values:
// Loop over boxes and allocate the corresponding coefficients
diff --git a/Source/FieldSolver/SpectralSolver/SpectralFieldData.cpp b/Source/FieldSolver/SpectralSolver/SpectralFieldData.cpp
index ab4e39710..0cd7a3463 100644
--- a/Source/FieldSolver/SpectralSolver/SpectralFieldData.cpp
+++ b/Source/FieldSolver/SpectralSolver/SpectralFieldData.cpp
@@ -47,7 +47,7 @@ SpectralFieldIndex::SpectralFieldIndex (const bool update_with_rho,
int c = 0;
- if (pml == false)
+ if (!pml)
{
Ex = c++; Ey = c++; Ez = c++;
Bx = c++; By = c++; Bz = c++;
@@ -291,15 +291,15 @@ SpectralFieldData::ForwardTransform (const int lev,
Complex spectral_field_value = tmp_arr(i,j,k);
// Apply proper shift in each dimension
#if (AMREX_SPACEDIM >= 2)
- if (is_nodal_x==false) spectral_field_value *= xshift_arr[i];
+ if (!is_nodal_x) spectral_field_value *= xshift_arr[i];
#endif
#if defined(WARPX_DIM_3D)
- if (is_nodal_y==false) spectral_field_value *= yshift_arr[j];
- if (is_nodal_z==false) spectral_field_value *= zshift_arr[k];
+ if (!is_nodal_y) spectral_field_value *= yshift_arr[j];
+ if (!is_nodal_z) spectral_field_value *= zshift_arr[k];
#elif defined(WARPX_DIM_XZ) || defined(WARPX_DIM_RZ)
- if (is_nodal_z==false) spectral_field_value *= zshift_arr[j];
+ if (!is_nodal_z) spectral_field_value *= zshift_arr[j];
#elif defined(WARPX_DIM_1D_Z)
- if (is_nodal_z==false) spectral_field_value *= zshift_arr[i];
+ if (!is_nodal_z) spectral_field_value *= zshift_arr[i];
#endif
// Copy field into the right index
fields_arr(i,j,k,field_index) = spectral_field_value;
@@ -391,15 +391,15 @@ SpectralFieldData::BackwardTransform (const int lev,
Complex spectral_field_value = field_arr(i,j,k,field_index);
// Apply proper shift in each dimension
#if (AMREX_SPACEDIM >= 2)
- if (is_nodal_x==false) spectral_field_value *= xshift_arr[i];
+ if (!is_nodal_x) spectral_field_value *= xshift_arr[i];
#endif
#if defined(WARPX_DIM_3D)
- if (is_nodal_y==false) spectral_field_value *= yshift_arr[j];
- if (is_nodal_z==false) spectral_field_value *= zshift_arr[k];
+ if (!is_nodal_y) spectral_field_value *= yshift_arr[j];
+ if (!is_nodal_z) spectral_field_value *= zshift_arr[k];
#elif defined(WARPX_DIM_XZ) || defined(WARPX_DIM_RZ)
- if (is_nodal_z==false) spectral_field_value *= zshift_arr[j];
+ if (!is_nodal_z) spectral_field_value *= zshift_arr[j];
#elif defined(WARPX_DIM_1D_Z)
- if (is_nodal_z==false) spectral_field_value *= zshift_arr[i];
+ if (!is_nodal_z) spectral_field_value *= zshift_arr[i];
#endif
// Copy field into temporary array
tmp_arr(i,j,k) = spectral_field_value;
@@ -444,11 +444,11 @@ SpectralFieldData::BackwardTransform (const int lev,
#endif
// If necessary, do not fill the guard cells
// (shrink box by passing negative number of cells)
- if (m_periodic_single_box == false)
+ if (!m_periodic_single_box)
{
for (int dir = 0; dir < AMREX_SPACEDIM; dir++)
{
- if (static_cast<bool>(fill_guards[dir]) == false) mf_box.grow(dir, -mf_ng[dir]);
+ if ((fill_guards[dir]) == 0) mf_box.grow(dir, -mf_ng[dir]);
}
}
diff --git a/Source/FieldSolver/SpectralSolver/SpectralFieldDataRZ.cpp b/Source/FieldSolver/SpectralSolver/SpectralFieldDataRZ.cpp
index 10575b189..b5e9f4c90 100644
--- a/Source/FieldSolver/SpectralSolver/SpectralFieldDataRZ.cpp
+++ b/Source/FieldSolver/SpectralSolver/SpectralFieldDataRZ.cpp
@@ -326,7 +326,7 @@ SpectralFieldDataRZ::FABZForwardTransform (amrex::MFIter const & mfi, amrex::Box
[=] AMREX_GPU_DEVICE(int i, int j, int k, int mode) noexcept {
Complex spectral_field_value = tmp_arr(i,j,k,mode);
// Apply proper shift.
- if (is_nodal_z==false) spectral_field_value *= zshift_arr[j];
+ if (!is_nodal_z) spectral_field_value *= zshift_arr[j];
// Copy field into the correct index.
int const ic = field_index + mode*n_fields;
fields_arr(i,j,k,ic) = spectral_field_value*inv_nz;
@@ -364,7 +364,7 @@ SpectralFieldDataRZ::FABZBackwardTransform (amrex::MFIter const & mfi, amrex::Bo
int const ic = field_index + mode*n_fields;
Complex spectral_field_value = fields_arr(i,j,k,ic);
// Apply proper shift.
- if (is_nodal_z==false) spectral_field_value *= zshift_arr[j];
+ if (!is_nodal_z) spectral_field_value *= zshift_arr[j];
// Copy field into the right index.
tmp_arr(i,j,k,mode) = spectral_field_value;
});
diff --git a/Source/Initialization/WarpXInitData.cpp b/Source/Initialization/WarpXInitData.cpp
index ed6490c82..0e1bb4aa7 100644
--- a/Source/Initialization/WarpXInitData.cpp
+++ b/Source/Initialization/WarpXInitData.cpp
@@ -330,7 +330,7 @@ WarpX::PrintMainPICparameters ()
amrex::Print() << " | - current_centering_noz = " << WarpX::current_centering_noz << "\n";
}
}
- if (WarpX::use_hybrid_QED == true){
+ if (WarpX::use_hybrid_QED){
amrex::Print() << " | - use_hybrid_QED = true \n";
}
diff --git a/Source/Parallelization/WarpXRegrid.cpp b/Source/Parallelization/WarpXRegrid.cpp
index 358316fc9..d890046da 100644
--- a/Source/Parallelization/WarpXRegrid.cpp
+++ b/Source/Parallelization/WarpXRegrid.cpp
@@ -233,7 +233,7 @@ WarpX::RemakeLevel (int lev, Real /*time*/, const BoxArray& ba, const Distributi
auto dx = CellSize(lev);
# ifdef WARPX_DIM_RZ
- if ( fft_periodic_single_box == false ) {
+ if ( !fft_periodic_single_box ) {
realspace_ba.grow(1, ngEB[1]); // add guard cells only in z
}
AllocLevelSpectralSolverRZ(spectral_solver_fp,
@@ -242,7 +242,7 @@ WarpX::RemakeLevel (int lev, Real /*time*/, const BoxArray& ba, const Distributi
dm,
dx);
# else
- if ( fft_periodic_single_box == false ) {
+ if ( !fft_periodic_single_box ) {
realspace_ba.grow(ngEB); // add guard cells
}
bool const pml_flag_false = false;
diff --git a/Source/Particles/Collision/BinaryCollision/BinaryCollision.H b/Source/Particles/Collision/BinaryCollision/BinaryCollision.H
index 2d6cba8b2..c52182681 100644
--- a/Source/Particles/Collision/BinaryCollision/BinaryCollision.H
+++ b/Source/Particles/Collision/BinaryCollision/BinaryCollision.H
@@ -90,10 +90,7 @@ public:
if(m_species_names.size() != 2)
WARPX_ABORT_WITH_MESSAGE("Binary collision " + collision_name + " must have exactly two species.");
- if (m_species_names[0] == m_species_names[1])
- m_isSameSpecies = true;
- else
- m_isSameSpecies = false;
+ m_isSameSpecies = (m_species_names[0] == m_species_names[1]);
m_binary_collision_functor = CollisionFunctorType(collision_name, mypc, m_isSameSpecies);
diff --git a/Source/Particles/LaserParticleContainer.cpp b/Source/Particles/LaserParticleContainer.cpp
index 73e27b3c5..6fb8aa974 100644
--- a/Source/Particles/LaserParticleContainer.cpp
+++ b/Source/Particles/LaserParticleContainer.cpp
@@ -655,7 +655,7 @@ LaserParticleContainer::Evolve (int lev,
WARPX_PROFILE_VAR_STOP(blp_pp);
// Current Deposition
- if (skip_deposition == false)
+ if (!skip_deposition)
{
// Deposit at t_{n+1/2}
const amrex::Real relative_time = -0.5_rt * dt;
diff --git a/Source/Particles/MultiParticleContainer.H b/Source/Particles/MultiParticleContainer.H
index 59815d150..3eb4cfba8 100644
--- a/Source/Particles/MultiParticleContainer.H
+++ b/Source/Particles/MultiParticleContainer.H
@@ -376,8 +376,8 @@ protected:
MFItInfoCheckTiling(pc_src, pc_dsts...);
- if (pc_src.do_tiling && amrex::Gpu::notInLaunchRegion()) {
- info.EnableTiling(pc_src.tile_size);
+ if (WarpXParticleContainer::do_tiling && amrex::Gpu::notInLaunchRegion()) {
+ info.EnableTiling(WarpXParticleContainer::tile_size);
}
#ifdef AMREX_USE_OMP
@@ -496,7 +496,7 @@ private:
void MFItInfoCheckTiling(const WarpXParticleContainer& pc_src,
First const& pc_dst, Args const&... others) const noexcept
{
- if (pc_src.do_tiling && amrex::Gpu::notInLaunchRegion()) {
+ if (WarpXParticleContainer::do_tiling && amrex::Gpu::notInLaunchRegion()) {
WARPX_ALWAYS_ASSERT_WITH_MESSAGE(pc_dst.do_tiling,
"For particle creation processes, either all or none of the "
"particle species must use tiling.");
diff --git a/Source/Particles/PhysicalParticleContainer.cpp b/Source/Particles/PhysicalParticleContainer.cpp
index 143847d4d..56fdbc378 100644
--- a/Source/Particles/PhysicalParticleContainer.cpp
+++ b/Source/Particles/PhysicalParticleContainer.cpp
@@ -2059,10 +2059,12 @@ PhysicalParticleContainer::Evolve (int lev,
// Gather and push for particles not in the buffer
//
WARPX_PROFILE_VAR_START(blp_fg);
+ const auto np_to_push = np_gather;
+ const auto gather_lev = lev;
PushPX(pti, exfab, eyfab, ezfab,
bxfab, byfab, bzfab,
Ex.nGrowVect(), e_is_nodal,
- 0, np_gather, lev, lev, dt, ScaleFields(false), a_dt_type);
+ 0, np_to_push, lev, gather_lev, dt, ScaleFields(false), a_dt_type);
if (np_gather < np)
{
@@ -2103,7 +2105,7 @@ PhysicalParticleContainer::Evolve (int lev,
WARPX_PROFILE_VAR_STOP(blp_fg);
// Current Deposition
- if (skip_deposition == false)
+ if (!skip_deposition)
{
// Deposit at t_{n+1/2}
const amrex::Real relative_time = -0.5_rt * dt;
diff --git a/Source/Particles/Resampling/Resampling.cpp b/Source/Particles/Resampling/Resampling.cpp
index 40510a05c..63ac44888 100644
--- a/Source/Particles/Resampling/Resampling.cpp
+++ b/Source/Particles/Resampling/Resampling.cpp
@@ -18,7 +18,7 @@ Resampling::Resampling (const std::string species_name)
std::string resampling_algorithm_string = "leveling_thinning"; // default resampling algorithm
pp_species_name.query("resampling_algorithm", resampling_algorithm_string);
- if (resampling_algorithm_string.compare("leveling_thinning") == 0)
+ if (resampling_algorithm_string == "leveling_thinning")
{
m_resampling_algorithm = std::make_unique<LevelingThinning>(species_name);
}
diff --git a/Source/Particles/WarpXParticleContainer.cpp b/Source/Particles/WarpXParticleContainer.cpp
index f0f745f76..ea9a6b3ec 100644
--- a/Source/Particles/WarpXParticleContainer.cpp
+++ b/Source/Particles/WarpXParticleContainer.cpp
@@ -1013,7 +1013,7 @@ WarpXParticleContainer::DepositCharge (amrex::Vector<std::unique_ptr<amrex::Mult
#endif
// Exchange guard cells
- if (local == false) {
+ if (!local) {
// Possible performance optimization:
// pass less than `rho[lev]->nGrowVect()` in the fifth input variable `dst_ng`
ablastr::utils::communication::SumBoundary(
@@ -1106,7 +1106,7 @@ WarpXParticleContainer::GetChargeDensity (int lev, bool local)
WarpX::GetInstance().ApplyInverseVolumeScalingToChargeDensity(rho.get(), lev);
#endif
- if (local == false) {
+ if (!local) {
// Possible performance optimization:
// pass less than `rho->nGrowVect()` in the fifth input variable `dst_ng`
ablastr::utils::communication::SumBoundary(
@@ -1146,7 +1146,7 @@ amrex::ParticleReal WarpXParticleContainer::sumParticleCharge(bool local) {
total_charge = get<0>(reduce_data.value());
- if (local == false) ParallelDescriptor::ReduceRealSum(total_charge);
+ if (!local) ParallelDescriptor::ReduceRealSum(total_charge);
total_charge *= this->charge;
return total_charge;
}
@@ -1222,7 +1222,7 @@ std::array<ParticleReal, 3> WarpXParticleContainer::meanParticleVelocity(bool lo
}
}
- if (local == false) {
+ if (!local) {
ParallelDescriptor::ReduceRealSum<ParticleReal>({vx_total,vy_total,vz_total});
ParallelDescriptor::ReduceLongSum(np_total);
}
@@ -1259,7 +1259,7 @@ amrex::ParticleReal WarpXParticleContainer::maxParticleVelocity(bool local) {
}
}
- if (local == false) ParallelAllReduce::Max(max_v, ParallelDescriptor::Communicator());
+ if (!local) ParallelAllReduce::Max(max_v, ParallelDescriptor::Communicator());
return max_v;
}
diff --git a/Source/Utils/WarpXMovingWindow.cpp b/Source/Utils/WarpXMovingWindow.cpp
index e43740d87..f62453f63 100644
--- a/Source/Utils/WarpXMovingWindow.cpp
+++ b/Source/Utils/WarpXMovingWindow.cpp
@@ -135,7 +135,7 @@ WarpX::MoveWindow (const int step, bool move_j)
if (step == end_moving_window_step) {
amrex::Print() << Utils::TextMsg::Info("Stopping moving window");
}
- if (moving_window_active(step) == false) return 0;
+ if (!moving_window_active(step)) return 0;
// Update the continuous position of the moving window,
// and of the plasma injection
@@ -491,12 +491,12 @@ WarpX::shiftMF (amrex::MultiFab& mf, const amrex::Geometry& geom,
const amrex::Box& outbox = mfi.fabbox() & adjBox;
if (outbox.ok()) {
- if (useparser == false) {
+ if (!useparser) {
AMREX_PARALLEL_FOR_4D ( outbox, nc, i, j, k, n,
{
srcfab(i,j,k,n) = external_field;
})
- } else if (useparser == true) {
+ } else {
// index type of the src mf
auto const& mf_IndexType = (tmpmf).ixType();
amrex::IntVect mf_type(AMREX_D_DECL(0,0,0));
diff --git a/Source/WarpX.cpp b/Source/WarpX.cpp
index f5826fd93..24e3ceb30 100644
--- a/Source/WarpX.cpp
+++ b/Source/WarpX.cpp
@@ -1144,7 +1144,7 @@ WarpX::ReadParameters ()
// - field_gathering_algo set to "default" above
// (default defined in Utils/WarpXAlgorithmSelection.cpp)
// - reset default value here for hybrid grids
- if (pp_algo.query("field_gathering", tmp_algo) == false)
+ if (!pp_algo.query("field_gathering", tmp_algo))
{
if (grid_type == GridType::Hybrid)
{
@@ -1371,7 +1371,7 @@ WarpX::ReadParameters ()
J_in_time = GetAlgorithmInteger(pp_psatd, "J_in_time");
rho_in_time = GetAlgorithmInteger(pp_psatd, "rho_in_time");
- if (psatd_solution_type != PSATDSolutionType::FirstOrder || do_multi_J == false)
+ if (psatd_solution_type != PSATDSolutionType::FirstOrder || !do_multi_J)
{
WARPX_ALWAYS_ASSERT_WITH_MESSAGE(
rho_in_time == RhoInTime::Linear,
@@ -1396,7 +1396,7 @@ WarpX::ReadParameters ()
pp_psatd.query("current_correction", current_correction);
- if (current_correction == false &&
+ if (!current_correction &&
current_deposition_algo != CurrentDepositionAlgo::Esirkepov &&
current_deposition_algo != CurrentDepositionAlgo::Vay)
{
@@ -1415,18 +1415,18 @@ WarpX::ReadParameters ()
if (WarpX::current_deposition_algo == CurrentDepositionAlgo::Vay)
{
WARPX_ALWAYS_ASSERT_WITH_MESSAGE(
- fft_periodic_single_box == false,
+ !fft_periodic_single_box,
"Option algo.current_deposition=vay must be used with psatd.periodic_single_box_fft=0.");
}
if (current_deposition_algo == CurrentDepositionAlgo::Vay)
{
WARPX_ALWAYS_ASSERT_WITH_MESSAGE(
- current_correction == false,
+ !current_correction,
"Options algo.current_deposition=vay and psatd.current_correction=1 cannot be combined together.");
}
- // Auxiliary: boosted_frame = true if warpx.gamma_boost is set in the inputs
+ // Auxiliary: boosted_frame = true if WarpX::gamma_boost is set in the inputs
const amrex::ParmParse pp_warpx("warpx");
const bool boosted_frame = pp_warpx.query("gamma_boost", gamma_boost);
@@ -1436,10 +1436,10 @@ WarpX::ReadParameters ()
WARPX_ALWAYS_ASSERT_WITH_MESSAGE(
!use_default_v_galilean || boosted_frame,
- "psatd.use_default_v_galilean = 1 can be used only if warpx.gamma_boost is also set"
+ "psatd.use_default_v_galilean = 1 can be used only if WarpX::gamma_boost is also set"
);
- if (use_default_v_galilean == true && boosted_frame == true)
+ if (use_default_v_galilean && boosted_frame)
{
m_v_galilean[2] = -std::sqrt(1._rt - 1._rt / (gamma_boost * gamma_boost));
}
@@ -1455,10 +1455,10 @@ WarpX::ReadParameters ()
WARPX_ALWAYS_ASSERT_WITH_MESSAGE(
!use_default_v_comoving || boosted_frame,
- "psatd.use_default_v_comoving = 1 can be used only if warpx.gamma_boost is also set"
+ "psatd.use_default_v_comoving = 1 can be used only if WarpX::gamma_boost is also set"
);
- if (use_default_v_comoving == true && boosted_frame == true)
+ if (use_default_v_comoving && boosted_frame)
{
m_v_comoving[2] = -std::sqrt(1._rt - 1._rt / (gamma_boost * gamma_boost));
}
@@ -1509,7 +1509,7 @@ WarpX::ReadParameters ()
# else
if (m_v_galilean[0] == 0. && m_v_galilean[1] == 0. && m_v_galilean[2] == 0. &&
m_v_comoving[0] == 0. && m_v_comoving[1] == 0. && m_v_comoving[2] == 0.) {
- update_with_rho = (do_dive_cleaning) ? true : false; // standard PSATD
+ update_with_rho = do_dive_cleaning; // standard PSATD
}
else {
update_with_rho = true; // Galilean PSATD or comoving PSATD
@@ -1583,7 +1583,7 @@ WarpX::ReadParameters ()
// Without periodic single box, fill guard cells with backward FFTs,
// with current correction or Vay deposition
- if (fft_periodic_single_box == false)
+ if (!fft_periodic_single_box)
{
if (current_correction ||
current_deposition_algo == CurrentDepositionAlgo::Vay)
@@ -2346,7 +2346,7 @@ WarpX::AllocLevelMFs (int lev, const BoxArray& ba, const DistributionMapping& dm
realspace_ba.enclosedCells(); // Make it cell-centered
// Define spectral solver
# ifdef WARPX_DIM_RZ
- if ( fft_periodic_single_box == false ) {
+ if ( !fft_periodic_single_box ) {
realspace_ba.grow(1, ngEB[1]); // add guard cells only in z
}
if (field_boundary_hi[0] == FieldBoundaryType::PML && !do_pml_in_domain) {
@@ -2360,7 +2360,7 @@ WarpX::AllocLevelMFs (int lev, const BoxArray& ba, const DistributionMapping& dm
dm,
dx);
# else
- if ( fft_periodic_single_box == false ) {
+ if ( !fft_periodic_single_box ) {
realspace_ba.grow(ngEB); // add guard cells
}
bool const pml_flag_false = false;