From 29e99787fc8b6548f20c352ffe24fe7a94ed3edb Mon Sep 17 00:00:00 2001 From: MaxThevenet Date: Fri, 21 Feb 2020 14:27:52 -0800 Subject: Make the option to exchange all guard cells safer (#709) * make the option to exchange all guard cells safer * EOL **** * more consistent naming in guard cells test script --- Source/Utils/WarpXMovingWindow.cpp | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'Source/Utils/WarpXMovingWindow.cpp') diff --git a/Source/Utils/WarpXMovingWindow.cpp b/Source/Utils/WarpXMovingWindow.cpp index 6c2a249e0..8f1666b2f 100644 --- a/Source/Utils/WarpXMovingWindow.cpp +++ b/Source/Utils/WarpXMovingWindow.cpp @@ -246,15 +246,20 @@ WarpX::shiftMF (MultiFab& mf, const Geometry& geom, int num_shift, int dir, MultiFab tmpmf(ba, dm, nc, ng); MultiFab::Copy(tmpmf, mf, 0, 0, nc, ng); - IntVect ng_mw = IntVect::TheUnitVector(); - // Enough guard cells in the MW direction - ng_mw[dir] = num_shift; - // Add the extra cell (if momentum-conserving gather with staggered field solve) - ng_mw += ng_extra; - // Make sure we don't exceed number of guard cells allocated - ng_mw = ng_mw.min(ng); - // Fill guard cells. - tmpmf.FillBoundary(ng_mw, geom.periodicity()); + if ( WarpX::safe_guard_cells ) { + // Fill guard cells. + tmpmf.FillBoundary(geom.periodicity()); + } else { + IntVect ng_mw = IntVect::TheUnitVector(); + // Enough guard cells in the MW direction + ng_mw[dir] = num_shift; + // Add the extra cell (if momentum-conserving gather with staggered field solve) + ng_mw += ng_extra; + // Make sure we don't exceed number of guard cells allocated + ng_mw = ng_mw.min(ng); + // Fill guard cells. + tmpmf.FillBoundary(ng_mw, geom.periodicity()); + } // Make a box that covers the region that the window moved into const IndexType& typ = ba.ixType(); -- cgit v1.2.3