8 #ifndef WARPX_PARTICLES_PUSHER_GETANDSETPOSITION_H_ 9 #define WARPX_PARTICLES_PUSHER_GETANDSETPOSITION_H_ 14 #include <AMReX_REAL.H> 22 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
24 amrex::ParticleReal&
x,
25 amrex::ParticleReal& y,
26 amrex::ParticleReal&
z) noexcept
30 amrex::ParticleReal r = p.pos(0);
31 x = r*std::cos(theta);
32 y = r*std::sin(theta);
40 y = amrex::ParticleReal(0.0);
51 using RType = amrex::ParticleReal;
54 #if (defined WARPX_DIM_RZ) 56 #elif (AMREX_SPACEDIM == 2) 57 static constexpr
RType m_y_default =
RType(0.0);
69 template <
typename ptiType>
72 const auto& aos = a_pti.GetArrayOfStructs();
73 m_structs = aos().dataPtr() + a_offset;
74 #if (defined WARPX_DIM_RZ) 75 const auto& soa = a_pti.GetStructOfArrays();
76 m_theta = soa.GetRealData(
PIdx::theta).dataPtr() + a_offset;
83 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
86 const PType& p = m_structs[
i];
89 x = r*std::cos(m_theta[
i]);
90 y = r*std::sin(m_theta[i]);
108 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
111 const PType& p = m_structs[
i];
140 #if (defined WARPX_DIM_RZ) 145 auto& aos = a_pti.GetArrayOfStructs();
146 m_structs = aos().dataPtr() + a_offset;
147 #if (defined WARPX_DIM_RZ) 148 auto& soa = a_pti.GetStructOfArrays();
149 m_theta = soa.GetRealData(
PIdx::theta).dataPtr() + a_offset;
155 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
158 #if defined(WARPX_DIM_XZ) 159 amrex::ignore_unused(y);
162 m_theta[
i] = std::atan2(y,
x);
163 m_structs[
i].pos(0) = std::sqrt(
x*
x + y*y);
164 m_structs[
i].pos(1) =
z;
166 m_structs[
i].pos(0) =
x;
167 m_structs[
i].pos(1) = y;
168 m_structs[
i].pos(2) =
z;
170 m_structs[
i].pos(0) =
x;
171 m_structs[
i].pos(1) =
z;
179 AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
182 #if defined(WARPX_DIM_XZ) 183 amrex::ignore_unused(y);
186 m_structs[
i].pos(0) =
x;
188 m_structs[
i].pos(1) =
z;
190 m_structs[
i].pos(0) =
x;
191 m_structs[
i].pos(1) = y;
192 m_structs[
i].pos(2) =
z;
194 m_structs[
i].pos(0) =
x;
195 m_structs[
i].pos(1) =
z;
200 #endif // WARPX_PARTICLES_PUSHER_GETANDSETPOSITION_H_
Definition: WarpXParticleContainer_fwd.H:30
def x
Definition: read_lab_particles.py:25
GetParticlePosition()=default
WarpXParticleContainer::ParticleType PType
Definition: GetAndSetPosition.H:50
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:23
def z
Definition: read_lab_particles.py:26
GetParticlePosition(const ptiType &a_pti, int a_offset=0) noexcept
Definition: GetAndSetPosition.H:70
const RType * m_theta
Definition: GetAndSetPosition.H:55
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:84
amrex::ParticleReal RType
Definition: GetAndSetPosition.H:51
i
Definition: check_interp_points_and_weights.py:171
PType *AMREX_RESTRICT m_structs
Definition: GetAndSetPosition.H:139
typename WarpXParticleContainer::SuperParticleType SuperParticleType
Definition: FilterFunctors.H:19
RType *AMREX_RESTRICT m_theta
Definition: GetAndSetPosition.H:141
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void AsStored(const int 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:180
WarpXParticleContainer::ParticleType ParticleType
Definition: ParticleUtils.cpp:29
amrex::ParticleReal RType
Definition: GetAndSetPosition.H:137
const PType *AMREX_RESTRICT m_structs
Definition: GetAndSetPosition.H:53
WarpXParticleContainer::ParticleType PType
Definition: GetAndSetPosition.H:136
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void AsStored(const int 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:109
Functor that can be used to extract the positions of the macroparticles inside a ParallelFor kernel...
Definition: GetAndSetPosition.H:48
Functor that can be used to modify the positions of the macroparticles, inside a ParallelFor kernel...
Definition: GetAndSetPosition.H:134
Definition: WarpXParticleContainer.H:58
SetParticlePosition(WarpXParIter &a_pti, int a_offset=0) noexcept
Definition: GetAndSetPosition.H:143