10#ifndef IMPACTX_CONSTF_H
11#define IMPACTX_CONSTF_H
43 static constexpr auto type =
"ConstF";
61 amrex::ParticleReal
ds,
62 amrex::ParticleReal kx,
63 amrex::ParticleReal ky,
64 amrex::ParticleReal kt,
65 amrex::ParticleReal
dx = 0,
66 amrex::ParticleReal
dy = 0,
67 amrex::ParticleReal rotation_degree = 0,
71 std::optional<std::string>
name = std::nullopt
82 using BeamOptic::operator();
93 using namespace amrex::literals;
96 Alignment::compute_constants(refpart);
99 amrex::ParticleReal
const slice_ds =
m_ds /
nslice();
102 amrex::ParticleReal
const betgam2 = powi<2>(refpart.
pt) - 1.0_prt;
118 amrex::ParticleReal
const sinct =
m_kt > 0 ? std::sin(
m_kt * slice_ds) /
m_kt : slice_ds;
135 template<
typename T_Real=amrex::ParticleReal,
typename T_IdCpu=u
int64_t>
148 using namespace amrex::literals;
193 using namespace amrex::literals;
197 amrex::ParticleReal
const x = refpart.x;
198 amrex::ParticleReal
const px = refpart.px;
199 amrex::ParticleReal
const y = refpart.y;
200 amrex::ParticleReal
const py = refpart.py;
201 amrex::ParticleReal
const z = refpart.z;
202 amrex::ParticleReal
const pz = refpart.pz;
203 amrex::ParticleReal
const t = refpart.t;
204 amrex::ParticleReal
const pt = refpart.pt;
205 amrex::ParticleReal
const s = refpart.s;
208 amrex::ParticleReal
const slice_ds =
m_ds /
nslice();
211 amrex::ParticleReal
const step = slice_ds / std::sqrt(powi<2>(pt) - 1.0_prt);
214 refpart.x = x + step*px;
215 refpart.y = y + step*py;
216 refpart.z = z + step*pz;
217 refpart.t =
t - step*pt;
220 refpart.s =
s + slice_ds;
225 using LinearTransport::operator();
235 using namespace amrex::literals;
239 amrex::ParticleReal
const slice_ds =
m_ds /
nslice();
242 amrex::ParticleReal
const betgam2 = powi<2>(refpart.pt) - 1.0_prt;
246 amrex::ParticleReal const_x = -
m_kx * sin_kxds;
248 amrex::ParticleReal const_y = -
m_ky * sin_kyds;
250 amrex::ParticleReal const_t = -
m_kt * betgam2 * sin_ktds;
253 amrex::ParticleReal sincx =
m_kx > 0 ? std::sin(
m_kx * slice_ds) /
m_kx : slice_ds;
254 amrex::ParticleReal sincy =
m_ky > 0 ? std::sin(
m_ky * slice_ds) /
m_ky : slice_ds;
255 amrex::ParticleReal
const sinct =
m_kt > 0 ? std::sin(
m_kt * slice_ds) /
m_kt : slice_ds;
256 amrex::ParticleReal const_pt = sinct / betgam2;
#define AMREX_FORCE_INLINE
#define AMREX_GPU_HOST_DEVICE
T_ParticleType ParticleType
__host__ __device__ std::pair< double, double > sincos(double x)
constexpr T powi(T x) noexcept
@ 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
static constexpr __host__ __device__ SmallMatrix< T, NRows, NCols, ORDER, StartIndex > Identity() noexcept
Definition ReferenceParticle.H:31
amrex::ParticleReal pt
energy, normalized by rest energy
Definition ReferenceParticle.H:40
amrex::ParticleReal m_const_pt
Definition ConstF.H:284
amrex::ParticleReal m_cos_kxds
Definition ConstF.H:285
amrex::ParticleReal m_kx
Definition ConstF.H:276
void compute_constants(RefPart const &refpart)
Definition ConstF.H:91
static constexpr auto type
Definition ConstF.H:43
amrex::ParticleReal m_const_t
Definition ConstF.H:284
amrex::ParticleReal m_cos_kyds
Definition ConstF.H:285
amrex::ParticleReal m_kt
focusing y strength in 1/m
Definition ConstF.H:278
ConstF(amrex::ParticleReal ds, amrex::ParticleReal kx, amrex::ParticleReal ky, amrex::ParticleReal kt, amrex::ParticleReal dx=0, amrex::ParticleReal dy=0, amrex::ParticleReal rotation_degree=0, amrex::ParticleReal aperture_x=0, amrex::ParticleReal aperture_y=0, int nslice=1, std::optional< std::string > name=std::nullopt)
Definition ConstF.H:60
amrex::ParticleReal m_sincx
focusing t strength in 1/m
Definition ConstF.H:283
amrex::ParticleReal m_sincy
Definition ConstF.H:283
ImpactXParticleContainer::ParticleType PType
Definition ConstF.H:44
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 ConstF.H:137
amrex::ParticleReal m_const_x
Definition ConstF.H:284
amrex::ParticleReal m_const_y
Definition ConstF.H:284
amrex::ParticleReal m_ky
focusing x strength in 1/m
Definition ConstF.H:277
amrex::ParticleReal m_cos_ktds
Definition ConstF.H:285
AMREX_GPU_HOST AMREX_FORCE_INLINE Map6x6 transport_map(RefPart const &AMREX_RESTRICT refpart) const
Definition ConstF.H:233
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:219
Definition lineartransport.H:29
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 pipeaperture.H:26
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void apply_aperture(T_Real &AMREX_RESTRICT x, T_Real &AMREX_RESTRICT y, T_IdCpu &AMREX_RESTRICT idcpu) const
Definition pipeaperture.H:59
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal aperture_x() const
Definition pipeaperture.H:90
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal aperture_y() const
Definition pipeaperture.H:101
PipeAperture(amrex::ParticleReal aperture_x, amrex::ParticleReal aperture_y)
Definition pipeaperture.H:32
Thick(amrex::ParticleReal ds, int nslice)
Definition thick.H:30
amrex::ParticleReal m_ds
Definition thick.H:58
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal ds() const
Definition thick.H:53
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int nslice() const
Definition thick.H:43