diff --git a/Src/C_AMRLib/Amr.cpp b/Src/C_AMRLib/Amr.cpp index b0759728393..9f795f660ec 100644 --- a/Src/C_AMRLib/Amr.cpp +++ b/Src/C_AMRLib/Amr.cpp @@ -2191,7 +2191,7 @@ Amr::ProjPeriodic (BoxList& blout, BoxList tmp(blorig); tmp.intersect(domain); - blout.join(tmp); + blout.catenate(tmp); if (rk != 0 && geom.isPeriodic(2)) blorig.shift(2,-rk*domain.length(2)); diff --git a/Src/C_BaseLib/BoxArray.cpp b/Src/C_BaseLib/BoxArray.cpp index 9d04c6c49b3..bf90e3ca074 100644 --- a/Src/C_BaseLib/BoxArray.cpp +++ b/Src/C_BaseLib/BoxArray.cpp @@ -599,10 +599,14 @@ BoxList BoxLib::GetBndryCells (const BoxArray& ba, int ngrow) { + BL_ASSERT(ba.ok()); + BL_ASSERT(ba.size() > 0); // // First get list of all ghost cells. // - BoxList gcells, bcells = ba.boxList(); + const IndexType btype = ba[0].ixType(); + + BoxList bcells = ba.boxList(), gcells(btype), leftover(btype); bcells.simplify(); @@ -612,14 +616,18 @@ BoxLib::GetBndryCells (const BoxArray& ba, for (int i = 0, N = tba.size(); i < N; ++i) { - gcells.join(BoxLib::boxDiff(BoxLib::grow(tba[i],ngrow),tba[i])); + bcells = BoxLib::boxDiff(BoxLib::grow(tba[i],ngrow),tba[i]); + + gcells.catenate(bcells); } // // Now strip out intersections with original BoxArray. // + std::vector< std::pair > isects; + for (BoxList::const_iterator it = gcells.begin(), End = gcells.end(); it != End; ++it) { - std::vector< std::pair > isects = tba.intersections(*it); + isects = tba.intersections(*it); if (isects.empty()) { @@ -630,10 +638,10 @@ BoxLib::GetBndryCells (const BoxArray& ba, // // Collect all the intersection pieces. // - BoxList pieces; + BoxList pieces(btype); for (int i = 0, N = isects.size(); i < N; i++) pieces.push_back(isects[i].second); - BoxList leftover = BoxLib::complementIn(*it,pieces); + leftover = BoxLib::complementIn(*it,pieces); bcells.catenate(leftover); } } diff --git a/Src/C_BaseLib/BoxList.cpp b/Src/C_BaseLib/BoxList.cpp index c96a1d146bc..50a3058ae4b 100644 --- a/Src/C_BaseLib/BoxList.cpp +++ b/Src/C_BaseLib/BoxList.cpp @@ -279,39 +279,40 @@ BoxList::complementIn (const Box& b, { clear(); - Box minbox = bl.minimalBox(); - BoxList tmpbl = BoxLib::boxDiff(b,minbox); + Box mbox = bl.minimalBox(); + BoxList diff = BoxLib::boxDiff(b,mbox); - catenate(tmpbl); + catenate(diff); BoxArray ba(bl); BoxList mesh(b.ixType()); - if (minbox.ok()) - mesh.push_back(minbox); + if (mbox.ok()) + mesh.push_back(mbox); mesh.maxSize(BL_SPACEDIM == 3 ? 64 : 128); + std::vector< std::pair > isects; + for (BoxList::const_iterator bli = mesh.begin(), End = mesh.end(); bli != End; ++bli) { const Box bx = *bli & b; if (!bx.ok()) continue; - std::vector< std::pair > isects = ba.intersections(bx); + isects = ba.intersections(bx); - if (!isects.empty()) + if (isects.empty()) + { + push_back(bx); + } + else { - tmpbl.clear(); - BoxList tm(b.ixType()); + BoxList tm(b.ixType()), tmpbl(b.ixType()); for (int i = 0, N = isects.size(); i < N; i++) tmpbl.push_back(isects[i].second); tm.complementIn_base(bx,tmpbl); catenate(tm); } - else - { - push_back(bx); - } } } @@ -328,14 +329,16 @@ BoxList::complementIn_base (const Box& b, push_back(b); + BoxList diff; + for (const_iterator bli = bl.begin(), End = bl.end(); bli != End && isNotEmpty(); ++bli) { for (iterator newbli = lbox.begin(); newbli != lbox.end(); ) { if (newbli->intersects(*bli)) { - BoxList tm = BoxLib::boxDiff(*newbli, *bli); - lbox.splice(lbox.begin(), tm.lbox); + diff = BoxLib::boxDiff(*newbli, *bli); + lbox.splice(lbox.begin(), diff.lbox); lbox.erase(newbli++); } else diff --git a/Src/Extern/amrdata/AmrData.cpp b/Src/Extern/amrdata/AmrData.cpp index 5feaf2d9bb8..83588c540ec 100644 --- a/Src/Extern/amrdata/AmrData.cpp +++ b/Src/Extern/amrdata/AmrData.cpp @@ -1185,7 +1185,7 @@ void AmrData::FillVar(MultiFab &destMultiFab, int finestFillLevel, BoxArray(BoxLib::complementIn(tempCoarseBox, tempUnfillableBoxes)); - unfillableBoxesOnThisLevel.join(tempUnfillableBoxes); + unfillableBoxesOnThisLevel.catenate(tempUnfillableBoxes); ++currentBLI; } } @@ -1410,7 +1410,7 @@ void AmrData::FillVar(Array &destFabs, const Array &destBoxes, BoxArray(BoxLib::complementIn(tempCoarseBox, tempUnfillableBoxes)); - unfillableBoxesOnThisLevel.join(tempUnfillableBoxes); + unfillableBoxesOnThisLevel.catenate(tempUnfillableBoxes); ++currentBLI; } }