@@ -63,25 +63,16 @@ struct GetParticlePosition
63
63
{
64
64
using RType = amrex::ParticleReal;
65
65
66
- #if defined(WARPX_DIM_RZ) || defined(WARPX_DIM_XZ)
67
- const RType* AMREX_RESTRICT m_x = nullptr ;
68
- const RType* AMREX_RESTRICT m_z = nullptr ;
69
- #elif defined(WARPX_DIM_3D)
70
66
const RType* AMREX_RESTRICT m_x = nullptr ;
71
67
const RType* AMREX_RESTRICT m_y = nullptr ;
72
68
const RType* AMREX_RESTRICT m_z = nullptr ;
73
- #elif defined(WARPX_DIM_1D_Z)
74
- const RType* AMREX_RESTRICT m_z = nullptr ;
75
- #endif
76
69
77
70
#if defined(WARPX_DIM_RZ)
78
71
const RType* m_theta = nullptr ;
79
- #elif defined(WARPX_DIM_XZ) || defined(WARPX_DIM_RZ)
80
- static constexpr RType m_y_default = RType(0.0 );
81
- #elif defined(WARPX_DIM_1D_Z)
72
+ #endif
73
+
82
74
static constexpr RType m_x_default = RType(0.0 );
83
75
static constexpr RType m_y_default = RType(0.0 );
84
- #endif
85
76
86
77
GetParticlePosition () = default ;
87
78
@@ -118,20 +109,20 @@ struct GetParticlePosition
118
109
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
119
110
void operator () (const long i, RType& x, RType& y, RType& z) const noexcept
120
111
{
121
- #ifdef WARPX_DIM_RZ
112
+ #if defined( WARPX_DIM_RZ)
122
113
RType const r = m_x[i];
123
114
x = r*std::cos (m_theta[i]);
124
115
y = r*std::sin (m_theta[i]);
125
116
z = m_z[i];
126
- #elif WARPX_DIM_3D
117
+ #elif defined( WARPX_DIM_3D)
127
118
x = m_x[i];
128
119
y = m_y[i];
129
120
z = m_z[i];
130
- #elif WARPX_DIM_XZ
121
+ #elif defined( WARPX_DIM_XZ)
131
122
x = m_x[i];
132
123
y = m_y_default;
133
124
z = m_z[i];
134
- #else
125
+ #elif defined(WARPX_DIM_1D_Z)
135
126
x = m_x_default;
136
127
y = m_y_default;
137
128
z = m_z[i];
@@ -146,19 +137,19 @@ struct GetParticlePosition
146
137
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
147
138
void AsStored (const long i, RType& x, RType& y, RType& z) const noexcept
148
139
{
149
- #ifdef WARPX_DIM_RZ
140
+ #if defined( WARPX_DIM_RZ)
150
141
x = m_x[i];
151
142
y = m_theta[i];
152
143
z = m_z[i];
153
- #elif WARPX_DIM_3D
144
+ #elif defined( WARPX_DIM_3D)
154
145
x = m_x[i];
155
146
y = m_y[i];
156
147
z = m_z[i];
157
- #elif WARPX_DIM_XZ
148
+ #elif defined( WARPX_DIM_XZ)
158
149
x = m_x[i];
159
150
y = m_y_default;
160
151
z = m_z[i];
161
- #else
152
+ #elif defined(WARPX_DIM_1D_Z)
162
153
x = m_x_default;
163
154
y = m_y_default;
164
155
z = m_z[i];
@@ -178,16 +169,10 @@ struct SetParticlePosition
178
169
{
179
170
using RType = amrex::ParticleReal;
180
171
181
- #if defined(WARPX_DIM_RZ) || defined(WARPX_DIM_XZ)
182
- RType* AMREX_RESTRICT m_x;
183
- RType* AMREX_RESTRICT m_z;
184
- #elif defined(WARPX_DIM_3D)
185
172
RType* AMREX_RESTRICT m_x;
186
173
RType* AMREX_RESTRICT m_y;
187
174
RType* AMREX_RESTRICT m_z;
188
- #elif defined(WARPX_DIM_1D_Z)
189
- RType* AMREX_RESTRICT m_z;
190
- #endif
175
+
191
176
#if defined(WARPX_DIM_RZ)
192
177
RType* AMREX_RESTRICT m_theta;
193
178
#endif
@@ -217,18 +202,18 @@ struct SetParticlePosition
217
202
void operator () (const long i, RType x, RType y, RType z) const noexcept
218
203
{
219
204
amrex::ignore_unused (x,y,z);
220
- #ifdef WARPX_DIM_RZ
205
+ #if defined( WARPX_DIM_RZ)
221
206
m_theta[i] = std::atan2 (y, x);
222
207
m_x[i] = std::sqrt (x*x + y*y);
223
208
m_z[i] = z;
224
- #elif WARPX_DIM_3D
209
+ #elif defined( WARPX_DIM_3D)
225
210
m_x[i] = x;
226
211
m_y[i] = y;
227
212
m_z[i] = z;
228
- #elif WARPX_DIM_XZ
213
+ #elif defined( WARPX_DIM_XZ)
229
214
m_x[i] = x;
230
215
m_z[i] = z;
231
- #else
216
+ #elif defined(WARPX_DIM_1D_Z)
232
217
m_z[i] = z;
233
218
#endif
234
219
}
@@ -241,18 +226,18 @@ struct SetParticlePosition
241
226
void AsStored (const long i, RType x, RType y, RType z) const noexcept
242
227
{
243
228
amrex::ignore_unused (x,y,z);
244
- #ifdef WARPX_DIM_RZ
229
+ #if defined( WARPX_DIM_RZ)
245
230
m_x[i] = x;
246
231
m_theta[i] = y;
247
232
m_z[i] = z;
248
- #elif WARPX_DIM_3D
233
+ #elif defined( WARPX_DIM_3D)
249
234
m_x[i] = x;
250
235
m_y[i] = y;
251
236
m_z[i] = z;
252
- #elif WARPX_DIM_XZ
237
+ #elif defined( WARPX_DIM_XZ)
253
238
m_x[i] = x;
254
239
m_z[i] = z;
255
- #else
240
+ #elif defined(WARPX_DIM_1D_Z)
256
241
m_z[i] = z;
257
242
#endif
258
243
}
0 commit comments