diff --git a/Source/Filter/Filter.cpp b/Source/Filter/Filter.cpp index 7ea0003e291..23893d5786b 100644 --- a/Source/Filter/Filter.cpp +++ b/Source/Filter/Filter.cpp @@ -101,7 +101,6 @@ void Filter::DoFilter (const Box& tbx, ) Dim3 slen_local = slen; -#if AMREX_SPACEDIM == 3 AMREX_PARALLEL_FOR_4D ( tbx, ncomp, i, j, k, n, { Real d = 0.0; @@ -116,6 +115,7 @@ void Filter::DoFilter (const Box& tbx, for (int iz=0; iz < slen_local.z; ++iz){ for (int iy=0; iy < slen_local.y; ++iy){ for (int ix=0; ix < slen_local.x; ++ix){ +#if AMREX_SPACEDIM == 3 Real sss = sx[ix]*sy[iy]*sz[iz]; d += sss*( src_zeropad(i-ix,j-iy,k-iz,scomp+n) +src_zeropad(i+ix,j-iy,k-iz,scomp+n) @@ -125,63 +125,23 @@ void Filter::DoFilter (const Box& tbx, +src_zeropad(i+ix,j-iy,k+iz,scomp+n) +src_zeropad(i-ix,j+iy,k+iz,scomp+n) +src_zeropad(i+ix,j+iy,k+iz,scomp+n)); - } - } - } - - dst(i,j,k,dcomp+n) = d; - }); #elif AMREX_SPACEDIM == 2 - AMREX_PARALLEL_FOR_4D ( tbx, ncomp, i, j, k, n, - { - Real d = 0.0; - - // Pad source array with zeros beyond ghost cells - // for out-of-bound accesses due to large-stencil operations - const auto src_zeropad = [src] (const int jj, const int kk, const int ll, const int nn) noexcept - { - return src.contains(jj,kk,ll) ? src(jj,kk,ll,nn) : 0.0_rt; - }; - - for (int iz=0; iz < slen_local.z; ++iz){ - for (int iy=0; iy < slen_local.y; ++iy){ - for (int ix=0; ix < slen_local.x; ++ix){ Real sss = sx[ix]*sy[iy]; d += sss*( src_zeropad(i-ix,j-iy,k,scomp+n) +src_zeropad(i+ix,j-iy,k,scomp+n) +src_zeropad(i-ix,j+iy,k,scomp+n) +src_zeropad(i+ix,j+iy,k,scomp+n)); - } - } - } - - dst(i,j,k,dcomp+n) = d; - }); #elif AMREX_SPACEDIM == 1 - AMREX_PARALLEL_FOR_4D ( tbx, ncomp, i, j, k, n, - { - Real d = 0.0; - - // Pad source array with zeros beyond ghost cells - // for out-of-bound accesses due to large-stencil operations - const auto src_zeropad = [src] (const int jj, const int kk, const int ll, const int nn) noexcept - { - return src.contains(jj,kk,ll) ? src(jj,kk,ll,nn) : 0.0_rt; - }; - - for (int iz=0; iz < slen_local.z; ++iz){ - for (int iy=0; iy < slen_local.y; ++iy){ - for (int ix=0; ix < slen_local.x; ++ix){ Real sss = sx[ix]; d += sss*( src_zeropad(i-ix,j,k,scomp+n) +src_zeropad(i+ix,j,k,scomp+n)); +#endif } } } dst(i,j,k,dcomp+n) = d; }); -#endif } #else