Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clang-Tidy changes in Src/EB #3473

Merged
merged 1 commit into from
Aug 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Src/EB/AMReX_EB2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,10 +267,10 @@ int comp_max_crse_level (Box cdomain, const Box& domain)
{
int ilev;
for (ilev = 0; ilev < 30; ++ilev) {
if (cdomain.contains(domain)) break;
if (cdomain.contains(domain)) { break; }
cdomain.refine(2);
}
if (cdomain != domain) ilev = -1;
if (cdomain != domain) { ilev = -1; }
return ilev;
}
}
Expand Down
8 changes: 4 additions & 4 deletions Src/EB/AMReX_EB2_2D_C.H
Original file line number Diff line number Diff line change
Expand Up @@ -271,10 +271,10 @@ void build_cellflag_from_ap (int i, int j, Array4<EBCellFlag> const& cflag,
// By default, all neighbors are already set.
auto flg = cflag(i,j,k);

if (apx(i ,j ,k) == 0.0_rt) flg.setDisconnected(-1, 0, 0);
if (apx(i+1,j ,k) == 0.0_rt) flg.setDisconnected( 1, 0, 0);
if (apy(i ,j ,k) == 0.0_rt) flg.setDisconnected( 0,-1, 0);
if (apy(i ,j+1,k) == 0.0_rt) flg.setDisconnected( 0, 1, 0);
if (apx(i ,j ,k) == 0.0_rt) { flg.setDisconnected(-1, 0, 0); }
if (apx(i+1,j ,k) == 0.0_rt) { flg.setDisconnected( 1, 0, 0); }
if (apy(i ,j ,k) == 0.0_rt) { flg.setDisconnected( 0,-1, 0); }
if (apy(i ,j+1,k) == 0.0_rt) { flg.setDisconnected( 0, 1, 0); }

if ((apx(i,j ,k) == 0.0_rt || apy(i-1,j,k) == 0.0_rt) &&
(apx(i,j-1,k) == 0.0_rt || apy(i ,j,k) == 0.0_rt))
Expand Down
16 changes: 8 additions & 8 deletions Src/EB/AMReX_EB2_2D_C.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,10 +278,10 @@ int build_faces (Box const& bx, Array4<EBCellFlag> const& cell,
else
{
int ncuts = 0;
if (fx(i ,j ,0) == Type::irregular) ++ncuts;
if (fx(i+1,j ,0) == Type::irregular) ++ncuts;
if (fy(i ,j ,0) == Type::irregular) ++ncuts;
if (fy(i ,j+1,0) == Type::irregular) ++ncuts;
if (fx(i ,j ,0) == Type::irregular) { ++ncuts; }
if (fx(i+1,j ,0) == Type::irregular) { ++ncuts; }
if (fy(i ,j ,0) == Type::irregular) { ++ncuts; }
if (fy(i ,j+1,0) == Type::irregular) { ++ncuts; }
if (ncuts > 2) {
Gpu::Atomic::Add(dp,1);
}
Expand Down Expand Up @@ -437,10 +437,10 @@ void set_connection_flags (Box const& bxg1,

auto flg = cell(i,j,0);

if (fx(i ,j ,0) == Type::covered) flg.setDisconnected(IntVect(-1, 0));
if (fx(i+1,j ,0) == Type::covered) flg.setDisconnected(IntVect( 1, 0));
if (fy(i ,j ,0) == Type::covered) flg.setDisconnected(IntVect( 0,-1));
if (fy(i ,j+1,0) == Type::covered) flg.setDisconnected(IntVect( 0, 1));
if (fx(i ,j ,0) == Type::covered) { flg.setDisconnected(IntVect(-1, 0)); }
if (fx(i+1,j ,0) == Type::covered) { flg.setDisconnected(IntVect( 1, 0)); }
if (fy(i ,j ,0) == Type::covered) { flg.setDisconnected(IntVect( 0,-1)); }
if (fy(i ,j+1,0) == Type::covered) { flg.setDisconnected(IntVect( 0, 1)); }

if (((fx(i,j,0) == Type::covered) || fy(i-1,j,0) == Type::covered) &&
((fx(i,j-1,0) == Type::covered) || fy(i,j,0) == Type::covered))
Expand Down
60 changes: 30 additions & 30 deletions Src/EB/AMReX_EB2_3D_C.H
Original file line number Diff line number Diff line change
Expand Up @@ -636,107 +636,107 @@ void build_cellflag_from_ap (int i, int j, int k, Array4<EBCellFlag> const& cfla
{
flg.setConnected(0,0,0);

if (apx(i ,j,k) != 0.0_rt) flg.setConnected(-1, 0, 0);
if (apx(i+1,j,k) != 0.0_rt) flg.setConnected( 1, 0, 0);
if (apy(i,j ,k) != 0.0_rt) flg.setConnected( 0, -1, 0);
if (apy(i,j+1,k) != 0.0_rt) flg.setConnected( 0, 1, 0);
if (apz(i,j,k ) != 0.0_rt) flg.setConnected( 0, 0, -1);
if (apz(i,j,k+1) != 0.0_rt) flg.setConnected( 0, 0, 1);
if (apx(i ,j,k) != 0.0_rt) { flg.setConnected(-1, 0, 0); }
if (apx(i+1,j,k) != 0.0_rt) { flg.setConnected( 1, 0, 0); }
if (apy(i,j ,k) != 0.0_rt) { flg.setConnected( 0, -1, 0); }
if (apy(i,j+1,k) != 0.0_rt) { flg.setConnected( 0, 1, 0); }
if (apz(i,j,k ) != 0.0_rt) { flg.setConnected( 0, 0, -1); }
if (apz(i,j,k+1) != 0.0_rt) { flg.setConnected( 0, 0, 1); }

if ( (apx(i,j,k) != 0.0_rt && apy(i-1,j,k) != 0.0_rt) ||
(apy(i,j,k) != 0.0_rt && apx(i,j-1,k) != 0.0_rt) )
{
flg.setConnected(-1, -1, 0);
if (apz(i-1,j-1,k ) != 0.0_rt) flg.setConnected(-1,-1,-1);
if (apz(i-1,j-1,k+1) != 0.0_rt) flg.setConnected(-1,-1, 1);
if (apz(i-1,j-1,k ) != 0.0_rt) { flg.setConnected(-1,-1,-1); }
if (apz(i-1,j-1,k+1) != 0.0_rt) { flg.setConnected(-1,-1, 1); }
}

if ( (apx(i+1,j,k) != 0.0_rt && apy(i+1,j ,k) != 0.0_rt) ||
(apy(i ,j,k) != 0.0_rt && apx(i+1,j-1,k) != 0.0_rt) )
{
flg.setConnected(1, -1, 0);
if (apz(i+1,j-1,k ) != 0.0_rt) flg.setConnected(1,-1,-1);
if (apz(i+1,j-1,k+1) != 0.0_rt) flg.setConnected(1,-1, 1);
if (apz(i+1,j-1,k ) != 0.0_rt) { flg.setConnected(1,-1,-1); }
if (apz(i+1,j-1,k+1) != 0.0_rt) { flg.setConnected(1,-1, 1); }
}

if ( (apx(i,j ,k) != 0.0_rt && apy(i-1,j+1,k) != 0.0_rt) ||
(apy(i,j+1,k) != 0.0_rt && apx(i ,j+1,k) != 0.0_rt) )
{
flg.setConnected(-1, 1, 0);
if (apz(i-1,j+1,k ) != 0.0_rt) flg.setConnected(-1, 1,-1);
if (apz(i-1,j+1,k+1) != 0.0_rt) flg.setConnected(-1, 1, 1);
if (apz(i-1,j+1,k ) != 0.0_rt) { flg.setConnected(-1, 1,-1); }
if (apz(i-1,j+1,k+1) != 0.0_rt) { flg.setConnected(-1, 1, 1); }
}

if ( (apx(i+1,j ,k) != 0.0_rt && apy(i+1,j+1,k) != 0.0_rt) ||
(apy(i ,j+1,k) != 0.0_rt && apx(i+1,j+1,k) != 0.0_rt) )
{
flg.setConnected(1, 1, 0);
if (apz(i+1,j+1,k ) != 0.0_rt) flg.setConnected(1, 1,-1);
if (apz(i+1,j+1,k+1) != 0.0_rt) flg.setConnected(1, 1, 1);
if (apz(i+1,j+1,k ) != 0.0_rt) { flg.setConnected(1, 1,-1); }
if (apz(i+1,j+1,k+1) != 0.0_rt) { flg.setConnected(1, 1, 1); }
}

if ( (apx(i,j,k) != 0.0_rt && apz(i-1,j,k ) != 0.0_rt) ||
(apz(i,j,k) != 0.0_rt && apx(i ,j,k-1) != 0.0_rt) )
{
flg.setConnected(-1, 0, -1);
if (apy(i-1,j ,k-1) != 0.0_rt) flg.setConnected(-1,-1,-1);
if (apy(i-1,j+1,k-1) != 0.0_rt) flg.setConnected(-1, 1,-1);
if (apy(i-1,j ,k-1) != 0.0_rt) { flg.setConnected(-1,-1,-1); }
if (apy(i-1,j+1,k-1) != 0.0_rt) { flg.setConnected(-1, 1,-1); }
}

if ( (apx(i+1,j,k) != 0.0_rt && apz(i+1,j,k ) != 0.0_rt) ||
(apz(i ,j,k) != 0.0_rt && apx(i+1,j,k-1) != 0.0_rt) )
{
flg.setConnected(1, 0, -1);
if (apy(i+1,j ,k-1) != 0.0_rt) flg.setConnected(1,-1,-1);
if (apy(i+1,j+1,k-1) != 0.0_rt) flg.setConnected(1, 1,-1);
if (apy(i+1,j ,k-1) != 0.0_rt) { flg.setConnected(1,-1,-1); }
if (apy(i+1,j+1,k-1) != 0.0_rt) { flg.setConnected(1, 1,-1); }
}

if ( (apx(i,j,k ) != 0.0_rt && apz(i-1,j,k+1) != 0.0_rt) ||
(apz(i,j,k+1) != 0.0_rt && apx(i ,j,k+1) != 0.0_rt) )
{
flg.setConnected(-1, 0, 1);
if (apy(i-1,j ,k+1) != 0.0_rt) flg.setConnected(-1,-1, 1);
if (apy(i-1,j+1,k+1) != 0.0_rt) flg.setConnected(-1, 1, 1);
if (apy(i-1,j ,k+1) != 0.0_rt) { flg.setConnected(-1,-1, 1); }
if (apy(i-1,j+1,k+1) != 0.0_rt) { flg.setConnected(-1, 1, 1); }
}

if ( (apx(i+1,j,k ) != 0.0_rt && apz(i+1,j,k+1) != 0.0_rt) ||
(apz(i ,j,k+1) != 0.0_rt && apx(i+1,j,k+1) != 0.0_rt) )
{
flg.setConnected(1, 0, 1);
if (apy(i+1,j ,k+1) != 0.0_rt) flg.setConnected(1,-1, 1);
if (apy(i+1,j+1,k+1) != 0.0_rt) flg.setConnected(1, 1, 1);
if (apy(i+1,j ,k+1) != 0.0_rt) { flg.setConnected(1,-1, 1); }
if (apy(i+1,j+1,k+1) != 0.0_rt) { flg.setConnected(1, 1, 1); }
}

if ( (apy(i,j,k) != 0.0_rt && apz(i,j-1,k ) != 0.0_rt) ||
(apz(i,j,k) != 0.0_rt && apy(i,j ,k-1) != 0.0_rt) )
{
flg.setConnected(0, -1, -1);
if (apx(i ,j-1,k-1) != 0.0_rt) flg.setConnected(-1,-1,-1);
if (apx(i+1,j-1,k-1) != 0.0_rt) flg.setConnected( 1,-1,-1);
if (apx(i ,j-1,k-1) != 0.0_rt) { flg.setConnected(-1,-1,-1); }
if (apx(i+1,j-1,k-1) != 0.0_rt) { flg.setConnected( 1,-1,-1); }
}

if ( (apy(i,j+1,k) != 0.0_rt && apz(i,j+1,k ) != 0.0_rt) ||
(apz(i,j ,k) != 0.0_rt && apy(i,j+1,k-1) != 0.0_rt) )
{
flg.setConnected(0, 1, -1);
if (apx(i ,j+1,k-1) != 0.0_rt) flg.setConnected(-1, 1,-1);
if (apx(i+1,j+1,k-1) != 0.0_rt) flg.setConnected( 1, 1,-1);
if (apx(i ,j+1,k-1) != 0.0_rt) { flg.setConnected(-1, 1,-1); }
if (apx(i+1,j+1,k-1) != 0.0_rt) { flg.setConnected( 1, 1,-1); }
}

if ( (apy(i,j,k ) != 0.0_rt && apz(i,j-1,k+1) != 0.0_rt) ||
(apz(i,j,k+1) != 0.0_rt && apy(i,j ,k+1) != 0.0_rt) )
{
flg.setConnected(0, -1, 1);
if (apx(i ,j-1,k+1) != 0.0_rt) flg.setConnected(-1,-1, 1);
if (apx(i+1,j-1,k+1) != 0.0_rt) flg.setConnected( 1,-1, 1);
if (apx(i ,j-1,k+1) != 0.0_rt) { flg.setConnected(-1,-1, 1); }
if (apx(i+1,j-1,k+1) != 0.0_rt) { flg.setConnected( 1,-1, 1); }
}

if ( (apy(i,j+1,k ) != 0.0_rt && apz(i,j+1,k+1) != 0.0_rt) ||
(apz(i,j ,k+1) != 0.0_rt && apy(i,j+1,k+1) != 0.0_rt) )
{
flg.setConnected(0, 1, 1);
if (apx(i ,j+1,k+1) != 0.0_rt) flg.setConnected(-1, 1, 1);
if (apx(i+1,j+1,k+1) != 0.0_rt) flg.setConnected( 1, 1, 1);
if (apx(i ,j+1,k+1) != 0.0_rt) { flg.setConnected(-1, 1, 1); }
if (apx(i+1,j+1,k+1) != 0.0_rt) { flg.setConnected( 1, 1, 1); }
}
}

Expand Down
8 changes: 4 additions & 4 deletions Src/EB/AMReX_EB2_GeometryShop.H
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ BrentRootFinder (GpuArray<Real,AMREX_SPACEDIM> const& lo,
}

// Check whether in bounds
if (p > 0) q = -q;
if (p > 0) { q = -q; }

p = std::abs(p);

Expand Down Expand Up @@ -158,8 +158,8 @@ BrentRootFinder (GpuArray<Real,AMREX_SPACEDIM> const& lo,
}
else
{
if (xm < 0) bPt[rangedir] = bPt[rangedir] - tol1;
else bPt[rangedir] = bPt[rangedir] + tol1;
if (xm < 0) { bPt[rangedir] = bPt[rangedir] - tol1; }
else { bPt[rangedir] = bPt[rangedir] + tol1; }
}

fb = IF_f(f, bPt);
Expand Down Expand Up @@ -220,7 +220,7 @@ public:
} else {
++nfluid;
}
if (nbody > 0 && nfluid > 0) return mixedcells;
if (nbody > 0 && nfluid > 0) { return mixedcells; }
}
}
}
Expand Down
12 changes: 6 additions & 6 deletions Src/EB/AMReX_EB2_Level.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -241,9 +241,9 @@ Level::coarsenFromFine (Level& fineLevel, bool fill_boundary)
vfrac(i,j,k) = 0.0;
cflag(i,j,k) = EBCellFlag::TheCoveredCell();
}
AMREX_D_TERM(if (xbx.contains(cell)) apx(i,j,k) = 0.0;,
if (ybx.contains(cell)) apy(i,j,k) = 0.0;,
if (zbx.contains(cell)) apz(i,j,k) = 0.0;);
AMREX_D_TERM(if (xbx.contains(cell)) { apx(i,j,k) = 0.0; },
if (ybx.contains(cell)) { apy(i,j,k) = 0.0; },
if (zbx.contains(cell)) { apz(i,j,k) = 0.0; })
});
}
}
Expand Down Expand Up @@ -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());

Expand Down Expand Up @@ -715,7 +715,7 @@ Level::fillAreaFrac (Array<MultiFab*,AMREX_SPACEDIM> 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)
{
Expand Down
4 changes: 2 additions & 2 deletions Src/EB/AMReX_EBFluxRegister.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ EBFluxRegister::FineAdd (const MFIter& mfi,

const int li = mfi.LocalIndex();
Vector<FArrayBox*>& 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());
Expand Down Expand Up @@ -340,7 +340,7 @@ EBFluxRegister::Reflux (MultiFab& crse_state, const amrex::MultiFab& crse_vfrac,
const Box& gdomain = m_crse_geom.growPeriodicDomain(1);

MFItInfo info;
if (Gpu::notInLaunchRegion()) info.EnableTiling().SetDynamic(true);
if (Gpu::notInLaunchRegion()) { info.EnableTiling().SetDynamic(true); }
#ifdef AMREX_USE_OMP
#pragma omp parallel if (Gpu::notInLaunchRegion())
#endif
Expand Down
Loading
Loading