ImpactX
Loading...
Searching...
No Matches
impactx::elements::mixin::Alignment Struct Reference

#include <alignment.H>

Inheritance diagram for impactx::elements::mixin::Alignment:
impactx::elements::Aperture impactx::elements::Buncher impactx::elements::CFbend impactx::elements::ChrAcc impactx::elements::ChrDrift impactx::elements::ChrPlasmaLens impactx::elements::ChrQuad impactx::elements::ConstF impactx::elements::DipEdge impactx::elements::Drift impactx::elements::ExactCFbend impactx::elements::ExactDrift impactx::elements::ExactMultipole impactx::elements::ExactQuad impactx::elements::ExactSbend impactx::elements::Kicker impactx::elements::LinearMap impactx::elements::Multipole impactx::elements::NonlinearLens impactx::elements::PlaneXYRot impactx::elements::PolygonAperture impactx::elements::Quad impactx::elements::QuadEdge impactx::elements::RFCavity impactx::elements::Sbend impactx::elements::ShortRF impactx::elements::SoftQuadrupole impactx::elements::SoftSolenoid impactx::elements::Sol impactx::elements::SpinMap impactx::elements::TaperedPL impactx::elements::ThinDipole

Public Member Functions

 Alignment (amrex::ParticleReal dx, amrex::ParticleReal dy, amrex::ParticleReal rotation_degree)
 
 Alignment ()=default
 
 Alignment (Alignment const &)=default
 
Alignmentoperator= (Alignment const &)=default
 
 Alignment (Alignment &&)=default
 
Alignmentoperator= (Alignment &&rhs)=default
 
 ~Alignment ()=default
 
void compute_constants (RefPart const &refpart)
 
template<typename T_Real>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void shift_in (T_Real &AMREX_RESTRICT x, T_Real &AMREX_RESTRICT y, T_Real &AMREX_RESTRICT px, T_Real &AMREX_RESTRICT py) const
 
template<typename T_Real>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void rotate_in (T_Real &AMREX_RESTRICT sx, T_Real &AMREX_RESTRICT sy) const
 
template<typename T_Real>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void shift_out (T_Real &AMREX_RESTRICT x, T_Real &AMREX_RESTRICT y, T_Real &AMREX_RESTRICT px, T_Real &AMREX_RESTRICT py) const
 
template<typename T_Real>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void rotate_out (T_Real &AMREX_RESTRICT sx, T_Real &AMREX_RESTRICT sy) const
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal dx () const
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal dy () const
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal rotation () const
 
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool misaligned () const
 
AMREX_GPU_HOST AMREX_FORCE_INLINE Map6x6 rotation_map () const
 
AMREX_GPU_HOST AMREX_FORCE_INLINE Map6x6 rotate_aligned_map (Map6x6 const &R) const
 

Public Attributes

amrex::ParticleReal m_dx = 0
 
amrex::ParticleReal m_dy = 0
 horizontal translation error [m]
 
amrex::ParticleReal m_rotation = 0
 vertical translation error [m]
 

Static Public Attributes

static constexpr amrex::ParticleReal degree2rad
 

Private Attributes

amrex::ParticleReal m_sin_rotation
 rotation error in the transverse plane [rad]
 
amrex::ParticleReal m_cos_rotation
 std::sin(m_rotation)
 

Detailed Description

This is a helper class for lattice elements with horizontal/vertical alignment errors

Constructor & Destructor Documentation

◆ Alignment() [1/4]

impactx::elements::mixin::Alignment::Alignment ( amrex::ParticleReal dx,
amrex::ParticleReal dy,
amrex::ParticleReal rotation_degree )
inline

A finite-length element

Parameters
dxhorizontal translation error in m
dyvertical translation error in m
rotation_degreerotation error in the transverse plane [degrees]

◆ Alignment() [2/4]

impactx::elements::mixin::Alignment::Alignment ( )
default

◆ Alignment() [3/4]

impactx::elements::mixin::Alignment::Alignment ( Alignment const & )
default

◆ Alignment() [4/4]

impactx::elements::mixin::Alignment::Alignment ( Alignment && )
default

◆ ~Alignment()

impactx::elements::mixin::Alignment::~Alignment ( )
default

Member Function Documentation

◆ compute_constants()

void impactx::elements::mixin::Alignment::compute_constants ( RefPart const & refpart)
inline

Compute and cache the constants for the push.

In particular, used to pre-compute and cache variables that are independent of the individually tracked particle.

Parameters
refpartreference particle

◆ dx()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal impactx::elements::mixin::Alignment::dx ( ) const
inline

Horizontal translation error

Returns
horizontal translation error in m

◆ dy()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal impactx::elements::mixin::Alignment::dy ( ) const
inline

Vertical translation error

Returns
vertical translation error in m

◆ misaligned()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE bool impactx::elements::mixin::Alignment::misaligned ( ) const
inline

Whether the element has any (nonzero) translation or rotation error.

Used to unswitch the alignment shift/rotate out of the per-particle push: a perfectly aligned element skips the (otherwise identity) transforms. Cheap to evaluate and called once per push launch (not per particle), so it reads the current alignment errors directly instead of caching.

Returns
true if dx, dy, or rotation is nonzero

◆ operator=() [1/2]

Alignment & impactx::elements::mixin::Alignment::operator= ( Alignment && rhs)
default

◆ operator=() [2/2]

Alignment & impactx::elements::mixin::Alignment::operator= ( Alignment const & )
default

◆ rotate_aligned_map()

AMREX_GPU_HOST AMREX_FORCE_INLINE Map6x6 impactx::elements::mixin::Alignment::rotate_aligned_map ( Map6x6 const & R) const
inline

Apply the transverse rotation (roll) alignment error to an element's intrinsic linear transport map.

Elements call this on their own transport_map result just before returning, so that linear-optics consumers (transfer_map, map_trace, envelope tracking) see the same roll that the particle push applies via

See also
shift_in /
shift_out. A perfectly roll-aligned element returns R unchanged.
Parameters
Rthe element's intrinsic (zero-rotation) 6x6 transport map
Returns
the lab-frame map A * R * A^T (see
See also
rotation_map)

◆ rotate_in()

template<typename T_Real>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void impactx::elements::mixin::Alignment::rotate_in ( T_Real &AMREX_RESTRICT sx,
T_Real &AMREX_RESTRICT sy ) const
inline

Rotate a transverse vector into the alignment error frame

The

See also
compute_constants method must be called before pushing particles through this operator.
Parameters
[in,out]sxhorizontal spin/vector component
[in,out]syvertical spin/vector component

◆ rotate_out()

template<typename T_Real>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void impactx::elements::mixin::Alignment::rotate_out ( T_Real &AMREX_RESTRICT sx,
T_Real &AMREX_RESTRICT sy ) const
inline

Rotate a transverse vector out of the alignment error frame

The

See also
compute_constants method must be called before pushing particles through this operator.
Parameters
[in,out]sxhorizontal spin/vector component
[in,out]syvertical spin/vector component

◆ rotation()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal impactx::elements::mixin::Alignment::rotation ( ) const
inline

rotation error in the transverse plane

Returns
rotation error in the transverse plane [degrees]

◆ rotation_map()

AMREX_GPU_HOST AMREX_FORCE_INLINE Map6x6 impactx::elements::mixin::Alignment::rotation_map ( ) const
inline

6x6 linear map of the transverse rotation (roll) alignment error.

Returns the lab-from-element rotation A = Rot(theta) acting on the (x, y) and (px, py) sub-blocks and the identity on (t, pt). It is the linear-map analogue of

See also
shift_in /
shift_out: the aligned (lab-frame) map of an element is A * R * A^T .

sin/cos are evaluated from m_rotation directly rather than the

See also
compute_constants cache, because the linear-optics path (transfer_map, map_trace, envelope tracking) does not call compute_constants().
Returns
the 6x6 transverse-rotation map in (x, px, y, py, t, pt) order

◆ shift_in()

template<typename T_Real>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void impactx::elements::mixin::Alignment::shift_in ( T_Real &AMREX_RESTRICT x,
T_Real &AMREX_RESTRICT y,
T_Real &AMREX_RESTRICT px,
T_Real &AMREX_RESTRICT py ) const
inline

Shift the particle into the alignment error frame

The

See also
compute_constants method must be called before pushing particles through this operator.
Parameters
[in,out]xhorizontal position relative to reference particle
[in,out]yvertical position relative to reference particle
[in,out]pxhorizontal momentum relative to reference particle
[in,out]pyvertical momentum relative to reference particle

◆ shift_out()

template<typename T_Real>
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void impactx::elements::mixin::Alignment::shift_out ( T_Real &AMREX_RESTRICT x,
T_Real &AMREX_RESTRICT y,
T_Real &AMREX_RESTRICT px,
T_Real &AMREX_RESTRICT py ) const
inline

Shift the particle out of the alignment error frame

The

See also
compute_constants method must be called before pushing particles through this operator.
Parameters
[in,out]xhorizontal position relative to reference particle
[in,out]yvertical position relative to reference particle
[in,out]pxhorizontal momentum relative to reference particle
[in,out]pyvertical momentum relative to reference particle

Member Data Documentation

◆ degree2rad

amrex::ParticleReal impactx::elements::mixin::Alignment::degree2rad
staticconstexpr
Initial value:

◆ m_cos_rotation

amrex::ParticleReal impactx::elements::mixin::Alignment::m_cos_rotation
private

std::sin(m_rotation)

◆ m_dx

amrex::ParticleReal impactx::elements::mixin::Alignment::m_dx = 0

◆ m_dy

amrex::ParticleReal impactx::elements::mixin::Alignment::m_dy = 0

horizontal translation error [m]

◆ m_rotation

amrex::ParticleReal impactx::elements::mixin::Alignment::m_rotation = 0

vertical translation error [m]

◆ m_sin_rotation

amrex::ParticleReal impactx::elements::mixin::Alignment::m_sin_rotation
private

rotation error in the transverse plane [rad]


The documentation for this struct was generated from the following file: