Skip to content

Commit

Permalink
fix bug plus BL_ASSERT --> AMREX_ASSERT
Browse files Browse the repository at this point in the history
  • Loading branch information
asalmgren committed Jun 25, 2023
1 parent 15a3fe6 commit 2bb6d42
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Src/EB/AMReX_EBCellFlag.H
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public:
void setMultiValued (int n) noexcept {
flag &= zero_lower_mask;
flag |= multi_valued_bits;
BL_ASSERT(n >= 2 && n <= 7);
AMREX_ASSERT(n >= 2 && n <= 7);
flag |= static_cast<uint32_t>(n) << pos_numvofs;
}

Expand Down
4 changes: 2 additions & 2 deletions Src/EB/AMReX_EBFArrayBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ EBFArrayBox::EBFArrayBox (const EBCellFlagFab& ebflag, const Box& bx, int ncomps
m_factory(factory),
m_box_index(box_index)
{
BL_ASSERT(ebflag.box().contains(amrex::enclosedCells(bx)));
AMREX_ASSERT(ebflag.box().contains(amrex::enclosedCells(bx)));
const Box& ccbx = amrex::enclosedCells(bx);
m_type = ebflag.getType(ccbx);
}
Expand Down Expand Up @@ -174,7 +174,7 @@ const EBCellFlagFab&
getEBCellFlagFab (const FArrayBox& fab)
{
const auto* ebfab = static_cast<EBFArrayBox const*>(&fab);
BL_ASSERT(ebfab);
AMREX_ASSERT(ebfab);
return ebfab->getEBCellFlagFab();
}

Expand Down
19 changes: 9 additions & 10 deletions Src/EB/AMReX_EBFluxRegister.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ EBFluxRegister::CrseAdd (const MFIter& mfi,
const std::array<FArrayBox const*, AMREX_SPACEDIM>& areafrac,
RunOn runon)
{
BL_ASSERT(m_crse_data.nComp() == flux[0]->nComp());
AMREX_ASSERT(m_crse_data.nComp() == flux[0]->nComp());
int destcomp = 0;
int numcomp = m_crse_data.nComp();
CrseAdd(mfi, flux, dx, dt, volfrac, areafrac, destcomp, numcomp, runon);
Expand All @@ -99,8 +99,8 @@ EBFluxRegister::CrseAdd (const MFIter& mfi,
// "destcomp" refers to the indexing in the arrays internal to the EBFluxRegister
//

BL_ASSERT(flux[0]->nComp() >= +numcomp);
BL_ASSERT(m_crse_data.nComp() >= flux[0]->nComp());
AMREX_ASSERT(flux[0]->nComp() >= +numcomp);
AMREX_ASSERT(m_crse_data.nComp() >= flux[0]->nComp());

if (m_crse_fab_flag[mfi.LocalIndex()] == crse_cell) {
return; // this coarse fab is not close to fine fabs.
Expand Down Expand Up @@ -139,7 +139,7 @@ EBFluxRegister::FineAdd (const MFIter& mfi,
const std::array<FArrayBox const*, AMREX_SPACEDIM>& areafrac,
RunOn runon)
{
BL_ASSERT(m_cfpatch.nComp() == a_flux[0]->nComp());
AMREX_ASSERT(m_cfpatch.nComp() == a_flux[0]->nComp());
int destcomp = 0;
int numcomp = m_crse_data.nComp();
FineAdd(mfi, a_flux, dx, dt, volfrac, areafrac, destcomp, numcomp, runon);
Expand All @@ -158,16 +158,16 @@ EBFluxRegister::FineAdd (const MFIter& mfi,
// "destcomp" refers to the indexing in the arrays internal to the EBFluxRegister
//

BL_ASSERT(m_cfpatch.nComp() >= a_flux[0]->nComp());
BL_ASSERT(a_flux[0]->nComp() >= numcomp);
AMREX_ASSERT(m_cfpatch.nComp() >= a_flux[0]->nComp());
AMREX_ASSERT(a_flux[0]->nComp() >= numcomp);

const int li = mfi.LocalIndex();
Vector<FArrayBox*>& cfp_fabs = m_cfp_fab[li];
if (cfp_fabs.empty()) return;

const int nc = numcomp;
const Box& tbx = mfi.tilebox();
BL_ASSERT(tbx.cellCentered());
AMREX_ASSERT(tbx.cellCentered());
const Box& cbx = amrex::coarsen(tbx, m_ratio);

AMREX_D_TERM(Array4<Real const> const& fx = a_flux[0]->const_array();,
Expand Down Expand Up @@ -258,7 +258,7 @@ EBFluxRegister::FineAdd (const MFIter& mfi,
const FArrayBox& dm,
RunOn runon)
{
BL_ASSERT(m_cfpatch.nComp() == a_flux[0]->nComp());
AMREX_ASSERT(m_cfpatch.nComp() == a_flux[0]->nComp());
int destcomp = 0;
int numcomp = m_crse_data.nComp();
FineAdd(mfi, a_flux, dx, dt, vfrac, areafrac, dm, destcomp, numcomp, runon);
Expand Down Expand Up @@ -433,8 +433,7 @@ EBFluxRegister::Reflux (MultiFab& crse_state, const amrex::MultiFab& crse_vfrac,
if (ebflag.getType(bxg1) == FabType::regular)
{
// no re-reflux or re-re-redistribution
// AMREX_HOST_DEVICE_PARALLEL_FOR_4D(bx, numcomp, i, j, k, n,
AMREX_HOST_DEVICE_PARALLEL_FOR_4D(bx, 2, i, j, k, n,
AMREX_HOST_DEVICE_PARALLEL_FOR_4D(bx, numcomp, i, j, k, n,
{
dfab(i,j,k,n) += sfab(i,j,k,n);
});
Expand Down
2 changes: 1 addition & 1 deletion Src/EB/AMReX_EBInterpolater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ EBCellConservativeLinear::interp (const FArrayBox& crse,

if (crse.getType() == FabType::regular)
{
BL_ASSERT(amrex::getEBCellFlagFab(fine).getType(target_fine_region) == FabType::regular);
AMREX_ASSERT(amrex::getEBCellFlagFab(fine).getType(target_fine_region) == FabType::regular);
}
else
{
Expand Down
4 changes: 2 additions & 2 deletions Src/EB/AMReX_EBMultiFabUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -410,8 +410,8 @@ EB_average_down (const MultiFab& S_fine, MultiFab& S_crse, int scomp, int ncomp,
const auto& factory = dynamic_cast<EBFArrayBoxFactory const&>(S_fine.Factory());
const auto& vfrac_fine = factory.getVolFrac();

BL_ASSERT(S_crse.nComp() == S_fine.nComp());
BL_ASSERT(S_crse.is_cell_centered() && S_fine.is_cell_centered());
AMREX_ASSERT(S_crse.nComp() == S_fine.nComp());
AMREX_ASSERT(S_crse.is_cell_centered() && S_fine.is_cell_centered());

BoxArray crse_S_fine_BA = S_fine.boxArray(); crse_S_fine_BA.coarsen(ratio);

Expand Down

0 comments on commit 2bb6d42

Please sign in to comment.