aboutsummaryrefslogtreecommitdiff
path: root/Source/WarpXMove.cpp
diff options
context:
space:
mode:
authorGravatar MaxThevenet <mthevenet@lbl.gov> 2018-12-11 10:37:21 -0800
committerGravatar MaxThevenet <mthevenet@lbl.gov> 2018-12-11 10:37:21 -0800
commitb53d4a7ea5c3963e16727aafdbda01771af04c0d (patch)
tree33ddccf2ceb4ae6670baa4ed31b9b97cb7035473 /Source/WarpXMove.cpp
parent4e4a84aba36b2d2168cf41077f596549180f0dd9 (diff)
downloadWarpX-b53d4a7ea5c3963e16727aafdbda01771af04c0d.tar.gz
WarpX-b53d4a7ea5c3963e16727aafdbda01771af04c0d.tar.zst
WarpX-b53d4a7ea5c3963e16727aafdbda01771af04c0d.zip
fix conflicts for merge revert
Diffstat (limited to 'Source/WarpXMove.cpp')
-rw-r--r--Source/WarpXMove.cpp48
1 files changed, 24 insertions, 24 deletions
diff --git a/Source/WarpXMove.cpp b/Source/WarpXMove.cpp
index 908c70573..401211554 100644
--- a/Source/WarpXMove.cpp
+++ b/Source/WarpXMove.cpp
@@ -40,8 +40,8 @@ WarpX::MoveWindow (bool move_j)
Real new_hi[AMREX_SPACEDIM];
const Real* current_lo = geom[0].ProbLo();
const Real* current_hi = geom[0].ProbHi();
- const Real* cdx = geom[0].CellSize();
- int num_shift_base = static_cast<int>((moving_window_x - current_lo[dir]) / cdx[dir]);
+ const Real* dx = geom[0].CellSize();
+ int num_shift_base = static_cast<int>((moving_window_x - current_lo[dir]) / dx[dir]);
if (num_shift_base == 0) return 0;
@@ -51,8 +51,8 @@ WarpX::MoveWindow (bool move_j)
new_lo[i] = current_lo[i];
new_hi[i] = current_hi[i];
}
- new_lo[dir] = current_lo[dir] + num_shift_base * cdx[dir];
- new_hi[dir] = current_hi[dir] + num_shift_base * cdx[dir];
+ new_lo[dir] = current_lo[dir] + num_shift_base * dx[dir];
+ new_hi[dir] = current_hi[dir] + num_shift_base * dx[dir];
RealBox new_box(new_lo, new_hi);
Geometry::ProbDomain(new_box);
@@ -181,7 +181,6 @@ WarpX::MoveWindow (bool move_j)
void
WarpX::shiftMF (MultiFab& mf, const Geometry& geom, int num_shift, int dir)
{
- BL_PROFILE("WarpX::shiftMF()");
const BoxArray& ba = mf.boxArray();
const DistributionMapping& dm = mf.DistributionMap();
const int nc = mf.nComp();
@@ -222,24 +221,25 @@ WarpX::shiftMF (MultiFab& mf, const Geometry& geom, int num_shift, int dir)
#endif
for (MFIter mfi(tmpmf); mfi.isValid(); ++mfi )
{
- FArrayBox* dstfab = mf.fabPtr(mfi);
- FArrayBox* srcfab = tmpmf.fabPtr(mfi);
- Box outbox = mfi.fabbox();
- outbox &= adjBox;
- AMREX_LAUNCH_HOST_DEVICE_LAMBDA(outbox, toutbox,
- {
- srcfab->setVal(0.0, toutbox, 0, nc);
- });
- Box dstBox = mf[mfi].box();
- if (num_shift > 0) {
- dstBox.growHi(dir, -num_shift);
- } else {
- dstBox.growLo(dir, num_shift);
- }
- AMREX_LAUNCH_HOST_DEVICE_LAMBDA(dstBox, tdstBox,
- {
- dstfab->setVal(0.0, tdstBox, 0, nc);
- dstfab->copy(*srcfab, amrex::shift(tdstBox,dir,num_shift), 0, tdstBox, 0, nc);
- });
+ FArrayBox& srcfab = tmpmf[mfi];
+
+ Box outbox = mfi.fabbox();
+ outbox &= adjBox;
+ if (outbox.ok()) { // outbox is the region that the window moved into
+ srcfab.setVal(0.0, outbox, 0, nc);
+ }
+
+ FArrayBox& dstfab = mf[mfi];
+ dstfab.setVal(0.0);
+
+ Box dstBox = dstfab.box();
+
+ if (num_shift > 0) {
+ dstBox.growHi(dir, -num_shift);
+ } else {
+ dstBox.growLo(dir, num_shift);
+ }
+
+ dstfab.copy(srcfab, amrex::shift(dstBox,dir,num_shift), 0, dstBox, 0, nc);
}
}