10#ifndef IMPACTX_ELEMENT_LINEAR_MAP_H
11#define IMPACTX_ELEMENT_LINEAR_MAP_H
41 static constexpr auto type =
"LinearMap";
89 for (
int i = 1; i <= 6; ++i) {
90 for (
int j = 1; j <= 6; ++j) {
92 max_err = std::max(max_err, err);
97 ? 1.0e-4_prt : 1.0e-10_prt;
98 return max_err <= tol;
113 throw std::runtime_error(
114 "LinearMap::reverse: transport map is not symplectic.");
121 Map6x6 const R_inv = (-Omega) * RT * Omega;
127 using BeamOptic::operator();
141 template<
typename T_Real=amrex::ParticleReal,
typename T_IdCpu=u
int64_t>
203 refpart.x = x + step*px;
204 refpart.y = y + step*py;
205 refpart.z = z + step*pz;
206 refpart.t =
t - step*pt;
209 refpart.s =
s + slice_ds;
248 template<
typename T_Real=amrex::ParticleReal,
typename T_IdCpu=u
int64_t>
267 (*this)(x, y,
t, px, py, pt, idcpu, refpart);
272 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:40
static constexpr amrex::ParticleReal DEFAULT_ds
Definition LinearMap.H:44
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 const &AMREX_RESTRICT sx, T_Real const &AMREX_RESTRICT sy, T_Real const &AMREX_RESTRICT sz, T_IdCpu const &AMREX_RESTRICT idcpu, RefPart const &AMREX_RESTRICT refpart) const
Definition LinearMap.H:250
bool symplectic() const
Definition LinearMap.H:81
Map6x6 m_transport_map
Definition LinearMap.H:290
AMREX_GPU_HOST AMREX_FORCE_INLINE Map6x6 transport_map(RefPart const &AMREX_RESTRICT refpart) const
Definition LinearMap.H:281
amrex::ParticleReal m_ds
Definition LinearMap.H:291
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal ds() const
Definition LinearMap.H:229
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 const &AMREX_RESTRICT idcpu, RefPart const &AMREX_RESTRICT refpart) const
Definition LinearMap.H:143
static constexpr auto type
Definition LinearMap.H:41
ImpactXParticleContainer::ParticleType PType
Definition LinearMap.H:42
LinearMap(Map6x6 const &R, amrex::ParticleReal ds=DEFAULT_ds, amrex::ParticleReal dx=DEFAULT_dx, amrex::ParticleReal dy=DEFAULT_dy, amrex::ParticleReal rotation_degree=DEFAULT_rotation_degree, std::optional< std::string > name=DEFAULT_name)
Definition LinearMap.H:58
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int nslice() const
Definition LinearMap.H:219
void reverse()
Definition LinearMap.H:110
Definition alignment.H:29
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal dy() const
Definition alignment.H:193
static constexpr amrex::ParticleReal DEFAULT_dy
Definition alignment.H:34
static constexpr amrex::ParticleReal DEFAULT_dx
Definition alignment.H:33
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal dx() const
Definition alignment.H:183
AMREX_GPU_HOST AMREX_FORCE_INLINE Map6x6 rotate_aligned_map(Map6x6 const &R) const
Definition alignment.H:267
Alignment(amrex::ParticleReal dx, amrex::ParticleReal dy, amrex::ParticleReal rotation_degree)
Definition alignment.H:43
static constexpr amrex::ParticleReal DEFAULT_rotation_degree
Definition alignment.H:35
Definition beamoptic.H:567
Definition lineartransport.H:50
static constexpr std::nullopt_t DEFAULT_name
Definition named.H:30
AMREX_GPU_HOST Named(std::optional< std::string > name)
Definition named.H:59
AMREX_FORCE_INLINE std::string name() const
Definition named.H:124
Definition nofinalize.H:22
Definition spintransport.H:36