diff options
-rw-r--r-- | Source/WarpXBoostedFrameDiagnostic.cpp | 8 | ||||
-rw-r--r-- | Source/WarpX_boosted_frame.F90 | 34 | ||||
-rw-r--r-- | Source/WarpX_f.H | 10 |
3 files changed, 39 insertions, 13 deletions
diff --git a/Source/WarpXBoostedFrameDiagnostic.cpp b/Source/WarpXBoostedFrameDiagnostic.cpp index b5c36d1a0..babf8619c 100644 --- a/Source/WarpXBoostedFrameDiagnostic.cpp +++ b/Source/WarpXBoostedFrameDiagnostic.cpp @@ -99,10 +99,10 @@ writeLabFrameData(const MultiFab& cell_centered_data, const Geometry& geom, Real #endif for (MFIter mfi(tmp, true); mfi.isValid(); ++mfi) { const Box& tile_box = mfi.tilebox(); - warpx_copy_slice(BL_TO_FORTRAN_BOX(tile_box), - BL_TO_FORTRAN_ANYD(tmp[mfi]), - BL_TO_FORTRAN_ANYD((*data_buffer_[i])[mfi]), - &ncomp, &i_boost, &i_lab); + WRPX_COPY_SLICE(BL_TO_FORTRAN_BOX(tile_box), + BL_TO_FORTRAN_ANYD(tmp[mfi]), + BL_TO_FORTRAN_ANYD((*data_buffer_[i])[mfi]), + &ncomp, &i_boost, &i_lab); } ++buff_counter_[i]; diff --git a/Source/WarpX_boosted_frame.F90 b/Source/WarpX_boosted_frame.F90 index cf0f8d0bb..3f8f0607c 100644 --- a/Source/WarpX_boosted_frame.F90 +++ b/Source/WarpX_boosted_frame.F90 @@ -57,10 +57,10 @@ contains end subroutine warpx_lorentz_transform_z - subroutine warpx_copy_slice(lo, hi, tmp, tlo, thi, & + subroutine warpx_copy_slice_3d(lo, hi, tmp, tlo, thi, & buf, blo, bhi, ncomp, & i_boost, i_lab) & - bind(C, name="warpx_copy_slice") + bind(C, name="warpx_copy_slice_3d") use amrex_fort_module, only : amrex_real @@ -68,8 +68,8 @@ contains integer , intent(in) :: lo(3), hi(3) integer , intent(in) :: tlo(3), thi(3) integer , intent(in) :: blo(3), bhi(3) - real(amrex_real), intent(inout) :: tmp(tlo(1):thi(1),tlo(2):thi(2),tlo(3):thi(3), ncomp) - real(amrex_real), intent(inout) :: buf(blo(1):bhi(1),blo(2):bhi(2),blo(3):bhi(3), ncomp) + real(amrex_real), intent(inout) :: tmp(tlo(1):thi(1),tlo(2):thi(2),tlo(3):thi(3),ncomp) + real(amrex_real), intent(inout) :: buf(blo(1):bhi(1),blo(2):bhi(2),blo(3):bhi(3),ncomp) integer n, i, j, k @@ -81,6 +81,30 @@ contains end do end do - end subroutine warpx_copy_slice + end subroutine warpx_copy_slice_3d + + subroutine warpx_copy_slice_2d(lo, hi, tmp, tlo, thi, & + buf, blo, bhi, ncomp, & + i_boost, i_lab) & + bind(C, name="warpx_copy_slice_2d") + + use amrex_fort_module, only : amrex_real + + integer , intent(in) :: ncomp, i_boost, i_lab + integer , intent(in) :: lo(2), hi(2) + integer , intent(in) :: tlo(2), thi(2) + integer , intent(in) :: blo(2), bhi(2) + real(amrex_real), intent(inout) :: tmp(tlo(1):thi(1),tlo(2):thi(2),ncomp) + real(amrex_real), intent(inout) :: buf(blo(1):bhi(1),blo(2):bhi(2),ncomp) + + integer n, i, j, k + + do n = 1, ncomp + do i = lo(1), hi(1) + buf(i, i_lab, n) = tmp(i, i_boost, n) + end do + end do + + end subroutine warpx_copy_slice_2d end module warpx_boosted_frame_module diff --git a/Source/WarpX_f.H b/Source/WarpX_f.H index bc334b539..3ee7ec02d 100644 --- a/Source/WarpX_f.H +++ b/Source/WarpX_f.H @@ -28,6 +28,7 @@ #define WRPX_LORENTZ_TRANSFORM_Z warpx_lorentz_transform_z #define WRPX_FILTER warpx_filter_3d +#define WRPX_COPY_SLICE warpx_copy_slice_3d #elif (BL_SPACEDIM == 2) @@ -56,6 +57,7 @@ #define WRPX_LORENTZ_TRANSFORM_Z warpx_lorentz_transform_z #define WRPX_FILTER warpx_filter_2d +#define WRPX_COPY_SLICE warpx_copy_slice_2d #endif @@ -64,10 +66,10 @@ extern "C" { #endif - void warpx_copy_slice(const int* lo, const int* hi, - const amrex_real* tmp, const int* tlo, const int* thi, - amrex_real* buf, const int* blo, const int* bhi, - const int* ncomp, const int* i_boost, const int* i_lab); + void WRPX_COPY_SLICE(const int* lo, const int* hi, + const amrex_real* tmp, const int* tlo, const int* thi, + amrex_real* buf, const int* blo, const int* bhi, + const int* ncomp, const int* i_boost, const int* i_lab); // Charge deposition void warpx_charge_deposition(amrex::Real* rho, |