8 #ifndef WARPX_PARTICLES_PUSHER_GETANDSETPOSITION_H_ 9 #define WARPX_PARTICLES_PUSHER_GETANDSETPOSITION_H_ 14 #include <AMReX_REAL.H> 28 using RType = amrex::ParticleReal;
31 #if (defined WARPX_DIM_RZ) 33 #elif (AMREX_SPACEDIM == 2) 34 static constexpr
RType m_snan = std::numeric_limits<RType>::quiet_NaN();
41 const auto& aos = a_pti.GetArrayOfStructs();
42 m_structs = aos().dataPtr() + a_offset;
43 #if (defined WARPX_DIM_RZ) 44 const auto& soa = a_pti.GetStructOfArrays();
45 m_theta = soa.GetRealData(
PIdx::theta).dataPtr() + a_offset;
52 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
56 RType r = m_structs[
i].pos(0);
57 x = r*std::cos(m_theta[
i]);
58 y = r*std::sin(m_theta[i]);
59 z = m_structs[
i].pos(1);
61 x = m_structs[
i].pos(0);
62 y = m_structs[
i].pos(1);
63 z = m_structs[
i].pos(2);
65 x = m_structs[
i].pos(0);
67 z = m_structs[
i].pos(1);
81 using RType = amrex::ParticleReal;
84 #if (defined WARPX_DIM_RZ) 89 auto& aos = a_pti.GetArrayOfStructs();
90 m_structs = aos().dataPtr() + a_offset;
91 #if (defined WARPX_DIM_RZ) 92 auto& soa = a_pti.GetStructOfArrays();
93 m_theta = soa.GetRealData(
PIdx::theta).dataPtr() + a_offset;
99 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
102 #if defined(WARPX_DIM_XZ) 103 amrex::ignore_unused(y);
106 m_theta[
i] = std::atan2(y,
x);
107 m_structs[
i].pos(0) = std::sqrt(
x*
x + y*y);
108 m_structs[
i].pos(1) =
z;
110 m_structs[
i].pos(0) =
x;
111 m_structs[
i].pos(1) = y;
112 m_structs[
i].pos(2) =
z;
114 m_structs[
i].pos(0) =
x;
115 m_structs[
i].pos(1) =
z;
120 #endif // WARPX_PARTICLES_PUSHER_GETANDSETPOSITION_H_ GetParticlePosition(const WarpXParIter &a_pti, int a_offset=0) noexcept
Definition: GetAndSetPosition.H:39
def x
Definition: read_lab_particles.py:25
GetParticlePosition()=default
WarpXParticleContainer::ParticleType PType
Definition: GetAndSetPosition.H:27
def z
Definition: read_lab_particles.py:26
const RType * m_theta
Definition: GetAndSetPosition.H:32
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void operator()(const int 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:53
amrex::ParticleReal RType
Definition: GetAndSetPosition.H:28
i
Definition: check_interp_points_and_weights.py:171
PType *AMREX_RESTRICT m_structs
Definition: GetAndSetPosition.H:83
RType *AMREX_RESTRICT m_theta
Definition: GetAndSetPosition.H:85
amrex::ParticleReal RType
Definition: GetAndSetPosition.H:81
const PType *AMREX_RESTRICT m_structs
Definition: GetAndSetPosition.H:30
Definition: WarpXParticleContainer.H:39
WarpXParticleContainer::ParticleType PType
Definition: GetAndSetPosition.H:80
Functor that can be used to extract the positions of the macroparticles inside a ParallelFor kernel...
Definition: GetAndSetPosition.H:25
Functor that can be used to modify the positions of the macroparticles, inside a ParallelFor kernel...
Definition: GetAndSetPosition.H:78
Definition: WarpXParticleContainer.H:76
WarpXParticleContainer::ParticleType ParticleType
Definition: CollisionType.cpp:46
SetParticlePosition(WarpXParIter &a_pti, int a_offset=0) noexcept
Definition: GetAndSetPosition.H:87