8 #ifndef WARPX_PARTICLES_PUSHER_GETANDSETPOSITION_H_
9 #define WARPX_PARTICLES_PUSHER_GETANDSETPOSITION_H_
26 template<
typename T_PIdx = PIdx>
29 amrex::ParticleReal& x,
30 amrex::ParticleReal& y,
31 amrex::ParticleReal& z) noexcept
34 const amrex::ParticleReal theta = p.rdata(T_PIdx::theta);
35 const amrex::ParticleReal r = p.pos(0);
36 x = r*std::cos(theta);
37 y = r*std::sin(theta);
45 y = amrex::ParticleReal(0.0);
48 x = amrex::ParticleReal(0.0);
49 y = amrex::ParticleReal(0.0);
59 template<
typename T_PIdx = PIdx>
63 using RType = amrex::ParticleReal;
66 #if defined(WARPX_DIM_RZ)
68 #elif defined(WARPX_DIM_XZ) || defined(WARPX_DIM_RZ)
69 static constexpr
RType m_y_default =
RType(0.0);
70 #elif defined(WARPX_DIM_1D_Z)
71 static constexpr
RType m_x_default =
RType(0.0);
72 static constexpr
RType m_y_default =
RType(0.0);
84 template <
typename ptiType>
87 const auto& aos = a_pti.GetArrayOfStructs();
89 #if defined(WARPX_DIM_RZ)
90 const auto& soa = a_pti.GetStructOfArrays();
91 m_theta = soa.GetRealData(T_PIdx::theta).dataPtr() + a_offset;
103 const RType r = p.pos(0);
158 template<
typename T_PIdx = PIdx>
165 #if defined(WARPX_DIM_RZ)
169 template <
typename ptiType>
172 auto& aos = a_pti.GetArrayOfStructs();
174 #if defined(WARPX_DIM_RZ)
175 auto& soa = a_pti.GetStructOfArrays();
176 m_theta = soa.GetRealData(T_PIdx::theta).dataPtr() + a_offset;
185 #if defined(WARPX_DIM_XZ)
188 #if defined(WARPX_DIM_1D_Z)
214 #if defined(WARPX_DIM_XZ)
217 #if defined(WARPX_DIM_1D_Z)
#define AMREX_FORCE_INLINE
#define AMREX_GPU_HOST_DEVICE
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void get_particle_position(const WarpXParticleContainer::SuperParticleType &p, amrex::ParticleReal &x, amrex::ParticleReal &y, amrex::ParticleReal &z) noexcept
Extract the cartesian position coordinates of the particle p and store them in the variables x,...
Definition: GetAndSetPosition.H:28
T_ParticleType ParticleType
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void ignore_unused(const Ts &...)
i
Definition: check_interp_points_and_weights.py:174
Functor that can be used to extract the positions of the macroparticles inside a ParallelFor kernel.
Definition: GetAndSetPosition.H:61
WarpXParticleContainer::ParticleType PType
Definition: GetAndSetPosition.H:62
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void AsStored(const long i, RType &x, RType &y, RType &z) const noexcept
Extract the position coordinates of the particle as stored located at index i + a_offset and store th...
Definition: GetAndSetPosition.H:128
const PType *AMREX_RESTRICT m_structs
Definition: GetAndSetPosition.H:65
GetParticlePosition(const ptiType &a_pti, long a_offset=0) noexcept
Definition: GetAndSetPosition.H:85
amrex::ParticleReal RType
Definition: GetAndSetPosition.H:63
GetParticlePosition()=default
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void operator()(const long i, RType &x, RType &y, RType &z) const noexcept
Extract the cartesian position coordinates of the particle located at index i + a_offset and store th...
Definition: GetAndSetPosition.H:99
const RType * m_theta
Definition: GetAndSetPosition.H:67
Functor that can be used to modify the positions of the macroparticles, inside a ParallelFor kernel.
Definition: GetAndSetPosition.H:160
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void operator()(const long i, RType x, RType y, RType z) const noexcept
Set the position of the particle at index i + a_offset to x, y, z
Definition: GetAndSetPosition.H:183
PType *AMREX_RESTRICT m_structs
Definition: GetAndSetPosition.H:164
WarpXParticleContainer::ParticleType PType
Definition: GetAndSetPosition.H:161
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void AsStored(const long i, RType x, RType y, RType z) const noexcept
Set the position of the particle at index i + a_offset to x, y, z This is only different for RZ since...
Definition: GetAndSetPosition.H:212
SetParticlePosition(const ptiType &a_pti, long a_offset=0) noexcept
Definition: GetAndSetPosition.H:170
RType *AMREX_RESTRICT m_theta
Definition: GetAndSetPosition.H:166
amrex::ParticleReal RType
Definition: GetAndSetPosition.H:162