diff --git a/.clang-tidy b/.clang-tidy index 1b0decbb18c..565062895ec 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -3,6 +3,7 @@ Checks: > bugprone-*, -bugprone-branch-clone, -bugprone-easily-swappable-parameters, + -bugprone-exception-escape, -bugprone-implicit-widening-of-multiplication-result, clang-analyzer-*, -clang-analyzer-optin.mpi.MPI-Checker, @@ -20,15 +21,17 @@ Checks: > -cppcoreguidelines-owning-memory, -cppcoreguidelines-pro-*, misc-*, + -misc-const-correctness, + -misc-non-private-member-variables-in-classes, + -misc-no-recursion, modernize-*, -modernize-avoid-c-arrays, -modernize-macro-to-enum, -modernize-return-braced-init-list, -modernize-use-trailing-return-type, performance-*, + portability-*, readability-*, - -readability-braces-around-statements, - -readability-container-data-pointer, -readability-else-after-return, -readability-function-cognitive-complexity, -readability-function-size, diff --git a/Src/Amr/AMReX_Amr.cpp b/Src/Amr/AMReX_Amr.cpp index 56e253b6ece..127486cbf0e 100644 --- a/Src/Amr/AMReX_Amr.cpp +++ b/Src/Amr/AMReX_Amr.cpp @@ -103,7 +103,7 @@ Amr::UsingPrecreateDirectories () noexcept void Amr::Initialize () { - if (initialized) return; + if (initialized) { return; } // // Set all defaults here!!! // @@ -1259,7 +1259,7 @@ Amr::InitializeInit(Real strt_time, { BL_PROFILE("Amr::InitializeInit()"); BL_COMM_PROFILE_NAMETAG("Amr::InitializeInit TOP"); - if (check_input) checkInput(); + if (check_input) { checkInput(); } // // Generate internal values from user-supplied values. // @@ -2541,7 +2541,7 @@ Amr::regrid (int lbase, { BL_PROFILE("Amr::regrid()"); - if (lbase > std::min(finest_level,max_level-1)) return; + if (lbase > std::min(finest_level,max_level-1)) { return; } if (verbose > 0) amrex::Print() << "Now regridding at level lbase = " << lbase << "\n"; @@ -3011,7 +3011,7 @@ Amr::bldFineLevels (Real strt_time) grid_places(finest_level,strt_time,new_finest,new_grids); - if (new_finest <= finest_level) break; + if (new_finest <= finest_level) { break; } // // Create a new level and link with others. // @@ -3181,8 +3181,8 @@ Amr::initPltAndChk () // // -1 ==> use ParallelDescriptor::NProcs(). // - if (plot_nfiles == -1) plot_nfiles = ParallelDescriptor::NProcs(); - if (checkpoint_nfiles == -1) checkpoint_nfiles = ParallelDescriptor::NProcs(); + if (plot_nfiles == -1) { plot_nfiles = ParallelDescriptor::NProcs(); } + if (checkpoint_nfiles == -1) { checkpoint_nfiles = ParallelDescriptor::NProcs(); } check_file_root = "chk"; pp.queryAdd("check_file",check_file_root); diff --git a/Src/Amr/AMReX_AmrLevel.cpp b/Src/Amr/AMReX_AmrLevel.cpp index 7ef14b505fb..02e4c404c34 100644 --- a/Src/Amr/AMReX_AmrLevel.cpp +++ b/Src/Amr/AMReX_AmrLevel.cpp @@ -123,7 +123,7 @@ AmrLevel::AmrLevel (Amr& papa, *m_factory); } - if (parent->useFixedCoarseGrids()) constructAreaNotToTag(); + if (parent->useFixedCoarseGrids()) { constructAreaNotToTag(); } post_step_regrid = 0; @@ -447,7 +447,7 @@ AmrLevel::restart (Amr& papa, m_fillpatcher.resize(ndesc); - if (parent->useFixedCoarseGrids()) constructAreaNotToTag(); + if (parent->useFixedCoarseGrids()) { constructAreaNotToTag(); } post_step_regrid = 0; @@ -773,7 +773,7 @@ FillPatchIteratorHelper::Initialize (int boxGrow, using IntAAAFBIDMapValType = std::map > > >::value_type; - if (m_leveldata.DistributionMap()[i] != MyProc) continue; + if (m_leveldata.DistributionMap()[i] != MyProc) { continue; } // // Insert with a hint since the indices are ordered lowest to highest. // @@ -1179,7 +1179,7 @@ FixUpPhysCorners (FArrayBox& fab, const Geometry& TheGeom = TheLevel.Geom(); const Box& ProbDomain = TheState.getDomain(); - if (!HasPhysBndry(fab.box(),ProbDomain,TheGeom)) return; + if (!HasPhysBndry(fab.box(),ProbDomain,TheGeom)) { return; } FArrayBox tmp; @@ -1191,14 +1191,14 @@ FixUpPhysCorners (FArrayBox& fab, { const int lo = ProbDomain.smallEnd(dir) - fab.box().smallEnd(dir); const int hi = fab.box().bigEnd(dir) - ProbDomain.bigEnd(dir); - if (lo > 0) GrownDomain.growLo(dir,lo); - if (hi > 0) GrownDomain.growHi(dir,hi); + if (lo > 0) { GrownDomain.growLo(dir,lo); } + if (hi > 0) { GrownDomain.growHi(dir,hi); } } } for (int dir = 0; dir < AMREX_SPACEDIM; dir++) { - if (!TheGeom.isPeriodic(dir)) continue; + if (!TheGeom.isPeriodic(dir)) { continue; } Box lo_slab = fab.box(); Box hi_slab = fab.box(); @@ -1331,7 +1331,7 @@ FillPatchIteratorHelper::fill (FArrayBox& fab, { FArrayBox& dstfab = *CrseFabs[i]; - if (ThePDomain.contains(dstfab.box())) continue; + if (ThePDomain.contains(dstfab.box())) { continue; } Vector pshifts(27); diff --git a/Src/Amr/AMReX_AuxBoundaryData.H b/Src/Amr/AMReX_AuxBoundaryData.H index 7e5aadf5575..bfaf7df8a2c 100644 --- a/Src/Amr/AMReX_AuxBoundaryData.H +++ b/Src/Amr/AMReX_AuxBoundaryData.H @@ -58,7 +58,7 @@ public: BL_ASSERT(!m_empty); BL_ASSERT(m_initialized); return m_fabs.boxArray(); } - void setVal (Real r) { BL_ASSERT(m_initialized); if (!m_empty) m_fabs.setVal(r); } + void setVal (Real r) { BL_ASSERT(m_initialized); if (!m_empty) { m_fabs.setVal(r); } } const DistributionMapping& DistributionMap () const noexcept { diff --git a/Src/Amr/AMReX_AuxBoundaryData.cpp b/Src/Amr/AMReX_AuxBoundaryData.cpp index fb8ffd6743e..361e09fe068 100644 --- a/Src/Amr/AMReX_AuxBoundaryData.cpp +++ b/Src/Amr/AMReX_AuxBoundaryData.cpp @@ -25,7 +25,7 @@ AuxBoundaryData::copy (const AuxBoundaryData& src, int dst_comp, int num_comp) { - if (m_empty || src.m_empty) return; + if (m_empty || src.m_empty) { return; } BL_ASSERT(m_initialized); BL_ASSERT(src_comp + num_comp <= src.m_fabs.nComp()); diff --git a/Src/Amr/AMReX_Extrapolater.cpp b/Src/Amr/AMReX_Extrapolater.cpp index ca3f4d525ec..cbac2648b9b 100644 --- a/Src/Amr/AMReX_Extrapolater.cpp +++ b/Src/Amr/AMReX_Extrapolater.cpp @@ -44,7 +44,7 @@ namespace amrex::Extrapolater [=] AMREX_GPU_DEVICE (int i, int j, int k, int n) noexcept { if (!gbx.contains(i,j,k)) { - if (mask_arr(i,j,k) == crsebnd) data_arr(i,j,k,n) = 0.0; + if (mask_arr(i,j,k) == crsebnd) { data_arr(i,j,k,n) = 0.0; } } }); ParallelFor(amrex::grow(gbx,1), ncomp, diff --git a/Src/Amr/AMReX_StateData.cpp b/Src/Amr/AMReX_StateData.cpp index b7429fd33e6..1cd919e83ef 100644 --- a/Src/Amr/AMReX_StateData.cpp +++ b/Src/Amr/AMReX_StateData.cpp @@ -442,7 +442,7 @@ StateData::FillBoundary (FArrayBox& dest, BL_PROFILE("StateData::FillBoundary(dx)"); BL_ASSERT(dest.box().ixType() == desc->getType()); - if (domain.contains(dest.box())) return; + if (domain.contains(dest.box())) { return; } const Box& bx = dest.box(); const int* dlo = dest.loVect(); @@ -531,7 +531,7 @@ StateData::FillBoundary (Box const& bx, { BL_PROFILE("StateData::FillBoundary(geom)"); - if (domain.contains(convert(bx,domain.ixType()))) return; + if (domain.contains(convert(bx,domain.ixType()))) { return; } Vector bcr(num_comp); @@ -925,14 +925,14 @@ StateDataPhysBCFunct::operator() (MultiFab& mf, int dest_comp, int num_comp, Int { const int lo = domainlo[dir] - bx.smallEnd(dir); const int hi = bx.bigEnd(dir) - domainhi[dir]; - if (lo > 0) GrownDomain.growLo(dir,lo); - if (hi > 0) GrownDomain.growHi(dir,hi); + if (lo > 0) { GrownDomain.growLo(dir,lo); } + if (hi > 0) { GrownDomain.growHi(dir,hi); } } } for (int dir = 0; dir < AMREX_SPACEDIM; dir++) { - if (!geom.isPeriodic(dir)) continue; + if (!geom.isPeriodic(dir)) { continue; } Box lo_slab = bx; Box hi_slab = bx; diff --git a/Src/Amr/AMReX_StateDescriptor.cpp b/Src/Amr/AMReX_StateDescriptor.cpp index aa9d15445a4..ae0493d6deb 100644 --- a/Src/Amr/AMReX_StateDescriptor.cpp +++ b/Src/Amr/AMReX_StateDescriptor.cpp @@ -21,7 +21,7 @@ StateDescriptor::bf_thread_safety (const int* /*lo*/,const int* /*hi*/, for (int i=0; i<2*AMREX_SPACEDIM*ng && !has_ext_dir; ++i) { has_ext_dir = bc[i]==BCType::ext_dir; } - if (has_ext_dir) thread_safe = false; + if (has_ext_dir) { thread_safe = false; } } return thread_safe; } @@ -417,7 +417,7 @@ StateDescriptor::setUpMaps (int& use_default_map, // First, count number of interpolaters needed and allocate. // InterpBase* map = mapper_comp[start_comp]; - if (!map) map = (InterpBase*) default_map; + if (!map) { map = (InterpBase*) default_map; } nmaps = 1; int icomp = start_comp+1; @@ -441,7 +441,7 @@ StateDescriptor::setUpMaps (int& use_default_map, icomp++; } - if (use_default_map) return; + if (use_default_map) { return; } maps = new InterpBase*[nmaps]; map_start_comp = new int[nmaps]; diff --git a/Src/Amr/AMReX_extrapolater_2D_K.H b/Src/Amr/AMReX_extrapolater_2D_K.H index b3bb3b8281a..33296c545e9 100644 --- a/Src/Amr/AMReX_extrapolater_2D_K.H +++ b/Src/Amr/AMReX_extrapolater_2D_K.H @@ -28,21 +28,21 @@ amrex_first_order_extrap_cpu(amrex::Box const& bx, { // y-dir edges int j = lo.y-1; for (int i = lo.x-1; i <= hi.x+1; ++i) { - if (mask(i,j,k) == crsecell) data(i,j,k,n) = Real(0.0); + if (mask(i,j,k) == crsecell) { data(i,j,k,n) = Real(0.0); } } j = hi.y+1; for (int i = lo.x-1; i <= hi.x+1; ++i) { - if (mask(i,j,k) == crsecell) data(i,j,k,n) = Real(0.0); + if (mask(i,j,k) == crsecell) { data(i,j,k,n) = Real(0.0); } } } { // x-dir edges int i = lo.x-1; for (int j = lo.y-1; j <= hi.y+1; ++j) { - if (mask(i,j,k) == crsecell) data(i,j,k,n) = Real(0.0); + if (mask(i,j,k) == crsecell) { data(i,j,k,n) = Real(0.0); } } i = hi.x+1; for (int j = lo.y-1; j <= hi.y+1; ++j) { - if (mask(i,j,k) == crsecell) data(i,j,k,n) = Real(0.0); + if (mask(i,j,k) == crsecell) { data(i,j,k,n) = Real(0.0); } } } diff --git a/Src/Amr/AMReX_extrapolater_3D_K.H b/Src/Amr/AMReX_extrapolater_3D_K.H index 63ff96b3265..ccf0b7506ba 100644 --- a/Src/Amr/AMReX_extrapolater_3D_K.H +++ b/Src/Amr/AMReX_extrapolater_3D_K.H @@ -27,13 +27,13 @@ amrex_first_order_extrap_cpu(amrex::Box const& bx, int k = lo.z-1; for (int j = lo.y-1; j <= hi.y+1; ++j) { for (int i = lo.x-1; i <= hi.x+1; ++i) { - if (mask(i,j,k) == crsecell) data(i,j,k,n) = Real(0.0); + if (mask(i,j,k) == crsecell) { data(i,j,k,n) = Real(0.0); } } } k = hi.z+1; for (int j = lo.y-1; j <= hi.y+1; ++j) { for (int i = lo.x-1; i <= hi.x+1; ++i) { - if (mask(i,j,k) == crsecell) data(i,j,k,n) = Real(0.0); + if (mask(i,j,k) == crsecell) { data(i,j,k,n) = Real(0.0); } } } } @@ -41,13 +41,13 @@ amrex_first_order_extrap_cpu(amrex::Box const& bx, int j = lo.y-1; for (int k = lo.z-1; k <= hi.z+1; ++k) { for (int i = lo.x-1; i <= hi.x+1; ++i) { - if (mask(i,j,k) == crsecell) data(i,j,k,n) = Real(0.0); + if (mask(i,j,k) == crsecell) { data(i,j,k,n) = Real(0.0); } } } j = hi.y+1; for (int k = lo.z-1; k <= hi.z+1; ++k) { for (int i = lo.x-1; i <= hi.x+1; ++i) { - if (mask(i,j,k) == crsecell) data(i,j,k,n) = Real(0.0); + if (mask(i,j,k) == crsecell) { data(i,j,k,n) = Real(0.0); } } } } @@ -55,13 +55,13 @@ amrex_first_order_extrap_cpu(amrex::Box const& bx, int i = lo.x-1; for (int k = lo.z-1; k <= hi.z+1; ++k) { for (int j = lo.y-1; j <= hi.y+1; ++j) { - if (mask(i,j,k) == crsecell) data(i,j,k,n) = Real(0.0); + if (mask(i,j,k) == crsecell) { data(i,j,k,n) = Real(0.0); } } } i = hi.x+1; for (int k = lo.z-1; k <= hi.z+1; ++k) { for (int j = lo.y-1; j <= hi.y+1; ++j) { - if (mask(i,j,k) == crsecell) data(i,j,k,n) = Real(0.0); + if (mask(i,j,k) == crsecell) { data(i,j,k,n) = Real(0.0); } } } } diff --git a/Src/AmrCore/AMReX_AmrCore.cpp b/Src/AmrCore/AMReX_AmrCore.cpp index ac35f279b44..502b3f5cb23 100644 --- a/Src/AmrCore/AMReX_AmrCore.cpp +++ b/Src/AmrCore/AMReX_AmrCore.cpp @@ -85,7 +85,7 @@ AmrCore::InitFromScratch (Real time) void AmrCore::regrid (int lbase, Real time, bool) { - if (lbase >= max_level) return; + if (lbase >= max_level) { return; } int new_finest; Vector new_grids(finest_level+2); diff --git a/Src/AmrCore/AMReX_AmrMesh.cpp b/Src/AmrCore/AMReX_AmrMesh.cpp index 46124fee39d..8c695ae39fa 100644 --- a/Src/AmrCore/AMReX_AmrMesh.cpp +++ b/Src/AmrCore/AMReX_AmrMesh.cpp @@ -61,7 +61,7 @@ AmrMesh::AmrMesh (Geometry const& level_0_geom, AmrInfo const& amr_info) finest_level = -1; - if (check_input) checkInput(); + if (check_input) { checkInput(); } } void @@ -375,15 +375,16 @@ AmrMesh::InitAmrMesh (int max_level_in, const Vector& n_cell_in, finest_level = -1; - if (check_input) checkInput(); + if (check_input) { checkInput(); } } int AmrMesh::MaxRefRatio (int lev) const noexcept { int maxval = 0; - for (int n = 0; n& // Add at most one new level int max_crse = std::min(finest_level, max_level-1); - if (new_grids.size() < max_crse+2) new_grids.resize(max_crse+2); + if (new_grids.size() < max_crse+2) { new_grids.resize(max_crse+2); } // // Construct problem domain at each level. @@ -807,7 +808,7 @@ AmrMesh::MakeNewGrids (Real time) // Add (at most) one level at a time. MakeNewGrids(finest_level,time,new_finest,new_grids); - if (new_finest <= finest_level) break; + if (new_finest <= finest_level) { break; } finest_level = new_finest; DistributionMapping dm(new_grids[new_finest]); @@ -834,7 +835,7 @@ AmrMesh::MakeNewGrids (Real time) int new_finest; MakeNewGrids(0, time, new_finest, new_grids); - if (new_finest < finest_level) break; + if (new_finest < finest_level) { break; } finest_level = new_finest; bool grids_the_same = true; @@ -852,7 +853,7 @@ AmrMesh::MakeNewGrids (Real time) } } } - if (grids_the_same) break; + if (grids_the_same) { break; } } } } diff --git a/Src/AmrCore/AMReX_AmrParticles.H b/Src/AmrCore/AMReX_AmrParticles.H index aa6260e6952..65036ab4cd4 100644 --- a/Src/AmrCore/AMReX_AmrParticles.H +++ b/Src/AmrCore/AMReX_AmrParticles.H @@ -21,7 +21,7 @@ ParticleContainer_impl BL_PROFILE("ParticleContainer::AssignDensity()"); - if (rho_index != 0) amrex::Abort("AssignDensity only works if rho_index = 0"); + if (rho_index != 0) { amrex::Abort("AssignDensity only works if rho_index = 0"); } BL_ASSERT(NStructReal >= 1); BL_ASSERT(NStructReal >= ncomp); diff --git a/Src/AmrCore/AMReX_Cluster.cpp b/Src/AmrCore/AMReX_Cluster.cpp index d9a5a7e80f4..1d06d8741fc 100644 --- a/Src/AmrCore/AMReX_Cluster.cpp +++ b/Src/AmrCore/AMReX_Cluster.cpp @@ -396,7 +396,7 @@ Cluster::new_chop () nlo += hist[dir][i-lo[dir]]; } - if (nlo <= 0 || nlo >= m_len) return chop(); + if (nlo <= 0 || nlo >= m_len) { return chop(); } Long nhi = m_len - nlo; diff --git a/Src/AmrCore/AMReX_FillPatchUtil.cpp b/Src/AmrCore/AMReX_FillPatchUtil.cpp index 84db10d2443..faa05685d11 100644 --- a/Src/AmrCore/AMReX_FillPatchUtil.cpp +++ b/Src/AmrCore/AMReX_FillPatchUtil.cpp @@ -35,7 +35,7 @@ namespace amrex BL_ASSERT(ngrow == fine[idim]->nGrowVect()); } - if (ngrow.max() == 0) return; + if (ngrow.max() == 0) { return; } bool include_periodic = true; bool include_physbndry = false; diff --git a/Src/AmrCore/AMReX_FluxRegister.cpp b/Src/AmrCore/AMReX_FluxRegister.cpp index 87f6e693fc5..17f4ed6695d 100644 --- a/Src/AmrCore/AMReX_FluxRegister.cpp +++ b/Src/AmrCore/AMReX_FluxRegister.cpp @@ -739,7 +739,7 @@ FluxRegister::OverwriteFlux (Array const& crse_fluxes, Box cdomain = crse_geom.Domain(); for (int idim = 0; idim < AMREX_SPACEDIM; ++idim) { - if (crse_geom.isPeriodic(idim)) cdomain.grow(idim, 1); + if (crse_geom.isPeriodic(idim)) { cdomain.grow(idim, 1); } } bool run_on_gpu = Gpu::inLaunchRegion(); diff --git a/Src/AmrCore/AMReX_Interpolater.cpp b/Src/AmrCore/AMReX_Interpolater.cpp index 80c00a24175..a5947f18aab 100644 --- a/Src/AmrCore/AMReX_Interpolater.cpp +++ b/Src/AmrCore/AMReX_Interpolater.cpp @@ -475,7 +475,7 @@ CellConservativeLinear::interp (const FArrayBox& crse, BCRec const* bcrp = (run_on_gpu) ? async_bcr.data() : bcr.data(); Elixir cceli; - if (run_on_gpu) cceli = ccfab.elixir(); + if (run_on_gpu) { cceli = ccfab.elixir(); } #else BCRec const* bcrp = bcr.data(); #endif @@ -628,7 +628,7 @@ CellQuadratic::interp (const FArrayBox& crse, BCRec const* bcrp = (run_on_gpu) ? async_bcr.data() : bcr.data(); Elixir seli; - if (run_on_gpu) seli = sfab.elixir(); + if (run_on_gpu) { seli = sfab.elixir(); } #else BCRec const* bcrp = bcr.data(); #endif @@ -1033,7 +1033,7 @@ CellQuartic::interp (const FArrayBox& crse, FArrayBox tmpz(bz, ncomp); #ifdef AMREX_USE_GPU Elixir tmpz_eli; - if (run_on_gpu) tmpz_eli = tmpz.elixir(); + if (run_on_gpu) { tmpz_eli = tmpz.elixir(); } #endif Array4 const& tmpzarr = tmpz.array(); AMREX_HOST_DEVICE_PARALLEL_FOR_4D_FLAG(runon, bz, ncomp, i, j, k, n, @@ -1048,7 +1048,7 @@ CellQuartic::interp (const FArrayBox& crse, FArrayBox tmpy(by, ncomp); #ifdef AMREX_USE_GPU Elixir tmpy_eli; - if (run_on_gpu) tmpy_eli = tmpy.elixir(); + if (run_on_gpu) { tmpy_eli = tmpy.elixir(); } #endif Array4 const& tmpyarr = tmpy.array(); #if (AMREX_SPACEDIM == 2) diff --git a/Src/AmrCore/AMReX_TagBox.cpp b/Src/AmrCore/AMReX_TagBox.cpp index f80daf81265..1efc1e5e870 100644 --- a/Src/AmrCore/AMReX_TagBox.cpp +++ b/Src/AmrCore/AMReX_TagBox.cpp @@ -98,9 +98,9 @@ TagBox::buffer (const IntVect& a_nbuff, const IntVect& a_nwid) noexcept for (int kk = kmin; kk <= kmax && !to_buf; ++kk) { for (int jj = jmin; jj <= jmax && !to_buf; ++jj) { for (int ii = imin; ii <= imax && !to_buf; ++ii) { - if (a(ii,jj,kk) == TagBox::SET) to_buf = true; + if (a(ii,jj,kk) == TagBox::SET) { to_buf = true; } }}} - if (to_buf) a(i,j,k) = TagBox::BUF; + if (to_buf) { a(i,j,k) = TagBox::BUF; } } }); } else @@ -195,7 +195,7 @@ TagBox::get_itags(Vector& ar, const Box& tilebx) const noexcept stb += stride[idim] * (tilebx.smallEnd(idim) - domain.smallEnd(idim)); } - if (ar.size() < Ntb) ar.resize(Ntb); + if (ar.size() < Ntb) { ar.resize(Ntb); } const TagType* const p0 = dataPtr() + stb; // +stb to the lower corner of tilebox int* iptr = ar.dataPtr(); @@ -364,7 +364,7 @@ TagBoxArray::mapPeriodicRemoveDuplicates (const Geometry& geom) Array4 const& msk = owner_mask->const_array(mfi); AMREX_LOOP_3D(box, i, j, k, { - if (!msk(i,j,k)) tag(i,j,k) = TagBox::CLEAR; + if (!msk(i,j,k)) { tag(i,j,k) = TagBox::CLEAR; } }); } @@ -375,7 +375,7 @@ TagBoxArray::mapPeriodicRemoveDuplicates (const Geometry& geom) void TagBoxArray::local_collate_cpu (Gpu::PinnedVector& v) const { - if (this->local_size() == 0) return; + if (this->local_size() == 0) { return; } Vector count(this->local_size()); #ifdef AMREX_USE_OMP @@ -388,7 +388,7 @@ TagBoxArray::local_collate_cpu (Gpu::PinnedVector& v) const int c = 0; AMREX_LOOP_3D(bx,i,j,k, { - if (arr(i,j,k) != TagBox::CLEAR) ++c; + if (arr(i,j,k) != TagBox::CLEAR) { ++c; } }); count[fai.LocalIndex()] = c; } @@ -398,7 +398,7 @@ TagBoxArray::local_collate_cpu (Gpu::PinnedVector& v) const v.resize(offset.back()); - if (v.empty()) return; + if (v.empty()) { return; } #ifdef AMREX_USE_OMP #pragma omp parallel @@ -425,7 +425,7 @@ void TagBoxArray::local_collate_gpu (Gpu::PinnedVector& v) const { const int nfabs = this->local_size(); - if (nfabs == 0) return; + if (nfabs == 0) { return; } constexpr int block_size = 128; Vector nblocks(nfabs); @@ -496,7 +496,7 @@ TagBoxArray::local_collate_gpu (Gpu::PinnedVector& v) const std::partial_sum(hv_ntags.begin(), hv_ntags.end(), hv_tags_offset.begin()+1); int ntotaltags = hv_tags_offset.back(); - if (ntotaltags == 0) return; + if (ntotaltags == 0) { return; } Gpu::NonManagedDeviceVector dv_tags_offset(ntotblocks); int* dp_tags_offset = dv_tags_offset.data(); diff --git a/Src/Base/AMReX.H b/Src/Base/AMReX.H index a0eba4a5c0d..c539a1d8e75 100644 --- a/Src/Base/AMReX.H +++ b/Src/Base/AMReX.H @@ -117,7 +117,7 @@ namespace amrex #if defined(NDEBUG) amrex::ignore_unused(msg); #else - if (msg) AMREX_DEVICE_PRINTF("Error %s\n", msg); + if (msg) { AMREX_DEVICE_PRINTF("Error %s\n", msg); } AMREX_DEVICE_ASSERT(0); #endif #else @@ -136,7 +136,7 @@ namespace amrex #if defined(NDEBUG) amrex::ignore_unused(msg); #else - if (msg) AMREX_DEVICE_PRINTF("Warning %s\n", msg); + if (msg) { AMREX_DEVICE_PRINTF("Warning %s\n", msg); } #endif #else Warning_host(msg); @@ -152,7 +152,7 @@ namespace amrex #if defined(NDEBUG) amrex::ignore_unused(msg); #else - if (msg) AMREX_DEVICE_PRINTF("Abort %s\n", msg); + if (msg) { AMREX_DEVICE_PRINTF("Abort %s\n", msg); } AMREX_DEVICE_ASSERT(0); #endif #else diff --git a/Src/Base/AMReX.cpp b/Src/Base/AMReX.cpp index 6bb199f21b6..668e6e17c14 100644 --- a/Src/Base/AMReX.cpp +++ b/Src/Base/AMReX.cpp @@ -364,7 +364,7 @@ amrex::Initialize (int& argc, char**& argv, bool build_parm_parse, system::exename += argv[0]; for (int i = 0; i < argc; ++i) { - if (i != 0) command_line.append(" "); + if (i != 0) { command_line.append(" "); } command_line.append(argv[i]); command_arguments.emplace_back(argv[i]); } @@ -412,7 +412,7 @@ amrex::Initialize (int& argc, char**& argv, bool build_parm_parse, // the rest get ingored. int ppargc = 1; for (; ppargc < argc; ++ppargc) { - if (std::strcmp(argv[ppargc], "--") == 0) break; + if (std::strcmp(argv[ppargc], "--") == 0) { break; } } if (ppargc > 1) { @@ -549,9 +549,9 @@ amrex::Initialize (int& argc, char**& argv, bool build_parm_parse, #if defined(__linux__) curr_fpe_excepts = 0; - if (invalid) curr_fpe_excepts |= FE_INVALID; - if (divbyzero) curr_fpe_excepts |= FE_DIVBYZERO; - if (overflow) curr_fpe_excepts |= FE_OVERFLOW; + if (invalid) { curr_fpe_excepts |= FE_INVALID; } + if (divbyzero) { curr_fpe_excepts |= FE_DIVBYZERO; } + if (overflow) { curr_fpe_excepts |= FE_OVERFLOW; } prev_fpe_excepts = fegetexcept(); if (curr_fpe_excepts != 0) { feenableexcept(curr_fpe_excepts); // trap floating point exceptions @@ -561,9 +561,9 @@ amrex::Initialize (int& argc, char**& argv, bool build_parm_parse, #elif defined(__APPLE__) && defined(__x86_64__) prev_fpe_mask = _MM_GET_EXCEPTION_MASK(); curr_fpe_excepts = 0u; - if (invalid) curr_fpe_excepts |= _MM_MASK_INVALID; - if (divbyzero) curr_fpe_excepts |= _MM_MASK_DIV_ZERO; - if (overflow) curr_fpe_excepts |= _MM_MASK_OVERFLOW; + if (invalid) { curr_fpe_excepts |= _MM_MASK_INVALID; } + if (divbyzero) { curr_fpe_excepts |= _MM_MASK_DIV_ZERO; } + if (overflow) { curr_fpe_excepts |= _MM_MASK_OVERFLOW; } if (curr_fpe_excepts != 0u) { _MM_SET_EXCEPTION_MASK(prev_fpe_mask & ~curr_fpe_excepts); prev_handler_sigfpe = std::signal(SIGFPE, BLBackTrace::handler); @@ -582,9 +582,9 @@ amrex::Initialize (int& argc, char**& argv, bool build_parm_parse, fenv_t env; fegetenv(&env); - if (invalid) env.__fpcr |= __fpcr_trap_invalid; - if (divbyzero) env.__fpcr |= __fpcr_trap_divbyzero; - if (overflow) env.__fpcr |= __fpcr_trap_overflow; + if (invalid) { env.__fpcr |= __fpcr_trap_invalid; } + if (divbyzero) { env.__fpcr |= __fpcr_trap_divbyzero; } + if (overflow) { env.__fpcr |= __fpcr_trap_overflow; } fesetenv(&env); // SIGILL ref: https://developer.apple.com/forums/thread/689159 #endif @@ -781,12 +781,12 @@ amrex::Finalize (amrex::AMReX* pamrex) #ifndef BL_AMRPROF if (system::signal_handling) { - if (prev_handler_sigsegv != SIG_ERR) std::signal(SIGSEGV, prev_handler_sigsegv); // NOLINT(performance-no-int-to-ptr) - if (prev_handler_sigterm != SIG_ERR) std::signal(SIGTERM, prev_handler_sigterm); // NOLINT(performance-no-int-to-ptr) - if (prev_handler_sigint != SIG_ERR) std::signal(SIGINT , prev_handler_sigint); // NOLINT(performance-no-int-to-ptr) - if (prev_handler_sigabrt != SIG_ERR) std::signal(SIGABRT, prev_handler_sigabrt); // NOLINT(performance-no-int-to-ptr) - if (prev_handler_sigfpe != SIG_ERR) std::signal(SIGFPE , prev_handler_sigfpe); // NOLINT(performance-no-int-to-ptr) - if (prev_handler_sigill != SIG_ERR) std::signal(SIGILL , prev_handler_sigill); // NOLINT(performance-no-int-to-ptr) + if (prev_handler_sigsegv != SIG_ERR) { std::signal(SIGSEGV, prev_handler_sigsegv); } // NOLINT(performance-no-int-to-ptr) + if (prev_handler_sigterm != SIG_ERR) { std::signal(SIGTERM, prev_handler_sigterm); } // NOLINT(performance-no-int-to-ptr) + if (prev_handler_sigint != SIG_ERR) { std::signal(SIGINT , prev_handler_sigint); } // NOLINT(performance-no-int-to-ptr) + if (prev_handler_sigabrt != SIG_ERR) { std::signal(SIGABRT, prev_handler_sigabrt); } // NOLINT(performance-no-int-to-ptr) + if (prev_handler_sigfpe != SIG_ERR) { std::signal(SIGFPE , prev_handler_sigfpe); } // NOLINT(performance-no-int-to-ptr) + if (prev_handler_sigill != SIG_ERR) { std::signal(SIGILL , prev_handler_sigill); } // NOLINT(performance-no-int-to-ptr) #if defined(__linux__) #if !defined(__PGI) || (__PGIC__ >= 16) if (curr_fpe_excepts != 0) { diff --git a/Src/Base/AMReX_Algorithm.H b/Src/Base/AMReX_Algorithm.H index 510796a861b..b418f3cc1c0 100644 --- a/Src/Base/AMReX_Algorithm.H +++ b/Src/Base/AMReX_Algorithm.H @@ -110,8 +110,8 @@ namespace amrex T flo = f(lo); T fhi = f(hi); - if (flo == T(0)) return flo; - if (fhi == T(0)) return fhi; + if (flo == T(0)) { return flo; } + if (fhi == T(0)) { return fhi; } AMREX_ASSERT_WITH_MESSAGE(flo * fhi <= T(0), "Error - calling bisect but lo and hi don't bracket a root."); @@ -121,10 +121,10 @@ namespace amrex int n = 1; while (n <= max_iter) { - if (hi - lo < tol || almostEqual(lo,hi)) break; + if (hi - lo < tol || almostEqual(lo,hi)) { break; } mi = (lo + hi) / T(2); fmi = f(mi); - if (fmi == T(0)) break; + if (fmi == T(0)) { break; } fmi*flo < T(0) ? hi = mi : lo = mi; flo = f(lo); fhi = f(hi); diff --git a/Src/Base/AMReX_Arena.cpp b/Src/Base/AMReX_Arena.cpp index d18fa0dd5d5..a30a5fc7344 100644 --- a/Src/Base/AMReX_Arena.cpp +++ b/Src/Base/AMReX_Arena.cpp @@ -141,7 +141,7 @@ Arena::allocate_system (std::size_t nbytes) // NOLINT(readability-make-member-fu #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wmaybe-uninitialized" #endif - if (p && (nbytes > 0) && arena_info.device_use_hostalloc) mlock(p, nbytes); + if (p && (nbytes > 0) && arena_info.device_use_hostalloc) { mlock(p, nbytes); } #if defined(__GNUC__) && !defined(__clang__) #pragma GCC diagnostic pop #endif @@ -201,13 +201,13 @@ Arena::allocate_system (std::size_t nbytes) // NOLINT(readability-make-member-fu #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wmaybe-uninitialized" #endif - if (p && (nbytes > 0) && arena_info.device_use_hostalloc) mlock(p, nbytes); + if (p && (nbytes > 0) && arena_info.device_use_hostalloc) { mlock(p, nbytes); } #if defined(__GNUC__) && !defined(__clang__) #pragma GCC diagnostic pop #endif #endif #endif - if (p == nullptr) amrex::Abort("Sorry, malloc failed"); + if (p == nullptr) { amrex::Abort("Sorry, malloc failed"); } return p; } @@ -217,7 +217,7 @@ Arena::deallocate_system (void* p, std::size_t nbytes) // NOLINT(readability-mak #ifdef AMREX_USE_GPU if (arena_info.use_cpu_memory) { - if (p && arena_info.device_use_hostalloc) AMREX_MUNLOCK(p, nbytes); + if (p && arena_info.device_use_hostalloc) { AMREX_MUNLOCK(p, nbytes); } std::free(p); } else if (arena_info.device_use_hostalloc) @@ -235,7 +235,7 @@ Arena::deallocate_system (void* p, std::size_t nbytes) // NOLINT(readability-mak sycl::free(p,Gpu::Device::syclContext())); } #else - if (p && arena_info.device_use_hostalloc) AMREX_MUNLOCK(p, nbytes); + if (p && arena_info.device_use_hostalloc) { AMREX_MUNLOCK(p, nbytes); } std::free(p); #endif } @@ -265,7 +265,7 @@ namespace { void Arena::Initialize () { - if (initialized) return; + if (initialized) { return; } initialized = true; // see reason on allowed reuse of the default CPU BArena in Arena::Finalize diff --git a/Src/Base/AMReX_Array.H b/Src/Base/AMReX_Array.H index c9a3eb63a56..3d853329ebc 100644 --- a/Src/Base/AMReX_Array.H +++ b/Src/Base/AMReX_Array.H @@ -103,7 +103,7 @@ namespace amrex { */ AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void fill ( const T& value ) noexcept - { for (unsigned int i = 0; i < N; ++i) arr[i] = value; } + { for (unsigned int i = 0; i < N; ++i) { arr[i] = value; } } /** * Returns the sum of all elements in the GpuArray object. @@ -853,7 +853,7 @@ namespace amrex template std::array GetArrOfPtrs (std::array& a) noexcept { - return {{AMREX_D_DECL(&a[0], &a[1], &a[2])}}; + return {{AMREX_D_DECL(a.data(), a.data()+1, a.data()+2)}}; } template @@ -865,13 +865,13 @@ namespace amrex template std::array GetArrOfConstPtrs (const std::array& a) noexcept { - return {{AMREX_D_DECL(&a[0], &a[1], &a[2])}}; + return {{AMREX_D_DECL(a.data(), a.data()+1, a.data()+2)}}; } template std::array GetArrOfConstPtrs (const std::array& a) noexcept { - return {{AMREX_D_DECL(a[0], a[1], a[2])}}; + return {{AMREX_D_DECL(a.data(), a.data()+1, a.data()+2)}}; } template @@ -897,4 +897,3 @@ namespace amrex } #endif - diff --git a/Src/Base/AMReX_AsyncOut.cpp b/Src/Base/AMReX_AsyncOut.cpp index 2ee6fec4637..b235baa6580 100644 --- a/Src/Base/AMReX_AsyncOut.cpp +++ b/Src/Base/AMReX_AsyncOut.cpp @@ -62,7 +62,7 @@ void Finalize () } #ifdef AMREX_USE_MPI - if (s_comm != MPI_COMM_NULL) MPI_Comm_free(&s_comm); + if (s_comm != MPI_COMM_NULL) { MPI_Comm_free(&s_comm); } s_comm = MPI_COMM_NULL; #endif } diff --git a/Src/Base/AMReX_BCUtil.cpp b/Src/Base/AMReX_BCUtil.cpp index ff17bd4e244..c0a645ba05c 100644 --- a/Src/Base/AMReX_BCUtil.cpp +++ b/Src/Base/AMReX_BCUtil.cpp @@ -35,8 +35,8 @@ struct dummy_gpu_fill_extdir void FillDomainBoundary (MultiFab& phi, const Geometry& geom, const Vector& bc) { - if (geom.isAllPeriodic()) return; - if (phi.nGrow() == 0) return; + if (geom.isAllPeriodic()) { return; } + if (phi.nGrow() == 0) { return; } AMREX_ALWAYS_ASSERT(phi.ixType().cellCentered()); diff --git a/Src/Base/AMReX_BaseFab.H b/Src/Base/AMReX_BaseFab.H index 960f1078e18..99132038397 100644 --- a/Src/Base/AMReX_BaseFab.H +++ b/Src/Base/AMReX_BaseFab.H @@ -1769,8 +1769,9 @@ BaseFab::getVal (T* data, AMREX_ASSERT(!(this->dptr == nullptr)); AMREX_ASSERT(n >= 0 && n + numcomp <= this->nvar); - for (int k = 0; k < numcomp; k++) + for (int k = 0; k < numcomp; k++) { data[k] = this->dptr[loc+(n+k)*sz]; + } } template @@ -1895,7 +1896,7 @@ BaseFab::define () AMREX_ASSERT(this->dptr == nullptr); AMREX_ASSERT(this->domain.numPts() > 0); AMREX_ASSERT(this->nvar >= 0); - if (this->nvar == 0) return; + if (this->nvar == 0) { return; } AMREX_ASSERT(std::numeric_limits::max()/this->nvar > this->domain.numPts()); this->truesize = this->nvar*this->domain.numPts(); @@ -1923,7 +1924,7 @@ template BaseFab::BaseFab (const Box& bx, int n, bool alloc, bool shared, Arena* ar) : DataAllocator{ar}, domain(bx), nvar(n), shared_memory(shared) { - if (!this->shared_memory && alloc) define(); + if (!this->shared_memory && alloc) { define(); } } template @@ -2054,16 +2055,18 @@ BaseFab::resize (const Box& b, int n, Arena* ar) } else if (this->dptr == nullptr || !this->ptr_owner) { - if (this->shared_memory) + if (this->shared_memory) { amrex::Abort("BaseFab::resize: BaseFab in shared memory cannot increase size"); + } this->dptr = nullptr; define(); } else if (this->nvar*this->domain.numPts() > this->truesize) { - if (this->shared_memory) + if (this->shared_memory) { amrex::Abort("BaseFab::resize: BaseFab in shared memory cannot increase size"); + } clear(); @@ -2590,7 +2593,7 @@ BaseFab::indexFromValue (Box const& subbox, int comp, T const& value) const n { AMREX_LOOP_3D(subbox, i, j, k, { - if (a(i,j,k) == value) return IntVect(AMREX_D_DECL(i,j,k)); + if (a(i,j,k) == value) { return IntVect(AMREX_D_DECL(i,j,k)); } }); return IntVect::TheMinVector(); } diff --git a/Src/Base/AMReX_BlockMutex.cpp b/Src/Base/AMReX_BlockMutex.cpp index d07d89fd76a..8ce63a15133 100644 --- a/Src/Base/AMReX_BlockMutex.cpp +++ b/Src/Base/AMReX_BlockMutex.cpp @@ -13,7 +13,7 @@ void BlockMutex::init_states (state_t* state, int N) noexcept { [=] AMREX_GPU_DEVICE () noexcept { int i = threadIdx.x + blockIdx.x*blockDim.x; - if (i < N) state[i] = FreeState(); + if (i < N) { state[i] = FreeState(); } }); #endif } diff --git a/Src/Base/AMReX_Box.H b/Src/Base/AMReX_Box.H index 025c4b90c45..0a32d637d4f 100644 --- a/Src/Base/AMReX_Box.H +++ b/Src/Base/AMReX_Box.H @@ -636,10 +636,11 @@ public: AMREX_GPU_HOST_DEVICE Box& grow (Orientation face, int n_cell = 1) noexcept { int idir = face.coordDir(); - if (face.isLow()) + if (face.isLow()) { smallend.shift(idir, -n_cell); - else + } else { bigend.shift(idir,n_cell); + } return *this; } @@ -800,9 +801,11 @@ Box::coarsen (const IntVect& ref_ratio) noexcept IntVect off(0); for (int dir = 0; dir < AMREX_SPACEDIM; dir++) { - if (btype[dir]) - if (bigend[dir]%ref_ratio[dir]) + if (btype[dir]) { + if (bigend[dir]%ref_ratio[dir]) { off.setVal(dir,1); + } + } } bigend.coarsen(ref_ratio); bigend += off; diff --git a/Src/Base/AMReX_Box.cpp b/Src/Base/AMReX_Box.cpp index 0b2560749b5..6fbb15184fa 100644 --- a/Src/Base/AMReX_Box.cpp +++ b/Src/Base/AMReX_Box.cpp @@ -123,7 +123,7 @@ AllGatherBoxes (Vector& bxs, int n_extra_reserve) count_tot += countvec[i]; } - if (count_tot == 0) return; + if (count_tot == 0) { return; } if (count_tot > static_cast(std::numeric_limits::max())) { amrex::Abort("AllGatherBoxes: too many boxes"); @@ -158,7 +158,7 @@ AllGatherBoxes (Vector& bxs, int n_extra_reserve) MPI_Bcast(&count_tot, 1, MPI_INT, root, comm); - if (count_tot == 0) return; + if (count_tot == 0) { return; } if (count_tot > static_cast(std::numeric_limits::max())) { amrex::Abort("AllGatherBoxes: too many boxes"); diff --git a/Src/Base/AMReX_BoxArray.cpp b/Src/Base/AMReX_BoxArray.cpp index 8dfbd2b6379..bda1cce0ab9 100644 --- a/Src/Base/AMReX_BoxArray.cpp +++ b/Src/Base/AMReX_BoxArray.cpp @@ -518,9 +518,9 @@ BoxArray::operator!= (const BoxArray& rhs) const noexcept bool BoxArray::operator== (const Vector& bv) const noexcept { - if (size() != bv.size()) return false; + if (size() != bv.size()) { return false; } for (int i = 0; i < static_cast(size()); ++i) { - if (this->operator[](i) != bv[i]) return false; + if (this->operator[](i) != bv[i]) { return false; } } return true; } @@ -601,11 +601,11 @@ bool BoxArray::coarsenable (const IntVect& refinement_ratio, const IntVect& min_width) const { const Long sz = size(); - if(size() == 0) return false; + if(size() == 0) { return false; } const Box& first = (*this)[0]; bool res = first.coarsenable(refinement_ratio,min_width); - if (res == false) return false; + if (res == false) { return false; } auto const& bxs = this->m_ref->m_abox; if (m_bat.is_null()) { @@ -873,17 +873,17 @@ BoxArray::ok () const auto const& bxs = this->m_ref->m_abox; if (m_bat.is_null()) { for (int i = 0; i < N; ++i) { - if (! bxs[i].ok()) return false; + if (! bxs[i].ok()) { return false; } } } else if (m_bat.is_simple()) { IndexType t = ixType(); IntVect cr = crseRatio(); for (int i = 0; i < N; ++i) { - if (! amrex::convert(amrex::coarsen(bxs[i],cr),t).ok()) return false; + if (! amrex::convert(amrex::coarsen(bxs[i],cr),t).ok()) { return false; } } } else { for (int i = 0; i < N; ++i) { - if (! m_bat.m_op.m_bndryReg(bxs[i]).ok()) return false; + if (! m_bat.m_op.m_bndryReg(bxs[i]).ok()) { return false; } } } } @@ -900,19 +900,19 @@ BoxArray::isDisjoint () const if (m_bat.is_null()) { for (int i = 0; i < N; ++i) { intersections(bxs[i],isects); - if ( isects.size() > 1 ) return false; + if ( isects.size() > 1 ) { return false; } } } else if (m_bat.is_simple()) { IndexType t = ixType(); IntVect cr = crseRatio(); for (int i = 0; i < N; ++i) { intersections(amrex::convert(amrex::coarsen(bxs[i],cr),t), isects); - if ( isects.size() > 1 ) return false; + if ( isects.size() > 1 ) { return false; } } } else { for (int i = 0; i < N; ++i) { intersections(m_bat.m_op.m_bndryReg(bxs[i]), isects); - if ( isects.size() > 1 ) return false; + if ( isects.size() > 1 ) { return false; } } } @@ -996,9 +996,9 @@ BoxArray::contains (const Box& b, bool assume_disjoint_ba, const IntVect& ng) co bool BoxArray::contains (const BoxArray& ba, bool assume_disjoint_ba, const IntVect& ng) const { - if (size() == 0) return false; + if (size() == 0) { return false; } - if (!minimalBox().grow(ng).contains(ba.minimalBox())) return false; + if (!minimalBox().grow(ng).contains(ba.minimalBox())) { return false; } for (int i = 0, N = static_cast(ba.size()); i < N; ++i) { if (!contains(ba[i],assume_disjoint_ba, ng)) { @@ -1200,7 +1200,7 @@ BoxArray::intersections (const Box& bx, Box cbx(sm,bg); cbx.normalize(); - if (!cbx.intersects(m_ref->bbox)) return; + if (!cbx.intersects(m_ref->bbox)) { return; } auto TheEnd = BoxHashMap.cend(); @@ -1221,7 +1221,7 @@ BoxArray::intersections (const Box& bx, if (isect.ok()) { isects.emplace_back(index,isect); - if (first_only) return; + if (first_only) { return; } } } } else if (m_bat.is_simple()) { @@ -1235,7 +1235,7 @@ BoxArray::intersections (const Box& bx, if (isect.ok()) { isects.emplace_back(index,isect); - if (first_only) return; + if (first_only) { return; } } } } else { @@ -1247,7 +1247,7 @@ BoxArray::intersections (const Box& bx, if (isect.ok()) { isects.emplace_back(index,isect); - if (first_only) return; + if (first_only) { return; } } } } @@ -1271,7 +1271,7 @@ BoxArray::complementIn (BoxList& bl, const Box& bx) const bl.set(bx.ixType()); bl.push_back(bx); - if (empty()) return; + if (empty()) { return; } BARef::HashType& BoxHashMap = getHashMap(); @@ -1293,7 +1293,7 @@ BoxArray::complementIn (BoxList& bl, const Box& bx) const Box cbx(sm,bg); cbx.normalize(); - if (!cbx.intersects(m_ref->bbox)) return; + if (!cbx.intersects(m_ref->bbox)) { return; } auto TheEnd = BoxHashMap.cend(); @@ -1408,7 +1408,7 @@ BoxArray::removeOverlap (bool simplify) for (auto const& is: isects) { - if (is.first == i) continue; + if (is.first == i) { continue; } Box& bx = m_ref->m_abox[is.first]; @@ -1481,7 +1481,7 @@ BoxArray::getHashMap () const { BARef::HashType& BoxHashMap = m_ref->hash; - if (m_ref->HasHashMap()) return BoxHashMap; + if (m_ref->HasHashMap()) { return BoxHashMap; } #ifdef AMREX_USE_OMP #pragma omp critical(intersections_lock) @@ -1669,7 +1669,7 @@ intersect (const BoxArray& ba, BoxArray intersect (const BoxArray& lhs, const BoxArray& rhs) { - if (lhs.empty() || rhs.empty()) return BoxArray(); + if (lhs.empty() || rhs.empty()) { return BoxArray(); } BoxList bl(lhs[0].ixType()); for (int i = 0, Nl = static_cast(lhs.size()); i < Nl; ++i) { diff --git a/Src/Base/AMReX_BoxIterator.H b/Src/Base/AMReX_BoxIterator.H index c11d55c0ce4..bf05a9e817f 100644 --- a/Src/Base/AMReX_BoxIterator.H +++ b/Src/Base/AMReX_BoxIterator.H @@ -111,7 +111,7 @@ namespace amrex inline void BoxIterator::begin () noexcept { - if (m_boxLo <= m_boxHi) m_current = m_boxLo; + if (m_boxLo <= m_boxHi) { m_current = m_boxLo; } } inline diff --git a/Src/Base/AMReX_BoxList.cpp b/Src/Base/AMReX_BoxList.cpp index 584b707b4d8..4459b24dba9 100644 --- a/Src/Base/AMReX_BoxList.cpp +++ b/Src/Base/AMReX_BoxList.cpp @@ -251,9 +251,9 @@ BoxList::isDisjoint () const } bool -BoxList::contains (const BoxList& bl) const +BoxList::contains (const BoxList& bl) const { - if (isEmpty() || bl.isEmpty()) return false; + if (isEmpty() || bl.isEmpty()) { return false; } BL_ASSERT(ixType() == bl.ixType()); diff --git a/Src/Base/AMReX_DistributionMapping.cpp b/Src/Base/AMReX_DistributionMapping.cpp index 7ee39e310d7..ad79af10be3 100644 --- a/Src/Base/AMReX_DistributionMapping.cpp +++ b/Src/Base/AMReX_DistributionMapping.cpp @@ -106,7 +106,7 @@ DistributionMapping::operator!= (const DistributionMapping& rhs) const noexcept void DistributionMapping::Initialize () { - if (initialized) return; + if (initialized) { return; } // // Set defaults here!!! // @@ -1335,7 +1335,7 @@ DistributionMapping::SFCProcessorMapDoIt (const BoxArray& boxes, LIpairV.emplace_back(wgt,i); } - if (sort) Sort(LIpairV, true); + if (sort) { Sort(LIpairV, true); } if (flag_verbose_mapper) { for (const auto &p : LIpairV) { @@ -1441,11 +1441,11 @@ DistributionMapping::SFCProcessorMapDoIt (const BoxArray& boxes, for (int i = 0; i < nteams; ++i) { const Long W = LIpairV[i].first; - if (W > max_wgt) max_wgt = W; + if (W > max_wgt) { max_wgt = W; } sum_wgt += W; } Real efficiency = static_cast(sum_wgt)/static_cast(nteams*max_wgt); - if (eff) *eff = efficiency; + if (eff) { *eff = efficiency; } if (verbose) { diff --git a/Src/Base/AMReX_FACopyDescriptor.H b/Src/Base/AMReX_FACopyDescriptor.H index 263fb9ece48..67a106f2700 100644 --- a/Src/Base/AMReX_FACopyDescriptor.H +++ b/Src/Base/AMReX_FACopyDescriptor.H @@ -435,7 +435,7 @@ FabArrayCopyDescriptor::CollectData () { dataAvailable = true; - if (ParallelDescriptor::NProcs() == 1) return; + if (ParallelDescriptor::NProcs() == 1) { return; } #ifdef BL_USE_MPI using value_type = typename FAB::value_type; @@ -538,7 +538,7 @@ FabArrayCopyDescriptor::CollectData () const auto N_snds = static_cast(Snds.size()); const auto N_rcvs = static_cast(Rcvs.size()); - if ( N_snds == 0 && N_rcvs == 0 ) return; + if ( N_snds == 0 && N_rcvs == 0 ) { return; } const int Nints = 4 + 3*AMREX_SPACEDIM; // # of ints in a meta-data diff --git a/Src/Base/AMReX_FArrayBox.cpp b/Src/Base/AMReX_FArrayBox.cpp index 2074ef8d663..56319176cfb 100644 --- a/Src/Base/AMReX_FArrayBox.cpp +++ b/Src/Base/AMReX_FArrayBox.cpp @@ -123,7 +123,7 @@ FArrayBox::FArrayBox (const Box& b, int ncomp, Arena* ar) FArrayBox::FArrayBox (const Box& b, int n, bool alloc, bool shared, Arena* ar) : BaseFab(b,n,alloc,shared,ar) { - if (alloc) initVal(); + if (alloc) { initVal(); } } FArrayBox::FArrayBox (const FArrayBox& rhs, MakeType make_type, int scomp, int ncomp) @@ -180,7 +180,7 @@ FArrayBox::initVal () noexcept p[i] = x; }); #ifdef AMREX_USE_GPU - if (runon == RunOn::Gpu) Gpu::streamSynchronize(); + if (runon == RunOn::Gpu) { Gpu::streamSynchronize(); } #else amrex::ignore_unused(runon); #endif @@ -346,7 +346,7 @@ FArrayBox::get_initval () void FArrayBox::Initialize () { - if (initialized) return; + if (initialized) { return; } initialized = true; BL_ASSERT(fabio == nullptr); @@ -472,11 +472,11 @@ FABio::read_header (std::istream& is, char c; is >> c; - if(c != 'F') amrex::Error("FABio::read_header(): expected \'F\'"); + if(c != 'F') { amrex::Error("FABio::read_header(): expected \'F\'"); } is >> c; - if(c != 'A') amrex::Error("FABio::read_header(): expected \'A\'"); + if(c != 'A') { amrex::Error("FABio::read_header(): expected \'A\'"); } is >> c; - if(c != 'B') amrex::Error("FABio::read_header(): expected \'B\'"); + if(c != 'B') { amrex::Error("FABio::read_header(): expected \'B\'"); } is >> c; if(c == ':') { // ---- The "old" FAB format. @@ -551,11 +551,11 @@ FABio::read_header (std::istream& is, char c; is >> c; - if(c != 'F') amrex::Error("FABio::read_header(): expected \'F\'"); + if(c != 'F') { amrex::Error("FABio::read_header(): expected \'F\'"); } is >> c; - if(c != 'A') amrex::Error("FABio::read_header(): expected \'A\'"); + if(c != 'A') { amrex::Error("FABio::read_header(): expected \'A\'"); } is >> c; - if(c != 'B') amrex::Error("FABio::read_header(): expected \'B\'"); + if(c != 'B') { amrex::Error("FABio::read_header(): expected \'B\'"); } is >> c; if(c == ':') { // ---- The "old" FAB format. diff --git a/Src/Base/AMReX_FBI.H b/Src/Base/AMReX_FBI.H index 4c7ba5ec4f0..e20f8bb4b79 100644 --- a/Src/Base/AMReX_FBI.H +++ b/Src/Base/AMReX_FBI.H @@ -212,7 +212,7 @@ FabArray::FB_local_copy_cpu (const FB& TheFB, int scomp, int ncomp) { auto const& LocTags = *(TheFB.m_LocTags); auto N_locs = static_cast(LocTags.size()); - if (N_locs == 0) return; + if (N_locs == 0) { return; } bool is_thread_safe = TheFB.m_threadsafe_loc; if (is_thread_safe) { @@ -273,7 +273,7 @@ FabArray::FB_local_copy_gpu (const FB& TheFB, int scomp, int ncomp) { auto const& LocTags = *(TheFB.m_LocTags); int N_locs = LocTags.size(); - if (N_locs == 0) return; + if (N_locs == 0) { return; } bool is_thread_safe = TheFB.m_threadsafe_loc; using TagType = Array4CopyTag; @@ -334,7 +334,7 @@ FabArray::CMD_local_setVal_gpu (typename FabArray::value_type x, { auto const& LocTags = *(thecmd.m_LocTags); int N_locs = LocTags.size(); - if (N_locs == 0) return; + if (N_locs == 0) { return; } bool is_thread_safe = thecmd.m_threadsafe_loc; using TagType = Array4BoxTag; @@ -374,7 +374,7 @@ FabArray::CMD_remote_setVal_gpu (typename FabArray::value_type x, } } - if (rcv_setval_tags.empty()) return; + if (rcv_setval_tags.empty()) { return; } AMREX_ALWAYS_ASSERT(amrex::IsStoreAtomic::value || is_thread_safe); @@ -561,7 +561,7 @@ FabArray::FB_pack_send_buffer_cuda_graph (const FB& TheFB, int scomp, int n Vector::CopyComTagsContainer const*> const& send_cctc) { const int N_snds = send_data.size(); - if (N_snds == 0) return; + if (N_snds == 0) { return; } if ( !(TheFB.m_copyToBuffer.ready()) ) { @@ -648,7 +648,7 @@ FabArray::FB_unpack_recv_buffer_cuda_graph (const FB& TheFB, int dcomp, int bool /*is_thread_safe*/) { const int N_rcvs = recv_cctc.size(); - if (N_rcvs == 0) return; + if (N_rcvs == 0) { return; } int launches = 0; LayoutData > recv_copy_tags(boxArray(),DistributionMap()); @@ -735,7 +735,7 @@ FabArray::pack_send_buffer_gpu (FabArray const& src, int scomp, int nc amrex::ignore_unused(send_size); const int N_snds = send_data.size(); - if (N_snds == 0) return; + if (N_snds == 0) { return; } char* pbuffer = send_data[0]; std::size_t szbuffer = 0; @@ -796,7 +796,7 @@ FabArray::unpack_recv_buffer_gpu (FabArray& dst, int dcomp, int ncomp, amrex::ignore_unused(recv_size); const int N_rcvs = recv_cctc.size(); - if (N_rcvs == 0) return; + if (N_rcvs == 0) { return; } char* pbuffer = recv_data[0]; #if 0 @@ -905,7 +905,7 @@ FabArray::pack_send_buffer_cpu (FabArray const& src, int scomp, int nc amrex::ignore_unused(send_size); auto const N_snds = static_cast(send_data.size()); - if (N_snds == 0) return; + if (N_snds == 0) { return; } #ifdef AMREX_USE_OMP #pragma omp parallel for @@ -945,7 +945,7 @@ FabArray::unpack_recv_buffer_cpu (FabArray& dst, int dcomp, int ncomp, amrex::ignore_unused(recv_size); auto const N_rcvs = static_cast(recv_cctc.size()); - if (N_rcvs == 0) return; + if (N_rcvs == 0) { return; } if (is_thread_safe) { diff --git a/Src/Base/AMReX_FabArray.H b/Src/Base/AMReX_FabArray.H index 2df4cf53ba2..70eff52c11d 100644 --- a/Src/Base/AMReX_FabArray.H +++ b/Src/Base/AMReX_FabArray.H @@ -1937,7 +1937,7 @@ template bool FabArray::ok () const { - if (!define_function_called) return false; + if (!define_function_called) { return false; } int isok = 1; @@ -3242,7 +3242,7 @@ FabArray::SumBoundary_nowait (int scomp, int ncomp, IntVect const& src_ngho { BL_PROFILE("FabArray::SumBoundary_nowait()"); - if ( n_grow == IntVect::TheZeroVector() && boxArray().ixType().cellCentered()) return; + if ( n_grow == IntVect::TheZeroVector() && boxArray().ixType().cellCentered()) { return; } AMREX_ASSERT(src_nghost <= n_grow); @@ -3262,7 +3262,7 @@ FabArray::SumBoundary_finish () BL_PROFILE("FabArray::SumBoundary_finish()"); // If pcd doesn't exist, ParallelCopy was all local and operation was fully completed in "SumBoundary_nowait". - if ( (n_grow == IntVect::TheZeroVector() && boxArray().ixType().cellCentered()) || !(this->pcd) ) return; + if ( (n_grow == IntVect::TheZeroVector() && boxArray().ixType().cellCentered()) || !(this->pcd) ) { return; } auto* tmp = const_cast*> (this->pcd->src); this->ParallelCopy_finish(); diff --git a/Src/Base/AMReX_FabArrayBase.H b/Src/Base/AMReX_FabArrayBase.H index a4c1407d36c..29d3d63b29e 100644 --- a/Src/Base/AMReX_FabArrayBase.H +++ b/Src/Base/AMReX_FabArrayBase.H @@ -409,7 +409,7 @@ public: RegionTag (RegionTag && rhs) noexcept : tagged(rhs.tagged) { rhs.tagged = false; } RegionTag& operator= (RegionTag const&) = delete; RegionTag& operator= (RegionTag &&) = delete; - ~RegionTag () { if (tagged) popRegionTag(); } + ~RegionTag () { if (tagged) { popRegionTag(); } } private: bool tagged = false; }; diff --git a/Src/Base/AMReX_FabArrayBase.cpp b/Src/Base/AMReX_FabArrayBase.cpp index e7b8e1977ae..e8184ee0649 100644 --- a/Src/Base/AMReX_FabArrayBase.cpp +++ b/Src/Base/AMReX_FabArrayBase.cpp @@ -94,7 +94,7 @@ namespace void FabArrayBase::Initialize () { - if (initialized) return; + if (initialized) { return; } initialized = true; // @@ -898,7 +898,7 @@ FabArrayBase::FB::define_epo (const FabArrayBase& fa) Box bxsnd = amrex::grow(ba[ksnd],ng); bxsnd &= pdomain; // source must be inside the periodic domain. - if (!bxsnd.ok()) continue; + if (!bxsnd.ok()) { continue; } for (auto const& pit : pshifts) { @@ -953,7 +953,7 @@ FabArrayBase::FB::define_epo (const FabArrayBase& fa) const Box& vbx = ba[krcv]; const Box& bxrcv = amrex::grow(vbx, ng); - if (pdomain.contains(bxrcv)) continue; + if (pdomain.contains(bxrcv)) { continue; } for (auto const& pit : pshifts) { @@ -1837,7 +1837,7 @@ FabArrayBase::FPinfo::FPinfo (const FabArrayBase& srcfa, amrex::AllGatherBoxes(bl.data()); } - if (bl.isEmpty()) return; + if (bl.isEmpty()) { return; } Long ncells_total = 0L; Long ncells_max = 0L; diff --git a/Src/Base/AMReX_FabArrayCommI.H b/Src/Base/AMReX_FabArrayCommI.H index d79df73c7b6..ea877266f9a 100644 --- a/Src/Base/AMReX_FabArrayCommI.H +++ b/Src/Base/AMReX_FabArrayCommI.H @@ -34,7 +34,7 @@ FabArray::FBEP_nowait (int scomp, int ncomp, const IntVect& nghost, // There can only be local work to do. // int N_locs = (*TheFB.m_LocTags).size(); - if (N_locs == 0) return; + if (N_locs == 0) { return; } #ifdef AMREX_USE_GPU if (Gpu::inLaunchRegion()) { @@ -647,7 +647,7 @@ FabArray::PrepareSendBuffers (const MapOfCopyComTagContainers& SndTags, send_reqs.clear(); send_cctc.clear(); const auto N_snds = SndTags.size(); - if (N_snds == 0) return; + if (N_snds == 0) { return; } send_data.reserve(N_snds); send_size.reserve(N_snds); send_rank.reserve(N_snds); @@ -843,7 +843,7 @@ template void fbv_copy (Vector const& tags) { const int N = tags.size(); - if (N == 0) return; + if (N == 0) { return; } #ifdef AMREX_USE_GPU if (Gpu::inLaunchRegion()) { ParallelFor(tags, 1, @@ -941,7 +941,7 @@ FillBoundary (Vector const& mf, Vector const& scomp, int SeqNum = ParallelDescriptor::SeqNum(); MPI_Comm comm = ParallelContext::CommunicatorSub(); - if (N_locs == 0 && N_rcvs == 0 && N_snds == 0) return; // No work to do + if (N_locs == 0 && N_rcvs == 0 && N_snds == 0) { return; } // No work to do char* the_recv_data = nullptr; Vector recv_from; diff --git a/Src/Base/AMReX_FabArrayUtility.H b/Src/Base/AMReX_FabArrayUtility.H index 04c4fc47b28..27982640487 100644 --- a/Src/Base/AMReX_FabArrayUtility.H +++ b/Src/Base/AMReX_FabArrayUtility.H @@ -1313,7 +1313,7 @@ OverrideSync_nowait (FabArray & fa, FabArray const& msk, const Period BL_PROFILE("OverrideSync_nowait()"); AMREX_ASSERT_WITH_MESSAGE(!fa.os_temp, "OverrideSync_nowait() called when already in progress."); - if (fa.ixType().cellCentered()) return; + if (fa.ixType().cellCentered()) { return; } const int ncomp = fa.nComp(); @@ -1359,7 +1359,7 @@ OverrideSync_finish (FabArray & fa) { BL_PROFILE("OverrideSync_finish()"); - if (fa.ixType().cellCentered()) return; + if (fa.ixType().cellCentered()) { return; } fa.os_temp->ParallelCopy_finish(); amrex::Copy(fa, *(fa.os_temp), 0, 0, fa.nComp(), 0); @@ -1504,7 +1504,7 @@ indexFromValue (FabArray const& mf, int comp, IntVect const& nghost, f = true; } - if (old == false) loc = priv_loc; + if (old == false) { loc = priv_loc; } } } } diff --git a/Src/Base/AMReX_Geometry.cpp b/Src/Base/AMReX_Geometry.cpp index ac30aba62c7..6565643f99c 100644 --- a/Src/Base/AMReX_Geometry.cpp +++ b/Src/Base/AMReX_Geometry.cpp @@ -111,7 +111,7 @@ Geometry::Setup (const RealBox* rb, int coord, int const* isper) noexcept { Geometry* gg = AMReX::top()->getDefaultGeometry(); - if (gg->ok) return; + if (gg->ok) { return; } AMREX_ASSERT(!OpenMP::in_parallel()); diff --git a/Src/Base/AMReX_GpuAsyncArray.H b/Src/Base/AMReX_GpuAsyncArray.H index 2258057e079..eda18a81dab 100644 --- a/Src/Base/AMReX_GpuAsyncArray.H +++ b/Src/Base/AMReX_GpuAsyncArray.H @@ -31,7 +31,7 @@ public: AsyncArray (T const* h_p, const std::size_t n) { - if (n == 0) return; + if (n == 0) { return; } h_data = static_cast(The_Pinned_Arena()->alloc(n*sizeof(T))); std::memcpy(h_data, h_p, n*sizeof(T)); #ifdef AMREX_USE_GPU @@ -46,7 +46,7 @@ public: template ::value && std::is_trivial::value,int>::type = 0> explicit AsyncArray (const std::size_t n) { - if (n == 0) return; + if (n == 0) { return; } #ifdef AMREX_USE_GPU if (Gpu::inLaunchRegion()) { @@ -120,7 +120,7 @@ public: void copyToHost (T* h_p, std::size_t n) const { - if (n == 0) return; + if (n == 0) { return; } #ifdef AMREX_USE_GPU if (d_data) { diff --git a/Src/Base/AMReX_GpuBuffer.H b/Src/Base/AMReX_GpuBuffer.H index 245a55910be..314cdf8b83c 100644 --- a/Src/Base/AMReX_GpuBuffer.H +++ b/Src/Base/AMReX_GpuBuffer.H @@ -20,7 +20,7 @@ public: Buffer (std::initializer_list init) : m_size(init.size()) { - if (m_size == 0) return; + if (m_size == 0) { return; } #ifdef AMREX_USE_GPU h_data = static_cast(The_Pinned_Arena()->alloc(m_size*sizeof(T))); #else @@ -39,7 +39,7 @@ public: Buffer (T const* h_p, const std::size_t n) : m_size(n) { - if (m_size == 0) return; + if (m_size == 0) { return; } #ifdef AMREX_USE_GPU h_data = static_cast(The_Pinned_Arena()->alloc(m_size*sizeof(T))); #else diff --git a/Src/Base/AMReX_GpuComplex.H b/Src/Base/AMReX_GpuComplex.H index 5c9deab3995..4cf0d6e69c8 100644 --- a/Src/Base/AMReX_GpuComplex.H +++ b/Src/Base/AMReX_GpuComplex.H @@ -355,8 +355,7 @@ T abs (const GpuComplex& a_z) noexcept T y = a_z.imag(); const T s = amrex::max(std::abs(x), std::abs(y)); - if (s == T()) - return s; + if (s == T()) { return s; } x /= s; y /= s; return s * std::sqrt(x * x + y * y); @@ -414,8 +413,9 @@ template AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE GpuComplex pow (const GpuComplex& a_z, const T& a_y) noexcept { - if (a_z.imag() == T() && a_z.real() > T()) + if (a_z.imag() == T() && a_z.real() > T()) { return std::pow(a_z.real(), a_y); + } GpuComplex t = amrex::log(a_z); return amrex::polar(std::exp(a_y * t.real()), a_y * t.imag()); @@ -432,8 +432,9 @@ namespace detail while (a_n >>= 1) { a_z *= a_z; - if (a_n % 2) + if (a_n % 2) { y *= a_z; + } } return y; diff --git a/Src/Base/AMReX_GpuContainers.H b/Src/Base/AMReX_GpuContainers.H index cb7b97acaf3..05399b2e047 100644 --- a/Src/Base/AMReX_GpuContainers.H +++ b/Src/Base/AMReX_GpuContainers.H @@ -129,7 +129,7 @@ namespace amrex::Gpu { "Can only copy trivially copyable types"); auto size = std::distance(begin, end); - if (size == 0) return; + if (size == 0) { return; } #ifdef AMREX_USE_GPU htod_memcpy(&(*result), &(*begin), size*sizeof(value_type)); #else @@ -166,7 +166,7 @@ namespace amrex::Gpu { "Can only copy trivially copyable types"); auto size = std::distance(begin, end); - if (size == 0) return; + if (size == 0) { return; } #ifdef AMREX_USE_GPU dtoh_memcpy(&(*result), &(*begin), size*sizeof(value_type)); #else @@ -203,7 +203,7 @@ namespace amrex::Gpu { "Can only copy trivially copyable types"); auto size = std::distance(begin, end); - if (size == 0) return; + if (size == 0) { return; } #ifdef AMREX_USE_GPU dtod_memcpy(&(*result), &(*begin), size*sizeof(value_type)); #else @@ -241,7 +241,7 @@ namespace amrex::Gpu { "Can only copy trivially copyable types"); auto size = std::distance(begin, end); - if (size == 0) return; + if (size == 0) { return; } #ifdef AMREX_USE_GPU htod_memcpy_async(&(*result), &(*begin), size*sizeof(value_type)); #else @@ -279,7 +279,7 @@ namespace amrex::Gpu { "Can only copy trivially copyable types"); auto size = std::distance(begin, end); - if (size == 0) return; + if (size == 0) { return; } #ifdef AMREX_USE_GPU dtoh_memcpy_async(&(*result), &(*begin), size*sizeof(value_type)); #else @@ -317,7 +317,7 @@ namespace amrex::Gpu { "Can only copy trivially copyable types"); auto size = std::distance(begin, end); - if (size == 0) return; + if (size == 0) { return; } #ifdef AMREX_USE_GPU dtod_memcpy_async(&(*result), &(*begin), size*sizeof(value_type)); #else @@ -339,7 +339,7 @@ namespace amrex::Gpu { "Can only copy trivially copyable types"); auto size = std::distance(begin, end); - if (size == 0) return; + if (size == 0) { return; } #ifdef AMREX_USE_GPU // Currently only implemented for CUDA. @@ -370,7 +370,7 @@ namespace amrex::Gpu { "Can only copy trivially copyable types"); auto size = std::distance(begin, end); - if (size == 0) return; + if (size == 0) { return; } #ifdef AMREX_USE_GPU // Currently only implemented for CUDA. @@ -411,7 +411,7 @@ namespace amrex::Gpu { void fillAsync (IT first, IT last, F&& f) noexcept { auto N = static_cast(std::distance(first, last)); - if (N <= 0) return; + if (N <= 0) { return; } auto p = &(*first); #ifndef AMREX_USE_GPU for (Long i = 0; i < N; ++i) { diff --git a/Src/Base/AMReX_GpuDevice.H b/Src/Base/AMReX_GpuDevice.H index 371bff773ca..20514aa367e 100644 --- a/Src/Base/AMReX_GpuDevice.H +++ b/Src/Base/AMReX_GpuDevice.H @@ -252,7 +252,7 @@ streamSynchronizeAll () noexcept inline void htod_memcpy_async (void* p_d, const void* p_h, const std::size_t sz) noexcept { - if (sz == 0) return; + if (sz == 0) { return; } #ifdef AMREX_USE_SYCL auto& q = Device::streamQueue(); q.submit([&] (sycl::handler& h) { h.memcpy(p_d, p_h, sz); }); @@ -266,7 +266,7 @@ htod_memcpy_async (void* p_d, const void* p_h, const std::size_t sz) noexcept inline void dtoh_memcpy_async (void* p_h, const void* p_d, const std::size_t sz) noexcept { - if (sz == 0) return; + if (sz == 0) { return; } #ifdef AMREX_USE_SYCL auto& q = Device::streamQueue(); q.submit([&] (sycl::handler& h) { h.memcpy(p_h, p_d, sz); }); @@ -280,7 +280,7 @@ dtoh_memcpy_async (void* p_h, const void* p_d, const std::size_t sz) noexcept inline void dtod_memcpy_async (void* p_d_dst, const void* p_d_src, const std::size_t sz) noexcept { - if (sz == 0) return; + if (sz == 0) { return; } #ifdef AMREX_USE_SYCL auto& q = Device::streamQueue(); q.submit([&] (sycl::handler& h) { h.memcpy(p_d_dst, p_d_src, sz); }); @@ -294,7 +294,7 @@ dtod_memcpy_async (void* p_d_dst, const void* p_d_src, const std::size_t sz) noe inline void htod_memcpy (void* p_d, const void* p_h, const std::size_t sz) noexcept { - if (sz == 0) return; + if (sz == 0) { return; } htod_memcpy_async(p_d, p_h, sz); Gpu::streamSynchronize(); } @@ -302,7 +302,7 @@ htod_memcpy (void* p_d, const void* p_h, const std::size_t sz) noexcept inline void dtoh_memcpy (void* p_h, const void* p_d, const std::size_t sz) noexcept { - if (sz == 0) return; + if (sz == 0) { return; } dtoh_memcpy_async(p_h, p_d, sz); Gpu::streamSynchronize(); } @@ -310,7 +310,7 @@ dtoh_memcpy (void* p_h, const void* p_d, const std::size_t sz) noexcept inline void dtod_memcpy (void* p_d_dst, const void* p_d_src, const std::size_t sz) noexcept { - if (sz == 0) return; + if (sz == 0) { return; } dtod_memcpy_async(p_d_dst, p_d_src, sz); Gpu::streamSynchronize(); } diff --git a/Src/Base/AMReX_GpuLaunchFunctsG.H b/Src/Base/AMReX_GpuLaunchFunctsG.H index 6c958f2070d..aea0c030152 100644 --- a/Src/Base/AMReX_GpuLaunchFunctsG.H +++ b/Src/Base/AMReX_GpuLaunchFunctsG.H @@ -114,7 +114,7 @@ void launch (int nblocks, gpuStream_t stream, L&& f) noexcept template void launch (T const& n, L&& f) noexcept { - if (amrex::isEmpty(n)) return; + if (amrex::isEmpty(n)) { return; } const auto ec = Gpu::makeExecutionConfig(n); int nthreads_per_block = ec.numThreads.x; int nthreads_total = nthreads_per_block * ec.numBlocks.x; @@ -190,7 +190,7 @@ namespace detail { template ::value> > void ParallelFor (Gpu::KernelInfo const& info, T n, L&& f) noexcept { - if (amrex::isEmpty(n)) return; + if (amrex::isEmpty(n)) { return; } const auto ec = Gpu::makeExecutionConfig(n); int nthreads_per_block = ec.numThreads.x; int nthreads_total = nthreads_per_block * ec.numBlocks.x; @@ -238,7 +238,7 @@ void ParallelFor (Gpu::KernelInfo const& info, T n, L&& f) noexcept template void ParallelFor (Gpu::KernelInfo const& info, Box const& box, L&& f) noexcept { - if (amrex::isEmpty(box)) return; + if (amrex::isEmpty(box)) { return; } int ncells = box.numPts(); const auto lo = amrex::lbound(box); const auto len = amrex::length(box); @@ -303,7 +303,7 @@ void ParallelFor (Gpu::KernelInfo const& info, Box const& box, L&& f) noexcept template ::value> > void ParallelFor (Gpu::KernelInfo const& info, Box const& box, T ncomp, L&& f) noexcept { - if (amrex::isEmpty(box)) return; + if (amrex::isEmpty(box)) { return; } int ncells = box.numPts(); const auto lo = amrex::lbound(box); const auto len = amrex::length(box); @@ -369,7 +369,7 @@ void ParallelFor (Gpu::KernelInfo const& info, Box const& box, T ncomp, L&& f) n template ::value> > void ParallelForRNG (T n, L&& f) noexcept { - if (amrex::isEmpty(n)) return; + if (amrex::isEmpty(n)) { return; } const auto ec = Gpu::ExecutionConfig(n); int nthreads_per_block = ec.numThreads.x; int nthreads_total = nthreads_per_block * amrex::min(ec.numBlocks.x,Gpu::Device::maxBlocksPerLaunch()); @@ -402,7 +402,7 @@ void ParallelForRNG (T n, L&& f) noexcept template void ParallelForRNG (Box const& box, L&& f) noexcept { - if (amrex::isEmpty(box)) return; + if (amrex::isEmpty(box)) { return; } int ncells = box.numPts(); const auto lo = amrex::lbound(box); const auto len = amrex::length(box); @@ -447,7 +447,7 @@ void ParallelForRNG (Box const& box, L&& f) noexcept template ::value> > void ParallelForRNG (Box const& box, T ncomp, L&& f) noexcept { - if (amrex::isEmpty(box)) return; + if (amrex::isEmpty(box)) { return; } int ncells = box.numPts(); const auto lo = amrex::lbound(box); const auto len = amrex::length(box); @@ -494,7 +494,7 @@ void ParallelForRNG (Box const& box, T ncomp, L&& f) noexcept template void ParallelFor (Gpu::KernelInfo const& /*info*/, Box const& box1, Box const& box2, L1&& f1, L2&& f2) noexcept { - if (amrex::isEmpty(box1) && amrex::isEmpty(box2)) return; + if (amrex::isEmpty(box1) && amrex::isEmpty(box2)) { return; } int ncells1 = box1.numPts(); int ncells2 = box2.numPts(); int ncells = amrex::max(ncells1, ncells2); @@ -551,7 +551,7 @@ void ParallelFor (Gpu::KernelInfo const& /*info*/, Box const& box1, Box const& box2, Box const& box3, L1&& f1, L2&& f2, L3&& f3) noexcept { - if (amrex::isEmpty(box1) && amrex::isEmpty(box2) && amrex::isEmpty(box3)) return; + if (amrex::isEmpty(box1) && amrex::isEmpty(box2) && amrex::isEmpty(box3)) { return; } int ncells1 = box1.numPts(); int ncells2 = box2.numPts(); int ncells3 = box3.numPts(); @@ -624,7 +624,7 @@ void ParallelFor (Gpu::KernelInfo const& /*info*/, Box const& box1, T1 ncomp1, L1&& f1, Box const& box2, T2 ncomp2, L2&& f2) noexcept { - if (amrex::isEmpty(box1) && amrex::isEmpty(box2)) return; + if (amrex::isEmpty(box1) && amrex::isEmpty(box2)) { return; } int ncells1 = box1.numPts(); int ncells2 = box2.numPts(); int ncells = amrex::max(ncells1, ncells2); @@ -689,7 +689,7 @@ void ParallelFor (Gpu::KernelInfo const& /*info*/, Box const& box2, T2 ncomp2, L2&& f2, Box const& box3, T3 ncomp3, L3&& f3) noexcept { - if (amrex::isEmpty(box1) && amrex::isEmpty(box2) && amrex::isEmpty(box3)) return; + if (amrex::isEmpty(box1) && amrex::isEmpty(box2) && amrex::isEmpty(box3)) { return; } int ncells1 = box1.numPts(); int ncells2 = box2.numPts(); int ncells3 = box3.numPts(); @@ -808,7 +808,7 @@ void launch (int nblocks, int nthreads_per_block, gpuStream_t stream, L&& f) noe template void launch (T const& n, L&& f) noexcept { - if (amrex::isEmpty(n)) return; + if (amrex::isEmpty(n)) { return; } const auto ec = Gpu::makeExecutionConfig(n); AMREX_LAUNCH_KERNEL(MT, ec.numBlocks, ec.numThreads, 0, Gpu::gpuStream(), [=] AMREX_GPU_DEVICE () noexcept { @@ -873,7 +873,7 @@ template ::value> ParallelFor (Gpu::KernelInfo const&, T n, L&& f) noexcept { - if (amrex::isEmpty(n)) return; + if (amrex::isEmpty(n)) { return; } const auto ec = Gpu::makeExecutionConfig(n); AMREX_LAUNCH_KERNEL(MT, ec.numBlocks, ec.numThreads, 0, Gpu::gpuStream(), [=] AMREX_GPU_DEVICE () noexcept { @@ -889,7 +889,7 @@ template std::enable_if_t::value> ParallelFor (Gpu::KernelInfo const&, Box const& box, L&& f) noexcept { - if (amrex::isEmpty(box)) return; + if (amrex::isEmpty(box)) { return; } int ncells = box.numPts(); const auto lo = amrex::lbound(box); const auto len = amrex::length(box); @@ -917,7 +917,7 @@ template ::value> ParallelFor (Gpu::KernelInfo const&, Box const& box, T ncomp, L&& f) noexcept { - if (amrex::isEmpty(box)) return; + if (amrex::isEmpty(box)) { return; } int ncells = box.numPts(); const auto lo = amrex::lbound(box); const auto len = amrex::length(box); @@ -944,7 +944,7 @@ template ::value> ParallelForRNG (T n, L&& f) noexcept { - if (amrex::isEmpty(n)) return; + if (amrex::isEmpty(n)) { return; } randState_t* rand_state = getRandState(); const auto ec = Gpu::ExecutionConfig(n); AMREX_LAUNCH_KERNEL(AMREX_GPU_MAX_THREADS, @@ -965,7 +965,7 @@ template std::enable_if_t::value> ParallelForRNG (Box const& box, L&& f) noexcept { - if (amrex::isEmpty(box)) return; + if (amrex::isEmpty(box)) { return; } randState_t* rand_state = getRandState(); int ncells = box.numPts(); const auto lo = amrex::lbound(box); @@ -997,7 +997,7 @@ template ::value> ParallelForRNG (Box const& box, T ncomp, L&& f) noexcept { - if (amrex::isEmpty(box)) return; + if (amrex::isEmpty(box)) { return; } randState_t* rand_state = getRandState(); int ncells = box.numPts(); const auto lo = amrex::lbound(box); @@ -1032,7 +1032,7 @@ std::enable_if_t::value && MaybeDeviceRunnable::valu ParallelFor (Gpu::KernelInfo const&, Box const& box1, Box const& box2, L1&& f1, L2&& f2) noexcept { - if (amrex::isEmpty(box1) && amrex::isEmpty(box2)) return; + if (amrex::isEmpty(box1) && amrex::isEmpty(box2)) { return; } int ncells1 = box1.numPts(); int ncells2 = box2.numPts(); int ncells = amrex::max(ncells1, ncells2); @@ -1078,7 +1078,7 @@ ParallelFor (Gpu::KernelInfo const&, Box const& box1, Box const& box2, Box const& box3, L1&& f1, L2&& f2, L3&& f3) noexcept { - if (amrex::isEmpty(box1) && amrex::isEmpty(box2) && amrex::isEmpty(box3)) return; + if (amrex::isEmpty(box1) && amrex::isEmpty(box2) && amrex::isEmpty(box3)) { return; } int ncells1 = box1.numPts(); int ncells2 = box2.numPts(); int ncells3 = box3.numPts(); @@ -1140,7 +1140,7 @@ ParallelFor (Gpu::KernelInfo const&, Box const& box1, T1 ncomp1, L1&& f1, Box const& box2, T2 ncomp2, L2&& f2) noexcept { - if (amrex::isEmpty(box1) && amrex::isEmpty(box2)) return; + if (amrex::isEmpty(box1) && amrex::isEmpty(box2)) { return; } int ncells1 = box1.numPts(); int ncells2 = box2.numPts(); int ncells = amrex::max(ncells1, ncells2); @@ -1194,7 +1194,7 @@ ParallelFor (Gpu::KernelInfo const&, Box const& box2, T2 ncomp2, L2&& f2, Box const& box3, T3 ncomp3, L3&& f3) noexcept { - if (amrex::isEmpty(box1) && amrex::isEmpty(box2) && amrex::isEmpty(box3)) return; + if (amrex::isEmpty(box1) && amrex::isEmpty(box2) && amrex::isEmpty(box3)) { return; } int ncells1 = box1.numPts(); int ncells2 = box2.numPts(); int ncells3 = box3.numPts(); diff --git a/Src/Base/AMReX_IArrayBox.cpp b/Src/Base/AMReX_IArrayBox.cpp index 6f751cf610c..40b2762729d 100644 --- a/Src/Base/AMReX_IArrayBox.cpp +++ b/Src/Base/AMReX_IArrayBox.cpp @@ -31,7 +31,7 @@ namespace void IArrayBox::Initialize () { - if (initialized) return; + if (initialized) { return; } // ParmParse pp("iab"); ifabio = std::make_unique(); diff --git a/Src/Base/AMReX_LayoutData.H b/Src/Base/AMReX_LayoutData.H index 57b8194d0b3..beaca630361 100644 --- a/Src/Base/AMReX_LayoutData.H +++ b/Src/Base/AMReX_LayoutData.H @@ -31,7 +31,7 @@ namespace amrex m_data.resize(local_size()); } - ~LayoutData () { if (m_need_to_clear_bd) clearThisBD(); } + ~LayoutData () { if (m_need_to_clear_bd) { clearThisBD(); } } LayoutData (const LayoutData& rhs) noexcept : FabArrayBase(rhs), @@ -54,13 +54,13 @@ namespace amrex if (&rhs != this) { m_data.clear(); - if (m_need_to_clear_bd) clearThisBD(); + if (m_need_to_clear_bd) { clearThisBD(); } FabArrayBase::operator=(rhs); m_data = rhs.m_data; m_need_to_clear_bd = rhs.m_need_to_clear_bd; - if (m_need_to_clear_bd) addThisBD(); + if (m_need_to_clear_bd) { addThisBD(); } } return *this; } @@ -70,7 +70,7 @@ namespace amrex if (&rhs != this) { m_data.clear(); - if (m_need_to_clear_bd) clearThisBD(); + if (m_need_to_clear_bd) { clearThisBD(); } FabArrayBase::operator=(static_cast(rhs)); m_data = std::move(rhs.m_data); diff --git a/Src/Base/AMReX_MFIter.cpp b/Src/Base/AMReX_MFIter.cpp index 5ae34d30a81..94e3ab02eb3 100644 --- a/Src/Base/AMReX_MFIter.cpp +++ b/Src/Base/AMReX_MFIter.cpp @@ -216,7 +216,7 @@ void MFIter::Finalize () { // avoid double finalize - if (finalized) return; + if (finalized) { return; } finalized = true; // mark as invalid @@ -503,7 +503,7 @@ Box MFIter::grownnodaltilebox (int dir, IntVect const& a_ng) const noexcept { BL_ASSERT(dir < AMREX_SPACEDIM); - if (dir < 0) return tilebox(IntVect::TheNodeVector(), a_ng); + if (dir < 0) { return tilebox(IntVect::TheNodeVector(), a_ng); } return tilebox(IntVect::TheDimensionVector(dir), a_ng); } diff --git a/Src/Base/AMReX_MPMD.H b/Src/Base/AMReX_MPMD.H index 60a478f4ca1..79ff3dd69b4 100644 --- a/Src/Base/AMReX_MPMD.H +++ b/Src/Base/AMReX_MPMD.H @@ -41,7 +41,7 @@ void Copier::send (FabArray const& mf, int icomp, int ncomp) const { const auto N_snds = static_cast(m_SndTags.size()); - if (N_snds == 0) return; + if (N_snds == 0) { return; } // Prepare buffer @@ -108,7 +108,7 @@ void Copier::recv (FabArray& mf, int icomp, int ncomp) const { const auto N_rcvs = static_cast(m_RcvTags.size()); - if (N_rcvs == 0) return; + if (N_rcvs == 0) { return; } // Prepare buffer diff --git a/Src/Base/AMReX_Math.H b/Src/Base/AMReX_Math.H index 7713bab56f8..769b9bf50f4 100644 --- a/Src/Base/AMReX_Math.H +++ b/Src/Base/AMReX_Math.H @@ -188,19 +188,20 @@ template (x); - else if constexpr (Power == 0) + } else if constexpr (Power == 0) { //note: 0^0 is implementation-defined, but most compilers return 1 return T(1); - else if constexpr (Power == 1) + } else if constexpr (Power == 1) { return x; - else if constexpr (Power == 2) + } else if constexpr (Power == 2) { return x*x; - else if constexpr (Power%2 == 0) + } else if constexpr (Power%2 == 0) { return powi<2>(powi(x)); - else + } else { return x*powi(x); + } } } diff --git a/Src/Base/AMReX_MemProfiler.cpp b/Src/Base/AMReX_MemProfiler.cpp index 223a5dad1ba..7bdc2fc4e2f 100644 --- a/Src/Base/AMReX_MemProfiler.cpp +++ b/Src/Base/AMReX_MemProfiler.cpp @@ -159,7 +159,7 @@ MemProfiler::report_ (const std::string& prefix, const std::string& memory_log_n } } ifs.ignore(std::numeric_limits::max(), '\n'); - if (nfound == npstat) break; + if (nfound == npstat) { break; } } } @@ -217,7 +217,7 @@ MemProfiler::report_ (const std::string& prefix, const std::string& memory_log_n std::ofstream memlog(memory_log_name.c_str(), std::ofstream::out|std::ofstream::app); - if (!memlog.good()) return; + if (!memlog.good()) { return; } static int width_name = 0; if (width_name == 0) { diff --git a/Src/Base/AMReX_MultiFab.cpp b/Src/Base/AMReX_MultiFab.cpp index a77d01d6375..3c7df473574 100644 --- a/Src/Base/AMReX_MultiFab.cpp +++ b/Src/Base/AMReX_MultiFab.cpp @@ -452,7 +452,7 @@ MultiFab::negate (const Box& region, int nghost) void MultiFab::Initialize () { - if (initialized) return; + if (initialized) { return; } initialized = true; amrex::ExecOnFinalize(MultiFab::Finalize); @@ -1411,7 +1411,7 @@ MultiFab::AverageSync (const Periodicity& period) { BL_PROFILE("MultiFab::AverageSync()"); - if (ixType().cellCentered()) return; + if (ixType().cellCentered()) { return; } auto wgt = this->OverlapMask(period); wgt->invert(1.0, 0, 1); this->WeightedSync(*wgt, period); @@ -1422,7 +1422,7 @@ MultiFab::WeightedSync (const MultiFab& wgt, const Periodicity& period) { BL_PROFILE("MultiFab::WeightedSync()"); - if (ixType().cellCentered()) return; + if (ixType().cellCentered()) { return; } const int ncomp = nComp(); for (int comp = 0; comp < ncomp; ++comp) diff --git a/Src/Base/AMReX_MultiFabUtil.H b/Src/Base/AMReX_MultiFabUtil.H index 8c499874a83..3e0d6bf7d9f 100644 --- a/Src/Base/AMReX_MultiFabUtil.H +++ b/Src/Base/AMReX_MultiFabUtil.H @@ -844,7 +844,7 @@ void average_down_faces (const FabArray& fine, FabArray& crse, const auto type = fine.ixType(); int dir; for (dir = 0; dir < AMREX_SPACEDIM; ++dir) { - if (type.nodeCentered(dir)) break; + if (type.nodeCentered(dir)) { break; } } auto tmptype = type; tmptype.unset(dir); diff --git a/Src/Base/AMReX_MultiFabUtil.cpp b/Src/Base/AMReX_MultiFabUtil.cpp index e3cbae4bb05..6f7723672fa 100644 --- a/Src/Base/AMReX_MultiFabUtil.cpp +++ b/Src/Base/AMReX_MultiFabUtil.cpp @@ -470,7 +470,7 @@ namespace amrex const auto type = fine.ixType(); int dir; for (dir = 0; dir < AMREX_SPACEDIM; ++dir) { - if (type.cellCentered(dir)) break; + if (type.cellCentered(dir)) { break; } } auto tmptype = type; tmptype.set(dir); diff --git a/Src/Base/AMReX_NonLocalBC.cpp b/Src/Base/AMReX_NonLocalBC.cpp index 109a77d1e54..ebd78f7b3d1 100644 --- a/Src/Base/AMReX_NonLocalBC.cpp +++ b/Src/Base/AMReX_NonLocalBC.cpp @@ -51,7 +51,7 @@ void PrepareCommBuffers(CommData& comm, comm.stats.clear(); const auto N_comms = static_cast(cctc.size()); - if (N_comms == 0) return; + if (N_comms == 0) { return; } // reserve for upcominf push_backs comm.data.reserve(N_comms); comm.size.reserve(N_comms); diff --git a/Src/Base/AMReX_NonLocalBCImpl.H b/Src/Base/AMReX_NonLocalBCImpl.H index ab2a0dfb978..60798f85a34 100644 --- a/Src/Base/AMReX_NonLocalBCImpl.H +++ b/Src/Base/AMReX_NonLocalBCImpl.H @@ -188,7 +188,7 @@ std::enable_if_t() && IsCallableR() && IsFabPro local_copy_cpu (FabArray& dest, const FabArray& src, int dcomp, int scomp, int ncomp, FabArrayBase::CopyComTagsContainer const& local_tags, DTOS const& dtos, Proj const& proj) noexcept { const auto N_locs = static_cast(local_tags.size()); - if (N_locs == 0) return; + if (N_locs == 0) { return; } #ifdef AMREX_USE_OMP #pragma omp parallel for #endif @@ -218,7 +218,7 @@ unpack_recv_buffer_cpu (FabArray& mf, int dcomp, int ncomp, Vector c amrex::ignore_unused(recv_size); const auto N_rcvs = static_cast(recv_cctc.size()); - if (N_rcvs == 0) return; + if (N_rcvs == 0) { return; } using T = typename FAB::value_type; #ifdef AMREX_USE_OMP @@ -256,7 +256,7 @@ std::enable_if_t() && IsCallableR() && IsFabPro local_copy_gpu (FabArray& dest, const FabArray& src, int dcomp, int scomp, int ncomp, FabArrayBase::CopyComTagsContainer const& local_tags, DTOS const& dtos, Proj const& proj) noexcept { int N_locs = local_tags.size(); - if (N_locs == 0) return; + if (N_locs == 0) { return; } using T = typename FAB::value_type; Vector > loc_copy_tags; @@ -284,7 +284,7 @@ unpack_recv_buffer_gpu (FabArray& mf, int scomp, int ncomp, amrex::ignore_unused(recv_size); const int N_rcvs = recv_cctc.size(); - if (N_rcvs == 0) return; + if (N_rcvs == 0) { return; } char* pbuffer = recv_data[0]; #if 0 @@ -484,7 +484,7 @@ void Comm_finish (FabArray& mf, int scomp, int ncomp, FabArrayBase::CommMetaData const& cmd, CommHandler handler, DTOS const& dtos, Proj const& proj) { - if (ParallelContext::NProcsSub() == 1) return; + if (ParallelContext::NProcsSub() == 1) { return; } const auto N_rcvs = static_cast(cmd.m_RcvTags->size()); if (N_rcvs > 0) @@ -535,7 +535,7 @@ Rotate90 (FabArray& mf, int scomp, int ncomp, IntVect const& nghost, Box co AMREX_ASSERT(scomp < mf.nComp() && scomp+ncomp <= mf.nComp()); AMREX_ASSERT(nghost.allLE(mf.nGrowVect()) && nghost[0] == nghost[1]); - if (nghost[0] <= 0) return; + if (nghost[0] <= 0) { return; } const FabArrayBase::RB90& TheRB90 = mf.getRB90(nghost, domain); @@ -585,7 +585,7 @@ Rotate180 (FabArray& mf, int scomp, int ncomp, IntVect const& nghost, Box c AMREX_ASSERT(scomp < mf.nComp() && scomp+ncomp <= mf.nComp()); AMREX_ASSERT(nghost.allLE(mf.nGrowVect())); - if (nghost[0] <= 0) return; + if (nghost[0] <= 0) { return; } const FabArrayBase::RB180& TheRB180 = mf.getRB180(nghost, domain); @@ -620,7 +620,7 @@ FillPolar (FabArray& mf, int scomp, int ncomp, IntVect const& nghost, Box c AMREX_ASSERT(scomp < mf.nComp() && scomp+ncomp <= mf.nComp()); AMREX_ASSERT(nghost.allLE(mf.nGrowVect())); - if (nghost[0] <= 0) return; + if (nghost[0] <= 0) { return; } const FabArrayBase::PolarB& ThePolarB = mf.getPolarB(nghost, domain); @@ -727,10 +727,10 @@ get_src_dst_boxes (DTOS const& dtos, Box const& dstbox, Box const& domain) r.reserve(AMREX_D_TERM(nboxes[0],*nboxes[1],*nboxes[2])); #if (AMREX_SPACEDIM == 3) - for (int kbox = 0; kbox < nboxes[2]; ++kbox) + for (int kbox = 0; kbox < nboxes[2]; ++kbox) { #endif #if (AMREX_SPACEDIM >=2 ) - for (int jbox = 0; jbox < nboxes[1]; ++jbox) + for (int jbox = 0; jbox < nboxes[1]; ++jbox) { #endif for (int ibox = 0; ibox < nboxes[0]; ++ibox) { @@ -750,9 +750,9 @@ get_src_dst_boxes (DTOS const& dtos, Box const& dstbox, Box const& domain) dst_ends[1][div[1]].second, dst_ends[2][div[2]].second)), dtype)); - } + AMREX_D_TERM(},},}) - return r; // NOLINT(readability-misleading-indentation,-warnings-as-errors) + return r; } template diff --git a/Src/Base/AMReX_PArena.cpp b/Src/Base/AMReX_PArena.cpp index a7c7ee1f4bb..82781a7be65 100644 --- a/Src/Base/AMReX_PArena.cpp +++ b/Src/Base/AMReX_PArena.cpp @@ -67,7 +67,7 @@ PArena::alloc (std::size_t nbytes) void PArena::free (void* p) { - if (p == nullptr) return; + if (p == nullptr) { return; } #if defined(AMREX_USE_GPU) diff --git a/Src/Base/AMReX_PCI.H b/Src/Base/AMReX_PCI.H index 7897adcbed8..6ccbe4078fc 100644 --- a/Src/Base/AMReX_PCI.H +++ b/Src/Base/AMReX_PCI.H @@ -7,7 +7,7 @@ FabArray::PC_local_cpu (const CPC& thecpc, FabArray const& src, int scomp, int dcomp, int ncomp, CpOp op) { auto const N_locs = static_cast(thecpc.m_LocTags->size()); - if (N_locs == 0) return; + if (N_locs == 0) { return; } bool is_thread_safe = thecpc.m_threadsafe_loc; if (is_thread_safe) @@ -89,7 +89,7 @@ FabArray::PC_local_gpu (const CPC& thecpc, FabArray const& src, int scomp, int dcomp, int ncomp, CpOp op) { int N_locs = thecpc.m_LocTags->size(); - if (N_locs == 0) return; + if (N_locs == 0) { return; } bool is_thread_safe = thecpc.m_threadsafe_loc; using TagType = Array4CopyTag; diff --git a/Src/Base/AMReX_ParallelDescriptor.H b/Src/Base/AMReX_ParallelDescriptor.H index 2e5a35a0ef8..d29e3655b75 100644 --- a/Src/Base/AMReX_ParallelDescriptor.H +++ b/Src/Base/AMReX_ParallelDescriptor.H @@ -355,8 +355,8 @@ while ( false ) { int rb, re; { - if (rit < 0) rit = ParallelDescriptor::MyRankInTeam(); - if (nworkers == 0) nworkers = ParallelDescriptor::TeamSize(); + if (rit < 0) { rit = ParallelDescriptor::MyRankInTeam(); } + if (nworkers == 0) { nworkers = ParallelDescriptor::TeamSize(); } BL_ASSERT(rit resl; - if ( root == MyProc() ) resl.resize(NProcs()); + if ( root == MyProc() ) { resl.resize(NProcs()); } BL_MPI_REQUIRE( MPI_Gather(const_cast(&t), 1, Mpi_typemap::type(), @@ -971,7 +971,7 @@ ParallelDescriptor::Gatherv (const T* send, int sc, BL_COMM_PROFILE(BLProfiler::Gatherv, BLProfiler::BeforeCall(), root, BLProfiler::NoTag()); MPI_Gatherv(send, sc, ParallelDescriptor::Mpi_typemap::type(), - recv, &rc[0], &disp[0], ParallelDescriptor::Mpi_typemap::type(), + recv, rc.data(), disp.data(), ParallelDescriptor::Mpi_typemap::type(), root, Communicator()); BL_COMM_PROFILE(BLProfiler::Gatherv, std::accumulate(rc.begin(),rc.end(),0)*sizeof(T), root, BLProfiler::NoTag()); @@ -1028,7 +1028,7 @@ ParallelDescriptor::GatherLayoutDataToVector (const LayoutData& sendbuf, } Vector disp(nprocs); - if (!disp.empty()) disp[0] = 0; + if (!disp.empty()) { disp[0] = 0; } std::partial_sum(recvcount.begin(), recvcount.end()-1, disp.begin()+1); Vector new_index_to_T(sendbuf.size()); diff --git a/Src/Base/AMReX_ParmParse.cpp b/Src/Base/AMReX_ParmParse.cpp index 8fb37dab408..6f6168588d2 100644 --- a/Src/Base/AMReX_ParmParse.cpp +++ b/Src/Base/AMReX_ParmParse.cpp @@ -85,7 +85,7 @@ ParmParse::PP_entry::~PP_entry () ParmParse::PP_entry& ParmParse::PP_entry::operator= (const PP_entry& pe) { - if ( &pe == this ) return *this; + if ( &pe == this ) { return *this; } m_name = pe.m_name; m_vals = pe.m_vals; m_table = nullptr; @@ -147,10 +147,10 @@ isT (const std::string& str, T& val) { std::istringstream s(str); s >> val; - if ( s.fail() ) return false; + if ( s.fail() ) { return false; } std::string left; std::getline(s, left); - if ( !left.empty() ) return false; + if ( !left.empty() ) { return false; } return true; } @@ -264,7 +264,7 @@ eat_garbage (const char*& str) int num_linefeeds = 0; for (;;) { - if ( *str == 0 ) break; // NOLINT + if ( *str == 0 ) { break; } // NOLINT else if ( *str == '#' ) { while ( *str && *str != '\n' ) @@ -915,7 +915,7 @@ squeryarr (const ParmParse::Table& table, num_val = static_cast(def->m_vals.size()); } - if ( num_val == 0 ) return true; + if ( num_val == 0 ) { return true; } int stop_ix = start_ix + num_val - 1; if ( static_cast(ref.size()) <= stop_ix ) @@ -1183,7 +1183,7 @@ unused_table_entries_q (const ParmParse::Table& table, const std::string& prefix } else { - if (unused_table_entries_q(*li.m_table, prefix)) return true; + if (unused_table_entries_q(*li.m_table, prefix)) { return true; } } } else if ( !li.m_queried ) diff --git a/Src/Base/AMReX_PhysBCFunct.H b/Src/Base/AMReX_PhysBCFunct.H index 211b6a5b777..1e0f1be99ec 100644 --- a/Src/Base/AMReX_PhysBCFunct.H +++ b/Src/Base/AMReX_PhysBCFunct.H @@ -140,7 +140,7 @@ public: void operator() (MultiFab& mf, int icomp, int ncomp, IntVect const& nghost, Real time, int bccomp) { - if (m_geom.isAllPeriodic()) return; + if (m_geom.isAllPeriodic()) { return; } BL_PROFILE("PhysBCFunct::()"); @@ -234,7 +234,7 @@ GpuBndryFuncFab::nddoit (Box const& bx, FArrayBox& dest, } } - if (gdomain.contains(bx)) return; + if (gdomain.contains(bx)) { return; } Array4 const& fab = dest.array(); const auto geomdata = geom.data(); @@ -359,7 +359,7 @@ GpuBndryFuncFab::ccfcdoit (Box const& bx, FArrayBox& dest, } } - if (gdomain.contains(bx)) return; + if (gdomain.contains(bx)) { return; } Array4 const& fab = dest.array(); const auto geomdata = geom.data(); diff --git a/Src/Base/AMReX_RealBox.H b/Src/Base/AMReX_RealBox.H index ddbc96b1b90..6f429c8262b 100644 --- a/Src/Base/AMReX_RealBox.H +++ b/Src/Base/AMReX_RealBox.H @@ -92,7 +92,7 @@ public: //! it's volume is considered to be zero. [[nodiscard]] AMREX_GPU_HOST_DEVICE Real volume () const noexcept { - if (ok()) return AMREX_D_TERM(length(0), *length(1), *length(2)); + if (ok()) { return AMREX_D_TERM(length(0), *length(1), *length(2)); } return 0.0; } diff --git a/Src/Base/AMReX_Reduce.H b/Src/Base/AMReX_Reduce.H index 34f1c6e74bb..497806cbac6 100644 --- a/Src/Base/AMReX_Reduce.H +++ b/Src/Base/AMReX_Reduce.H @@ -618,7 +618,7 @@ public: typename M=std::enable_if_t::value> > void eval (N n, D & reduce_data, F&& f) { - if (n <= 0) return; + if (n <= 0) { return; } using ReduceTuple = typename D::Type; auto const& stream = Gpu::gpuStream(); auto dp = reduce_data.devicePtr(stream); @@ -1259,7 +1259,7 @@ bool AnyOf (Box const& box, P&&pred) for (int k = lo.z; k <= hi.z; ++k) { for (int j = lo.y; j <= hi.y; ++j) { for (int i = lo.x; i <= hi.x; ++i) { - if (pred(i,j,k)) return true; + if (pred(i,j,k)) { return true; } }}} return false; } diff --git a/Src/Base/AMReX_Scan.H b/Src/Base/AMReX_Scan.H index df255b16e09..11fdfd8bd70 100644 --- a/Src/Base/AMReX_Scan.H +++ b/Src/Base/AMReX_Scan.H @@ -189,7 +189,7 @@ struct BlockStatus template T PrefixSum_mp (N n, FIN && fin, FOUT && fout, TYPE, RetSum a_ret_sum) { - if (n <= 0) return 0; + if (n <= 0) { return 0; } constexpr int nwarps_per_block = 8; constexpr int nthreads = nwarps_per_block*Gpu::Device::warp_size; constexpr int nchunks = 12; @@ -234,7 +234,7 @@ T PrefixSum_mp (N n, FIN && fin, FOUT && fout, TYPE, RetSum a_ret_sum) T sum_prev_chunk = 0; // inclusive sum from previous chunks. for (int ichunk = 0; ichunk < nchunks; ++ichunk) { N offset = ibegin + ichunk*blockDimx; - if (offset >= iend) break; + if (offset >= iend) { break; } offset += threadIdxx; T x0 = (offset < iend) ? fin(offset) : 0; @@ -242,7 +242,7 @@ T PrefixSum_mp (N n, FIN && fin, FOUT && fout, TYPE, RetSum a_ret_sum) // Scan within a warp for (int i = 1; i <= Gpu::Device::warp_size; i *= 2) { T s = sycl::shift_group_right(sg, x, i); - if (lane >= i) x += s; + if (lane >= i) { x += s; } } // x now holds the inclusive sum within the warp. The @@ -260,10 +260,10 @@ T PrefixSum_mp (N n, FIN && fin, FOUT && fout, TYPE, RetSum a_ret_sum) T y = (lane < nwarps) ? shared[lane] : 0; for (int i = 1; i <= Gpu::Device::warp_size; i *= 2) { T s = sycl::shift_group_right(sg, y, i); - if (lane >= i) y += s; + if (lane >= i) { y += s; } } - if (lane < nwarps) shared2[lane] = y; + if (lane < nwarps) { shared2[lane] = y; } } gh.item->barrier(sycl::access::fence_space::local_space); @@ -309,7 +309,7 @@ T PrefixSum_mp (N n, FIN && fin, FOUT && fout, TYPE, RetSum a_ret_sum) // Scan within a warp for (int i = 1; i <= Gpu::Device::warp_size; i *= 2) { T s = sycl::shift_group_right(sg, x, i); - if (lane >= i) x += s; + if (lane >= i) { x += s; } } // x now holds the inclusive sum within the warp. The @@ -327,10 +327,10 @@ T PrefixSum_mp (N n, FIN && fin, FOUT && fout, TYPE, RetSum a_ret_sum) T y = (lane < nwarps) ? shared[lane] : 0; for (int i = 1; i <= Gpu::Device::warp_size; i *= 2) { T s = sycl::shift_group_right(sg, y, i); - if (lane >= i) y += s; + if (lane >= i) { y += s; } } - if (lane < nwarps) shared2[lane] = y; + if (lane < nwarps) { shared2[lane] = y; } } gh.item->barrier(sycl::access::fence_space::local_space); @@ -390,7 +390,7 @@ template ,Type::Exclusive>::value)> > T PrefixSum (N n, FIN && fin, FOUT && fout, TYPE type, RetSum a_ret_sum = retSum) { - if (n <= 0) return 0; + if (n <= 0) { return 0; } constexpr int nwarps_per_block = 8; constexpr int nthreads = nwarps_per_block*Gpu::Device::warp_size; constexpr int nchunks = 12; @@ -476,7 +476,7 @@ T PrefixSum (N n, FIN && fin, FOUT && fout, TYPE type, RetSum a_ret_sum = retSum T tmp_out[nchunks]; // block-wide inclusive sum for chunks for (int ichunk = 0; ichunk < nchunks; ++ichunk) { N offset = ibegin + ichunk*blockDimx; - if (offset >= iend) break; + if (offset >= iend) { break; } offset += threadIdxx; T x0 = (offset < iend) ? fin(offset) : 0; @@ -487,7 +487,7 @@ T PrefixSum (N n, FIN && fin, FOUT && fout, TYPE type, RetSum a_ret_sum = retSum // Scan within a warp for (int i = 1; i <= Gpu::Device::warp_size; i *= 2) { T s = sycl::shift_group_right(sg, x, i); - if (lane >= i) x += s; + if (lane >= i) { x += s; } } // x now holds the inclusive sum within the warp. The @@ -505,10 +505,10 @@ T PrefixSum (N n, FIN && fin, FOUT && fout, TYPE type, RetSum a_ret_sum = retSum T y = (lane < nwarps) ? shared[lane] : 0; for (int i = 1; i <= Gpu::Device::warp_size; i *= 2) { T s = sycl::shift_group_right(sg, y, i); - if (lane >= i) y += s; + if (lane >= i) { y += s; } } - if (lane < nwarps) shared2[lane] = y; + if (lane < nwarps) { shared2[lane] = y; } } gh.item->barrier(sycl::access::fence_space::local_space); @@ -533,7 +533,7 @@ T PrefixSum (N n, FIN && fin, FOUT && fout, TYPE type, RetSum a_ret_sum = retSum if (virtual_block_id == 0) { for (int ichunk = 0; ichunk < nchunks; ++ichunk) { N offset = ibegin + ichunk*blockDimx + threadIdxx; - if (offset >= iend) break; + if (offset >= iend) { break; } fout(offset, tmp_out[ichunk]); if (offset == n-1) { *totalsum_p += tmp_out[ichunk]; @@ -564,11 +564,11 @@ T PrefixSum (N n, FIN && fin, FOUT && fout, TYPE type, RetSum a_ret_sum = retSum if (stop_lookback == false) { if (status_bf != 0) { T y = x; - if (lane > 0) x = 0; + if (lane > 0) { x = 0; } unsigned int bit_mask = 0x1u; for (int i = 1; i < Gpu::Device::warp_size; ++i) { bit_mask <<= 1; - if (i == lane) x = y; + if (i == lane) { x = y; } if (status_bf & bit_mask) { stop_lookback = true; break; @@ -582,7 +582,7 @@ T PrefixSum (N n, FIN && fin, FOUT && fout, TYPE type, RetSum a_ret_sum = retSum } if (lane == 0) { exclusive_prefix += x; } - if (stop_lookback) break; + if (stop_lookback) { break; } } if (lane == 0) { @@ -597,7 +597,7 @@ T PrefixSum (N n, FIN && fin, FOUT && fout, TYPE type, RetSum a_ret_sum = retSum for (int ichunk = 0; ichunk < nchunks; ++ichunk) { N offset = ibegin + ichunk*blockDimx + threadIdxx; - if (offset >= iend) break; + if (offset >= iend) { break; } T t = tmp_out[ichunk] + exclusive_prefix; fout(offset, t); if (offset == n-1) { @@ -629,7 +629,7 @@ template ,Type::Exclusive>::value)> > T PrefixSum (N n, FIN && fin, FOUT && fout, TYPE, RetSum a_ret_sum = retSum) { - if (n <= 0) return 0; + if (n <= 0) { return 0; } constexpr int nwarps_per_block = 4; constexpr int nthreads = nwarps_per_block*Gpu::Device::warp_size; // # of threads per block constexpr int nelms_per_thread = sizeof(T) >= 8 ? 8 : 16; @@ -772,7 +772,7 @@ template ,Type::Exclusive>::value)> > T PrefixSum (N n, FIN && fin, FOUT && fout, TYPE, RetSum a_ret_sum = retSum) { - if (n <= 0) return 0; + if (n <= 0) { return 0; } constexpr int nwarps_per_block = 8; constexpr int nthreads = nwarps_per_block*Gpu::Device::warp_size; // # of threads per block constexpr int nelms_per_thread = sizeof(T) >= 8 ? 4 : 8; @@ -905,7 +905,7 @@ template ,Type::Exclusive>::value)> > T PrefixSum (N n, FIN && fin, FOUT && fout, TYPE, RetSum a_ret_sum = retSum) { - if (n <= 0) return 0; + if (n <= 0) { return 0; } constexpr int nwarps_per_block = 4; constexpr int nthreads = nwarps_per_block*Gpu::Device::warp_size; constexpr int nchunks = 12; @@ -980,7 +980,7 @@ T PrefixSum (N n, FIN && fin, FOUT && fout, TYPE, RetSum a_ret_sum = retSum) T tmp_out[nchunks]; // block-wide inclusive sum for chunks for (int ichunk = 0; ichunk < nchunks; ++ichunk) { N offset = ibegin + ichunk*blockDim.x; - if (offset >= iend) break; + if (offset >= iend) { break; } offset += threadIdx.x; T x0 = (offset < iend) ? fin(offset) : 0; @@ -992,7 +992,7 @@ T PrefixSum (N n, FIN && fin, FOUT && fout, TYPE, RetSum a_ret_sum = retSum) for (int i = 1; i <= Gpu::Device::warp_size; i *= 2) { AMREX_HIP_OR_CUDA( T s = __shfl_up(x,i);, T s = __shfl_up_sync(0xffffffff, x, i); ) - if (lane >= i) x += s; + if (lane >= i) { x += s; } } // x now holds the inclusive sum within the warp. The @@ -1013,7 +1013,7 @@ T PrefixSum (N n, FIN && fin, FOUT && fout, TYPE, RetSum a_ret_sum = retSum) int mask = (1 << nwarps) - 1; for (int i = 1; i <= nwarps; i *= 2) { T s = __shfl_up_sync(mask, y, i, nwarps); - if (lane >= i) y += s; + if (lane >= i) { y += s; } } shared2[lane] = y; } @@ -1025,7 +1025,7 @@ T PrefixSum (N n, FIN && fin, FOUT && fout, TYPE, RetSum a_ret_sum = retSum) } for (int i = 1; i <= nwarps; i *= 2) { T s = __shfl_up(y, i, nwarps); - if (lane >= i) y += s; + if (lane >= i) { y += s; } } if (lane < nwarps) { shared2[lane] = y; @@ -1055,7 +1055,7 @@ T PrefixSum (N n, FIN && fin, FOUT && fout, TYPE, RetSum a_ret_sum = retSum) if (virtual_block_id == 0) { for (int ichunk = 0; ichunk < nchunks; ++ichunk) { N offset = ibegin + ichunk*blockDim.x + threadIdx.x; - if (offset >= iend) break; + if (offset >= iend) { break; } fout(offset, tmp_out[ichunk]); if (offset == n-1) { *totalsum_p += tmp_out[ichunk]; @@ -1082,12 +1082,12 @@ T PrefixSum (N n, FIN && fin, FOUT && fout, TYPE, RetSum a_ret_sum = retSum) if (stop_lookback == false) { if (status_bf != 0) { T y = x; - if (lane > 0) x = 0; + if (lane > 0) { x = 0; } AMREX_HIP_OR_CUDA(uint64_t bit_mask = 0x1ull;, unsigned bit_mask = 0x1u); for (int i = 1; i < Gpu::Device::warp_size; ++i) { bit_mask <<= 1; - if (i == lane) x = y; + if (i == lane) { x = y; } if (status_bf & bit_mask) { stop_lookback = true; break; @@ -1102,7 +1102,7 @@ T PrefixSum (N n, FIN && fin, FOUT && fout, TYPE, RetSum a_ret_sum = retSum) } if (lane == 0) { exclusive_prefix += x; } - if (stop_lookback) break; + if (stop_lookback) { break; } } if (lane == 0) { @@ -1117,7 +1117,7 @@ T PrefixSum (N n, FIN && fin, FOUT && fout, TYPE, RetSum a_ret_sum = retSum) for (int ichunk = 0; ichunk < nchunks; ++ichunk) { N offset = ibegin + ichunk*blockDim.x + threadIdx.x; - if (offset >= iend) break; + if (offset >= iend) { break; } T t = tmp_out[ichunk] + exclusive_prefix; fout(offset, t); if (offset == n-1) { @@ -1208,7 +1208,7 @@ T InclusiveSum (N n, T const* in, T * out, RetSum a_ret_sum = retSum) template ::value> > T ExclusiveSum (N n, T const* in, T * out, RetSum a_ret_sum = retSum) { - if (n <= 0) return 0; + if (n <= 0) { return 0; } #if defined(AMREX_USE_CUDA) && defined(__CUDACC__) && (__CUDACC_VER_MAJOR__ >= 11) T in_last = 0; if (a_ret_sum) { @@ -1286,7 +1286,7 @@ template ,Type::Exclusive>::value)> > T PrefixSum (N n, FIN && fin, FOUT && fout, TYPE, RetSum = retSum) { - if (n <= 0) return 0; + if (n <= 0) { return 0; } T totalsum = 0; for (N i = 0; i < n; ++i) { T x = fin(i); @@ -1317,7 +1317,7 @@ T InclusiveSum (N n, T const* in, T * out, RetSum /*a_ret_sum*/ = retSum) template ::value> > T ExclusiveSum (N n, T const* in, T * out, RetSum /*a_ret_sum*/ = retSum) { - if (n <= 0) return 0; + if (n <= 0) { return 0; } auto in_last = in[n-1]; #if (__cplusplus >= 201703L) && (!defined(_GLIBCXX_RELEASE) || _GLIBCXX_RELEASE >= 10) @@ -1366,7 +1366,7 @@ namespace Gpu // GCC's __cplusplus is not a reliable indication for C++17 support return std::exclusive_scan(begin, end, result, 0); #else - if (begin == end) return result; + if (begin == end) { return result; } typename std::iterator_traits::value_type sum = *begin; *result++ = sum - *begin; diff --git a/Src/Base/AMReX_TagParallelFor.H b/Src/Base/AMReX_TagParallelFor.H index ae832f3b2af..5aa748a3d61 100644 --- a/Src/Base/AMReX_TagParallelFor.H +++ b/Src/Base/AMReX_TagParallelFor.H @@ -149,7 +149,7 @@ void ParallelFor_doit (Vector const& tags, F && f) { const int ntags = tags.size(); - if (ntags == 0) return; + if (ntags == 0) { return; } int ntotwarps = 0; Vector nwarps; @@ -197,7 +197,7 @@ ParallelFor_doit (Vector const& tags, F && f) int g_tid = blockDim.x*blockIdx.x + threadIdx.x; #endif int g_wid = g_tid / Gpu::Device::warp_size; - if (g_wid >= ntotwarps) return; + if (g_wid >= ntotwarps) { return; } int tag_id = amrex::bisect(d_nwarps, 0, ntags, g_wid); diff --git a/Src/Base/AMReX_TinyProfiler.cpp b/Src/Base/AMReX_TinyProfiler.cpp index 8c59a1eae7b..bf827659062 100644 --- a/Src/Base/AMReX_TinyProfiler.cpp +++ b/Src/Base/AMReX_TinyProfiler.cpp @@ -543,7 +543,7 @@ TinyProfiler::PrintStats (std::map& regstats, double dt_max) } } - if (regstats.empty()) return; + if (regstats.empty()) { return; } int nprocs = ParallelDescriptor::NProcs(); int ioproc = ParallelDescriptor::IOProcessorNumber(); @@ -742,7 +742,7 @@ TinyProfiler::PrintMemStats(std::map& memstats, } } - if (memstats.empty()) return; + if (memstats.empty()) { return; } const int nprocs = ParallelDescriptor::NProcs(); const int ioproc = ParallelDescriptor::IOProcessorNumber(); @@ -864,7 +864,7 @@ TinyProfiler::PrintMemStats(std::map& memstats, maxlen[i] += 2; } - if (allstatsstr.size() == 1) return; + if (allstatsstr.size() == 1) { return; } int lenhline = 0; for (auto i : maxlen) { diff --git a/Src/Base/AMReX_Utility.cpp b/Src/Base/AMReX_Utility.cpp index 423f3046ed9..8441324621a 100644 --- a/Src/Base/AMReX_Utility.cpp +++ b/Src/Base/AMReX_Utility.cpp @@ -132,7 +132,7 @@ std::string amrex::trim(std::string s, std::string const& space) { const auto sbegin = s.find_first_not_of(space); - if (sbegin == std::string::npos) return std::string{}; + if (sbegin == std::string::npos) { return std::string{}; } const auto send = s.find_last_not_of(space); s = s.substr(sbegin, send-sbegin+1); return s; diff --git a/Src/Base/AMReX_Vector.H b/Src/Base/AMReX_Vector.H index 248aced1de4..c377076fe1b 100644 --- a/Src/Base/AMReX_Vector.H +++ b/Src/Base/AMReX_Vector.H @@ -63,7 +63,7 @@ namespace amrex { Vector r; r.reserve(a.size()); - for (auto& x : a) r.push_back(&x); + for (auto& x : a) { r.push_back(&x); } return r; } @@ -72,7 +72,7 @@ namespace amrex { Vector r; r.reserve(a.size()); - for (const auto& x : a) r.push_back(x.get()); + for (const auto& x : a) { r.push_back(x.get()); } return r; } @@ -83,7 +83,7 @@ namespace amrex { Vector r; r.reserve(a.size()); - for (const auto& x : a) r.push_back(&x); + for (const auto& x : a) { r.push_back(&x); } return r; } @@ -92,7 +92,7 @@ namespace amrex { Vector r; r.reserve(a.size()); - for (const auto& x : a) r.push_back(x.get()); + for (const auto& x : a) { r.push_back(x.get()); } return r; } @@ -109,7 +109,7 @@ namespace amrex { Vector > r; r.reserve(a.size()); - for (const auto& x : a) r.push_back(GetVecOfPtrs(x)); + for (const auto& x : a) { r.push_back(GetVecOfPtrs(x)); } return r; } @@ -122,7 +122,7 @@ namespace amrex { Vector > r; r.reserve(a.size()); - for (const auto& x : a) r.push_back(GetArrOfPtrs(x)); + for (const auto& x : a) { r.push_back(GetArrOfPtrs(x)); } return r; } @@ -132,7 +132,7 @@ namespace amrex { Vector > r; r.reserve(a.size()); - for (const auto& x : a) r.push_back(GetArrOfConstPtrs(x)); + for (const auto& x : a) { r.push_back(GetArrOfConstPtrs(x)); } return r; } @@ -142,7 +142,7 @@ namespace amrex { Vector > r; r.reserve(a.size()); - for (const auto& x : a) r.push_back(GetArrOfConstPtrs(x)); + for (const auto& x : a) { r.push_back(GetArrOfConstPtrs(x)); } return r; } @@ -154,7 +154,7 @@ namespace amrex { Vector > r; r.reserve(a.size()); - for (const auto& x : a) r.push_back(GetArrOfConstPtrs(x)); + for (const auto& x : a) { r.push_back(GetArrOfConstPtrs(x)); } return r; } @@ -166,7 +166,7 @@ namespace amrex { Vector > r; r.reserve(a.size()); - for (auto &x: a) r.push_back(GetArrOfPtrs(x)); + for (auto &x: a) { r.push_back(GetArrOfPtrs(x)); } return r; } #endif @@ -199,7 +199,7 @@ namespace amrex std::size_t removeDupDoit (Vector& vec, std::size_t start, std::size_t stop) { std::size_t N = stop-start; - if (N < 2) return stop; + if (N < 2) { return stop; } T* const data = vec.data() + start; T const sentinel = data[0]; // duplicates will be set to sentinel and removed later diff --git a/Src/Base/AMReX_VisMF.cpp b/Src/Base/AMReX_VisMF.cpp index a109a09b04e..1855d1ddd63 100644 --- a/Src/Base/AMReX_VisMF.cpp +++ b/Src/Base/AMReX_VisMF.cpp @@ -1535,7 +1535,7 @@ VisMF::Read (FabArray &mf, // This allows us to read in an empty MultiFab without an error -- but only if explicitly told to if (allow_empty_mf > 0) { - if (hdr.m_ba.empty()) return; + if (hdr.m_ba.empty()) { return; } } else { if (hdr.m_ba.empty()) { diff --git a/Src/Base/AMReX_iMultiFab.cpp b/Src/Base/AMReX_iMultiFab.cpp index 63465f0a036..3941c4267b2 100644 --- a/Src/Base/AMReX_iMultiFab.cpp +++ b/Src/Base/AMReX_iMultiFab.cpp @@ -148,7 +148,7 @@ iMultiFab::negate (const Box& region, int nghost) void iMultiFab::Initialize () { - if (initialized) return; + if (initialized) { return; } amrex::ExecOnFinalize(iMultiFab::Finalize); diff --git a/Src/Base/Parser/AMReX_Parser_Y.cpp b/Src/Base/Parser/AMReX_Parser_Y.cpp index 74dde9679ec..75a58498c15 100644 --- a/Src/Base/Parser/AMReX_Parser_Y.cpp +++ b/Src/Base/Parser/AMReX_Parser_Y.cpp @@ -631,7 +631,7 @@ namespace { bool parser_node_equal (struct parser_node* a, struct parser_node* b) { - if (a->type != b->type) return false; + if (a->type != b->type) { return false; } switch (a->type) { case PARSER_NUMBER: diff --git a/Src/Boundary/AMReX_InterpBndryData.H b/Src/Boundary/AMReX_InterpBndryData.H index a50cd62eb78..c2b57ba6114 100644 --- a/Src/Boundary/AMReX_InterpBndryData.H +++ b/Src/Boundary/AMReX_InterpBndryData.H @@ -169,7 +169,7 @@ InterpBndryDataT::setBndryValues (BndryRegisterT const& crse, int c_star if (max_order==3 || max_order==1) { MFItInfo info; - if (Gpu::notInLaunchRegion()) info.SetDynamic(true); + if (Gpu::notInLaunchRegion()) { info.SetDynamic(true); } #ifdef AMREX_USE_OMP #pragma omp parallel if (Gpu::notInLaunchRegion()) #endif diff --git a/Src/Boundary/AMReX_YAFluxRegister.H b/Src/Boundary/AMReX_YAFluxRegister.H index 619b7100983..6f17c4de556 100644 --- a/Src/Boundary/AMReX_YAFluxRegister.H +++ b/Src/Boundary/AMReX_YAFluxRegister.H @@ -426,7 +426,7 @@ YAFluxRegisterT::FineAdd (const MFIter& mfi, // const int li = mfi.LocalIndex(); Vector& cfp_fabs = m_cfp_fab[li]; - if (cfp_fabs.empty()) return; + if (cfp_fabs.empty()) { return; } const Box& tbx = mfi.tilebox(); const Box& bx = amrex::coarsen(tbx, m_ratio); diff --git a/Src/EB/AMReX_EB2_GeometryShop.H b/Src/EB/AMReX_EB2_GeometryShop.H index 6b5e255286e..c0cae18ca32 100644 --- a/Src/EB/AMReX_EB2_GeometryShop.H +++ b/Src/EB/AMReX_EB2_GeometryShop.H @@ -220,7 +220,7 @@ public: } else { ++nfluid; } - if (nbody > 0 && nfluid > 0) return mixedcells; + if (nbody > 0 && nfluid > 0) { return mixedcells; } } } } diff --git a/Src/EB/AMReX_EB2_Level.cpp b/Src/EB/AMReX_EB2_Level.cpp index 9289f5d77f9..daa22113082 100644 --- a/Src/EB/AMReX_EB2_Level.cpp +++ b/Src/EB/AMReX_EB2_Level.cpp @@ -162,7 +162,7 @@ Level::coarsenFromFine (Level& fineLevel, bool fill_boundary) ParallelDescriptor::ReduceBoolOr(b); mvmc_error = b; } - if (mvmc_error) return mvmc_error; + if (mvmc_error) { return mvmc_error; } const int ng = 2; m_cellflag.define(m_grids, m_dmap, 1, ng); @@ -483,7 +483,7 @@ void Level::fillVolFrac (MultiFab& vfrac, const Geometry& geom) const { vfrac.setVal(1.0); - if (isAllRegular()) return; + if (isAllRegular()) { return; } vfrac.ParallelCopy(m_volfrac,0,0,1,0,vfrac.nGrow(),geom.periodicity()); @@ -715,7 +715,7 @@ Level::fillAreaFrac (Array const& a_areafrac, const Ge a_areafrac[idim]->setVal(1.0); } - if (isAllRegular()) return; + if (isAllRegular()) { return; } for (int idim = 0; idim < AMREX_SPACEDIM; ++idim) { diff --git a/Src/EB/AMReX_EBFluxRegister.cpp b/Src/EB/AMReX_EBFluxRegister.cpp index ed2c42f758c..a447be226c7 100644 --- a/Src/EB/AMReX_EBFluxRegister.cpp +++ b/Src/EB/AMReX_EBFluxRegister.cpp @@ -166,7 +166,7 @@ EBFluxRegister::FineAdd (const MFIter& mfi, const int li = mfi.LocalIndex(); Vector& cfp_fabs = m_cfp_fab[li]; - if (cfp_fabs.empty()) return; + if (cfp_fabs.empty()) { return; } const Box& tbx = mfi.tilebox(); BL_ASSERT(tbx.cellCentered()); diff --git a/Src/EB/AMReX_EBMultiFabUtil.cpp b/Src/EB/AMReX_EBMultiFabUtil.cpp index a5202c7d805..b83b2f0f62d 100644 --- a/Src/EB/AMReX_EBMultiFabUtil.cpp +++ b/Src/EB/AMReX_EBMultiFabUtil.cpp @@ -27,7 +27,7 @@ void EB_set_covered (MultiFab& mf, int icomp, int ncomp, int ngrow, Real val) { const auto *const factory = dynamic_cast(&(mf.Factory())); - if (factory == nullptr) return; + if (factory == nullptr) { return; } const auto& flags = factory->getMultiEBCellFlagFab(); AMREX_ALWAYS_ASSERT(mf.ixType().cellCentered() || mf.ixType().nodeCentered()); @@ -69,7 +69,7 @@ void EB_set_covered (MultiFab& mf, int icomp, int ncomp, int ngrow, const Vector& a_vals) { const auto *const factory = dynamic_cast(&(mf.Factory())); - if (factory == nullptr) return; + if (factory == nullptr) { return; } const auto& flags = factory->getMultiEBCellFlagFab(); AMREX_ALWAYS_ASSERT(mf.ixType().cellCentered() || mf.ixType().nodeCentered()); @@ -109,7 +109,7 @@ void EB_set_covered_faces (const Array& umac, Real val) { const auto *const factory = dynamic_cast(&(umac[0]->Factory())); - if (factory == nullptr) return; + if (factory == nullptr) { return; } const auto& area = factory->getAreaFrac(); const auto& flags = factory->getMultiEBCellFlagFab(); @@ -220,7 +220,7 @@ void EB_set_covered_faces (const Array& umac, const int scomp, const int ncomp, const Vector& a_vals ) { const auto *const factory = dynamic_cast(&(umac[0]->Factory())); - if (factory == nullptr) return; + if (factory == nullptr) { return; } const auto& area = factory->getAreaFrac(); const auto& flags = factory->getMultiEBCellFlagFab(); diff --git a/Src/EB/AMReX_EBToPVD.cpp b/Src/EB/AMReX_EBToPVD.cpp index dc6e93d5fb2..bd5c85721d5 100644 --- a/Src/EB/AMReX_EBToPVD.cpp +++ b/Src/EB/AMReX_EBToPVD.cpp @@ -443,7 +443,7 @@ void EBToPVD::EBGridCoverage(const int myID, const Real* problo, const Real* dx, }; ++m_grid; - if(lc1 == 0) return; + if(lc1 == 0) { return; } std::stringstream ss; ss << std::setw(4) << std::setfill('0') << myID; diff --git a/Src/EB/AMReX_WriteEBSurface.cpp b/Src/EB/AMReX_WriteEBSurface.cpp index 52b50d6c182..75a0421c94d 100644 --- a/Src/EB/AMReX_WriteEBSurface.cpp +++ b/Src/EB/AMReX_WriteEBSurface.cpp @@ -28,7 +28,7 @@ void WriteEBSurface (const BoxArray & ba, const DistributionMapping & dmap, cons const Box & bx = mfi.validbox(); if (my_flag.getType(bx) == FabType::covered || - my_flag.getType(bx) == FabType::regular) continue; + my_flag.getType(bx) == FabType::regular) { continue; } std::array areafrac; const MultiCutFab * bndrycent; @@ -62,7 +62,7 @@ void WriteEBSurface (const BoxArray & ba, const DistributionMapping & dmap, cons const Box & bx = mfi.validbox(); if (my_flag.getType(bx) == FabType::covered || - my_flag.getType(bx) == FabType::regular) continue; + my_flag.getType(bx) == FabType::regular) { continue; } eb_to_pvd.EBGridCoverage(cpu, problo, dx, bx, my_flag.const_array()); } diff --git a/Src/EB/AMReX_algoim_K.H b/Src/EB/AMReX_algoim_K.H index c8a47614a08..9cf26e6cc10 100644 --- a/Src/EB/AMReX_algoim_K.H +++ b/Src/EB/AMReX_algoim_K.H @@ -442,7 +442,7 @@ struct ImplicitIntegral // Loop over segments of divided interval for (int i = 0; i < nroots - 1; ++i) { - if (roots[i+1] - roots[i] < tol) continue; + if (roots[i+1] - roots[i] < tol) { continue; } // Evaluate sign of phi within segment and check for consistency with psi bool okay = true; @@ -457,7 +457,7 @@ struct ImplicitIntegral bool new_ok = (phi(x) > 0.0) ? (psi[j].sign() >= 0) : (psi[j].sign() <= 0); okay = okay && new_ok; } - if (!okay) continue; + if (!okay) { continue; } for (int j = 0; j < p; ++j) { diff --git a/Src/Extern/HDF5/AMReX_ParticleHDF5.H b/Src/Extern/HDF5/AMReX_ParticleHDF5.H index db58f07d6a3..0dddc14b67c 100644 --- a/Src/Extern/HDF5/AMReX_ParticleHDF5.H +++ b/Src/Extern/HDF5/AMReX_ParticleHDF5.H @@ -155,10 +155,10 @@ ParticleContainer_impl AMREX_ASSERT( int_comp_names.size() == NStructInt + NumIntComps() ); Vector write_real_comp; - for (int i = 0; i < NStructReal + NumRealComps(); ++i) write_real_comp.push_back(1); + for (int i = 0; i < NStructReal + NumRealComps(); ++i) { write_real_comp.push_back(1); } Vector write_int_comp; - for (int i = 0; i < NStructInt + NumIntComps(); ++i) write_int_comp.push_back(1); + for (int i = 0; i < NStructInt + NumIntComps(); ++i) { write_int_comp.push_back(1); } WriteHDF5ParticleData(dir, name, write_real_comp, write_int_comp, @@ -312,10 +312,10 @@ ParticleContainer_impl AMREX_ASSERT( int_comp_names.size() == NStructInt + NArrayInt ); Vector write_real_comp; - for (int i = 0; i < NStructReal + NumRealComps(); ++i) write_real_comp.push_back(1); + for (int i = 0; i < NStructReal + NumRealComps(); ++i) { write_real_comp.push_back(1); } Vector write_int_comp; - for (int i = 0; i < NStructInt + NumIntComps(); ++i) write_int_comp.push_back(1); + for (int i = 0; i < NStructInt + NumIntComps(); ++i) { write_int_comp.push_back(1); } WriteHDF5ParticleData(dir, name, write_real_comp, write_int_comp, @@ -335,10 +335,10 @@ ParticleContainer_impl AMREX_ASSERT(real_comp_names.size() == NStructReal + NumRealComps()); Vector write_real_comp; - for (int i = 0; i < NStructReal + NumRealComps(); ++i) write_real_comp.push_back(1); + for (int i = 0; i < NStructReal + NumRealComps(); ++i) { write_real_comp.push_back(1); } Vector write_int_comp; - for (int i = 0; i < NStructInt + NumIntComps(); ++i) write_int_comp.push_back(1); + for (int i = 0; i < NStructInt + NumIntComps(); ++i) { write_int_comp.push_back(1); } Vector int_comp_names; for (int i = 0; i < NStructInt + NumIntComps(); ++i ) @@ -604,8 +604,9 @@ ParticleContainer_impl hsize_t chunk_dim = 1024; chunk_env = getenv("HDF5_CHUNK_SIZE"); - if (chunk_env != NULL) + if (chunk_env != NULL) { chunk_dim = atoi(chunk_env); + } H5Pset_chunk(dcpl_int, 1, &chunk_dim); H5Pset_chunk(dcpl_real, 1, &chunk_dim); @@ -815,22 +816,25 @@ ParticleContainer_impl H5Sclose(real_dset_space); real_file_offset = 0; - for (int i = 0; i < ParallelDescriptor::MyProc(); i++) + for (int i = 0; i < ParallelDescriptor::MyProc(); i++) { real_file_offset += all_mfi_real_total_size[i]; + } my_real_offset = real_file_offset; my_real_count = 0; int max_mfi_count = 0, write_count = 0; - for (int i = 0; i < ParallelDescriptor::MyProc(); i++) - if (max_mfi_count < all_mfi_cnt[i]) + for (int i = 0; i < ParallelDescriptor::MyProc(); i++) { + if (max_mfi_count < all_mfi_cnt[i]) { max_mfi_count = all_mfi_cnt[i]; + } + } for (MFIter mfi(state); mfi.isValid(); ++mfi) { const int grid = mfi.index(); - if (count[grid] == 0) continue; + if (count[grid] == 0) { continue; } Vector istuff; Vector rstuff; @@ -864,20 +868,21 @@ ParticleContainer_impl /* my_real_offset << ", my_real_count = " << my_real_count << ", total_real_size = " << total_real_size << '\n'; */ real_dset_space = H5Screate_simple(1, &total_real_size, NULL); H5Sselect_hyperslab (real_dset_space, H5S_SELECT_SET, &my_real_offset, NULL, &my_real_count, NULL); - if (sizeof(typename ParticleType::RealType) == 4) + if (sizeof(typename ParticleType::RealType) == 4) { #ifdef AMREX_USE_HDF5_ASYNC ret = H5Dwrite_async(real_dset_id, H5T_NATIVE_FLOAT, real_mem_space, real_dset_space, dxpl_col, rstuff.dataPtr(), es_par_g); #else ret = H5Dwrite(real_dset_id, H5T_NATIVE_FLOAT, real_mem_space, real_dset_space, dxpl_col, rstuff.dataPtr()); #endif - else + } else { #ifdef AMREX_USE_HDF5_ASYNC ret = H5Dwrite_async(real_dset_id, H5T_NATIVE_DOUBLE, real_mem_space, real_dset_space, dxpl_col, rstuff.dataPtr(), es_par_g); #else ret = H5Dwrite(real_dset_id, H5T_NATIVE_DOUBLE, real_mem_space, real_dset_space, dxpl_col, rstuff.dataPtr()); #endif + } - if (ret < 0) amrex::Abort("H5Dwrite real_dset failed!"); + if (ret < 0) { amrex::Abort("H5Dwrite real_dset failed!"); } H5Sclose(real_mem_space); H5Sclose(real_dset_space); @@ -896,16 +901,18 @@ ParticleContainer_impl #ifdef AMREX_USE_HDF5_ASYNC H5Dwrite_async(int_dset_id, H5T_NATIVE_INT, int_dset_space, int_dset_space, dxpl_col, NULL, es_par_g); - if (sizeof(typename ParticleType::RealType) == 4) + if (sizeof(typename ParticleType::RealType) == 4) { H5Dwrite_async(real_dset_id, H5T_NATIVE_FLOAT, real_dset_space, real_dset_space, dxpl_col, NULL, es_par_g); - else + } else { H5Dwrite_async(real_dset_id, H5T_NATIVE_DOUBLE, real_dset_space, real_dset_space, dxpl_col, NULL, es_par_g); + } #else H5Dwrite(int_dset_id, H5T_NATIVE_INT, int_dset_space, int_dset_space, dxpl_col, NULL); - if (sizeof(typename ParticleType::RealType) == 4) + if (sizeof(typename ParticleType::RealType) == 4) { H5Dwrite(real_dset_id, H5T_NATIVE_FLOAT, real_dset_space, real_dset_space, dxpl_col, NULL); - else + } else { H5Dwrite(real_dset_id, H5T_NATIVE_DOUBLE, real_dset_space, real_dset_space, dxpl_col, NULL); + } #endif H5Sclose(int_dset_space); @@ -931,8 +938,9 @@ ParticleContainer_impl #endif my_int_offset = 0; - for (int i = 0; i < ParallelDescriptor::MyProc(); i++) + for (int i = 0; i < ParallelDescriptor::MyProc(); i++) { my_int_offset += all_mfi_cnt[i]; + } my_int_count = my_mfi_cnt; int_mem_space = H5Screate_simple(1, &my_int_count, NULL); /* std::cout << "Rank " << ParallelDescriptor::MyProc() << ": my_int_offset = " << */ @@ -944,7 +952,7 @@ ParticleContainer_impl #else ret = H5Dwrite(offset_id, H5T_NATIVE_INT, int_mem_space, offset_space, dxpl_col, &(my_nparticles[0])); #endif - if (ret < 0) amrex::Abort("H5Dwrite offset failed!"); + if (ret < 0) { amrex::Abort("H5Dwrite offset failed!"); } H5Pclose(dcpl_int); H5Pclose(dcpl_real); @@ -986,8 +994,9 @@ ParticleContainer_impl const auto strttime = amrex::second(); std::string fullname = dir; - if (!fullname.empty() && fullname[fullname.size()-1] != '/') + if (!fullname.empty() && fullname[fullname.size()-1] != '/') { fullname += '/'; + } fullname += file; fullname += ".h5"; @@ -1285,7 +1294,7 @@ ParticleContainer_impl const int rank = ParallelDescriptor::MyProc(); const int NReaders = MaxReaders(); - if (rank >= NReaders) return; + if (rank >= NReaders) { return; } const int Navg = ngrids[lev] / NReaders; const int Nleft = ngrids[lev] - Navg * NReaders; @@ -1378,10 +1387,11 @@ ParticleContainer_impl hsize_t real_offset = offset*rChunkSize; real_dspace = H5Screate_simple(1, &real_cnt, NULL); H5Sselect_hyperslab (real_fspace, H5S_SELECT_SET, &real_offset, NULL, &real_cnt, NULL); - if (sizeof(RTYPE) == 4) + if (sizeof(RTYPE) == 4) { H5Dread(real_dset, H5T_NATIVE_FLOAT, real_dspace, real_fspace, H5P_DEFAULT, rstuff.dataPtr()); - else + } else { H5Dread(real_dset, H5T_NATIVE_DOUBLE, real_dspace, real_fspace, H5P_DEFAULT, rstuff.dataPtr()); + } H5Sclose(real_fspace); H5Sclose(real_dspace); diff --git a/Src/Extern/HYPRE/AMReX_HypreIJIface.cpp b/Src/Extern/HYPRE/AMReX_HypreIJIface.cpp index aaf1ecea689..0466343d7db 100644 --- a/Src/Extern/HYPRE/AMReX_HypreIJIface.cpp +++ b/Src/Extern/HYPRE/AMReX_HypreIJIface.cpp @@ -102,9 +102,10 @@ void HypreIJIface::run_hypre_setup () { if (m_need_setup || m_recompute_preconditioner) { BL_PROFILE("HypreIJIface::run_hypre_setup()"); - if (m_has_preconditioner) + if (m_has_preconditioner) { m_solverPrecondPtr( m_solver, m_precondSolvePtr, m_precondSetupPtr, m_precond); + } m_solverSetupPtr(m_solver, m_parA, m_parRhs, m_parSln); m_need_setup = false; @@ -137,8 +138,9 @@ void HypreIJIface::solve ( m_solverSetTolPtr(m_solver, rel_tol); m_solverSetMaxIterPtr(m_solver, max_iter); - if ((abs_tol > 0.0) && (m_solverSetAbsTolPtr != nullptr)) + if ((abs_tol > 0.0) && (m_solverSetAbsTolPtr != nullptr)) { m_solverSetAbsTolPtr(m_solver, abs_tol); + } // setup run_hypre_setup(); @@ -156,14 +158,15 @@ void HypreIJIface::solve ( HYPRE_IJVectorPrint(m_sln, slnfile.c_str()); // Increment counter if the user has requested output of multiple solves - if (!m_overwrite_files) ++m_write_counter; + if (!m_overwrite_files) { ++m_write_counter; } } - if (m_verbose > 1) + if (m_verbose > 1) { amrex::Print() << "HYPRE " << m_solver_name << ": Num. iterations = " << m_num_iterations << "; Relative residual = " << m_final_res_norm << std::endl; + } } void HypreIJIface::parse_inputs (const std::string& prefix) @@ -177,10 +180,11 @@ void HypreIJIface::parse_inputs (const std::string& prefix) pp.queryAdd("overwrite_existing_matrix_files", m_overwrite_files); pp.queryAdd("adjust_singular_matrix", m_adjust_singular_matrix); - if (m_verbose > 2) + if (m_verbose > 2) { amrex::Print() << "HYPRE: solver = " << m_solver_name << "; preconditioner = " << m_preconditioner_name << std::endl; + } if (m_preconditioner_name == "none") { m_has_preconditioner = false; @@ -230,8 +234,9 @@ void HypreIJIface::init_solver ( void HypreIJIface::boomeramg_precond_configure (const std::string& prefix) { - if (m_verbose > 2) + if (m_verbose > 2) { amrex::Print() << "Creating BoomerAMG preconditioner" << std::endl; + } HYPRE_BoomerAMGCreate(&m_precond); // Setup the pointers @@ -291,14 +296,16 @@ void HypreIJIface::boomeramg_precond_configure (const std::string& prefix) hpp.pp.getarr("bamg_non_galerkin_level_levels", levels); hpp.pp.getarr("bamg_non_galerkin_level_tols", tols); - if (levels.size() != tols.size()) + if (levels.size() != tols.size()) { amrex::Abort( "HypreIJIface: Invalid sizes for non-Galerkin level " "tolerances"); + } - for (size_t i = 0; i < levels.size(); ++i) + for (size_t i = 0; i < levels.size(); ++i) { HYPRE_BoomerAMGSetLevelNonGalerkinTol( m_precond, tols[i], levels[i]); + } } } @@ -418,14 +425,16 @@ void HypreIJIface::boomeramg_solver_configure (const std::string& prefix) bool use_old_default = true; hpp.pp.queryAdd("bamg_use_old_default", use_old_default); - if (use_old_default) + if (use_old_default) { HYPRE_BoomerAMGSetOldDefault(m_solver); + } } void HypreIJIface::gmres_solver_configure (const std::string& prefix) { - if (m_verbose > 2) + if (m_verbose > 2) { amrex::Print() << "Creating GMRES solver" << std::endl; + } HYPRE_ParCSRGMRESCreate(m_comm, &m_solver); // Setup pointers diff --git a/Src/Extern/SUNDIALS/AMReX_NVector_MultiFab.cpp b/Src/Extern/SUNDIALS/AMReX_NVector_MultiFab.cpp index 1674a83343a..8408f75c41d 100644 --- a/Src/Extern/SUNDIALS/AMReX_NVector_MultiFab.cpp +++ b/Src/Extern/SUNDIALS/AMReX_NVector_MultiFab.cpp @@ -29,7 +29,7 @@ N_Vector N_VNewEmpty_MultiFab(sunindextype length, ::sundials::Context* sunctx) { /* Create vector */ N_Vector v = N_VNewEmpty(*sunctx); - if (v == nullptr) return(nullptr); + if (v == nullptr) { return(nullptr); } v->ops->nvclone = N_VClone_MultiFab; v->ops->nvcloneempty = N_VCloneEmpty_MultiFab; @@ -85,7 +85,7 @@ N_Vector N_VNew_MultiFab(sunindextype length, ::sundials::Context* sunctx) { N_Vector v = N_VNewEmpty_MultiFab(length, sunctx); - if (v == nullptr) return(nullptr); + if (v == nullptr) { return(nullptr); } // Create and attach new MultiFab if (length > 0) @@ -107,7 +107,7 @@ N_Vector N_VMake_MultiFab(sunindextype length, amrex::MultiFab *v_mf, ::sundials::Context* sunctx) { N_Vector v = N_VNewEmpty_MultiFab(length, sunctx); - if (v == nullptr) return(nullptr); + if (v == nullptr) { return(nullptr); } if (length > 0) { @@ -157,11 +157,11 @@ int N_VGetOwnMF_MultiFab(N_Vector v) N_Vector N_VCloneEmpty_MultiFab(N_Vector w) { - if (w == nullptr) return(nullptr); + if (w == nullptr) { return(nullptr); } /* Create vector and copy operations */ N_Vector v = N_VNewEmpty(w->sunctx); - if (v == nullptr) return(nullptr); + if (v == nullptr) { return(nullptr); } N_VCopyOps(w, v); /* Create content */ @@ -182,7 +182,7 @@ N_Vector N_VCloneEmpty_MultiFab(N_Vector w) N_Vector N_VClone_MultiFab(N_Vector w) { N_Vector v = N_VCloneEmpty_MultiFab(w); - if (v == nullptr) return(nullptr); + if (v == nullptr) { return(nullptr); } sunindextype length = amrex::sundials::N_VGetLength_MultiFab(w); diff --git a/Src/Extern/SUNDIALS/AMReX_SUNMemory.cpp b/Src/Extern/SUNDIALS/AMReX_SUNMemory.cpp index 043c44b0634..041b91b1b1e 100644 --- a/Src/Extern/SUNDIALS/AMReX_SUNMemory.cpp +++ b/Src/Extern/SUNDIALS/AMReX_SUNMemory.cpp @@ -37,7 +37,7 @@ namespace { { SUNMemory mem = SUNMemoryNewEmpty(); - if (mem == nullptr) return -1; + if (mem == nullptr) { return -1; } mem->ptr = nullptr; mem->own = SUNTRUE; mem->type = mem_type; @@ -59,7 +59,7 @@ namespace { int Dealloc(SUNMemoryHelper, SUNMemory mem, void* /*queue*/) { - if (mem == nullptr) return 0; + if (mem == nullptr) { return 0; } auto* arena = getArena(mem->type); if (arena) { if(mem->own) @@ -173,7 +173,7 @@ void MemoryHelper::Initialize(int nthreads) std::fill(the_sunmemory_helper.begin(), the_sunmemory_helper.end(), nullptr); } for (int i = 0; i < nthreads; i++) { - if (initialized[i]) continue; + if (initialized[i]) { continue; } initialized[i] = 1; BL_ASSERT(the_sunmemory_helper[i] == nullptr); the_sunmemory_helper[i] = new MemoryHelper(The_Sundials_Context(i)); diff --git a/Src/Extern/SUNDIALS/AMReX_Sundials_Core.cpp b/Src/Extern/SUNDIALS/AMReX_Sundials_Core.cpp index 80a3a33b18d..286662058a3 100644 --- a/Src/Extern/SUNDIALS/AMReX_Sundials_Core.cpp +++ b/Src/Extern/SUNDIALS/AMReX_Sundials_Core.cpp @@ -22,7 +22,7 @@ void Initialize(int nthreads) std::fill(the_sundials_context.begin(), the_sundials_context.end(), nullptr); } for (int i = 0; i < nthreads; i++) { - if (initialized[i]) continue; + if (initialized[i]) { continue; } initialized[i] = 1; BL_ASSERT(the_sundials_context[i] == nullptr); the_sundials_context[i] = new ::sundials::Context(); diff --git a/Src/LinearSolvers/MLMG/AMReX_MLABecLaplacian.H b/Src/LinearSolvers/MLMG/AMReX_MLABecLaplacian.H index 5384f534107..c115a419db7 100644 --- a/Src/LinearSolvers/MLMG/AMReX_MLABecLaplacian.H +++ b/Src/LinearSolvers/MLMG/AMReX_MLABecLaplacian.H @@ -478,7 +478,7 @@ template void MLABecLaplacianT::applyRobinBCTermsCoeffs () { - if (!(this->hasRobinBC())) return; + if (!(this->hasRobinBC())) { return; } const int ncomp = this->getNComp(); bool reset_alpha = false; @@ -515,7 +515,7 @@ MLABecLaplacianT::applyRobinBCTermsCoeffs () const Box& bhi = amrex::adjCellHi(vbx,idim); bool outside_domain_lo = !(domain.contains(blo)); bool outside_domain_hi = !(domain.contains(bhi)); - if ((!outside_domain_lo) && (!outside_domain_hi)) continue; + if ((!outside_domain_lo) && (!outside_domain_hi)) { continue; } for (int icomp = 0; icomp < ncomp; ++icomp) { auto const& rbc = (*(this->m_robin_bcval[amrlev]))[mfi].const_array(icomp*3); if (this->m_lobc_orig[icomp][idim] == LinOpBCType::Robin && outside_domain_lo) @@ -1166,7 +1166,7 @@ template std::unique_ptr> MLABecLaplacianT::makeNLinOp (int /*grid_size*/) const { - if (this->m_overset_mask[0][0] == nullptr) return nullptr; + if (this->m_overset_mask[0][0] == nullptr) { return nullptr; } const Geometry& geom = this->m_geom[0].back(); const BoxArray& ba = this->m_grids[0].back(); @@ -1265,7 +1265,7 @@ template void MLABecLaplacianT::copyNSolveSolution (MF& dst, MF const& src) const { - if (this->m_overset_mask[0].back() == nullptr) return; + if (this->m_overset_mask[0].back() == nullptr) { return; } const int ncomp = dst.nComp(); diff --git a/Src/LinearSolvers/MLMG/AMReX_MLCellABecLap.H b/Src/LinearSolvers/MLMG/AMReX_MLCellABecLap.H index f58137ca9b6..48042b428ab 100644 --- a/Src/LinearSolvers/MLMG/AMReX_MLCellABecLap.H +++ b/Src/LinearSolvers/MLMG/AMReX_MLCellABecLap.H @@ -277,7 +277,7 @@ MLCellABecLapT::applyInhomogNeumannTerm (int amrlev, MF& rhs) const bool has_inhomog_neumann = this->hasInhomogNeumannBC(); bool has_robin = this->hasRobinBC(); - if (!has_inhomog_neumann && !has_robin) return; + if (!has_inhomog_neumann && !has_robin) { return; } int ncomp = this->getNComp(); const int mglev = 0; @@ -329,7 +329,7 @@ MLCellABecLapT::applyInhomogNeumannTerm (int amrlev, MF& rhs) const const auto& bvhi = bndry.bndryValues(ohi).array(mfi); bool outside_domain_lo = !(domain.contains(blo)); bool outside_domain_hi = !(domain.contains(bhi)); - if ((!outside_domain_lo) && (!outside_domain_hi)) continue; + if ((!outside_domain_lo) && (!outside_domain_hi)) { continue; } for (int icomp = 0; icomp < ncomp; ++icomp) { const BoundCond bctlo = bdcv[icomp][olo]; const BoundCond bcthi = bdcv[icomp][ohi]; @@ -509,7 +509,7 @@ MLCellABecLapT::addInhomogNeumannFlux ( bool has_inhomog_neumann = this->hasInhomogNeumannBC(); bool has_robin = this->hasRobinBC(); - if (!has_inhomog_neumann && !has_robin) return; + if (!has_inhomog_neumann && !has_robin) { return; } int ncomp = this->getNComp(); const int mglev = 0; diff --git a/Src/LinearSolvers/MLMG/AMReX_MLCellLinOp.H b/Src/LinearSolvers/MLMG/AMReX_MLCellLinOp.H index 9fa69d8de12..47916cd8b12 100644 --- a/Src/LinearSolvers/MLMG/AMReX_MLCellLinOp.H +++ b/Src/LinearSolvers/MLMG/AMReX_MLCellLinOp.H @@ -588,7 +588,7 @@ MLCellLinOpT::setLevelBC (int amrlev, const MF* a_levelbcdata, const MF* rob const Box& bhi = amrex::adjCellHi(vbx, idim); bool outside_domain_lo = !(domain.contains(blo)); bool outside_domain_hi = !(domain.contains(bhi)); - if ((!outside_domain_lo) && (!outside_domain_hi)) continue; + if ((!outside_domain_lo) && (!outside_domain_hi)) { continue; } for (int icomp = 0; icomp < ncomp; ++icomp) { Array4 const& rbc = (*m_robin_bcval[amrlev])[mfi].array(icomp*3); if (this->m_lobc_orig[icomp][idim] == LinOpBCType::Robin && outside_domain_lo) @@ -775,7 +775,7 @@ MLCellLinOpT::applyBC (int amrlev, int mglev, MF& in, BCMode bc_mode, StateM for (int idim = 0; idim < AMREX_SPACEDIM; ++idim) { - if (hidden_direction == idim) continue; + if (hidden_direction == idim) { continue; } const Orientation olo(idim,Orientation::low); const Orientation ohi(idim,Orientation::high); const Box blo = amrex::adjCellLo(vbx, idim); @@ -1408,7 +1408,7 @@ MLCellLinOpT::applyMetricTerm (int amrlev, int mglev, MF& rhs) const { amrex::ignore_unused(amrlev,mglev,rhs); #if (AMREX_SPACEDIM != 3) - if (!m_has_metric_term) return; + if (!m_has_metric_term) { return; } const int ncomp = rhs.nComp(); @@ -1464,7 +1464,7 @@ MLCellLinOpT::unapplyMetricTerm (int amrlev, int mglev, MF& rhs) const { amrex::ignore_unused(amrlev,mglev,rhs); #if (AMREX_SPACEDIM != 3) - if (!m_has_metric_term) return; + if (!m_has_metric_term) { return; } const int ncomp = rhs.nComp(); @@ -1808,7 +1808,7 @@ MLCellLinOpT::prepareForSolve () #endif for (int idim = 0; idim < AMREX_SPACEDIM; ++idim) { - if (idim == hidden_direction) continue; + if (idim == hidden_direction) { continue; } const Orientation olo(idim,Orientation::low); const Orientation ohi(idim,Orientation::high); const Box blo = amrex::adjCellLo(vbx, idim); @@ -1904,7 +1904,7 @@ template void MLCellLinOpT::computeVolInv () const { - if (!m_volinv.empty()) return; + if (!m_volinv.empty()) { return; } m_volinv.resize(this->m_num_amr_levels); for (int amrlev = 0; amrlev < this->m_num_amr_levels; ++amrlev) { @@ -2051,7 +2051,7 @@ MLCellLinOpT::normInf (int amrlev, MF const& mf, bool local) const -> RT } } - if (!local) ParallelAllReduce::Max(norm, ParallelContext::CommunicatorSub()); + if (!local) { ParallelAllReduce::Max(norm, ParallelContext::CommunicatorSub()); } return norm; } diff --git a/Src/LinearSolvers/MLMG/AMReX_MLEBTensorOp.cpp b/Src/LinearSolvers/MLMG/AMReX_MLEBTensorOp.cpp index 0538421683b..45082d4f80c 100644 --- a/Src/LinearSolvers/MLMG/AMReX_MLEBTensorOp.cpp +++ b/Src/LinearSolvers/MLMG/AMReX_MLEBTensorOp.cpp @@ -203,7 +203,7 @@ MLEBTensorOp::apply (int amrlev, int mglev, MultiFab& out, MultiFab& in, BCMode BL_PROFILE("MLEBTensorOp::apply()"); MLEBABecLap::apply(amrlev, mglev, out, in, bc_mode, s_mode, bndry); - if (mglev >= m_kappa[amrlev].size()) return; + if (mglev >= m_kappa[amrlev].size()) { return; } applyBCTensor(amrlev, mglev, in, bc_mode, s_mode, bndry); @@ -237,7 +237,7 @@ MLEBTensorOp::apply (int amrlev, int mglev, MultiFab& out, MultiFab& in, BCMode const Box& bx = mfi.tilebox(); auto fabtyp = (flags) ? (*flags)[mfi].getType(bx) : FabType::regular; - if (fabtyp == FabType::covered) continue; + if (fabtyp == FabType::covered) { continue; } Array4 const axfab = out.array(mfi); AMREX_D_TERM(Array4 const fxfab = fluxmf[0].const_array(mfi);, @@ -511,7 +511,7 @@ MLEBTensorOp::compFlux (int amrlev, const Array& fluxe const int ncomp = getNComp(); MLEBABecLap::compFlux(amrlev, fluxes, sol, loc); - if (mglev >= m_kappa[amrlev].size()) return; + if (mglev >= m_kappa[amrlev].size()) { return; } applyBCTensor(amrlev, mglev, sol, BCMode::Inhomogeneous, StateMode::Solution, m_bndry_sol[amrlev].get()); @@ -535,7 +535,7 @@ MLEBTensorOp::compFlux (int amrlev, const Array& fluxe const Box& bx = mfi.tilebox(); auto fabtyp = (flags) ? (*flags)[mfi].getType(bx) : FabType::regular; - if (fabtyp == FabType::covered) continue; + if (fabtyp == FabType::covered) { continue; } if (fabtyp == FabType::regular) { @@ -648,7 +648,7 @@ MLEBTensorOp::compVelGrad (int amrlev, const Box& bx = mfi.tilebox(); auto fabtyp = (flags) ? (*flags)[mfi].getType(bx) : FabType::regular; - if (fabtyp == FabType::covered) continue; + if (fabtyp == FabType::covered) { continue; } Array4 const vfab = sol.const_array(mfi); AMREX_D_TERM(Box const xbx = mfi.nodaltilebox(0);, diff --git a/Src/LinearSolvers/MLMG/AMReX_MLEBTensor_3D_K.H b/Src/LinearSolvers/MLMG/AMReX_MLEBTensor_3D_K.H index 55586e26ce8..2113d38ed50 100644 --- a/Src/LinearSolvers/MLMG/AMReX_MLEBTensor_3D_K.H +++ b/Src/LinearSolvers/MLMG/AMReX_MLEBTensor_3D_K.H @@ -823,8 +823,8 @@ void mlebtensor_cross_terms (Box const& box, Array4 const& Ax, if (apz(i,j,k+1) > Real(0.0) && apz(i,j,k+1) < Real(1.0)) { int ii = i + (fcz(i,j,k+1,0) >= Real(0.0) ? 1 : -1); int jj = j + (fcz(i,j,k+1,1) >= Real(0.0) ? 1 : -1); - Real fracx = (ccm(ii,j,k) || ccm(ii,j,k)) ? std::abs(fcz(i,j,k+1,0)) : Real(0.0); - Real fracy = (ccm(i,jj,k) || ccm(i,jj,k)) ? std::abs(fcz(i,j,k+1,1)) : Real(0.0); + Real fracx = (ccm(ii,j,k) || ccm(ii,j,k+1)) ? std::abs(fcz(i,j,k+1,0)) : Real(0.0); + Real fracy = (ccm(i,jj,k) || ccm(i,jj,k+1)) ? std::abs(fcz(i,j,k+1,1)) : Real(0.0); fzp_0 = (Real(1.0)-fracx)*(Real(1.0)-fracy) * fzp_0 + fracx*(Real(1.0)-fracy) * fz(ii,j ,k+1,0) + fracy*(Real(1.0)-fracx) * fz(i ,jj,k+1,0) diff --git a/Src/LinearSolvers/MLMG/AMReX_MLLinOp.H b/Src/LinearSolvers/MLMG/AMReX_MLLinOp.H index 83986a09baf..f42088aa100 100644 --- a/Src/LinearSolvers/MLMG/AMReX_MLLinOp.H +++ b/Src/LinearSolvers/MLMG/AMReX_MLLinOp.H @@ -538,7 +538,7 @@ protected: void operator= (CommContainer&&) = delete; ~CommContainer () { // NOLINT(modernize-use-equals-default) #ifdef BL_USE_MPI - if (comm != MPI_COMM_NULL) MPI_Comm_free(&comm); + if (comm != MPI_COMM_NULL) { MPI_Comm_free(&comm); } #endif } }; @@ -704,14 +704,14 @@ MLLinOpT::define (const Vector& a_geom, #ifdef AMREX_USE_GPU if (Gpu::notInLaunchRegion()) { - if (info.agg_grid_size <= 0) info.agg_grid_size = AMREX_D_PICK(32, 16, 8); - if (info.con_grid_size <= 0) info.con_grid_size = AMREX_D_PICK(32, 16, 8); + if (info.agg_grid_size <= 0) { info.agg_grid_size = AMREX_D_PICK(32, 16, 8); } + if (info.con_grid_size <= 0) { info.con_grid_size = AMREX_D_PICK(32, 16, 8); } } else #endif { - if (info.agg_grid_size <= 0) info.agg_grid_size = LPInfo::getDefaultAgglomerationGridSize(); - if (info.con_grid_size <= 0) info.con_grid_size = LPInfo::getDefaultConsolidationGridSize(); + if (info.agg_grid_size <= 0) { info.agg_grid_size = LPInfo::getDefaultAgglomerationGridSize(); } + if (info.con_grid_size <= 0) { info.con_grid_size = LPInfo::getDefaultConsolidationGridSize(); } } #ifdef AMREX_USE_EB @@ -780,10 +780,10 @@ MLLinOpT::defineGrids (const Vector& a_geom, const Box& dom = a_geom[amrlev].Domain(); for (int i = 0; i < 2; ++i) { - if (!dom.coarsenable(rr)) amrex::Abort("MLLinOp: Uncoarsenable domain"); + if (!dom.coarsenable(rr)) { amrex::Abort("MLLinOp: Uncoarsenable domain"); } const Box& cdom = amrex::coarsen(dom,rr); - if (cdom == a_geom[amrlev-1].Domain()) break; + if (cdom == a_geom[amrlev-1].Domain()) { break; } ++(m_num_mg_levels[amrlev]); @@ -824,7 +824,7 @@ MLLinOpT::defineGrids (const Vector& a_geom, m_domain_covered[0] = (npts0 == compactify(m_geom[0][0].Domain()).numPts()); for (int amrlev = 1; amrlev < m_num_amr_levels; ++amrlev) { - if (!m_domain_covered[amrlev-1]) break; + if (!m_domain_covered[amrlev-1]) { break; } m_domain_covered[amrlev] = (m_grids[amrlev][0].numPts() == compactify(m_geom[amrlev][0].Domain()).numPts()); } diff --git a/Src/LinearSolvers/MLMG/AMReX_MLMG.H b/Src/LinearSolvers/MLMG/AMReX_MLMG.H index ccc54128f7c..7fc822afa23 100644 --- a/Src/LinearSolvers/MLMG/AMReX_MLMG.H +++ b/Src/LinearSolvers/MLMG/AMReX_MLMG.H @@ -426,7 +426,7 @@ MLMGT::solve (const Vector& a_sol, const Vector& a_rhs, // Test convergence on the fine amr level computeResidual(finest_amr_lev); - if (is_nsolve) continue; + if (is_nsolve) { continue; } RT fine_norminf = ResNormInf(finest_amr_lev); m_iter_fine_resnorm0.push_back(fine_norminf); @@ -916,7 +916,7 @@ MLMGT::apply (const Vector& out, const Vector& a_in) #endif for (int alev = 0; alev <= finest_amr_lev; ++alev) { - if (cf_strategy == CFStrategy::ghostnodes) nghost = linop.getNGrow(alev); + if (cf_strategy == CFStrategy::ghostnodes) { nghost = linop.getNGrow(alev); } out[alev]->negate(nghost); } } @@ -1417,7 +1417,7 @@ MLMGT::actualBottomSolve () { BL_PROFILE("MLMG::actualBottomSolve()"); - if (!linop.isBottomActive()) return; + if (!linop.isBottomActive()) { return; } auto bottom_start_time = amrex::second(); @@ -1572,7 +1572,9 @@ MLMGT::computeResWithCrseSolFineCor (int calev, int falev) BL_PROFILE("MLMG::computeResWithCrseSolFineCor()"); IntVect nghost(0); - if (cf_strategy == CFStrategy::ghostnodes) nghost = IntVect(std::min(linop.getNGrow(falev),linop.getNGrow(calev))); + if (cf_strategy == CFStrategy::ghostnodes) { + nghost = IntVect(std::min(linop.getNGrow(falev),linop.getNGrow(calev))); + } MF& crse_sol = sol[calev]; const MF& crse_rhs = rhs[calev]; @@ -1603,7 +1605,9 @@ MLMGT::computeResWithCrseCorFineCor (int falev) BL_PROFILE("MLMG::computeResWithCrseCorFineCor()"); IntVect nghost(0); - if (cf_strategy == CFStrategy::ghostnodes) nghost = IntVect(linop.getNGrow(falev)); + if (cf_strategy == CFStrategy::ghostnodes) { + nghost = IntVect(linop.getNGrow(falev)); + } const MF& crse_cor = cor[falev-1][0]; @@ -1625,7 +1629,9 @@ MLMGT::interpCorrection (int alev) BL_PROFILE("MLMG::interpCorrection_1"); IntVect nghost(0); - if (cf_strategy == CFStrategy::ghostnodes) nghost = IntVect(linop.getNGrow(alev)); + if (cf_strategy == CFStrategy::ghostnodes) { + nghost = IntVect(linop.getNGrow(alev)); + } MF const& crse_cor = cor[alev-1][0]; MF & fine_cor = cor[alev ][0]; @@ -1724,7 +1730,7 @@ MLMGT::MLResNormInf (int alevmax, bool local) -> RT { r = std::max(r, ResNormInf(alev,true)); } - if (!local) ParallelAllReduce::Max(r, ParallelContext::CommunicatorSub()); + if (!local) { ParallelAllReduce::Max(r, ParallelContext::CommunicatorSub()); } return r; } @@ -1739,7 +1745,7 @@ MLMGT::MLRhsNormInf (bool local) -> RT auto t = linop.normInf(alev, rhs[alev], true); r = std::max(r, t); } - if (!local) ParallelAllReduce::Max(r, ParallelContext::CommunicatorSub()); + if (!local) { ParallelAllReduce::Max(r, ParallelContext::CommunicatorSub()); } return r; } diff --git a/Src/LinearSolvers/MLMG/AMReX_MLNodeLap_2D_K.H b/Src/LinearSolvers/MLMG/AMReX_MLNodeLap_2D_K.H index d34290c0162..a98824c4fee 100644 --- a/Src/LinearSolvers/MLMG/AMReX_MLNodeLap_2D_K.H +++ b/Src/LinearSolvers/MLMG/AMReX_MLNodeLap_2D_K.H @@ -190,7 +190,7 @@ void mlndlap_bc_doit (Box const& vbx, Array4 const& a, Box const& domain, if (! bfhi[idim]) gdomain.growHi(idim,1); } - if (gdomain.strictly_contains(vbx)) return; + if (gdomain.strictly_contains(vbx)) { return; } const int offset = domain.cellCentered() ? 0 : 1; @@ -1326,14 +1326,10 @@ void mlndlap_crse_resid (int i, int j, int k, Array4 const& resid, GpuArray const& bchi, bool neumann_doubling) noexcept { - if ((msk(i-1,j-1,k ) == 0 || + if ( msk(i-1,j-1,k ) == 0 || msk(i ,j-1,k ) == 0 || msk(i-1,j ,k ) == 0 || - msk(i ,j ,k ) == 0) && - (msk(i-1,j-1,k ) == 0 || - msk(i ,j-1,k ) == 0 || - msk(i-1,j ,k ) == 0 || - msk(i ,j ,k ) == 0)) + msk(i ,j ,k ) == 0 ) { Real fac = Real(1.0); if (neumann_doubling) { @@ -2905,7 +2901,7 @@ void mlndlap_fillijmat_sten_gpu (const int ps, const int i, const int j, const i } ++nelems; } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 2 || offset == 0) { @@ -2916,7 +2912,7 @@ void mlndlap_fillijmat_sten_gpu (const int ps, const int i, const int j, const i } ++nelems; } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 3 || offset == 0) { @@ -2927,7 +2923,7 @@ void mlndlap_fillijmat_sten_gpu (const int ps, const int i, const int j, const i } ++nelems; } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 4 || offset == 0) { @@ -2938,7 +2934,7 @@ void mlndlap_fillijmat_sten_gpu (const int ps, const int i, const int j, const i } ++nelems; } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 5 || offset == 0) { @@ -2949,7 +2945,7 @@ void mlndlap_fillijmat_sten_gpu (const int ps, const int i, const int j, const i } ++nelems; } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 6 || offset == 0) { @@ -2960,7 +2956,7 @@ void mlndlap_fillijmat_sten_gpu (const int ps, const int i, const int j, const i } ++nelems; } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 7 || offset == 0) { @@ -2971,7 +2967,7 @@ void mlndlap_fillijmat_sten_gpu (const int ps, const int i, const int j, const i } ++nelems; } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 8 || offset == 0) { @@ -2982,7 +2978,7 @@ void mlndlap_fillijmat_sten_gpu (const int ps, const int i, const int j, const i } ++nelems; } - if (offset != 0) return; + if (offset != 0) { return; } } // Only offset == 0 could get this far. @@ -3038,7 +3034,7 @@ void mlndlap_fillijmat_aa_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 2 || offset == 0) { @@ -3059,7 +3055,7 @@ void mlndlap_fillijmat_aa_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 3 || offset == 0) { @@ -3074,7 +3070,7 @@ void mlndlap_fillijmat_aa_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 4 || offset == 0) { @@ -3095,7 +3091,7 @@ void mlndlap_fillijmat_aa_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 5 || offset == 0) { @@ -3116,7 +3112,7 @@ void mlndlap_fillijmat_aa_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 6 || offset == 0) { @@ -3131,7 +3127,7 @@ void mlndlap_fillijmat_aa_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 7 || offset == 0) { @@ -3152,7 +3148,7 @@ void mlndlap_fillijmat_aa_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 8 || offset == 0) { @@ -3167,7 +3163,7 @@ void mlndlap_fillijmat_aa_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } // Only offset == 0 could get this far. @@ -3221,7 +3217,7 @@ void mlndlap_fillijmat_ha_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 2 || offset == 0) { @@ -3244,7 +3240,7 @@ void mlndlap_fillijmat_ha_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 3 || offset == 0) { @@ -3259,7 +3255,7 @@ void mlndlap_fillijmat_ha_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 4 || offset == 0) { @@ -3282,7 +3278,7 @@ void mlndlap_fillijmat_ha_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 5 || offset == 0) { @@ -3305,7 +3301,7 @@ void mlndlap_fillijmat_ha_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 6 || offset == 0) { @@ -3320,7 +3316,7 @@ void mlndlap_fillijmat_ha_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 7 || offset == 0) { @@ -3343,7 +3339,7 @@ void mlndlap_fillijmat_ha_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 8 || offset == 0) { @@ -3358,7 +3354,7 @@ void mlndlap_fillijmat_ha_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } // Only offset == 0 could get this far. @@ -3414,7 +3410,7 @@ void mlndlap_fillijmat_cs_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 2 || offset == 0) { @@ -3435,7 +3431,7 @@ void mlndlap_fillijmat_cs_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 3 || offset == 0) { @@ -3450,7 +3446,7 @@ void mlndlap_fillijmat_cs_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 4 || offset == 0) { @@ -3471,7 +3467,7 @@ void mlndlap_fillijmat_cs_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 5 || offset == 0) { @@ -3492,7 +3488,7 @@ void mlndlap_fillijmat_cs_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 6 || offset == 0) { @@ -3507,7 +3503,7 @@ void mlndlap_fillijmat_cs_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 7 || offset == 0) { @@ -3528,7 +3524,7 @@ void mlndlap_fillijmat_cs_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 8 || offset == 0) { @@ -3543,7 +3539,7 @@ void mlndlap_fillijmat_cs_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } // Only offset == 0 could get this far. diff --git a/Src/LinearSolvers/MLMG/AMReX_MLNodeLap_3D_K.H b/Src/LinearSolvers/MLMG/AMReX_MLNodeLap_3D_K.H index 53ea8d9ae10..23b69982bba 100644 --- a/Src/LinearSolvers/MLMG/AMReX_MLNodeLap_3D_K.H +++ b/Src/LinearSolvers/MLMG/AMReX_MLNodeLap_3D_K.H @@ -262,7 +262,7 @@ inline void mlndlap_bc_doit (Box const& vbx, Array4 const& a, Box const& doma if (! bfhi[idim]) gdomain.growHi(idim,1); } - if (gdomain.strictly_contains(vbx)) return; + if (gdomain.strictly_contains(vbx)) { return; } const int offset = domain.cellCentered() ? 0 : 1; @@ -2417,22 +2417,14 @@ void mlndlap_crse_resid (int i, int j, int k, Array4 const& resid, GpuArray const& bchi, bool neumann_doubling) noexcept { - if ((msk(i-1,j-1,k-1) == 0 || + if ( msk(i-1,j-1,k-1) == 0 || msk(i ,j-1,k-1) == 0 || msk(i-1,j ,k-1) == 0 || msk(i ,j ,k-1) == 0 || msk(i-1,j-1,k ) == 0 || msk(i ,j-1,k ) == 0 || msk(i-1,j ,k ) == 0 || - msk(i ,j ,k ) == 0) && - (msk(i-1,j-1,k-1) == 0 || - msk(i ,j-1,k-1) == 0 || - msk(i-1,j ,k-1) == 0 || - msk(i ,j ,k-1) == 0 || - msk(i-1,j-1,k ) == 0 || - msk(i ,j-1,k ) == 0 || - msk(i-1,j ,k ) == 0 || - msk(i ,j ,k ) == 0)) + msk(i ,j ,k ) == 0 ) { Real fac = Real(1.0); if (neumann_doubling) { @@ -8719,7 +8711,7 @@ void mlndlap_fillijmat_sten_gpu (const int ps, const int i, const int j, const i } ++nelems; } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 2 || offset == 0) { @@ -8730,7 +8722,7 @@ void mlndlap_fillijmat_sten_gpu (const int ps, const int i, const int j, const i } ++nelems; } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 3 || offset == 0) { @@ -8741,7 +8733,7 @@ void mlndlap_fillijmat_sten_gpu (const int ps, const int i, const int j, const i } ++nelems; } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 4 || offset == 0) { @@ -8752,7 +8744,7 @@ void mlndlap_fillijmat_sten_gpu (const int ps, const int i, const int j, const i } ++nelems; } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 5 || offset == 0) { @@ -8763,7 +8755,7 @@ void mlndlap_fillijmat_sten_gpu (const int ps, const int i, const int j, const i } ++nelems; } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 6 || offset == 0) { @@ -8774,7 +8766,7 @@ void mlndlap_fillijmat_sten_gpu (const int ps, const int i, const int j, const i } ++nelems; } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 7 || offset == 0) { @@ -8785,7 +8777,7 @@ void mlndlap_fillijmat_sten_gpu (const int ps, const int i, const int j, const i } ++nelems; } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 8 || offset == 0) { @@ -8796,7 +8788,7 @@ void mlndlap_fillijmat_sten_gpu (const int ps, const int i, const int j, const i } ++nelems; } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 9 || offset == 0) { @@ -8807,7 +8799,7 @@ void mlndlap_fillijmat_sten_gpu (const int ps, const int i, const int j, const i } ++nelems; } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 10 || offset == 0) { @@ -8818,7 +8810,7 @@ void mlndlap_fillijmat_sten_gpu (const int ps, const int i, const int j, const i } ++nelems; } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 11 || offset == 0) { @@ -8829,7 +8821,7 @@ void mlndlap_fillijmat_sten_gpu (const int ps, const int i, const int j, const i } ++nelems; } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 12 || offset == 0) { @@ -8840,7 +8832,7 @@ void mlndlap_fillijmat_sten_gpu (const int ps, const int i, const int j, const i } ++nelems; } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 13 || offset == 0) { @@ -8851,7 +8843,7 @@ void mlndlap_fillijmat_sten_gpu (const int ps, const int i, const int j, const i } ++nelems; } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 14 || offset == 0) { @@ -8862,7 +8854,7 @@ void mlndlap_fillijmat_sten_gpu (const int ps, const int i, const int j, const i } ++nelems; } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 15 || offset == 0) { @@ -8873,7 +8865,7 @@ void mlndlap_fillijmat_sten_gpu (const int ps, const int i, const int j, const i } ++nelems; } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 16 || offset == 0) { @@ -8884,7 +8876,7 @@ void mlndlap_fillijmat_sten_gpu (const int ps, const int i, const int j, const i } ++nelems; } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 17 || offset == 0) { @@ -8895,7 +8887,7 @@ void mlndlap_fillijmat_sten_gpu (const int ps, const int i, const int j, const i } ++nelems; } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 18 || offset == 0) { @@ -8906,7 +8898,7 @@ void mlndlap_fillijmat_sten_gpu (const int ps, const int i, const int j, const i } ++nelems; } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 19 || offset == 0) { @@ -8917,7 +8909,7 @@ void mlndlap_fillijmat_sten_gpu (const int ps, const int i, const int j, const i } ++nelems; } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 20 || offset == 0) { @@ -8928,7 +8920,7 @@ void mlndlap_fillijmat_sten_gpu (const int ps, const int i, const int j, const i } ++nelems; } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 21 || offset == 0) { @@ -8939,7 +8931,7 @@ void mlndlap_fillijmat_sten_gpu (const int ps, const int i, const int j, const i } ++nelems; } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 22 || offset == 0) { @@ -8950,7 +8942,7 @@ void mlndlap_fillijmat_sten_gpu (const int ps, const int i, const int j, const i } ++nelems; } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 23 || offset == 0) { @@ -8961,7 +8953,7 @@ void mlndlap_fillijmat_sten_gpu (const int ps, const int i, const int j, const i } ++nelems; } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 24 || offset == 0) { @@ -8972,7 +8964,7 @@ void mlndlap_fillijmat_sten_gpu (const int ps, const int i, const int j, const i } ++nelems; } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 25 || offset == 0) { @@ -8983,7 +8975,7 @@ void mlndlap_fillijmat_sten_gpu (const int ps, const int i, const int j, const i } ++nelems; } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 26 || offset == 0) { @@ -8994,7 +8986,7 @@ void mlndlap_fillijmat_sten_gpu (const int ps, const int i, const int j, const i } ++nelems; } - if (offset != 0) return; + if (offset != 0) { return; } } // Only offset == 0 could get this far. @@ -9047,7 +9039,7 @@ void mlndlap_fillijmat_aa_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 2 || offset == 0) { @@ -9068,7 +9060,7 @@ void mlndlap_fillijmat_aa_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 3 || offset == 0) { @@ -9083,7 +9075,7 @@ void mlndlap_fillijmat_aa_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 4 || offset == 0) { @@ -9104,7 +9096,7 @@ void mlndlap_fillijmat_aa_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 5 || offset == 0) { @@ -9131,7 +9123,7 @@ void mlndlap_fillijmat_aa_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 6 || offset == 0) { @@ -9152,7 +9144,7 @@ void mlndlap_fillijmat_aa_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 7 || offset == 0) { @@ -9167,7 +9159,7 @@ void mlndlap_fillijmat_aa_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 8 || offset == 0) { @@ -9188,7 +9180,7 @@ void mlndlap_fillijmat_aa_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 9 || offset == 0) { @@ -9203,7 +9195,7 @@ void mlndlap_fillijmat_aa_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 10 || offset == 0) { @@ -9224,7 +9216,7 @@ void mlndlap_fillijmat_aa_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 11 || offset == 0) { @@ -9251,7 +9243,7 @@ void mlndlap_fillijmat_aa_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 12 || offset == 0) { @@ -9272,7 +9264,7 @@ void mlndlap_fillijmat_aa_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 13 || offset == 0) { @@ -9299,7 +9291,7 @@ void mlndlap_fillijmat_aa_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 14 || offset == 0) { @@ -9326,7 +9318,7 @@ void mlndlap_fillijmat_aa_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 15 || offset == 0) { @@ -9347,7 +9339,7 @@ void mlndlap_fillijmat_aa_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 16 || offset == 0) { @@ -9374,7 +9366,7 @@ void mlndlap_fillijmat_aa_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 17 || offset == 0) { @@ -9395,7 +9387,7 @@ void mlndlap_fillijmat_aa_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 18 || offset == 0) { @@ -9410,7 +9402,7 @@ void mlndlap_fillijmat_aa_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 19 || offset == 0) { @@ -9431,7 +9423,7 @@ void mlndlap_fillijmat_aa_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 20 || offset == 0) { @@ -9446,7 +9438,7 @@ void mlndlap_fillijmat_aa_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 21 || offset == 0) { @@ -9467,7 +9459,7 @@ void mlndlap_fillijmat_aa_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 22 || offset == 0) { @@ -9494,7 +9486,7 @@ void mlndlap_fillijmat_aa_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 23 || offset == 0) { @@ -9515,7 +9507,7 @@ void mlndlap_fillijmat_aa_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 24 || offset == 0) { @@ -9530,7 +9522,7 @@ void mlndlap_fillijmat_aa_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 25 || offset == 0) { @@ -9551,7 +9543,7 @@ void mlndlap_fillijmat_aa_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 26 || offset == 0) { @@ -9566,7 +9558,7 @@ void mlndlap_fillijmat_aa_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } // Only offset == 0 could get this far. @@ -9616,7 +9608,7 @@ void mlndlap_fillijmat_ha_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 2 || offset == 0) { @@ -9641,7 +9633,7 @@ void mlndlap_fillijmat_ha_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 3 || offset == 0) { @@ -9658,7 +9650,7 @@ void mlndlap_fillijmat_ha_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 4 || offset == 0) { @@ -9683,7 +9675,7 @@ void mlndlap_fillijmat_ha_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 5 || offset == 0) { @@ -9719,7 +9711,7 @@ void mlndlap_fillijmat_ha_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 6 || offset == 0) { @@ -9744,7 +9736,7 @@ void mlndlap_fillijmat_ha_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 7 || offset == 0) { @@ -9761,7 +9753,7 @@ void mlndlap_fillijmat_ha_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 8 || offset == 0) { @@ -9786,7 +9778,7 @@ void mlndlap_fillijmat_ha_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 9 || offset == 0) { @@ -9803,7 +9795,7 @@ void mlndlap_fillijmat_ha_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 10 || offset == 0) { @@ -9828,7 +9820,7 @@ void mlndlap_fillijmat_ha_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 11 || offset == 0) { @@ -9863,7 +9855,7 @@ void mlndlap_fillijmat_ha_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 12 || offset == 0) { @@ -9888,7 +9880,7 @@ void mlndlap_fillijmat_ha_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 13 || offset == 0) { @@ -9923,7 +9915,7 @@ void mlndlap_fillijmat_ha_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 14 || offset == 0) { @@ -9958,7 +9950,7 @@ void mlndlap_fillijmat_ha_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 15 || offset == 0) { @@ -9983,7 +9975,7 @@ void mlndlap_fillijmat_ha_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 16 || offset == 0) { @@ -10018,7 +10010,7 @@ void mlndlap_fillijmat_ha_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 17 || offset == 0) { @@ -10043,7 +10035,7 @@ void mlndlap_fillijmat_ha_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 18 || offset == 0) { @@ -10060,7 +10052,7 @@ void mlndlap_fillijmat_ha_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 19 || offset == 0) { @@ -10085,7 +10077,7 @@ void mlndlap_fillijmat_ha_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 20 || offset == 0) { @@ -10102,7 +10094,7 @@ void mlndlap_fillijmat_ha_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 21 || offset == 0) { @@ -10127,7 +10119,7 @@ void mlndlap_fillijmat_ha_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 22 || offset == 0) { @@ -10162,7 +10154,7 @@ void mlndlap_fillijmat_ha_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 23 || offset == 0) { @@ -10187,7 +10179,7 @@ void mlndlap_fillijmat_ha_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 24 || offset == 0) { @@ -10204,7 +10196,7 @@ void mlndlap_fillijmat_ha_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 25 || offset == 0) { @@ -10229,7 +10221,7 @@ void mlndlap_fillijmat_ha_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 26 || offset == 0) { @@ -10246,7 +10238,7 @@ void mlndlap_fillijmat_ha_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } // Only offset == 0 could get this far. @@ -10298,7 +10290,7 @@ void mlndlap_fillijmat_cs_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 2 || offset == 0) { @@ -10319,7 +10311,7 @@ void mlndlap_fillijmat_cs_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 3 || offset == 0) { @@ -10334,7 +10326,7 @@ void mlndlap_fillijmat_cs_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 4 || offset == 0) { @@ -10355,7 +10347,7 @@ void mlndlap_fillijmat_cs_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 5 || offset == 0) { @@ -10382,7 +10374,7 @@ void mlndlap_fillijmat_cs_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 6 || offset == 0) { @@ -10403,7 +10395,7 @@ void mlndlap_fillijmat_cs_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 7 || offset == 0) { @@ -10418,7 +10410,7 @@ void mlndlap_fillijmat_cs_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 8 || offset == 0) { @@ -10439,7 +10431,7 @@ void mlndlap_fillijmat_cs_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 9 || offset == 0) { @@ -10454,7 +10446,7 @@ void mlndlap_fillijmat_cs_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 10 || offset == 0) { @@ -10475,7 +10467,7 @@ void mlndlap_fillijmat_cs_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 11 || offset == 0) { @@ -10502,7 +10494,7 @@ void mlndlap_fillijmat_cs_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 12 || offset == 0) { @@ -10523,7 +10515,7 @@ void mlndlap_fillijmat_cs_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 13 || offset == 0) { @@ -10550,7 +10542,7 @@ void mlndlap_fillijmat_cs_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 14 || offset == 0) { @@ -10577,7 +10569,7 @@ void mlndlap_fillijmat_cs_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 15 || offset == 0) { @@ -10598,7 +10590,7 @@ void mlndlap_fillijmat_cs_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 16 || offset == 0) { @@ -10625,7 +10617,7 @@ void mlndlap_fillijmat_cs_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 17 || offset == 0) { @@ -10646,7 +10638,7 @@ void mlndlap_fillijmat_cs_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 18 || offset == 0) { @@ -10661,7 +10653,7 @@ void mlndlap_fillijmat_cs_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 19 || offset == 0) { @@ -10682,7 +10674,7 @@ void mlndlap_fillijmat_cs_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 20 || offset == 0) { @@ -10697,7 +10689,7 @@ void mlndlap_fillijmat_cs_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 21 || offset == 0) { @@ -10718,7 +10710,7 @@ void mlndlap_fillijmat_cs_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 22 || offset == 0) { @@ -10745,7 +10737,7 @@ void mlndlap_fillijmat_cs_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 23 || offset == 0) { @@ -10766,7 +10758,7 @@ void mlndlap_fillijmat_cs_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 24 || offset == 0) { @@ -10781,7 +10773,7 @@ void mlndlap_fillijmat_cs_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 25 || offset == 0) { @@ -10802,7 +10794,7 @@ void mlndlap_fillijmat_cs_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } if (offset == 26 || offset == 0) { @@ -10817,7 +10809,7 @@ void mlndlap_fillijmat_cs_gpu (const int ps, const int i, const int j, const int ++nelems; } } - if (offset != 0) return; + if (offset != 0) { return; } } // Only offset == 0 could get this far. diff --git a/Src/LinearSolvers/MLMG/AMReX_MLNodeLap_K.H b/Src/LinearSolvers/MLMG/AMReX_MLNodeLap_K.H index 211c4abf6a2..32bd012ac34 100644 --- a/Src/LinearSolvers/MLMG/AMReX_MLNodeLap_K.H +++ b/Src/LinearSolvers/MLMG/AMReX_MLNodeLap_K.H @@ -206,7 +206,7 @@ bool mlndlap_any_fine_sync_cells (Box const& bx, Array4 const& msk, i for (int k = lo.z; k <= hi.z; ++k) { for (int j = lo.y; j <= hi.y; ++j) { for (int i = lo.x; i <= hi.x; ++i) { - if (msk(i,j,k) == fine_flag) return true; + if (msk(i,j,k) == fine_flag) { return true; } }}} return false; } diff --git a/Src/LinearSolvers/MLMG/AMReX_MLNodeLaplacian.H b/Src/LinearSolvers/MLMG/AMReX_MLNodeLaplacian.H index d284eff33ee..7ec9f13ce73 100644 --- a/Src/LinearSolvers/MLMG/AMReX_MLNodeLaplacian.H +++ b/Src/LinearSolvers/MLMG/AMReX_MLNodeLaplacian.H @@ -81,7 +81,7 @@ public : void setMapped (bool flag) noexcept { m_use_mapped = flag; } void setCoarseningStrategy (CoarseningStrategy cs) noexcept { - if (m_const_sigma == Real(0.0)) m_coarsening_strategy = cs; + if (m_const_sigma == Real(0.0)) { m_coarsening_strategy = cs; } } void setSmoothNumSweeps (int nsweeps) noexcept { diff --git a/Src/LinearSolvers/MLMG/AMReX_MLNodeLaplacian.cpp b/Src/LinearSolvers/MLMG/AMReX_MLNodeLaplacian.cpp index e33bdfdb21d..23e81402021 100644 --- a/Src/LinearSolvers/MLMG/AMReX_MLNodeLaplacian.cpp +++ b/Src/LinearSolvers/MLMG/AMReX_MLNodeLaplacian.cpp @@ -838,7 +838,7 @@ MLNodeLaplacian::normalize (int amrlev, int mglev, MultiFab& mf) const { BL_PROFILE("MLNodeLaplacian::normalize()"); - if (m_sigma[0][0][0] == nullptr) return; + if (m_sigma[0][0][0] == nullptr) { return; } const auto& sigma = m_sigma[amrlev][mglev]; const auto& stencil = m_stencil[amrlev][mglev]; diff --git a/Src/LinearSolvers/MLMG/AMReX_MLNodeLaplacian_eb.cpp b/Src/LinearSolvers/MLMG/AMReX_MLNodeLaplacian_eb.cpp index 67ebc27b884..eebfc961bb3 100644 --- a/Src/LinearSolvers/MLMG/AMReX_MLNodeLaplacian_eb.cpp +++ b/Src/LinearSolvers/MLMG/AMReX_MLNodeLaplacian_eb.cpp @@ -14,7 +14,7 @@ namespace amrex { void MLNodeLaplacian::buildIntegral () { - if (m_integral_built) return; + if (m_integral_built) { return; } BL_PROFILE("MLNodeLaplacian::buildIntegral()"); @@ -83,7 +83,7 @@ MLNodeLaplacian::buildIntegral () void MLNodeLaplacian::buildSurfaceIntegral () { - if (m_surface_integral_built) return; + if (m_surface_integral_built) { return; } BL_PROFILE("MLNodeLaplacian::buildSurfaceIntegral()"); diff --git a/Src/LinearSolvers/MLMG/AMReX_MLNodeLaplacian_misc.cpp b/Src/LinearSolvers/MLMG/AMReX_MLNodeLaplacian_misc.cpp index 907b0483400..c9e2637c1a2 100644 --- a/Src/LinearSolvers/MLMG/AMReX_MLNodeLaplacian_misc.cpp +++ b/Src/LinearSolvers/MLMG/AMReX_MLNodeLaplacian_misc.cpp @@ -18,7 +18,7 @@ MLNodeLaplacian::averageDownCoeffs () { BL_PROFILE("MLNodeLaplacian::averageDownCoeffs()"); - if (m_sigma[0][0][0] == nullptr) return; + if (m_sigma[0][0][0] == nullptr) { return; } if (m_coarsening_strategy == CoarseningStrategy::Sigma) { @@ -85,7 +85,7 @@ MLNodeLaplacian::averageDownCoeffs () void MLNodeLaplacian::averageDownCoeffsToCoarseAmrLevel (int flev) { - if (m_sigma[0][0][0] == nullptr) return; + if (m_sigma[0][0][0] == nullptr) { return; } const int mglev = 0; const int idim = 0; // other dimensions are just aliases @@ -101,9 +101,9 @@ MLNodeLaplacian::averageDownCoeffsToCoarseAmrLevel (int flev) void MLNodeLaplacian::averageDownCoeffsSameAmrLevel (int amrlev) { - if (m_sigma[0][0][0] == nullptr) return; + if (m_sigma[0][0][0] == nullptr) { return; } - if (m_coarsening_strategy != CoarseningStrategy::Sigma) return; + if (m_coarsening_strategy != CoarseningStrategy::Sigma) { return; } #if (AMREX_SPACEDIM == 1) const int nsigma = 1; diff --git a/Src/LinearSolvers/MLMG/AMReX_MLNodeLaplacian_sten.cpp b/Src/LinearSolvers/MLMG/AMReX_MLNodeLaplacian_sten.cpp index 8a71c6cf760..ff3548cb4d8 100644 --- a/Src/LinearSolvers/MLMG/AMReX_MLNodeLaplacian_sten.cpp +++ b/Src/LinearSolvers/MLMG/AMReX_MLNodeLaplacian_sten.cpp @@ -25,7 +25,7 @@ MLNodeLaplacian::buildStencil () m_s0_norm0[amrlev].resize(m_num_mg_levels[amrlev],0.0); } - if (m_coarsening_strategy != CoarseningStrategy::RAP) return; + if (m_coarsening_strategy != CoarseningStrategy::RAP) { return; } const int ncomp_s = (AMREX_SPACEDIM == 2) ? 5 : 9; AMREX_ALWAYS_ASSERT_WITH_MESSAGE(AMREX_SPACEDIM != 1, diff --git a/Src/LinearSolvers/MLMG/AMReX_MLNodeLinOp.cpp b/Src/LinearSolvers/MLMG/AMReX_MLNodeLinOp.cpp index f6f6dbd80e6..14a58922c5e 100644 --- a/Src/LinearSolvers/MLMG/AMReX_MLNodeLinOp.cpp +++ b/Src/LinearSolvers/MLMG/AMReX_MLNodeLinOp.cpp @@ -257,7 +257,7 @@ void MLNodeLinOp_set_dot_mask (MultiFab& dot_mask, iMultiFab const& omask, Geome void MLNodeLinOp::buildMasks () { - if (m_masks_built) return; + if (m_masks_built) { return; } BL_PROFILE("MLNodeLinOp::buildMasks()"); diff --git a/Src/LinearSolvers/MLMG/AMReX_MLPoisson.H b/Src/LinearSolvers/MLMG/AMReX_MLPoisson.H index 8cf808c073b..0586f833d53 100644 --- a/Src/LinearSolvers/MLMG/AMReX_MLPoisson.H +++ b/Src/LinearSolvers/MLMG/AMReX_MLPoisson.H @@ -299,7 +299,7 @@ MLPoissonT::normalize (int amrlev, int mglev, MF& mf) const #if (AMREX_SPACEDIM != 3) BL_PROFILE("MLPoisson::normalize()"); - if (!this->m_has_metric_term) return; + if (!this->m_has_metric_term) { return; } const Real* dxinv = this->m_geom[amrlev][mglev].InvCellSize(); AMREX_D_TERM(const RT dhx = RT(dxinv[0]*dxinv[0]);, diff --git a/Src/LinearSolvers/MLMG/AMReX_MLTensorOp.cpp b/Src/LinearSolvers/MLMG/AMReX_MLTensorOp.cpp index f8a7ff71b97..adbc1b20c49 100644 --- a/Src/LinearSolvers/MLMG/AMReX_MLTensorOp.cpp +++ b/Src/LinearSolvers/MLMG/AMReX_MLTensorOp.cpp @@ -207,7 +207,7 @@ MLTensorOp::apply (int amrlev, int mglev, MultiFab& out, MultiFab& in, BCMode bc MLABecLaplacian::apply(amrlev, mglev, out, in, bc_mode, s_mode, bndry); - if (mglev >= m_kappa[amrlev].size()) return; + if (mglev >= m_kappa[amrlev].size()) { return; } applyBCTensor(amrlev, mglev, in, bc_mode, s_mode, bndry); diff --git a/Src/Particle/AMReX_NeighborList.H b/Src/Particle/AMReX_NeighborList.H index 28afc3bce9d..330bef29834 100644 --- a/Src/Particle/AMReX_NeighborList.H +++ b/Src/Particle/AMReX_NeighborList.H @@ -375,7 +375,7 @@ public: for (auto p = poffset[index]; p < poffset[index+1]; ++p) { const auto& pid = pperm[p]; bool ghost_pid = (pid >= np_real); - if (is_same && (pid == i)) continue; + if (is_same && (pid == i)) { continue; } if (call_check_pair(check_pair, src_ptile_data, dst_ptile_data, i, pid, type, ghost_i, ghost_pid)) { @@ -435,7 +435,7 @@ public: for (auto p = poffset[index]; p < poffset[index+1]; ++p) { const auto& pid = pperm[p]; bool ghost_pid = (pid >= np_real); - if (is_same && (pid == i)) continue; + if (is_same && (pid == i)) { continue; } if (call_check_pair(check_pair, src_ptile_data, dst_ptile_data, i, pid, type, ghost_i, ghost_pid)) { diff --git a/Src/Particle/AMReX_NeighborParticles.H b/Src/Particle/AMReX_NeighborParticles.H index 1e0872a032e..fd744c0be43 100644 --- a/Src/Particle/AMReX_NeighborParticles.H +++ b/Src/Particle/AMReX_NeighborParticles.H @@ -93,9 +93,9 @@ private: {} bool operator< (const NeighborCopyTag& other) const { - if (level != other.level) return level < other.level; - if (grid != other.grid) return grid < other.grid; - if (tile != other.tile) return tile < other.tile; + if (level != other.level) { return level < other.level; } + if (grid != other.grid) { return grid < other.grid; } + if (tile != other.tile) { return tile < other.tile; } AMREX_D_TERM( if (periodic_shift[0] != other.periodic_shift[0]) return periodic_shift[0] < other.periodic_shift[0];, @@ -433,15 +433,15 @@ protected: : grid_id(a_grid_id), box(a_box), periodic_shift(a_periodic_shift) {} bool operator<(const NeighborTask& other) const { - if (grid_id != other.grid_id) return grid_id < other.grid_id; - if (box != other.box ) return box < other.box; + if (grid_id != other.grid_id) { return grid_id < other.grid_id; } + if (box != other.box ) { return box < other.box; } AMREX_D_TERM( if (periodic_shift[0] != other.periodic_shift[0]) - return periodic_shift[0] < other.periodic_shift[0];, + { return periodic_shift[0] < other.periodic_shift[0]; }, if (periodic_shift[1] != other.periodic_shift[1]) - return periodic_shift[1] < other.periodic_shift[1];, + { return periodic_shift[1] < other.periodic_shift[1]; }, if (periodic_shift[2] != other.periodic_shift[2]) - return periodic_shift[2] < other.periodic_shift[2]; + { return periodic_shift[2] < other.periodic_shift[2]; } ) return false; } diff --git a/Src/Particle/AMReX_NeighborParticlesCPUImpl.H b/Src/Particle/AMReX_NeighborParticlesCPUImpl.H index 6be73c64a5a..49a92952860 100644 --- a/Src/Particle/AMReX_NeighborParticlesCPUImpl.H +++ b/Src/Particle/AMReX_NeighborParticlesCPUImpl.H @@ -132,7 +132,7 @@ sumNeighborsMPI (std::map >& not_ours, ParallelAllReduce::Max(num_isnds, ParallelContext::CommunicatorSub()); - if (num_isnds == 0) return; + if (num_isnds == 0) { return; } const int num_ircvs = neighbor_procs.size(); Vector stats(num_ircvs); @@ -163,7 +163,7 @@ sumNeighborsMPI (std::map >& not_ours, ParallelContext::CommunicatorSub()); } - if (num_ircvs > 0) ParallelDescriptor::Waitall(rreqs, stats); + if (num_ircvs > 0) { ParallelDescriptor::Waitall(rreqs, stats); } } Vector RcvProc; @@ -303,11 +303,12 @@ NeighborParticleContainer auto& aos = neighbors[tag.level][dst_index].GetArrayOfStructs(); ParticleType& p = aos[tag.dst_index]; for (int dir = 0; dir < AMREX_SPACEDIM; ++dir) { - if (! periodicity.isPeriodic(dir)) continue; - if (tag.periodic_shift[dir] < 0) + if (! periodicity.isPeriodic(dir)) { continue; } + if (tag.periodic_shift[dir] < 0) { p.pos(dir) += static_cast (prob_domain.length(dir)); - else if (tag.periodic_shift[dir] > 0) + } else if (tag.periodic_shift[dir] > 0) { p.pos(dir) -= static_cast (prob_domain.length(dir)); + } } } @@ -326,11 +327,12 @@ NeighborParticleContainer ParticleType p = aos[tag.src_index]; // copy if (periodicity.isAnyPeriodic()) { for (int dir = 0; dir < AMREX_SPACEDIM; ++dir) { - if (! periodicity.isPeriodic(dir)) continue; - if (tag.periodic_shift[dir] < 0) + if (! periodicity.isPeriodic(dir)) { continue; } + if (tag.periodic_shift[dir] < 0) { p.pos(dir) += static_cast (prob_domain.length(dir)); - else if (tag.periodic_shift[dir] > 0) + } else if (tag.periodic_shift[dir] > 0) { p.pos(dir) -= static_cast (prob_domain.length(dir)); + } } } @@ -461,7 +463,7 @@ getRcvCountsMPI () { ParallelAllReduce::Max(num_snds, ParallelContext::CommunicatorSub()); - if (num_snds == 0) return; + if (num_snds == 0) { return; } const int num_rcvs = neighbor_procs.size(); Vector stats(num_rcvs); @@ -491,7 +493,7 @@ getRcvCountsMPI () { ParallelContext::CommunicatorSub()); } - if (num_rcvs > 0) ParallelDescriptor::Waitall(rreqs, stats); + if (num_rcvs > 0) { ParallelDescriptor::Waitall(rreqs, stats); } #endif // AMREX_USE_MPI } @@ -508,8 +510,8 @@ fillNeighborsMPI (bool reuse_rcv_counts) { // each proc figures out how many bytes it will send, and how // many it will receive - if (!reuse_rcv_counts) getRcvCountsMPI(); - if (num_snds == 0) return; + if (!reuse_rcv_counts) { getRcvCountsMPI(); } + if (num_snds == 0) { return; } Vector RcvProc; Vector rOffset; // Offset (in bytes) in the receive buffer @@ -571,7 +573,7 @@ fillNeighborsMPI (bool reuse_rcv_counts) { std::memcpy(&tid, buffer, sizeof(int)); buffer += sizeof(int); std::memcpy(&size, buffer, sizeof(int)); buffer += sizeof(int); - if (size == 0) continue; + if (size == 0) { continue; } np = size / cdata_size; diff --git a/Src/Particle/AMReX_NeighborParticlesGPUImpl.H b/Src/Particle/AMReX_NeighborParticlesGPUImpl.H index 6338d9d55f8..f6b8b311c3f 100644 --- a/Src/Particle/AMReX_NeighborParticlesGPUImpl.H +++ b/Src/Particle/AMReX_NeighborParticlesGPUImpl.H @@ -21,7 +21,7 @@ namespace detail face_boxes.push_back(lo_face_box); bl.push_back(lo_face_box); for (auto face_box : face_boxes) { for (int j = 0; j < AMREX_SPACEDIM; ++j) { - if (i == j) continue; + if (i == j) { continue; } BoxList edge_boxes; Box hi_edge_box = adjCellHi(face_box, j, ncells); Box lo_edge_box = adjCellLo(face_box, j, ncells); @@ -29,7 +29,7 @@ namespace detail edge_boxes.push_back(lo_edge_box); bl.push_back(lo_edge_box); for (auto edge_box : edge_boxes) { for (int k = 0; k < AMREX_SPACEDIM; ++k) { - if ((j == k) || (i == k)) continue; + if ((j == k) || (i == k)) { continue; } Box hi_corner_box = adjCellHi(edge_box, k, ncells); Box lo_corner_box = adjCellLo(edge_box, k, ncells); bl.push_back(hi_corner_box); @@ -57,7 +57,7 @@ buildNeighborMask () const BoxArray& ba = this->ParticleBoxArray(lev); const DistributionMapping& dmap = this->ParticleDistributionMap(lev); - if (ba.size() == 1 && (! geom.isAnyPeriodic()) ) return; + if (ba.size() == 1 && (! geom.isAnyPeriodic()) ) { return; } if (m_neighbor_mask_ptr == nullptr || ! BoxArray::SameRefs(m_neighbor_mask_ptr->boxArray(), ba) || @@ -82,7 +82,7 @@ buildNeighborMask () { int nbor_grid = isec.first; const Box isec_box = isec.second - pshift; - if ( (grid == nbor_grid) && (pshift == 0)) continue; + if ( (grid == nbor_grid) && (pshift == 0)) { continue; } neighbor_grids.insert(NeighborTask(nbor_grid, isec_box, pshift)); const int global_rank = dmap[nbor_grid]; neighbor_procs.push_back(ParallelContext::global_to_local_rank(global_rank)); @@ -131,7 +131,7 @@ buildNeighborCopyOp (bool use_boundary_neighbor) auto& plev = this->GetParticles(lev); auto& ba = this->ParticleBoxArray(lev); - if (ba.size() == 1 && (! geom.isAnyPeriodic()) ) return; + if (ba.size() == 1 && (! geom.isAnyPeriodic()) ) { return; } for(MFIter mfi = this->MakeMFIter(lev); mfi.isValid(); ++mfi) { diff --git a/Src/Particle/AMReX_NeighborParticlesI.H b/Src/Particle/AMReX_NeighborParticlesI.H index 56ce4ff27d8..800dbbfe17a 100644 --- a/Src/Particle/AMReX_NeighborParticlesI.H +++ b/Src/Particle/AMReX_NeighborParticlesI.H @@ -373,7 +373,7 @@ NeighborParticleContainer for (int j = 0; j < static_cast(tags.size()); ++j) { NeighborCopyTag& tag = tags[j]; PairIndex dst_index(tag.grid, tag.tile); - if (tag.grid < 0) continue; + if (tag.grid < 0) { continue; } tag.src_index = i; const int cache_index = cache.size(); @@ -482,14 +482,14 @@ NeighborParticleContainer } for (const auto& kv: remote_map) { - if (kv.first.proc_id == MyProc) continue; + if (kv.first.proc_id == MyProc) { continue; } Vector& buffer = send_data[kv.first.proc_id]; buffer.resize(sizeof(int)); std::memcpy(&buffer[0], &tile_counts[kv.first.proc_id], sizeof(int)); } for (auto& kv : remote_map) { - if (kv.first.proc_id == MyProc) continue; + if (kv.first.proc_id == MyProc) { continue; } int np = kv.second.size(); int data_size = np * cdata_size; Vector& buffer = send_data[kv.first.proc_id]; @@ -550,7 +550,7 @@ getNeighborTags (Vector& tags, const ParticleType& p, const int lev = 0; const IntVect& iv = this->Index(p, lev); - if (shrink_box.contains(iv)) return; + if (shrink_box.contains(iv)) { return; } const Periodicity& periodicity = this->Geom(lev).periodicity(); const Box& domain = this->Geom(lev).Domain(); @@ -562,7 +562,7 @@ getNeighborTags (Vector& tags, const ParticleType& p, for (int ii = -nGrow[0]; ii < nGrow[0] + 1; ii += nGrow[0]) {, for (int jj = -nGrow[1]; jj < nGrow[1] + 1; jj += nGrow[1]) {, for (int kk = -nGrow[2]; kk < nGrow[2] + 1; kk += nGrow[2]) {) - if (AMREX_D_TERM((ii == 0), && (jj == 0), && (kk == 0))) continue; + if (AMREX_D_TERM((ii == 0), && (jj == 0), && (kk == 0))) { continue; } IntVect shift(AMREX_D_DECL(ii, jj, kk)); IntVect neighbor_cell = iv + shift; @@ -572,15 +572,16 @@ getNeighborTags (Vector& tags, const ParticleType& p, tag.level = mask(neighbor_cell, MaskComps::level); if (periodicity.isAnyPeriodic()) { for (int dir = 0; dir < AMREX_SPACEDIM; ++dir) { - if (! periodicity.isPeriodic(dir)) continue; - if (neighbor_cell[dir] < lo[dir]) + if (! periodicity.isPeriodic(dir)) { continue; } + if (neighbor_cell[dir] < lo[dir]) { tag.periodic_shift[dir] = -1; - else if (neighbor_cell[dir] > hi[dir]) + } else if (neighbor_cell[dir] > hi[dir]) { tag.periodic_shift[dir] = 1; + } } } - if (tag != src_tag) tags.push_back(tag); + if (tag != src_tag) { tags.push_back(tag); } AMREX_D_TERM( }, @@ -610,12 +611,12 @@ getNeighborTags (Vector& tags, const ParticleType& p, { const Box& grid_box = ba[isec.first]; for (IntVect cell = pbox.smallEnd(); cell <= pbox.bigEnd(); pbox.next(cell)) { - if ( !grid_box.contains(cell) ) continue; + if ( !grid_box.contains(cell) ) { continue; } int tile = getTileIndex(cell, grid_box, this->do_tiling, this->tile_size, tbx); auto nbor = NeighborCopyTag(lev, isec.first, tile); nbor.periodic_shift = -pshift; - if (src_tag != nbor) tags.push_back(nbor); + if (src_tag != nbor) { tags.push_back(nbor); } } } } @@ -724,7 +725,7 @@ buildNeighborList (CheckPair&& check_pair, bool /*sort*/) auto& ptile = plev[index]; - if (ptile.numParticles() == 0) continue; + if (ptile.numParticles() == 0) { continue; } Box bx = pti.tilebox(); int ng = computeRefFac(0, lev).max()*m_num_neighbor_cells; @@ -809,7 +810,7 @@ buildNeighborList (CheckPair&& check_pair, OtherPCType& other, const auto& ptile = plev[index]; auto& other_ptile = other.ParticlesAt(lev, pti); - if (ptile.numParticles() == 0) continue; + if (ptile.numParticles() == 0) { continue; } Box bx = pti.tilebox(); int ng = computeRefFac(0, lev).max()*m_num_neighbor_cells; @@ -880,7 +881,7 @@ buildNeighborList (CheckPair&& check_pair, int type_ind, int* ref_ratio, auto index = std::make_pair(gid, tid); auto& ptile = plev[index]; - if (ptile.numParticles() == 0) continue; + if (ptile.numParticles() == 0) { continue; } Box bx = pti.tilebox(); int ng = 1; @@ -1060,7 +1061,7 @@ selectActualNeighbors (CheckPair&& check_pair, int num_cells) if (isActualNeighbor) break; int nbr_cell_id = (ii * ny + jj) * nz + kk; for (auto p = poffset[nbr_cell_id]; p < poffset[nbr_cell_id+1]; ++p) { - if (pperm[p] == i) continue; + if (pperm[p] == i) { continue; } if (call_check_pair(check_pair, ptile_data, ptile_data, i, pperm[p])) { IntVect cell_ijk = getParticleCell(pstruct[pperm[p]], plo, dxi, domain); if (!box.contains(cell_ijk)) { diff --git a/Src/Particle/AMReX_Particle.H b/Src/Particle/AMReX_Particle.H index 8bee9af24eb..7b025dbac96 100644 --- a/Src/Particle/AMReX_Particle.H +++ b/Src/Particle/AMReX_Particle.H @@ -55,7 +55,7 @@ struct ParticleIDWrapper AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE ParticleIDWrapper& operator= (const ParticleIDWrapper& pidw) noexcept { - return this->operator=(Long(pidw)); // NOLINT(cppcoreguidelines-c-copy-assignment-signature) + return this->operator=(Long(pidw)); // NOLINT } AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE @@ -123,7 +123,7 @@ struct ParticleCPUWrapper AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE ParticleCPUWrapper& operator= (const ParticleCPUWrapper& pcpuw) noexcept { - return this->operator=(int(pcpuw)); // NOLINT(cppcoreguidelines-c-copy-assignment-signature) + return this->operator=(int(pcpuw)); // NOLINT } AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE diff --git a/Src/Particle/AMReX_ParticleBufferMap.cpp b/Src/Particle/AMReX_ParticleBufferMap.cpp index 86686ec87b1..387f0a0680f 100644 --- a/Src/Particle/AMReX_ParticleBufferMap.cpp +++ b/Src/Particle/AMReX_ParticleBufferMap.cpp @@ -57,15 +57,15 @@ void ParticleBufferMap::define (const ParGDBBase* a_gdb) { int pid_a = std::get<2>(a); int pid_b = std::get<2>(b); - if (pid_a != pid_b) return pid_a < pid_b; + if (pid_a != pid_b) { return pid_a < pid_b; } int lev_a = std::get<1>(a); int lev_b = std::get<1>(b); - if (lev_a != lev_b) return lev_a < lev_b; + if (lev_a != lev_b) { return lev_a < lev_b; } int gid_a = std::get<0>(a); int gid_b = std::get<0>(b); - if (gid_a != gid_b) return gid_a < gid_b; + if (gid_a != gid_b) { return gid_a < gid_b; } return false; }); @@ -113,10 +113,10 @@ void ParticleBufferMap::define (const ParGDBBase* a_gdb) bool ParticleBufferMap::isValid (const ParGDBBase* a_gdb) const { - if (!m_defined) return false; + if (!m_defined) { return false; } int num_levs = a_gdb->finestLevel() + 1; - if (num_levs != m_ba.size()) return false; + if (num_levs != m_ba.size()) { return false; } bool valid = true; for (int lev = 0; lev < num_levs; ++lev) diff --git a/Src/Particle/AMReX_ParticleCommunication.H b/Src/Particle/AMReX_ParticleCommunication.H index 924fc894a89..0919c2baa3e 100644 --- a/Src/Particle/AMReX_ParticleCommunication.H +++ b/Src/Particle/AMReX_ParticleCommunication.H @@ -66,7 +66,7 @@ struct ParticleCopyOp [[nodiscard]] int numCopies (int gid, int lev) const { - if (m_boxes.size() <= lev) return 0; + if (m_boxes.size() <= lev) { return 0; } auto mit = m_boxes[lev].find(gid); return mit == m_boxes[lev].end() ? 0 : int(mit->second.size()); } @@ -160,7 +160,7 @@ struct ParticleCopyPlan { int gid = kv.first.first; int num_copies = op.numCopies(gid, lev); - if (num_copies == 0) continue; + if (num_copies == 0) { continue; } m_dst_indices[lev][gid].resize(num_copies); const auto* p_boxes = op.m_boxes[lev].at(gid).dataPtr(); @@ -337,7 +337,7 @@ void packBuffer (const PC& pc, const ParticleCopyOp& op, const ParticleCopyPlan& const auto ptd = src_tile.getConstParticleTileData(); int num_copies = op.numCopies(gid, lev); - if (num_copies == 0) continue; + if (num_copies == 0) { continue; } const auto* p_boxes = op.m_boxes[lev].at(gid).dataPtr(); const auto* p_levels = op.m_levels[lev].at(gid).dataPtr(); @@ -370,11 +370,12 @@ void packBuffer (const PC& pc, const ParticleCopyOp& op, const ParticleCopyPlan& AMREX_SPACEDIM*sizeof(ParticleReal)); for (int idim = 0; idim < AMREX_SPACEDIM; ++idim) { - if (! is_per[idim]) continue; - if (pshift[idim] > 0) + if (! is_per[idim]) { continue; } + if (pshift[idim] > 0) { pos[idim] += phi[idim] - plo[idim]; - else if (pshift[idim] < 0) + } else if (pshift[idim] < 0) { pos[idim] -= phi[idim] - plo[idim]; + } } amrex::Gpu::memcpy(&p_snd_buffer[dst_offset], &pos[0], AMREX_SPACEDIM*sizeof(ParticleReal)); @@ -461,7 +462,7 @@ void communicateParticlesStart (const PC& pc, ParticleCopyPlan& plan, const SndB const int NProcs = ParallelContext::NProcsSub(); const int MyProc = ParallelContext::MyProcSub(); - if (NProcs == 1) return; + if (NProcs == 1) { return; } Vector RcvProc; Vector rOffset; @@ -519,15 +520,15 @@ void communicateParticlesStart (const PC& pc, ParticleCopyPlan& plan, const SndB ParallelDescriptor::Arecv((char*) (rcv_buffer.dataPtr() + offset), Cnt, Who, SeqNum, ParallelContext::CommunicatorSub()).req(); } - if (plan.m_NumSnds == 0) return; + if (plan.m_NumSnds == 0) { return; } // Send. for (int i = 0; i < NProcs; ++i) { - if (i == MyProc) continue; + if (i == MyProc) { continue; } const auto Who = i; const auto Cnt = plan.m_snd_counts[i]; - if (Cnt == 0) continue; + if (Cnt == 0) { continue; } auto snd_offset = plan.m_snd_offsets[i]; AMREX_ASSERT(plan.m_snd_counts[i] % ParallelDescriptor::alignof_comm_data(plan.m_snd_num_particles[i]*psize) == 0); @@ -554,7 +555,7 @@ void unpackRemotes (PC& pc, const ParticleCopyPlan& plan, Buffer& rcv_buffer, Un #ifdef AMREX_USE_MPI const int NProcs = ParallelContext::NProcsSub(); - if (NProcs == 1) return; + if (NProcs == 1) { return; } const int MyProc = ParallelContext::MyProcSub(); amrex::ignore_unused(MyProc); diff --git a/Src/Particle/AMReX_ParticleCommunication.cpp b/Src/Particle/AMReX_ParticleCommunication.cpp index 474c8adc40e..a3bd1304a9b 100644 --- a/Src/Particle/AMReX_ParticleCommunication.cpp +++ b/Src/Particle/AMReX_ParticleCommunication.cpp @@ -54,7 +54,7 @@ void ParticleCopyPlan::buildMPIStart (const ParticleBufferMap& map, Long psize) const int MyProc = ParallelContext::MyProcSub(); const auto NNeighborProcs = static_cast(m_neighbor_procs.size()); - if (NProcs == 1) return; + if (NProcs == 1) { return; } m_Snds.resize(0); m_Snds.resize(NProcs, 0); @@ -81,9 +81,9 @@ void ParticleCopyPlan::buildMPIStart (const ParticleBufferMap& map, Long psize) int lev = map.bucketToLevel(bucket); AMREX_ASSERT(m_box_counts_h[bucket] <= static_cast(std::numeric_limits::max())); int npart = static_cast(m_box_counts_h[bucket]); - if (npart == 0) continue; + if (npart == 0) { continue; } m_snd_num_particles[i] += npart; - if (i == MyProc) continue; + if (i == MyProc) { continue; } snd_data[i].push_back(npart); snd_data[i].push_back(dst); snd_data[i].push_back(lev); @@ -160,10 +160,10 @@ void ParticleCopyPlan::buildMPIStart (const ParticleBufferMap& map, Long psize) for (auto i : m_neighbor_procs) { - if (i == MyProc) continue; + if (i == MyProc) { continue; } const auto Who = i; const auto Cnt = m_Snds[i]; - if (Cnt == 0) continue; + if (Cnt == 0) { continue; } AMREX_ASSERT(Cnt > 0); AMREX_ASSERT(Who >= 0 && Who < NProcs); @@ -212,7 +212,7 @@ void ParticleCopyPlan::buildMPIFinish (const ParticleBufferMap& map) // NOLINT(r #ifdef AMREX_USE_MPI const int NProcs = ParallelContext::NProcsSub(); - if (NProcs == 1) return; + if (NProcs == 1) { return; } if (m_nrcvs > 0) { @@ -349,7 +349,7 @@ void ParticleCopyPlan::doHandShakeGlobal (const Vector& Snds, Vector } for (int i = 0; i < NProcs; ++i) { - if (Snds[i] == 0) continue; + if (Snds[i] == 0) { continue; } const Long Cnt = 1; MPI_Send( &Snds[i], Cnt, ParallelDescriptor::Mpi_typemap::type(), i, SeqNum, ParallelContext::CommunicatorSub()); diff --git a/Src/Particle/AMReX_ParticleContainerI.H b/Src/Particle/AMReX_ParticleContainerI.H index 9712a13a415..76595c44bcd 100644 --- a/Src/Particle/AMReX_ParticleContainerI.H +++ b/Src/Particle/AMReX_ParticleContainerI.H @@ -176,7 +176,7 @@ ParticleContainer_impl AMREX_ASSERT(m_gdb != nullptr); - if (!Geom(0).isAnyPeriodic()) return false; + if (!Geom(0).isAnyPeriodic()) { return false; } if (lev_max == -1) lev_max = finestLevel(); @@ -424,7 +424,7 @@ Long ParticleContainer_impl::Num { Long nparticles = 0; - if (level < 0 || level >= int(m_particles.size())) return nparticles; + if (level < 0 || level >= int(m_particles.size())) { return nparticles; } if (only_valid) { ReduceOps reduce_op; @@ -575,7 +575,7 @@ ParticleContainer_impl::Incremen BL_PROFILE("ParticleContainer::Increment"); AMREX_ASSERT(OK()); - if (m_particles.empty()) return; + if (m_particles.empty()) { return; } AMREX_ASSERT(lev >= 0 && lev < int(m_particles.size())); AMREX_ASSERT(numParticlesOutOfRange(*this, 0) == 0); @@ -609,7 +609,7 @@ void ParticleContainer_impl::RemoveParticlesAtLevel (int level) { BL_PROFILE("ParticleContainer::RemoveParticlesAtLevel()"); - if (level >= int(this->m_particles.size())) return; + if (level >= int(this->m_particles.size())) { return; } if (!this->m_particles[level].empty()) { @@ -1038,12 +1038,12 @@ addParticles (const PCType& other, F&& f, bool local) for(MFIter mfi = other.MakeMFIter(lev); mfi.isValid(); ++mfi) { auto index = std::make_pair(mfi.index(), mfi.LocalTileIndex()); - if(plevel_other.find(index) == plevel_other.end()) continue; + if(plevel_other.find(index) == plevel_other.end()) { continue; } auto& ptile = DefineAndReturnParticleTile(lev, mfi.index(), mfi.LocalTileIndex()); const auto& ptile_other = plevel_other.at(index); auto np = ptile_other.numParticles(); - if (np == 0) continue; + if (np == 0) { continue; } auto dst_index = ptile.numParticles(); ptile.resize(dst_index + np); @@ -1175,7 +1175,7 @@ ParticleContainer_impl { BL_PROFILE("ParticleContainer::SortParticlesByBin()"); - if (bin_size == IntVect::TheZeroVector()) return; + if (bin_size == IntVect::TheZeroVector()) { return; } for (int lev = 0; lev < numLevels(); ++lev) { diff --git a/Src/Particle/AMReX_ParticleIO.H b/Src/Particle/AMReX_ParticleIO.H index 4417385d39f..c61e4728a64 100644 --- a/Src/Particle/AMReX_ParticleIO.H +++ b/Src/Particle/AMReX_ParticleIO.H @@ -568,7 +568,7 @@ ParticleContainer_impl which[grid] = fnum; where[grid] = VisMF::FileOffset(ofs); - if (count[grid] == 0) continue; + if (count[grid] == 0) { continue; } Vector istuff; Vector rstuff; @@ -733,7 +733,7 @@ ParticleContainer_impl phdr_name = amrex::Concatenate(phdr_name, lev, 1); phdr_name += "/Particle_H"; - if (! amrex::FileExists(phdr_name)) continue; + if (! amrex::FileExists(phdr_name)) { continue; } Vector phdr_chars; ParallelDescriptor::ReadAndBcastFile(phdr_name, phdr_chars); @@ -798,7 +798,7 @@ ParticleContainer_impl const int rank = ParallelDescriptor::MyProc(); const int NReaders = MaxReaders(); - if (rank >= NReaders) return; + if (rank >= NReaders) { return; } const int Navg = ngrids[lev] / NReaders; const int Nleft = ngrids[lev] - Navg * NReaders; @@ -821,13 +821,14 @@ ParticleContainer_impl for(int igrid = 0; igrid < static_cast(grids_to_read.size()); ++igrid) { const int grid = grids_to_read[igrid]; - if (count[grid] <= 0) continue; + if (count[grid] <= 0) { continue; } // The file names in the header file are relative. std::string name = fullname; - if (!name.empty() && name[name.size()-1] != '/') + if (!name.empty() && name[name.size()-1] != '/') { name += '/'; + } name += "Level_"; name += amrex::Concatenate("", lev, 1); @@ -839,8 +840,9 @@ ParticleContainer_impl ParticleFile.open(name.c_str(), std::ios::in | std::ios::binary); - if (!ParticleFile.good()) + if (!ParticleFile.good()) { amrex::FileOpenFailed(name); + } ParticleFile.seekg(where[grid], std::ios::beg); @@ -869,8 +871,9 @@ ParticleContainer_impl ParticleFile.close(); - if (!ParticleFile.good()) + if (!ParticleFile.good()) { amrex::Abort("ParticleContainer::Restart(): problem reading particles"); + } } } diff --git a/Src/Particle/AMReX_ParticleLocator.H b/Src/Particle/AMReX_ParticleLocator.H index 35257049b9d..27246060b4a 100644 --- a/Src/Particle/AMReX_ParticleLocator.H +++ b/Src/Particle/AMReX_ParticleLocator.H @@ -178,7 +178,7 @@ public: bool isValid (const BoxArray& ba) const noexcept { - if (m_defined) return BoxArray::SameRefs(m_ba, ba); + if (m_defined) { return BoxArray::SameRefs(m_ba, ba); } return false; } @@ -220,13 +220,13 @@ struct AmrAssignGrid for (int lev = lev_max; lev >= lev_min; --lev) { int grid = m_funcs[lev](p); - if (grid >= 0) return makeTuple(grid, lev); + if (grid >= 0) { return makeTuple(grid, lev); } } for (int lev = lev_min; lev >= lev_min; --lev) { int grid = m_funcs[lev](p, nGrow); - if (grid >= 0) return makeTuple(grid, lev); + if (grid >= 0) { return makeTuple(grid, lev); } } return makeTuple(-1, -1); @@ -301,11 +301,12 @@ public: [[nodiscard]] bool isValid (const Vector& a_ba) const { if ( !m_defined || (m_locators.empty()) || - (m_locators.size() != a_ba.size()) ) return false; + (m_locators.size() != a_ba.size()) ) { return false; } bool all_valid = true; int num_levels = m_locators.size(); - for (int lev = 0; lev < num_levels; ++lev) + for (int lev = 0; lev < num_levels; ++lev) { all_valid = all_valid && m_locators[lev].isValid(a_ba[lev]); + } return all_valid; } diff --git a/Src/Particle/AMReX_ParticleMPIUtil.cpp b/Src/Particle/AMReX_ParticleMPIUtil.cpp index 64e9737a95a..d9b9f73a29f 100644 --- a/Src/Particle/AMReX_ParticleMPIUtil.cpp +++ b/Src/Particle/AMReX_ParticleMPIUtil.cpp @@ -26,7 +26,7 @@ namespace amrex { Vector& Snds, Vector& Rcvs) { Long NumSnds = CountSnds(not_ours, Snds); - if (NumSnds == 0) return NumSnds; + if (NumSnds == 0) { return NumSnds; } BL_COMM_PROFILE(BLProfiler::Alltoall, sizeof(Long), ParallelContext::MyProcSub(), BLProfiler::BeforeCall()); diff --git a/Src/Particle/AMReX_ParticleUtil.H b/Src/Particle/AMReX_ParticleUtil.H index 0d7f9af776b..9136bea6741 100644 --- a/Src/Particle/AMReX_ParticleUtil.H +++ b/Src/Particle/AMReX_ParticleUtil.H @@ -74,7 +74,7 @@ numParticlesOutOfRange (Iterator const& pti, IntVect nGrow) [=] AMREX_GPU_DEVICE (int i) -> ReduceTuple { auto p = make_particle{}(ptd,i); - if ((p.id() < 0)) return false; + if ((p.id() < 0)) { return false; } IntVect iv( AMREX_D_DECL(int(amrex::Math::floor((p.pos(0)-plo[0])*dxi[0])), int(amrex::Math::floor((p.pos(1)-plo[1])*dxi[1])), @@ -383,7 +383,7 @@ int getParticleGrid (P const& p, amrex::Array4 const& mask, amrex::GpuArray const& dxi, const Box& domain) noexcept { - if (p.id() < 0) return -1; + if (p.id() < 0) { return -1; } IntVect iv = getParticleCell(p, plo, dxi, domain); return mask(iv); } @@ -400,7 +400,7 @@ bool enforcePeriodic (P& p, bool shifted = false; for (int idim = 0; idim < AMREX_SPACEDIM; ++idim) { - if (! is_per[idim]) continue; + if (! is_per[idim]) { continue; } if (p.pos(idim) > rhi[idim]) { while (p.pos(idim) > rhi[idim]) { p.pos(idim) -= static_cast(phi[idim] - plo[idim]); @@ -441,7 +441,7 @@ partitionParticlesByDest (PTile& ptile, const PLocator& ploc, const ParticleBuff int lev_min, int lev_max, int nGrow, bool remove_negative) { const int np = ptile.numParticles(); - if (np == 0) return 0; + if (np == 0) { return 0; } auto getPID = pmap.getPIDFunctor(); diff --git a/Src/Particle/AMReX_Particle_mod_K.H b/Src/Particle/AMReX_Particle_mod_K.H index fe62bb002a6..2d1f91b4275 100644 --- a/Src/Particle/AMReX_Particle_mod_K.H +++ b/Src/Particle/AMReX_Particle_mod_K.H @@ -123,7 +123,7 @@ void amrex_deposit_particle_dx_cic (P const& p, int nc, amrex::Array4(amrex::Math::floor(hx)); for (int i = lo_x; i <= hi_x; ++i) { - if (i < rho.begin.x || i >= rho.end.x) continue; + if (i < rho.begin.x || i >= rho.end.x) { continue; } amrex::Real wx = amrex::min(hx - static_cast(i), amrex::Real(1.0)) - amrex::max(lx - static_cast(i), amrex::Real(0.0)); amrex::Real weight = wx*factor; amrex::Gpu::Atomic::AddNoRet(&rho(i, 0, 0, 0), static_cast(weight*p.rdata(0))); @@ -132,7 +132,7 @@ void amrex_deposit_particle_dx_cic (P const& p, int nc, amrex::Array4= rho.end.x) continue; + if (i < rho.begin.x || i >= rho.end.x) { continue; } amrex::Real wx = amrex::min(hx - static_cast(i), amrex::Real(1.0)) - amrex::max(lx - static_cast(i), amrex::Real(0.0)); amrex::Real weight = wx*factor; amrex::Gpu::Atomic::AddNoRet(&rho(i, 0, 0, comp), static_cast(weight*p.rdata(0)*p.rdata(comp))); @@ -155,10 +155,10 @@ void amrex_deposit_particle_dx_cic (P const& p, int nc, amrex::Array4(amrex::Math::floor(hy)); for (int j = lo_y; j <= hi_y; ++j) { - if (j < rho.begin.y || j >= rho.end.y) continue; + if (j < rho.begin.y || j >= rho.end.y) { continue; } amrex::Real wy = amrex::min(hy - static_cast(j), amrex::Real(1.0)) - amrex::max(ly - static_cast(j), amrex::Real(0.0)); for (int i = lo_x; i <= hi_x; ++i) { - if (i < rho.begin.x || i >= rho.end.x) continue; + if (i < rho.begin.x || i >= rho.end.x) { continue; } amrex::Real wx = amrex::min(hx - static_cast(i), amrex::Real(1.0)) - amrex::max(lx - static_cast(i), amrex::Real(0.0)); amrex::Real weight = wx*wy*factor; amrex::Gpu::Atomic::AddNoRet(&rho(i, j, 0, 0), static_cast(weight*p.rdata(0))); @@ -167,10 +167,10 @@ void amrex_deposit_particle_dx_cic (P const& p, int nc, amrex::Array4= rho.end.y) continue; + if (j < rho.begin.y || j >= rho.end.y) { continue; } amrex::Real wy = amrex::min(hy - static_cast(j), amrex::Real(1.0)) - amrex::max(ly - static_cast(j), amrex::Real(0.0)); for (int i = lo_x; i <= hi_x; ++i) { - if (i < rho.begin.x || i >= rho.end.x) continue; + if (i < rho.begin.x || i >= rho.end.x) { continue; } amrex::Real wx = amrex::min(hx - static_cast(i), amrex::Real(1.0)) - amrex::max(lx - static_cast(i), amrex::Real(0.0)); amrex::Real weight = wx*wy*factor; amrex::Gpu::Atomic::AddNoRet(&rho(i, j, 0, comp), static_cast(weight*p.rdata(0)*p.rdata(comp))); @@ -198,13 +198,13 @@ void amrex_deposit_particle_dx_cic (P const& p, int nc, amrex::Array4(amrex::Math::floor(hz)); for (int k = lo_z; k <= hi_z; ++k) { - if (k < rho.begin.z || k >= rho.end.z) continue; + if (k < rho.begin.z || k >= rho.end.z) { continue; } amrex::Real wz = amrex::min(hz - static_cast(k), amrex::Real(1.0)) - amrex::max(lz - static_cast(k), amrex::Real(0.0)); for (int j = lo_y; j <= hi_y; ++j) { - if (j < rho.begin.y || j >= rho.end.y) continue; + if (j < rho.begin.y || j >= rho.end.y) { continue; } amrex::Real wy = amrex::min(hy - static_cast(j), amrex::Real(1.0)) - amrex::max(ly - static_cast(j), amrex::Real(0.0)); for (int i = lo_x; i <= hi_x; ++i) { - if (i < rho.begin.x || i >= rho.end.x) continue; + if (i < rho.begin.x || i >= rho.end.x) { continue; } amrex::Real wx = amrex::min(hx - static_cast(i), amrex::Real(1.0)) - amrex::max(lx - static_cast(i), amrex::Real(0.0)); amrex::Real weight = wx*wy*wz*factor; amrex::Gpu::Atomic::AddNoRet(&rho(i, j, k, 0), static_cast(weight*p.rdata(0))); @@ -214,13 +214,13 @@ void amrex_deposit_particle_dx_cic (P const& p, int nc, amrex::Array4= rho.end.z) continue; + if (k < rho.begin.z || k >= rho.end.z) { continue; } amrex::Real wz = amrex::min(hz - static_cast(k), amrex::Real(1.0)) - amrex::max(lz - static_cast(k), amrex::Real(0.0)); for (int j = lo_y; j <= hi_y; ++j) { - if (j < rho.begin.y || j >= rho.end.y) continue; + if (j < rho.begin.y || j >= rho.end.y) { continue; } amrex::Real wy = amrex::min(hy - static_cast(j), amrex::Real(1.0)) - amrex::max(ly - static_cast(j), amrex::Real(0.0)); for (int i = lo_x; i <= hi_x; ++i) { - if (i < rho.begin.x || i >= rho.end.x) continue; + if (i < rho.begin.x || i >= rho.end.x) { continue; } amrex::Real wx = amrex::min(hx - static_cast(i), amrex::Real(1.0)) - amrex::max(lx - static_cast(i), amrex::Real(0.0)); amrex::Real weight = wx*wy*wz*factor; amrex::Gpu::Atomic::AddNoRet(&rho(i, j, k, comp), static_cast(weight*p.rdata(0)*p.rdata(comp))); diff --git a/Src/Particle/AMReX_SparseBins.H b/Src/Particle/AMReX_SparseBins.H index 035828b1da6..6ec80a0a831 100644 --- a/Src/Particle/AMReX_SparseBins.H +++ b/Src/Particle/AMReX_SparseBins.H @@ -39,18 +39,18 @@ struct SparseBinIteratorFactory [[nodiscard]] AMREX_GPU_HOST_DEVICE index_type getIndex (const index_type bin_number) const noexcept { - if (m_num_bins == 1) return 0; + if (m_num_bins == 1) { return 0; } index_type lo = 0; index_type hi = m_num_bins - 1; while (lo < hi) { - if (m_bins_ptr[lo] == bin_number) return lo; - if (m_bins_ptr[hi] == bin_number) return hi; + if (m_bins_ptr[lo] == bin_number) { return lo; } + if (m_bins_ptr[hi] == bin_number) { return hi; } index_type mid = (lo + hi) / 2; index_type mid_value = m_bins_ptr[mid]; - if (mid_value == bin_number) return mid; + if (mid_value == bin_number) { return mid; } mid_value < bin_number ? lo = mid+1 : hi = mid; } diff --git a/Src/Particle/AMReX_TracerParticles.cpp b/Src/Particle/AMReX_TracerParticles.cpp index 5d290be43f2..188dc93cfa8 100644 --- a/Src/Particle/AMReX_TracerParticles.cpp +++ b/Src/Particle/AMReX_TracerParticles.cpp @@ -73,7 +73,7 @@ TracerParticleContainer::AdvectWithUmac (MultiFab* umac, int lev, Real dt) [=] AMREX_GPU_DEVICE (int i) { ParticleType& p = p_pbox[i]; - if (p.id() <= 0) return; + if (p.id() <= 0) { return; } ParticleReal v[AMREX_SPACEDIM]; mac_interpolate(p, plo, dxi, umacarr, v); if (ipass == 0) @@ -151,7 +151,7 @@ TracerParticleContainer::AdvectWithUcc (const MultiFab& Ucc, int lev, Real dt) [=] AMREX_GPU_DEVICE (int i) { ParticleType& p = p_pbox[i]; - if (p.id() <= 0) return; + if (p.id() <= 0) { return; } ParticleReal v[AMREX_SPACEDIM]; cic_interpolate(p, plo, dxi, uccarr, v); @@ -299,11 +299,11 @@ TracerParticleContainer::Timestamp (const std::string& basename, { const ParticleType& p = pbox[k]; - if (p.id() <= 0) continue; + if (p.id() <= 0) { continue; } const IntVect& iv = Index(p,lev); - if (!bx.contains(iv) && !ba.contains(iv)) continue; + if (!bx.contains(iv) && !ba.contains(iv)) { continue; } TimeStampFile << p.id() << ' ' << p.cpu() << ' '; diff --git a/Src/Particle/AMReX_WriteBinaryParticleData.H b/Src/Particle/AMReX_WriteBinaryParticleData.H index 40203e17c12..f470ca50cdc 100644 --- a/Src/Particle/AMReX_WriteBinaryParticleData.H +++ b/Src/Particle/AMReX_WriteBinaryParticleData.H @@ -956,9 +956,9 @@ void WriteBinaryParticleDataAsync (PC const& pc, for (int k = 0; k < bas[lev].size(); ++k) { int rank = dms[lev][k]; - if (rank != MyProc) continue; + if (rank != MyProc) { continue; } const int grid = k; - if (np_per_grid_local[lev][grid] == 0) continue; + if (np_per_grid_local[lev][grid] == 0) { continue; } // First write out the integer data in binary. int num_output_int = 0; @@ -978,7 +978,7 @@ void WriteBinaryParticleDataAsync (PC const& pc, const auto& soa = pbox.GetStructOfArrays(); const auto& p = make_particle{}(ptd, pindex); - if (p.id() <= 0) continue; + if (p.id() <= 0) { continue; } // note: for pure SoA particle layouts, we do write the id, cpu and positions as a struct // for backwards compatibility with readers @@ -1041,12 +1041,12 @@ void WriteBinaryParticleDataAsync (PC const& pc, const auto& soa = pbox.GetStructOfArrays(); const auto& p = make_particle{}(ptd, pindex); - if (p.id() <= 0) continue; + if (p.id() <= 0) { continue; } if constexpr(!PC::ParticleType::is_soa_particle) { // Real: position - for (int j = 0; j < AMREX_SPACEDIM; j++) rptr[j] = p.pos(j); + for (int j = 0; j < AMREX_SPACEDIM; j++) { rptr[j] = p.pos(j); } rptr += AMREX_SPACEDIM; // extra AoS real @@ -1061,7 +1061,7 @@ void WriteBinaryParticleDataAsync (PC const& pc, } else { // Real: position - for (int j = 0; j < AMREX_SPACEDIM; j++) rptr[j] = soa.GetRealData(j)[pindex]; + for (int j = 0; j < AMREX_SPACEDIM; j++) { rptr[j] = soa.GetRealData(j)[pindex]; } rptr += AMREX_SPACEDIM; } diff --git a/Tests/Amr/Advection_AmrCore/Source/AmrCoreAdv.cpp b/Tests/Amr/Advection_AmrCore/Source/AmrCoreAdv.cpp index ea60a0a4077..3e4d05fbe20 100644 --- a/Tests/Amr/Advection_AmrCore/Source/AmrCoreAdv.cpp +++ b/Tests/Amr/Advection_AmrCore/Source/AmrCoreAdv.cpp @@ -332,7 +332,7 @@ AmrCoreAdv::ErrorEst (int lev, TagBoxArray& tags, Real /*time*/, int /*ngrow*/) } } - if (lev >= phierr.size()) return; + if (lev >= phierr.size()) { return; } // const int clearval = TagBox::CLEAR; const int tagval = TagBox::SET; diff --git a/Tests/Amr/Advection_AmrLevel/Source/AmrLevelAdv.cpp b/Tests/Amr/Advection_AmrLevel/Source/AmrLevelAdv.cpp index ecf7aec9f73..502fa6e246f 100644 --- a/Tests/Amr/Advection_AmrLevel/Source/AmrLevelAdv.cpp +++ b/Tests/Amr/Advection_AmrLevel/Source/AmrLevelAdv.cpp @@ -737,7 +737,7 @@ AmrLevelAdv::read_params () { static bool done = false; - if (done) return; + if (done) { return; } done = true; @@ -793,14 +793,14 @@ AmrLevelAdv::reflux () void AmrLevelAdv::avgDown () { - if (level == parent->finestLevel()) return; + if (level == parent->finestLevel()) { return; } avgDown(Phi_Type); } void AmrLevelAdv::avgDown (int state_indx) { - if (level == parent->finestLevel()) return; + if (level == parent->finestLevel()) { return; } AmrLevelAdv& fine_lev = getLevel(level+1); MultiFab& S_fine = fine_lev.get_new_data(state_indx); diff --git a/Tests/EB/CNS/Source/CNS.cpp b/Tests/EB/CNS/Source/CNS.cpp index 3ab01b68dd0..24eb6056d0d 100644 --- a/Tests/EB/CNS/Source/CNS.cpp +++ b/Tests/EB/CNS/Source/CNS.cpp @@ -286,7 +286,7 @@ CNS::printTotal () const void CNS::post_init (Real) { - if (level > 0) return; + if (level > 0) { return; } for (int k = parent->finestLevel()-1; k >= 0; --k) { getLevel(k).avgDown(); } @@ -417,7 +417,7 @@ CNS::avgDown () { BL_PROFILE("CNS::avgDown()"); - if (level == parent->finestLevel()) return; + if (level == parent->finestLevel()) { return; } auto& fine_lev = getLevel(level+1); diff --git a/Tests/EB_CNS/Source/CNS.cpp b/Tests/EB_CNS/Source/CNS.cpp index 5bb3c4e2532..40882a4edb0 100644 --- a/Tests/EB_CNS/Source/CNS.cpp +++ b/Tests/EB_CNS/Source/CNS.cpp @@ -293,7 +293,7 @@ CNS::printTotal () const void CNS::post_init (Real) { - if (level > 0) return; + if (level > 0) { return; } for (int k = parent->finestLevel()-1; k >= 0; --k) { getLevel(k).avgDown(); } @@ -462,7 +462,7 @@ CNS::avgDown () { BL_PROFILE("CNS::avgDown()"); - if (level == parent->finestLevel()) return; + if (level == parent->finestLevel()) { return; } auto& fine_lev = getLevel(level+1); diff --git a/Tests/GPU/CNS/Source/CNS.cpp b/Tests/GPU/CNS/Source/CNS.cpp index 1a073c68c8a..25823b9b76d 100644 --- a/Tests/GPU/CNS/Source/CNS.cpp +++ b/Tests/GPU/CNS/Source/CNS.cpp @@ -284,7 +284,7 @@ CNS::printTotal () const void CNS::post_init (Real) { - if (level > 0) return; + if (level > 0) { return; } for (int k = parent->finestLevel()-1; k >= 0; --k) { getLevel(k).avgDown(); } @@ -401,7 +401,7 @@ CNS::avgDown () { BL_PROFILE("CNS::avgDown()"); - if (level == parent->finestLevel()) return; + if (level == parent->finestLevel()) { return; } auto& fine_lev = getLevel(level+1); diff --git a/Tests/MultiBlock/IndexType/main.cpp b/Tests/MultiBlock/IndexType/main.cpp index 84f939dd5e0..1a35bc1e5b4 100644 --- a/Tests/MultiBlock/IndexType/main.cpp +++ b/Tests/MultiBlock/IndexType/main.cpp @@ -53,7 +53,7 @@ bool ParallelCopyWithItselfIsCorrect(amrex::iMultiFab& mf, const amrex::Box& dom int fails = 0; for (amrex::MFIter mfi(mf); mfi.isValid(); ++mfi) { const amrex::Box section = dest_box & mfi.tilebox(); - if (section.isEmpty()) continue; + if (section.isEmpty()) { continue; } auto array = mf.const_array(mfi); amrex::LoopOnCpu(section, [&](int i, int j, int k) { @@ -115,7 +115,7 @@ bool ParallelCopyFaceToFace(amrex::iMultiFab& dest, const amrex::Box& domain_des const int ny = domain_src.length(1); for (amrex::MFIter mfi(dest); mfi.isValid(); ++mfi) { const amrex::Box section = dest_box & mfi.tilebox(); - if (section.isEmpty()) continue; + if (section.isEmpty()) { continue; } auto darray = dest.const_array(mfi); amrex::LoopOnCpu(section, [&](int i, int j, int k) { diff --git a/Tests/Parser2/fn.cpp b/Tests/Parser2/fn.cpp index 18e2b00d694..46ce898b320 100644 --- a/Tests/Parser2/fn.cpp +++ b/Tests/Parser2/fn.cpp @@ -1,8 +1,8 @@ #include #include +// This is intentional. Cannot have std:: in amrex::Parser expressions. using std::sin; -using std::cos; using std::atan2; using std::pow; diff --git a/Tests/Particles/DenseBins/main.cpp b/Tests/Particles/DenseBins/main.cpp index dd3019d5951..cc40e2fcb77 100644 --- a/Tests/Particles/DenseBins/main.cpp +++ b/Tests/Particles/DenseBins/main.cpp @@ -47,7 +47,7 @@ void checkAnswer (const amrex::DenseBins& bins) for (int i = 0; i < bins.numBins(); ++i) { auto start = offsets[i ]; auto stop = offsets[i+1]; - if (start == stop) continue; + if (start == stop) { continue; } for (auto j = start+1; j < stop; ++j) { AMREX_ALWAYS_ASSERT(bins_ptr[perm[start]] == bins_ptr[perm[j]]); diff --git a/Tests/Particles/NeighborParticles/MDParticleContainer.cpp b/Tests/Particles/NeighborParticles/MDParticleContainer.cpp index bcbf6760b0e..6197dcbef41 100644 --- a/Tests/Particles/NeighborParticles/MDParticleContainer.cpp +++ b/Tests/Particles/NeighborParticles/MDParticleContainer.cpp @@ -251,7 +251,7 @@ void MDParticleContainer::checkNeighborParticles() { int gid = mfi.index(); - if (gid != 0) continue; + if (gid != 0) { continue; } int tid = mfi.LocalTileIndex(); auto index = std::make_pair(gid, tid); @@ -320,7 +320,7 @@ void MDParticleContainer::checkNeighborList() for (int j = 0; j < np_total; j++) { // Don't be your own neighbor. - if ( i == j ) continue; + if ( i == j ) { continue; } ParticleType& p2 = h_pstruct[j]; AMREX_D_TERM(Real dx = p1.pos(0) - p2.pos(0);, diff --git a/Tools/Plotfile/fcompare.cpp b/Tools/Plotfile/fcompare.cpp index 7dc5ed361ad..6a7b95daf5a 100644 --- a/Tools/Plotfile/fcompare.cpp +++ b/Tools/Plotfile/fcompare.cpp @@ -366,7 +366,7 @@ int main_main() if (! all_variables_found) { amrex::Print() << " WARNING: not all variables present in both files\n"; - if (abort_if_not_all_found) return EXIT_FAILURE; + if (abort_if_not_all_found) { return EXIT_FAILURE; } } if (any_nans) { diff --git a/Tools/Postprocessing/C_Src/particle_compare.cpp b/Tools/Postprocessing/C_Src/particle_compare.cpp index 84ceeed914a..9967625cca6 100644 --- a/Tools/Postprocessing/C_Src/particle_compare.cpp +++ b/Tools/Postprocessing/C_Src/particle_compare.cpp @@ -302,8 +302,8 @@ int sort_particles_ascending(const void *p, const void *q) std::memcpy(&cpu1, iptr1, sizeof(int)); std::memcpy(&cpu2, iptr2, sizeof(int)); - if (cpu1 != cpu2) return (cpu1 - cpu2); - if (id1 != id2 ) return (id1 - id2 ); + if (cpu1 != cpu2) { return (cpu1 - cpu2); } + if (id1 != id2 ) { return (id1 - id2 ); } return 0; } @@ -312,7 +312,7 @@ void compare_particle_chunk(const ParticleHeader& header1, std::vector& norms, int level, int file_num, int np, int offset) { - if (np == 0) return; + if (np == 0) { return; } std::string read_file1 = getDataFileName(header1.par_file_name, level, file_num); std::string read_file2 = getDataFileName(header2.par_file_name, level, file_num);