Skip to content

Commit

Permalink
Fix: shift_in/shift_out Position Update
Browse files Browse the repository at this point in the history
Co-authored-by: Chad Mitchell <chadmitchell@lbl.gov>
  • Loading branch information
ax3l and cemitch99 committed Dec 24, 2023
1 parent 4426cfd commit 715b8dc
Show file tree
Hide file tree
Showing 22 changed files with 132 additions and 132 deletions.
12 changes: 6 additions & 6 deletions src/particles/elements/Aperture.H
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,14 @@ namespace impactx
{
using namespace amrex::literals; // for _rt and _prt

// shift due to alignment errors of the element
shift_in(p.pos(RealAoS::x), p.pos(RealAoS::y), px, py);

// access AoS data such as positions and cpu/id
amrex::ParticleReal x = p.pos(RealAoS::x);
amrex::ParticleReal y = p.pos(RealAoS::y);
amrex::ParticleReal const x = p.pos(RealAoS::x);
amrex::ParticleReal const y = p.pos(RealAoS::y);
auto const id = p.id();

// shift due to alignment errors of the element
shift_in(x, y, px, py);

// scale horizontal and vertical coordinates
amrex::ParticleReal const u = x / m_xmax;
amrex::ParticleReal const v = y / m_ymax;
Expand All @@ -114,7 +114,7 @@ namespace impactx
}

// undo shift due to alignment errors of the element
shift_out(x, y, px, py);
shift_out(p.pos(RealAoS::x), p.pos(RealAoS::y), px, py);
}

/** This pushes the reference particle. */
Expand Down
12 changes: 6 additions & 6 deletions src/particles/elements/Buncher.H
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,14 @@ namespace impactx

using namespace amrex::literals; // for _rt and _prt

// shift due to alignment errors of the element
shift_in(p.pos(RealAoS::x), p.pos(RealAoS::y), px, py);

// access AoS data such as positions and cpu/id
amrex::ParticleReal x = p.pos(RealAoS::x);
amrex::ParticleReal y = p.pos(RealAoS::y);
amrex::ParticleReal const x = p.pos(RealAoS::x);
amrex::ParticleReal const y = p.pos(RealAoS::y);
amrex::ParticleReal const t = p.pos(RealAoS::t);

// shift due to alignment errors of the element
shift_in(x, y, px, py);

// access reference particle values to find (beta*gamma)^2
amrex::ParticleReal const pt_ref = refpart.pt;
amrex::ParticleReal const betgam2 = pow(pt_ref, 2) - 1.0_prt;
Expand All @@ -108,7 +108,7 @@ namespace impactx
pt = ptout;

// undo shift due to alignment errors of the element
shift_out(x, y, px, py);
shift_out(p.pos(RealAoS::x), p.pos(RealAoS::y), px, py);
}

/** This pushes the reference particle. */
Expand Down
12 changes: 6 additions & 6 deletions src/particles/elements/CFbend.H
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,14 @@ namespace impactx
{
using namespace amrex::literals; // for _rt and _prt

// shift due to alignment errors of the element
shift_in(p.pos(RealAoS::x), p.pos(RealAoS::y), px, py);

// access AoS data such as positions and cpu/id
amrex::ParticleReal x = p.pos(RealAoS::x);
amrex::ParticleReal y = p.pos(RealAoS::y);
amrex::ParticleReal const x = p.pos(RealAoS::x);
amrex::ParticleReal const y = p.pos(RealAoS::y);
amrex::ParticleReal const t = p.pos(RealAoS::t);

// shift due to alignment errors of the element
shift_in(x, y, px, py);

// initialize output values of momenta
amrex::ParticleReal pxout = px;
amrex::ParticleReal pyout = py;
Expand Down Expand Up @@ -167,7 +167,7 @@ namespace impactx
pt = ptout;

// undo shift due to alignment errors of the element
shift_out(x, y, px, py);
shift_out(p.pos(RealAoS::x), p.pos(RealAoS::y), px, py);
}

/** This pushes the reference particle.
Expand Down
12 changes: 6 additions & 6 deletions src/particles/elements/ChrDrift.H
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,14 @@ namespace impactx

using namespace amrex::literals; // for _rt and _prt

// shift due to alignment errors of the element
shift_in(p.pos(RealAoS::x), p.pos(RealAoS::y), px, py);

// access AoS data such as positions and cpu/id
amrex::ParticleReal x = p.pos(RealAoS::x);
amrex::ParticleReal y = p.pos(RealAoS::y);
amrex::ParticleReal const x = p.pos(RealAoS::x);
amrex::ParticleReal const y = p.pos(RealAoS::y);
amrex::ParticleReal const t = p.pos(RealAoS::t);

// shift due to alignment errors of the element
shift_in(x, y, px, py);

// initialize output values of momenta
amrex::ParticleReal const pxout = px;
amrex::ParticleReal const pyout = py;
Expand Down Expand Up @@ -122,7 +122,7 @@ namespace impactx
pt = ptout;

// undo shift due to alignment errors of the element
shift_out(x, y, px, py);
shift_out(p.pos(RealAoS::x), p.pos(RealAoS::y), px, py);
}

/** This pushes the reference particle.
Expand Down
12 changes: 6 additions & 6 deletions src/particles/elements/ChrQuad.H
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,14 @@ namespace impactx

using namespace amrex::literals; // for _rt and _prt

// shift due to alignment errors of the element
shift_in(p.pos(RealAoS::x), p.pos(RealAoS::y), px, py);

// access AoS data such as positions and cpu/id
amrex::ParticleReal x = p.pos(RealAoS::x);
amrex::ParticleReal y = p.pos(RealAoS::y);
amrex::ParticleReal const x = p.pos(RealAoS::x);
amrex::ParticleReal const y = p.pos(RealAoS::y);
amrex::ParticleReal const t = p.pos(RealAoS::t);

// shift due to alignment errors of the element
shift_in(x, y, px, py);

// length of the current slice
amrex::ParticleReal const slice_ds = m_ds / nslice();

Expand Down Expand Up @@ -180,7 +180,7 @@ namespace impactx
pt = ptout;

// undo shift due to alignment errors of the element
shift_out(x, y, px, py);
shift_out(p.pos(RealAoS::x), p.pos(RealAoS::y), px, py);
}

/** This pushes the reference particle.
Expand Down
12 changes: 6 additions & 6 deletions src/particles/elements/ChrUniformAcc.H
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,14 @@ namespace impactx

using namespace amrex::literals; // for _rt and _prt

// shift due to alignment errors of the element
shift_in(p.pos(RealAoS::x), p.pos(RealAoS::y), px, py);

// access AoS data such as positions and cpu/id
amrex::ParticleReal x = p.pos(RealAoS::x);
amrex::ParticleReal y = p.pos(RealAoS::y);
amrex::ParticleReal const x = p.pos(RealAoS::x);
amrex::ParticleReal const y = p.pos(RealAoS::y);
amrex::ParticleReal const t = p.pos(RealAoS::t);

// shift due to alignment errors of the element
shift_in(x, y, px, py);

// length of the current slice
amrex::ParticleReal const slice_ds = m_ds / nslice();

Expand Down Expand Up @@ -167,7 +167,7 @@ namespace impactx
pt = pt/bgf;

// undo shift due to alignment errors of the element
shift_out(x, y, px, py);
shift_out(p.pos(RealAoS::x), p.pos(RealAoS::y), px, py);
}

/** This pushes the reference particle.
Expand Down
12 changes: 6 additions & 6 deletions src/particles/elements/ConstF.H
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,14 @@ namespace impactx

using namespace amrex::literals; // for _rt and _prt

// shift due to alignment errors of the element
shift_in(p.pos(RealAoS::x), p.pos(RealAoS::y), px, py);

// access AoS data such as positions and cpu/id
amrex::ParticleReal x = p.pos(RealAoS::x);
amrex::ParticleReal y = p.pos(RealAoS::y);
amrex::ParticleReal const x = p.pos(RealAoS::x);
amrex::ParticleReal const y = p.pos(RealAoS::y);
amrex::ParticleReal const t = p.pos(RealAoS::t);

// shift due to alignment errors of the element
shift_in(x, y, px, py);

// access reference particle values to find beta*gamma^2
amrex::ParticleReal const pt_ref = refpart.pt;
amrex::ParticleReal const betgam2 = pow(pt_ref, 2) - 1.0_prt;
Expand Down Expand Up @@ -117,7 +117,7 @@ namespace impactx
pt = ptout;

// undo shift due to alignment errors of the element
shift_out(x, y, px, py);
shift_out(p.pos(RealAoS::x), p.pos(RealAoS::y), px, py);
}

/** This pushes the reference particle.
Expand Down
12 changes: 6 additions & 6 deletions src/particles/elements/DipEdge.H
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,12 @@ namespace impactx

using namespace amrex::literals; // for _rt and _prt

// access AoS data such as positions and cpu/id
amrex::ParticleReal x = p.pos(RealAoS::x);
amrex::ParticleReal y = p.pos(RealAoS::y);

// shift due to alignment errors of the element
shift_in(x, y, px, py);
shift_in(p.pos(RealAoS::x), p.pos(RealAoS::y), px, py);

// access AoS data such as positions and cpu/id
amrex::ParticleReal const x = p.pos(RealAoS::x);
amrex::ParticleReal const y = p.pos(RealAoS::y);

// access reference particle values if needed

Expand All @@ -110,7 +110,7 @@ namespace impactx
py = py + R43*y;

// undo shift due to alignment errors of the element
shift_out(x, y, px, py);
shift_out(p.pos(RealAoS::x), p.pos(RealAoS::y), px, py);
}

/** This pushes the reference particle. */
Expand Down
12 changes: 6 additions & 6 deletions src/particles/elements/Drift.H
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,14 @@ namespace impactx

using namespace amrex::literals; // for _rt and _prt

// shift due to alignment errors of the element
shift_in(p.pos(RealAoS::x), p.pos(RealAoS::y), px, py);

// access AoS data such as positions and cpu/id
amrex::ParticleReal x = p.pos(RealAoS::x);
amrex::ParticleReal y = p.pos(RealAoS::y);
amrex::ParticleReal const x = p.pos(RealAoS::x);
amrex::ParticleReal const y = p.pos(RealAoS::y);
amrex::ParticleReal const t = p.pos(RealAoS::t);

// shift due to alignment errors of the element
shift_in(x, y, px, py);

// initialize output values of momenta
amrex::ParticleReal const pxout = px;
amrex::ParticleReal const pyout = py;
Expand All @@ -108,7 +108,7 @@ namespace impactx
pt = ptout;

// undo shift due to alignment errors of the element
shift_out(x, y, px, py);
shift_out(p.pos(RealAoS::x), p.pos(RealAoS::y), px, py);
}

/** This pushes the reference particle.
Expand Down
12 changes: 6 additions & 6 deletions src/particles/elements/ExactDrift.H
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,14 @@ namespace impactx

using namespace amrex::literals; // for _rt and _prt

// shift due to alignment errors of the element
shift_in(p.pos(RealAoS::x), p.pos(RealAoS::y), px, py);

// access AoS data such as positions and cpu/id
amrex::ParticleReal x = p.pos(RealAoS::x);
amrex::ParticleReal y = p.pos(RealAoS::y);
amrex::ParticleReal const x = p.pos(RealAoS::x);
amrex::ParticleReal const y = p.pos(RealAoS::y);
amrex::ParticleReal const t = p.pos(RealAoS::t);

// shift due to alignment errors of the element
shift_in(x, y, px, py);

// initialize output values of momenta
amrex::ParticleReal const pxout = px;
amrex::ParticleReal const pyout = py;
Expand Down Expand Up @@ -114,7 +114,7 @@ namespace impactx
pt = ptout;

// undo shift due to alignment errors of the element
shift_out(x, y, px, py);
shift_out(p.pos(RealAoS::x), p.pos(RealAoS::y), px, py);
}

/** This pushes the reference particle.
Expand Down
12 changes: 6 additions & 6 deletions src/particles/elements/ExactSbend.H
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,14 @@ namespace impactx

using namespace amrex::literals; // for _rt and _prt

// shift due to alignment errors of the element
shift_in(p.pos(RealAoS::x), p.pos(RealAoS::y), px, py);

// access AoS data such as positions and cpu/id
amrex::ParticleReal x = p.pos(RealAoS::x);
amrex::ParticleReal y = p.pos(RealAoS::y);
amrex::ParticleReal const x = p.pos(RealAoS::x);
amrex::ParticleReal const y = p.pos(RealAoS::y);
amrex::ParticleReal const t = p.pos(RealAoS::t);

// shift due to alignment errors of the element
shift_in(x, y, px, py);

// angle of arc for the current slice
amrex::ParticleReal const slice_phi = m_phi / nslice();

Expand Down Expand Up @@ -140,7 +140,7 @@ namespace impactx
pt = ptout;

// undo shift due to alignment errors of the element
shift_out(x, y, px, py);
shift_out(p.pos(RealAoS::x), p.pos(RealAoS::y), px, py);
}

/** This pushes the reference particle.
Expand Down
12 changes: 6 additions & 6 deletions src/particles/elements/Kicker.H
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,14 @@ namespace impactx
{
using namespace amrex::literals; // for _rt and _prt

// shift due to alignment errors of the element
shift_in(p.pos(RealAoS::x), p.pos(RealAoS::y), px, py);

// access AoS data such as positions and cpu/id
amrex::ParticleReal x = p.pos(RealAoS::x);
amrex::ParticleReal y = p.pos(RealAoS::y);
amrex::ParticleReal const x = p.pos(RealAoS::x);
amrex::ParticleReal const y = p.pos(RealAoS::y);
amrex::ParticleReal const t = p.pos(RealAoS::t);

// shift due to alignment errors of the element
shift_in(x, y, px, py);

// normalize quad units to MAD-X convention if needed
amrex::ParticleReal dpx = m_xkick;
amrex::ParticleReal dpy = m_ykick;
Expand Down Expand Up @@ -121,7 +121,7 @@ namespace impactx
pt = ptout;

// undo shift due to alignment errors of the element
shift_out(x, y, px, py);
shift_out(p.pos(RealAoS::x), p.pos(RealAoS::y), px, py);
}

/** This pushes the reference particle. */
Expand Down
12 changes: 6 additions & 6 deletions src/particles/elements/Multipole.H
Original file line number Diff line number Diff line change
Expand Up @@ -83,17 +83,17 @@ namespace impactx

using namespace amrex::literals; // for _rt and _prt

// shift due to alignment errors of the element
shift_in(p.pos(RealAoS::x), p.pos(RealAoS::y), px, py);

// a complex type with two amrex::ParticleReal
using Complex = amrex::GpuComplex<amrex::ParticleReal>;

// access AoS data such as positions and cpu/id
amrex::ParticleReal x = p.pos(RealAoS::x);
amrex::ParticleReal y = p.pos(RealAoS::y);
amrex::ParticleReal const x = p.pos(RealAoS::x);
amrex::ParticleReal const y = p.pos(RealAoS::y);
amrex::ParticleReal const t = p.pos(RealAoS::t);

// shift due to alignment errors of the element
shift_in(x, y, px, py);

// access reference particle values to find (beta*gamma)^2
//amrex::ParticleReal const pt_ref = refpart.pt;
//amrex::ParticleReal const betgam2 = pow(pt_ref, 2) - 1.0_prt;
Expand Down Expand Up @@ -130,7 +130,7 @@ namespace impactx
pt = ptout;

// undo shift due to alignment errors of the element
shift_out(x, y, px, py);
shift_out(p.pos(RealAoS::x), p.pos(RealAoS::y), px, py);
}

/** This pushes the reference particle. */
Expand Down
Loading

0 comments on commit 715b8dc

Please sign in to comment.