Skip to content

Commit

Permalink
Avoid accessing out of bounds nodal flag in 1D
Browse files Browse the repository at this point in the history
  • Loading branch information
dpgrote committed Nov 12, 2024
1 parent 847c7ea commit 0181794
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Source/BoundaryConditions/PEC_Insulator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ PEC_Insulator::ApplyPEC_InsulatortoField (
amrex::IntVect const iv(AMREX_D_DECL(i, j, k));
amrex::Real const shiftx = (Fx_nodal[0] ? 0._rt : 0.5_rt);
amrex::Real const x = (AMREX_SPACEDIM > 1 ? xyzmin_x.x + (iv[0] - lo_x[0] + shiftx)*dx[0] : 0._rt);
amrex::Real const shifty = (Fx_nodal[1] ? 0._rt : 0.5_rt);
amrex::Real const shifty = (AMREX_SPACEDIM == 3 ? (Fx_nodal[1] ? 0._rt : 0.5_rt) : 0._rt);
amrex::Real const y = (AMREX_SPACEDIM == 3 ? xyzmin_x.y + (iv[1] - lo_x[1] + shifty)*dx[1] : 0._rt);
#if (AMREX_SPACEDIM > 1)
amrex::Real const shiftz = (Fx_nodal[WARPX_ZINDEX] ? 0._rt : 0.5_rt);
Expand Down Expand Up @@ -476,7 +476,7 @@ PEC_Insulator::ApplyPEC_InsulatortoField (
amrex::IntVect const iv(AMREX_D_DECL(i, j, k));
amrex::Real const shiftx = (Fy_nodal[0] ? 0._rt : 0.5_rt);
amrex::Real const x = (AMREX_SPACEDIM > 1 ? xyzmin_y.x + (iv[0] - lo_y[0] + shiftx)*dx[0] : 0._rt);
amrex::Real const shifty = (Fy_nodal[1] ? 0._rt : 0.5_rt);
amrex::Real const shifty = (AMREX_SPACEDIM == 3 ? (Fy_nodal[1] ? 0._rt : 0.5_rt) : 0._rt);
amrex::Real const y = (AMREX_SPACEDIM == 3 ? xyzmin_y.y + (iv[1] - lo_y[1] + shifty)*dx[1] : 0._rt);
#if (AMREX_SPACEDIM > 1)
amrex::Real const shiftz = (Fy_nodal[WARPX_ZINDEX] ? 0._rt : 0.5_rt);
Expand Down Expand Up @@ -524,7 +524,7 @@ PEC_Insulator::ApplyPEC_InsulatortoField (
amrex::IntVect const iv(AMREX_D_DECL(i, j, k));
amrex::Real const shiftx = (Fz_nodal[0] ? 0._rt : 0.5_rt);
amrex::Real const x = (AMREX_SPACEDIM > 1 ? xyzmin_z.x + (iv[0] - lo_z[0] + shiftx)*dx[0] : 0._rt);
amrex::Real const shifty = (Fz_nodal[1] ? 0._rt : 0.5_rt);
amrex::Real const shifty = (AMREX_SPACEDIM == 3 ? (Fz_nodal[1] ? 0._rt : 0.5_rt) : 0._rt);
amrex::Real const y = (AMREX_SPACEDIM == 3 ? xyzmin_z.y + (iv[1] - lo_z[1] + shifty)*dx[1] : 0._rt);
#if (AMREX_SPACEDIM > 1)
amrex::Real const shiftz = (Fz_nodal[WARPX_ZINDEX] ? 0._rt : 0.5_rt);
Expand Down

0 comments on commit 0181794

Please sign in to comment.