diff --git a/Source/Particles/ParticleBoundaries_K.H b/Source/Particles/ParticleBoundaries_K.H index 71b95aae95a..ffadd4dd28b 100644 --- a/Source/Particles/ParticleBoundaries_K.H +++ b/Source/Particles/ParticleBoundaries_K.H @@ -109,17 +109,15 @@ namespace ApplyParticleBoundaries { */ AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void - apply_boundaries ( -#ifndef WARPX_DIM_1D_Z - amrex::ParticleReal& x, amrex::Real xmin, amrex::Real xmax, -#endif -#if (defined WARPX_DIM_3D) || (defined WARPX_DIM_RZ) - amrex::ParticleReal& y, -#endif -#if (defined WARPX_DIM_3D) - amrex::Real ymin, amrex::Real ymax, -#endif - amrex::ParticleReal& z, amrex::Real zmin, amrex::Real zmax, + apply_boundaries ([[maybe_unused]] amrex::ParticleReal& x, + [[maybe_unused]] amrex::Real xmin, + [[maybe_unused]] amrex::Real xmax, + [[maybe_unused]] amrex::ParticleReal& y, + [[maybe_unused]] amrex::Real ymin, + [[maybe_unused]] amrex::Real ymax, + [[maybe_unused]] amrex::ParticleReal& z, + [[maybe_unused]] amrex::Real zmin, + [[maybe_unused]] amrex::Real zmax, amrex::ParticleReal& ux, amrex::ParticleReal& uy, amrex::ParticleReal& uz, bool& particle_lost, ParticleBoundaries::ParticleBoundariesData const& boundaries, diff --git a/Source/Particles/WarpXParticleContainer.cpp b/Source/Particles/WarpXParticleContainer.cpp index 4800d9e209f..8ad15397c08 100644 --- a/Source/Particles/WarpXParticleContainer.cpp +++ b/Source/Particles/WarpXParticleContainer.cpp @@ -1563,6 +1563,17 @@ WarpXParticleContainer::ApplyBoundaryConditions (){ auto boundary_conditions = m_boundary_conditions.data; + amrex::Box const & domain = Geom(0).Domain(); + std::array xyzmin = WarpX::LowerCorner(domain, 0, 0._rt); + std::array xyzmax = WarpX::UpperCorner(domain, 0, 0._rt); + + const amrex::Real xmin = xyzmin[0]; + const amrex::Real xmax = xyzmax[0]; + const amrex::Real ymin = xyzmin[1]; + const amrex::Real ymax = xyzmax[1]; + const amrex::Real zmin = xyzmin[2]; + const amrex::Real zmax = xyzmax[2]; + for (int lev = 0; lev <= finestLevel(); ++lev) { #ifdef AMREX_USE_OMP @@ -1572,16 +1583,6 @@ WarpXParticleContainer::ApplyBoundaryConditions (){ { auto GetPosition = GetParticlePosition(pti); auto SetPosition = SetParticlePosition(pti); -#ifndef WARPX_DIM_1D_Z - const Real xmin = Geom(lev).ProbLo(0); - const Real xmax = Geom(lev).ProbHi(0); -#endif -#ifdef WARPX_DIM_3D - const Real ymin = Geom(lev).ProbLo(1); - const Real ymax = Geom(lev).ProbHi(1); -#endif - const Real zmin = Geom(lev).ProbLo(WARPX_ZINDEX); - const Real zmax = Geom(lev).ProbHi(WARPX_ZINDEX); ParticleTileType& ptile = ParticlesAt(lev, pti); @@ -1604,16 +1605,8 @@ WarpXParticleContainer::ApplyBoundaryConditions (){ // Note that for RZ, (x, y, z) is actually (r, theta, z). bool particle_lost = false; - ApplyParticleBoundaries::apply_boundaries( -#ifndef WARPX_DIM_1D_Z - x, xmin, xmax, -#endif -#if (defined WARPX_DIM_3D) || (defined WARPX_DIM_RZ) - y, -#endif -#if (defined WARPX_DIM_3D) - ymin, ymax, -#endif + ApplyParticleBoundaries::apply_boundaries(x, xmin, xmax, + y, ymin, ymax, z, zmin, zmax, ux[i], uy[i], uz[i], particle_lost, boundary_conditions, engine);