Skip to content

Commit

Permalink
change 'if (bool_var == 1)' into 'if (bool_var)' for readability
Browse files Browse the repository at this point in the history
  • Loading branch information
lucafedeli88 committed Jul 18, 2024
1 parent b58343a commit 38c22b9
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Source/Diagnostics/SliceDiagnostic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ CreateSlice( const MultiFab& mf, const Vector<Geometry> &dom_geom,
ablastr::utils::communication::ParallelCopy(*smf, mf, 0, 0, ncomp, nghost_vect, nghost_vect, WarpX::do_single_precision_comms);

// interpolate if required on refined slice //
if (interpolate == 1 ) {
if (interpolate) {
InterpolateSliceValues( *smf, interp_lo, slice_cc_nd_box, dom_geom,
ncomp, nghost, slice_lo, slice_hi, SliceType, real_box);
}
Expand Down
4 changes: 2 additions & 2 deletions Source/Evolve/WarpXEvolve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,15 +142,15 @@ WarpX::Evolve (int numsteps)
OneStep_multiJ(cur_time);
}
// Electromagnetic case: no subcycling or no mesh refinement
else if (do_subcycling == 0 || finest_level == 0)
else if ( !do_subcycling || (finest_level == 0))
{
OneStep_nosub(cur_time);
// E: guard cells are up-to-date
// B: guard cells are NOT up-to-date
// F: guard cells are NOT up-to-date
}
// Electromagnetic case: subcycling with one level of mesh refinement
else if (do_subcycling == 1 && finest_level == 1)
else if (do_subcycling && (finest_level == 1))
{
OneStep_sub1(cur_time);
}
Expand Down
12 changes: 6 additions & 6 deletions Source/Initialization/WarpXInitData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,19 +294,19 @@ WarpX::PrintMainPICparameters ()
" | - v_comoving = (" << m_v_comoving[0] << "," <<
m_v_comoving[1] << "," << m_v_comoving[2] << ")\n";
}
if (WarpX::update_with_rho==1) {
if (WarpX::update_with_rho) {
amrex::Print() << " | - update with rho is ON \n";
}
if (current_correction==1) {
if (current_correction) {
amrex::Print() << " | - current correction is ON \n";
}
if (WarpX::do_dive_cleaning==1) {
if (WarpX::do_dive_cleaning) {
amrex::Print() << " | - div(E) cleaning is ON \n";
}
if (WarpX::do_divb_cleaning==1) {
if (WarpX::do_divb_cleaning) {
amrex::Print() << " | - div(B) cleaning is ON \n";
}
if (do_multi_J == 1){
if (do_multi_J){
amrex::Print() << " | - multi-J deposition is ON \n";
amrex::Print() << " | - do_multi_J_n_depositions = "
<< WarpX::do_multi_J_n_depositions << "\n";
Expand All @@ -323,7 +323,7 @@ WarpX::PrintMainPICparameters ()
amrex::Print() << " | - rho_in_time = constant \n";
}
}
if (fft_do_time_averaging == 1){
if (fft_do_time_averaging){
amrex::Print()<<" | - time-averaged is ON \n";
}
#endif // WARPX_USE_FFT
Expand Down
6 changes: 3 additions & 3 deletions Source/Parallelization/GuardCellManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ guardCellManager::Init (
// When using subcycling, the particles on the fine level perform two pushes
// before being redistributed ; therefore, we need one extra guard cell
// (the particles may move by 2*c*dt)
int ngx_tmp = (max_level > 0 && do_subcycling == 1) ? nox+1 : nox;
int ngy_tmp = (max_level > 0 && do_subcycling == 1) ? nox+1 : nox;
int ngz_tmp = (max_level > 0 && do_subcycling == 1) ? nox+1 : nox;
int ngx_tmp = (max_level > 0 && do_subcycling) ? nox+1 : nox;
int ngy_tmp = (max_level > 0 && do_subcycling) ? nox+1 : nox;
int ngz_tmp = (max_level > 0 && do_subcycling) ? nox+1 : nox;

const bool galilean = (v_galilean[0] != 0. || v_galilean[1] != 0. || v_galilean[2] != 0.);
const bool comoving = (v_comoving[0] != 0. || v_comoving[1] != 0. || v_comoving[2] != 0.);
Expand Down
4 changes: 2 additions & 2 deletions Source/Particles/PhysicalParticleContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1065,7 +1065,7 @@ PhysicalParticleContainer::AddPlasma (PlasmaInjector const& plasma_injector, int
static_cast<int>(std::round((overlap_realbox.lo(dir)-problo[dir])/dx[dir]));
// shifted is exact in non-moving-window direction. That's all we care.
}
if (no_overlap == 1) {
if (no_overlap) {
continue; // Go to the next tile
}

Expand Down Expand Up @@ -1640,7 +1640,7 @@ PhysicalParticleContainer::AddPlasmaFlux (PlasmaInjector const& plasma_injector,
// shifted is exact in non-moving-window direction. That's all we care.
}
}
if (no_overlap == 1) {
if (no_overlap) {
continue; // Go to the next tile
}

Expand Down
2 changes: 1 addition & 1 deletion Source/Utils/WarpXTagging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ WarpX::ErrorEst (int lev, TagBoxArray& tags, Real /*time*/, int /*ngrow*/)
} else {
tag_val = (pos > ftlo && pos < fthi);
}
if ( tag_val == 1) {
if (tag_val) {
fab(i,j,k) = TagBox::SET;
}
});
Expand Down
2 changes: 1 addition & 1 deletion Source/WarpX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2457,7 +2457,7 @@ WarpX::AllocLevelMFs (int lev, const BoxArray& ba, const DistributionMapping& dm
AllocInitMultiFab(phi_fp[lev], amrex::convert(ba, phi_nodal_flag), dm, ncomps, ngPhi, lev, "phi_fp", 0.0_rt);
}

if (do_subcycling == 1 && lev == 0)
if (do_subcycling && lev == 0)
{
AllocInitMultiFab(current_store[lev][0], amrex::convert(ba,jx_nodal_flag),dm,ncomps,ngJ,lev, "current_store[x]");
AllocInitMultiFab(current_store[lev][1], amrex::convert(ba,jy_nodal_flag),dm,ncomps,ngJ,lev, "current_store[y]");
Expand Down

0 comments on commit 38c22b9

Please sign in to comment.