10#ifndef IMPACTX_ELEMENT_LINEAR_MAP_H
11#define IMPACTX_ELEMENT_LINEAR_MAP_H
42 static constexpr auto type =
"LinearMap";
63 std::optional<std::string>
name = std::nullopt
88 for (
int i = 1; i <= 6; ++i) {
89 for (
int j = 1; j <= 6; ++j) {
91 max_err = std::max(max_err, err);
96 ? 1.0e-4_prt : 1.0e-10_prt;
97 return max_err <= tol;
112 throw std::runtime_error(
113 "LinearMap::reverse: transport map is not symplectic.");
120 Map6x6 const R_inv = (-Omega) * RT * Omega;
126 using BeamOptic::operator();
140 template<
typename T_Real=amrex::ParticleReal,
typename T_IdCpu=u
int64_t>
208 refpart.x = x + step*px;
209 refpart.y = y + step*py;
210 refpart.z = z + step*pz;
211 refpart.t =
t - step*pt;
214 refpart.s =
s + slice_ds;
254 template<
typename T_Real=amrex::ParticleReal,
typename T_IdCpu=u
int64_t>
273 (*this)(x, y,
t, px, py, pt, idcpu, refpart);
279 using LinearTransport::operator();
#define AMREX_FORCE_INLINE
#define AMREX_GPU_HOST_DEVICE
#define IMPACTX_PUSH_EXTERN_TEMPLATE(ElementType)
Definition PushAll.H:78
T_ParticleType ParticleType
amrex_particle_real ParticleReal
constexpr T powi(T x) noexcept
SmallMatrix< T, N, 1, Order::F, StartIndex > SmallVector
@ s
fixed s as the independent variable
Definition ImpactXParticleContainer.H:37
@ t
fixed t as the independent variable
Definition ImpactXParticleContainer.H:38
amrex::SmallMatrix< amrex::ParticleReal, 6, 6, amrex::Order::F, 1 > Map6x6
Definition CovarianceMatrix.H:20
Map6x6 symplectic_form()
Definition CovarianceMatrix.H:38
static constexpr __host__ __device__ SmallMatrix< T, NRows, NCols, ORDER, StartIndex > Identity() noexcept
Definition ReferenceParticle.H:33
Definition LinearMap.H:41
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void spin_and_phasespace_push(T_Real &AMREX_RESTRICT x, T_Real &AMREX_RESTRICT y, T_Real &AMREX_RESTRICT t, T_Real &AMREX_RESTRICT px, T_Real &AMREX_RESTRICT py, T_Real &AMREX_RESTRICT pt, T_Real &AMREX_RESTRICT sx, T_Real &AMREX_RESTRICT sy, T_Real &AMREX_RESTRICT sz, T_IdCpu &AMREX_RESTRICT idcpu, RefPart const &AMREX_RESTRICT refpart) const
Definition LinearMap.H:256
bool symplectic() const
Definition LinearMap.H:80
Map6x6 m_transport_map
Definition LinearMap.H:296
AMREX_GPU_HOST AMREX_FORCE_INLINE Map6x6 transport_map(RefPart const &AMREX_RESTRICT refpart) const
Definition LinearMap.H:288
amrex::ParticleReal m_ds
Definition LinearMap.H:297
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal ds() const
Definition LinearMap.H:234
static constexpr auto type
Definition LinearMap.H:42
ImpactXParticleContainer::ParticleType PType
Definition LinearMap.H:43
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void operator()(T_Real &AMREX_RESTRICT x, T_Real &AMREX_RESTRICT y, T_Real &AMREX_RESTRICT t, T_Real &AMREX_RESTRICT px, T_Real &AMREX_RESTRICT py, T_Real &AMREX_RESTRICT pt, T_IdCpu &AMREX_RESTRICT idcpu, RefPart const &AMREX_RESTRICT refpart) const
Definition LinearMap.H:142
LinearMap(Map6x6 const &R, amrex::ParticleReal ds=0, amrex::ParticleReal dx=0, amrex::ParticleReal dy=0, amrex::ParticleReal rotation_degree=0, std::optional< std::string > name=std::nullopt)
Definition LinearMap.H:57
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int nslice() const
Definition LinearMap.H:224
void reverse()
Definition LinearMap.H:109
Definition alignment.H:27
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
Definition alignment.H:109
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal dy() const
Definition alignment.H:146
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal dx() const
Definition alignment.H:136
Alignment(amrex::ParticleReal dx, amrex::ParticleReal dy, amrex::ParticleReal rotation_degree)
Definition alignment.H:36
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
Definition alignment.H:78
Definition beamoptic.H:436
Definition lineartransport.H:50
AMREX_GPU_HOST Named(std::optional< std::string > name)
Definition named.H:57
AMREX_FORCE_INLINE std::string name() const
Definition named.H:122
Definition nofinalize.H:22
Definition spintransport.H:36