@@ -34,7 +34,7 @@ void get_particle_position (const WarpXParticleContainer::SuperParticleType& p,
34
34
35
35
#if defined(WARPX_DIM_RZ)
36
36
amrex::ParticleReal const theta = p.rdata (T_PIdx::theta);
37
- amrex::ParticleReal const r = p.pos (T_PIdx::x );
37
+ amrex::ParticleReal const r = p.pos (T_PIdx::r );
38
38
x = r*std::cos (theta);
39
39
y = r*std::sin (theta);
40
40
z = p.pos (PIdx::z);
@@ -63,9 +63,12 @@ struct GetParticlePosition
63
63
{
64
64
using RType = amrex::ParticleReal;
65
65
66
- #if defined(WARPX_DIM_RZ) || defined( WARPX_DIM_XZ)
66
+ #if defined(WARPX_DIM_XZ)
67
67
const RType* AMREX_RESTRICT m_x = nullptr ;
68
68
const RType* AMREX_RESTRICT m_z = nullptr ;
69
+ #elif defined(WARPX_DIM_RZ)
70
+ const RType* AMREX_RESTRICT m_r = nullptr ;
71
+ const RType* AMREX_RESTRICT m_z = nullptr ;
69
72
#elif defined(WARPX_DIM_3D)
70
73
const RType* AMREX_RESTRICT m_x = nullptr ;
71
74
const RType* AMREX_RESTRICT m_y = nullptr ;
@@ -97,9 +100,12 @@ struct GetParticlePosition
97
100
{
98
101
const auto & soa = a_pti.GetStructOfArrays ();
99
102
100
- #if defined(WARPX_DIM_RZ) || defined( WARPX_DIM_XZ)
103
+ #if defined(WARPX_DIM_XZ)
101
104
m_x = soa.GetRealData (PIdx::x).dataPtr () + a_offset;
102
105
m_z = soa.GetRealData (PIdx::z).dataPtr () + a_offset;
106
+ #elif defined(WARPX_DIM_RZ)
107
+ m_r = soa.GetRealData (PIdx::r).dataPtr () + a_offset;
108
+ m_z = soa.GetRealData (PIdx::z).dataPtr () + a_offset;
103
109
#elif defined(WARPX_DIM_3D)
104
110
m_x = soa.GetRealData (PIdx::x).dataPtr () + a_offset;
105
111
m_y = soa.GetRealData (PIdx::y).dataPtr () + a_offset;
@@ -119,7 +125,7 @@ struct GetParticlePosition
119
125
void operator () (const long i, RType& x, RType& y, RType& z) const noexcept
120
126
{
121
127
#ifdef WARPX_DIM_RZ
122
- RType const r = m_x [i];
128
+ RType const r = m_r [i];
123
129
x = r*std::cos (m_theta[i]);
124
130
y = r*std::sin (m_theta[i]);
125
131
z = m_z[i];
@@ -147,7 +153,7 @@ struct GetParticlePosition
147
153
void AsStored (const long i, RType& x, RType& y, RType& z) const noexcept
148
154
{
149
155
#ifdef WARPX_DIM_RZ
150
- x = m_x [i];
156
+ x = m_r [i];
151
157
y = m_theta[i];
152
158
z = m_z[i];
153
159
#elif WARPX_DIM_3D
@@ -178,9 +184,12 @@ struct SetParticlePosition
178
184
{
179
185
using RType = amrex::ParticleReal;
180
186
181
- #if defined(WARPX_DIM_RZ) || defined( WARPX_DIM_XZ)
187
+ #if defined(WARPX_DIM_XZ)
182
188
RType* AMREX_RESTRICT m_x;
183
189
RType* AMREX_RESTRICT m_z;
190
+ #elif defined(WARPX_DIM_RZ)
191
+ RType* AMREX_RESTRICT m_r;
192
+ RType* AMREX_RESTRICT m_z;
184
193
#elif defined(WARPX_DIM_3D)
185
194
RType* AMREX_RESTRICT m_x;
186
195
RType* AMREX_RESTRICT m_y;
@@ -196,9 +205,12 @@ struct SetParticlePosition
196
205
SetParticlePosition (const ptiType& a_pti, long a_offset = 0 ) noexcept
197
206
{
198
207
auto & soa = a_pti.GetStructOfArrays ();
199
- #if defined(WARPX_DIM_RZ) || defined( WARPX_DIM_XZ)
208
+ #if defined(WARPX_DIM_XZ)
200
209
m_x = soa.GetRealData (PIdx::x).dataPtr () + a_offset;
201
210
m_z = soa.GetRealData (PIdx::z).dataPtr () + a_offset;
211
+ #elif defined(WARPX_DIM_RZ)
212
+ m_r = soa.GetRealData (PIdx::r).dataPtr () + a_offset;
213
+ m_z = soa.GetRealData (PIdx::z).dataPtr () + a_offset;
202
214
#elif defined(WARPX_DIM_3D)
203
215
m_x = soa.GetRealData (PIdx::x).dataPtr () + a_offset;
204
216
m_y = soa.GetRealData (PIdx::y).dataPtr () + a_offset;
@@ -224,7 +236,7 @@ struct SetParticlePosition
224
236
#endif
225
237
#ifdef WARPX_DIM_RZ
226
238
m_theta[i] = std::atan2 (y, x);
227
- m_x [i] = std::sqrt (x*x + y*y);
239
+ m_r [i] = std::sqrt (x*x + y*y);
228
240
m_z[i] = z;
229
241
#elif WARPX_DIM_3D
230
242
m_x[i] = x;
@@ -252,7 +264,7 @@ struct SetParticlePosition
252
264
amrex::ignore_unused (x,y);
253
265
#endif
254
266
#ifdef WARPX_DIM_RZ
255
- m_x [i] = x;
267
+ m_r [i] = x;
256
268
m_theta[i] = y;
257
269
m_z[i] = z;
258
270
#elif WARPX_DIM_3D
0 commit comments