aboutsummaryrefslogtreecommitdiff
path: root/Source/WarpXMove.cpp
diff options
context:
space:
mode:
authorGravatar Andrew Myers <atmyers@lbl.gov> 2018-10-25 15:15:44 -0400
committerGravatar Andrew Myers <atmyers@lbl.gov> 2018-10-25 15:15:44 -0400
commit40cf7d3c854948b84e57a18cfeaa402f2b4236ff (patch)
tree44e9f6fd62baab02d11484b640abb824230636ab /Source/WarpXMove.cpp
parent86f979d1d058c4a3d8f1def0655af406a6a29c73 (diff)
parent3f1b4fd6049c12639e8d11f556c2eef0090c2c51 (diff)
downloadWarpX-40cf7d3c854948b84e57a18cfeaa402f2b4236ff.tar.gz
WarpX-40cf7d3c854948b84e57a18cfeaa402f2b4236ff.tar.zst
WarpX-40cf7d3c854948b84e57a18cfeaa402f2b4236ff.zip
Merge branch 'gpu' of github.com:ECP-WarpX/WarpX into gpu
Diffstat (limited to 'Source/WarpXMove.cpp')
-rw-r--r--Source/WarpXMove.cpp40
1 files changed, 20 insertions, 20 deletions
diff --git a/Source/WarpXMove.cpp b/Source/WarpXMove.cpp
index 53379b031..2082130ef 100644
--- a/Source/WarpXMove.cpp
+++ b/Source/WarpXMove.cpp
@@ -179,6 +179,7 @@ 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();
@@ -219,25 +220,24 @@ WarpX::shiftMF (MultiFab& mf, const Geometry& geom, int num_shift, int dir)
#endif
for (MFIter mfi(tmpmf); mfi.isValid(); ++mfi )
{
- 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);
+ FArrayBox* dstfab = &(mf[mfi]);
+ FArrayBox* srcfab = &(tmpmf[mfi]);
+ Box outbox = mfi.fabbox();
+ outbox &= adjBox;
+ AMREX_CUDA_LAUNCH_HOST_DEVICE_LAMBDA(outbox, toutbox,
+ {
+ srcfab->setVal(0.0, toutbox, 0, nc);
+ });
+ Box dstBox = dstfab->box();
+ if (num_shift > 0) {
+ dstBox.growHi(dir, -num_shift);
+ } else {
+ dstBox.growLo(dir, num_shift);
+ }
+ AMREX_CUDA_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);
+ });
}
}