36 [[maybe_unused]]
const amrex::ParticleReal xp,
37 [[maybe_unused]]
const amrex::ParticleReal yp,
38 [[maybe_unused]]
const amrex::ParticleReal zp,
39 amrex::ParticleReal& Fxp,
40 amrex::ParticleReal& Fyp,
41 amrex::ParticleReal& Fzp,
51 [[maybe_unused]]
const int n_rz_azimuthal_modes)
53 using namespace amrex;
58#if defined(WARPX_DIM_RZ) || defined(WARPX_DIM_RCYLINDER)
59 const double rp = std::sqrt(xp*xp + yp*yp);
60 const double x_bar = (rp - xyzmin.
x)*dinv.
x;
61#elif defined(WARPX_DIM_RSPHERE)
62 const double rp = std::sqrt(xp*xp + yp*yp + zp*zp);
63 const double x_bar = (rp - xyzmin.
x)*dinv.
x;
64#elif !defined(WARPX_DIM_1D_Z)
65 const double x_bar = (xp - xyzmin.
x)*dinv.
x;
67#if defined(WARPX_DIM_3D)
68 const double y_bar = (yp - xyzmin.
y)*dinv.
y;
70#if !defined(WARPX_DIM_RCYLINDER) && !defined(WARPX_DIM_RSPHERE)
71 const double z_bar = (zp - xyzmin.
z)*dinv.
z;
77#if !defined(WARPX_DIM_RCYLINDER) && !defined(WARPX_DIM_RSPHERE)
78 constexpr int zdir = WARPX_ZINDEX;
83 double sz_node[depos_order_perp+1] = {0.};
84 double sz_cell[depos_order_perp+1] = {0.};
85 if (Fx_type[zdir] ==
NODE || Fy_type[zdir] ==
NODE) {
86 kp_node = shape_factor_perp(sz_node, z_bar);
88 if (Fx_type[zdir] == CELL || Fy_type[zdir] == CELL) {
89 kp_cell = shape_factor_perp(sz_cell, z_bar - 0.5);
92 const int kp_Fx = ((Fx_type[zdir] ==
NODE) ? kp_node : kp_cell);
93 const double (&sz_Fx)[depos_order_perp+1] = ((Fx_type[zdir] ==
NODE) ? sz_node : sz_cell);
95 const int kp_Fy = ((Fy_type[zdir] ==
NODE) ? kp_node : kp_cell);
96 const double (&sz_Fy)[depos_order_perp+1] = ((Fy_type[zdir] ==
NODE) ? sz_node : sz_cell);
99 double sz_Fz[depos_order_para+1] = {0.};
100 if (Fz_type[zdir] ==
NODE) { kp_Fz = shape_factor_para(sz_Fz, z_bar); }
101 else { kp_Fz = shape_factor_para(sz_Fz, z_bar - 0.5); }
104#if !defined(WARPX_DIM_1D_Z)
108 double sx_node[depos_order_perp+1] = {0.};
109 double sx_cell[depos_order_perp+1] = {0.};
110 if (Fy_type[0] ==
NODE || Fz_type[0] ==
NODE) {
111 ip_node = shape_factor_perp(sx_node, x_bar);
113 if (Fy_type[0] == CELL || Fz_type[0] == CELL) {
114 ip_cell = shape_factor_perp(sx_cell, x_bar - 0.5);
117 const int ip_Fy = ((Fy_type[0] ==
NODE) ? ip_node : ip_cell);
118 const double (&sx_Fy)[depos_order_perp+1] = ((Fy_type[0] ==
NODE) ? sx_node : sx_cell);
120 const int ip_Fz = ((Fz_type[0] ==
NODE) ? ip_node : ip_cell);
121 const double (&sx_Fz)[depos_order_perp+1] = ((Fz_type[0] ==
NODE) ? sx_node : sx_cell);
124 double sx_Fx[depos_order_para + 1] = {0.};
125 if (Fx_type[0] ==
NODE) { ip_Fx = shape_factor_para(sx_Fx, x_bar); }
126 else { ip_Fx = shape_factor_para(sx_Fx, x_bar - 0.5); }
129#if defined(WARPX_DIM_3D)
133 double sy_node[depos_order_perp+1] = {0.};
134 double sy_cell[depos_order_perp+1] = {0.};
135 if (Fx_type[1] ==
NODE || Fz_type[1] ==
NODE) {
136 jp_node = shape_factor_perp(sy_node, y_bar);
138 if (Fx_type[1] == CELL || Fz_type[1] == CELL) {
139 jp_cell = shape_factor_perp(sy_cell, y_bar - 0.5);
142 const int jp_Fx = ((Fx_type[1] ==
NODE) ? jp_node : jp_cell);
143 const double (&sy_Fx)[depos_order_perp+1] = ((Fx_type[1] ==
NODE) ? sy_node : sy_cell);
145 const int jp_Fz = ((Fz_type[1] ==
NODE) ? jp_node : jp_cell);
146 const double (&sy_Fz)[depos_order_perp+1] = ((Fz_type[1] ==
NODE) ? sy_node : sy_cell);
149 double sy_Fy[depos_order_para + 1] = {0.};
150 if (Fy_type[1] ==
NODE) { jp_Fy = shape_factor_para(sy_Fy, y_bar); }
151 else { jp_Fy = shape_factor_para(sy_Fy, y_bar - 0.5); }
155 for (
int k=0; k<=depos_order_perp; k++) {
156 for (
int j=0; j<=depos_order_perp; j++) {
157 for (
int i=0; i<=depos_order_para; i++) {
158 weight =
static_cast<amrex::Real
>(sx_Fx[i]*sy_Fx[j]*sz_Fx[k]);
159 Fxp += Fx_arr(lo.
x+ip_Fx+i, lo.
y+jp_Fx+j, lo.
z+kp_Fx+k)*weight;
163 for (
int k=0; k<=depos_order_perp; k++) {
164 for (
int j=0; j<=depos_order_para; j++) {
165 for (
int i=0; i<=depos_order_perp; i++) {
166 weight =
static_cast<amrex::Real
>(sx_Fy[i]*sy_Fy[j]*sz_Fy[k]);
167 Fyp += Fy_arr(lo.
x+ip_Fy+i, lo.
y+jp_Fy+j, lo.
z+kp_Fy+k)*weight;
171 for (
int k=0; k<=depos_order_para; k++) {
172 for (
int j=0; j<=depos_order_perp; j++) {
173 for (
int i=0; i<=depos_order_perp; i++) {
174 weight =
static_cast<amrex::Real
>(sx_Fz[i]*sy_Fz[j]*sz_Fz[k]);
175 Fzp += Fz_arr(lo.
x+ip_Fz+i, lo.
y+jp_Fz+j, lo.
z+kp_Fz+k)*weight;
180#elif defined(WARPX_DIM_XZ)
183 for (
int k=0; k<=depos_order_perp; k++) {
184 for (
int i=0; i<=depos_order_para; i++) {
185 const auto weight_Fx =
static_cast<amrex::Real
>(sx_Fx[i]*sz_Fx[k]);
186 Fxp += Fx_arr(lo.
x+ip_Fx+i, lo.
y+kp_Fx+k, 0, 0)*weight_Fx;
189 for (
int k=0; k<=depos_order_perp; k++) {
190 for (
int i=0; i<=depos_order_perp; i++) {
191 const auto weight_Fy =
static_cast<amrex::Real
>(sx_Fy[i]*sz_Fy[k]);
192 Fyp += Fy_arr(lo.
x+ip_Fy+i, lo.
y+kp_Fy+k, 0, 0)*weight_Fy;
195 for (
int k=0; k<=depos_order_para; k++) {
196 for (
int i=0; i<=depos_order_perp; i++) {
197 const auto weight_Fz =
static_cast<amrex::Real
>(sx_Fz[i]*sz_Fz[k]);
198 Fzp += Fz_arr(lo.
x+ip_Fz+i, lo.
y+kp_Fz+k, 0, 0)*weight_Fz;
202#elif defined(WARPX_DIM_RZ)
204 amrex::ParticleReal Frp = 0.;
205 amrex::ParticleReal Fthp = 0.;
208 for (
int k=0; k<=depos_order_perp; k++) {
209 for (
int i=0; i<=depos_order_para; i++) {
210 const auto weight_Fr =
static_cast<amrex::Real
>(sx_Fx[i]*sz_Fx[k]);
211 Frp += Fx_arr(lo.
x+ip_Fx+i, lo.
y+kp_Fx+k, 0, 0)*weight_Fr;
214 for (
int k=0; k<=depos_order_perp; k++) {
215 for (
int i=0; i<=depos_order_perp; i++) {
216 const auto weight_Fth =
static_cast<amrex::Real
>(sx_Fy[i]*sz_Fy[k]);
217 Fthp += Fy_arr(lo.
x+ip_Fy+i, lo.
y+kp_Fy+k, 0, 0)*weight_Fth;
220 for (
int k=0; k<=depos_order_para; k++) {
221 for (
int i=0; i<=depos_order_perp; i++) {
222 const auto weight_Fz =
static_cast<amrex::Real
>(sx_Fz[i]*sz_Fz[k]);
223 Fzp += Fz_arr(lo.
x+ip_Fz+i, lo.
y+kp_Fz+k, 0, 0)*weight_Fz;
227 const amrex::Real costheta = (rp > 0. ? xp/rp: 1._rt);
228 const amrex::Real sintheta = (rp > 0. ? yp/rp: 0.);
233 for (
int imode=1 ; imode < n_rz_azimuthal_modes ; imode++) {
235 for (
int k=0; k<=depos_order_perp; k++) {
236 for (
int i=0; i<=depos_order_para; i++) {
237 const auto weight_Fr =
static_cast<amrex::Real
>(sx_Fx[i]*sz_Fx[k]);
238 const auto dFr = (+ Fx_arr(lo.
x+ip_Fx+i, lo.
y+kp_Fx+k, 0, 2*imode-1)*xy.
real()
239 - Fx_arr(lo.
x+ip_Fx+i, lo.
y+kp_Fx+k, 0, 2*imode)*xy.
imag());
240 Frp += weight_Fr*dFr;
243 for (
int k=0; k<=depos_order_perp; k++) {
244 for (
int i=0; i<=depos_order_perp; i++) {
245 const auto weight_Fth =
static_cast<amrex::Real
>(sx_Fy[i]*sz_Fy[k]);
246 const auto dFth = (+ Fy_arr(lo.
x+ip_Fy+i, lo.
y+kp_Fy+k, 0, 2*imode-1)*xy.
real()
247 - Fy_arr(lo.
x+ip_Fy+i, lo.
y+kp_Fy+k, 0, 2*imode)*xy.
imag());
248 Fthp += weight_Fth*dFth;
251 for (
int k=0; k<=depos_order_para; k++) {
252 for (
int i=0; i<=depos_order_perp; i++) {
253 const auto weight_Fz =
static_cast<amrex::Real
>(sx_Fz[i]*sz_Fz[k]);
254 const auto dFz = (+ Fz_arr(lo.
x+ip_Fz+i, lo.
y+kp_Fz+k, 0, 2*imode-1)*xy.
real()
255 - Fz_arr(lo.
x+ip_Fz+i, lo.
y+kp_Fz+k, 0, 2*imode)*xy.
imag());
256 Fzp += weight_Fz*dFz;
264 Fxp += costheta*Frp - sintheta*Fthp;
265 Fyp += costheta*Fthp + sintheta*Frp;
267#elif defined(WARPX_DIM_1D_Z)
270 for (
int k=0; k<=depos_order_perp; k++) {
271 const auto weight_Fx =
static_cast<amrex::Real
>(sz_Fx[k]);
272 Fxp += Fx_arr(lo.
x+kp_Fx+k, 0, 0)*weight_Fx;
274 const auto weight_Fy =
static_cast<amrex::Real
>(sz_Fy[k]);
275 Fyp += Fy_arr(lo.
x+kp_Fy+k, 0, 0)*weight_Fy;
277 for (
int k=0; k<=depos_order_para; k++) {
278 const auto weight_Fz =
static_cast<amrex::Real
>(sz_Fz[k]);
279 Fzp += Fz_arr(lo.
x+kp_Fz+k, 0, 0)*weight_Fz;
282#elif defined(WARPX_DIM_RCYLINDER) || defined(WARPX_DIM_RSPHERE)
284 amrex::ParticleReal Frp = 0.;
285 amrex::ParticleReal Fthetap = 0.;
287 amrex::ParticleReal F3p = 0.;
290 for (
int i=0; i<=depos_order_para; i++) {
291 const auto weight_Fx =
static_cast<amrex::Real
>(sx_Fx[i]);
292 Frp += Fx_arr(lo.
x+ip_Fx+i, 0, 0)*weight_Fx;
294 for (
int i=0; i<=depos_order_perp; i++) {
295 const auto weight_Fy =
static_cast<amrex::Real
>(sx_Fy[i]);
296 Fthetap += Fy_arr(lo.
x+ip_Fy+i, 0, 0)*weight_Fy;
298 const auto weight_Fz =
static_cast<amrex::Real
>(sx_Fz[i]);
299 F3p += Fz_arr(lo.
x+ip_Fz+i, 0, 0)*weight_Fz;
302#if defined(WARPX_DIM_RCYLINDER)
304 amrex::Real
const costheta = (rp > 0. ? xp/rp: 1._rt);
305 amrex::Real
const sintheta = (rp > 0. ? yp/rp: 0.);
308 Fxp += costheta*Frp - sintheta*Fthetap;
309 Fyp += costheta*Fthetap + sintheta*Frp;
312#elif defined(WARPX_DIM_RSPHERE)
314 amrex::Real
const rpxy = std::sqrt(xp*xp + yp*yp);
315 amrex::Real
const costheta = (rpxy > 0. ? xp/rpxy : 1.);
316 amrex::Real
const sintheta = (rpxy > 0. ? yp/rpxy : 0.);
317 amrex::Real
const cosphi = (rp > 0. ? rpxy/rp : 1.);
318 amrex::Real
const sinphi = (rp > 0. ? zp/rp : 0.);
321 Fxp += costheta*cosphi*Frp - sintheta*Fthetap - costheta*sinphi*F3p;
322 Fyp += sintheta*cosphi*Frp + costheta*Fthetap - sintheta*sinphi*F3p;
323 Fzp += sinphi*Frp + cosphi*F3p;
350 [[maybe_unused]]
const amrex::ParticleReal yp,
351 [[maybe_unused]]
const amrex::ParticleReal zp,
352 amrex::ParticleReal& Exp,
353 amrex::ParticleReal& Eyp,
354 amrex::ParticleReal& Ezp,
355 amrex::ParticleReal& Bxp,
356 amrex::ParticleReal& Byp,
357 amrex::ParticleReal& Bzp,
373 [[maybe_unused]]
const int n_rz_azimuthal_modes)
375 using namespace amrex;
378 constexpr int zdir = WARPX_ZINDEX;
387 Compute_shape_factor<depos_order - galerkin_interpolation >
const compute_shape_factor_galerkin;
389#if !defined(WARPX_DIM_1D_Z)
392#if defined(WARPX_DIM_RZ) || defined(WARPX_DIM_RCYLINDER)
393 const amrex::Real rp = std::sqrt(xp*xp + yp*yp);
394 const amrex::Real x = (rp - xyzmin.
x)*dinv.
x;
395#elif defined(WARPX_DIM_RSPHERE)
396 const amrex::Real rp = std::sqrt(xp*xp + yp*yp + zp*zp);
397 const amrex::Real x = (rp - xyzmin.
x)*dinv.
x;
399 const amrex::Real x = (xp - xyzmin.
x)*dinv.
x;
406 amrex::Real sx_node[depos_order + 1] = {0._rt};
407 amrex::Real sx_cell[depos_order + 1] = {0._rt};
408 amrex::Real sx_node_galerkin[depos_order + 1 - galerkin_interpolation] = {0._rt};
409 amrex::Real sx_cell_galerkin[depos_order + 1 - galerkin_interpolation] = {0._rt};
415 if ((ey_type[0] ==
NODE) || (ez_type[0] ==
NODE) || (bx_type[0] ==
NODE)) {
416 j_node = compute_shape_factor(sx_node, x);
418 if ((ey_type[0] == CELL) || (ez_type[0] == CELL) || (bx_type[0] == CELL)) {
419 j_cell = compute_shape_factor(sx_cell, x - 0.5_rt);
421 if ((ex_type[0] ==
NODE) || (by_type[0] ==
NODE) || (bz_type[0] ==
NODE)) {
422 j_node_v = compute_shape_factor_galerkin(sx_node_galerkin, x);
424 if ((ex_type[0] == CELL) || (by_type[0] == CELL) || (bz_type[0] == CELL)) {
425 j_cell_v = compute_shape_factor_galerkin(sx_cell_galerkin, x - 0.5_rt);
427 const amrex::Real (&sx_ex)[depos_order + 1 - galerkin_interpolation] = ((ex_type[0] ==
NODE) ? sx_node_galerkin : sx_cell_galerkin);
428 const amrex::Real (&sx_ey)[depos_order + 1 ] = ((ey_type[0] ==
NODE) ? sx_node : sx_cell );
429 const amrex::Real (&sx_ez)[depos_order + 1 ] = ((ez_type[0] ==
NODE) ? sx_node : sx_cell );
430 const amrex::Real (&sx_bx)[depos_order + 1 ] = ((bx_type[0] ==
NODE) ? sx_node : sx_cell );
431 const amrex::Real (&sx_by)[depos_order + 1 - galerkin_interpolation] = ((by_type[0] ==
NODE) ? sx_node_galerkin : sx_cell_galerkin);
432 const amrex::Real (&sx_bz)[depos_order + 1 - galerkin_interpolation] = ((bz_type[0] ==
NODE) ? sx_node_galerkin : sx_cell_galerkin);
433 int const j_ex = ((ex_type[0] ==
NODE) ? j_node_v : j_cell_v);
434 int const j_ey = ((ey_type[0] ==
NODE) ? j_node : j_cell );
435 int const j_ez = ((ez_type[0] ==
NODE) ? j_node : j_cell );
436 int const j_bx = ((bx_type[0] ==
NODE) ? j_node : j_cell );
437 int const j_by = ((by_type[0] ==
NODE) ? j_node_v : j_cell_v);
438 int const j_bz = ((bz_type[0] ==
NODE) ? j_node_v : j_cell_v);
441#if defined(WARPX_DIM_3D)
443 const amrex::Real y = (yp-xyzmin.
y)*dinv.
y;
444 amrex::Real sy_node[depos_order + 1] = {0._rt};
445 amrex::Real sy_cell[depos_order + 1] = {0._rt};
446 amrex::Real sy_node_v[depos_order + 1 - galerkin_interpolation] = {0._rt};
447 amrex::Real sy_cell_v[depos_order + 1 - galerkin_interpolation] = {0._rt};
452 if ((ex_type[1] ==
NODE) || (ez_type[1] ==
NODE) || (by_type[1] ==
NODE)) {
453 k_node = compute_shape_factor(sy_node, y);
455 if ((ex_type[1] == CELL) || (ez_type[1] == CELL) || (by_type[1] == CELL)) {
456 k_cell = compute_shape_factor(sy_cell, y - 0.5_rt);
458 if ((ey_type[1] ==
NODE) || (bx_type[1] ==
NODE) || (bz_type[1] ==
NODE)) {
459 k_node_v = compute_shape_factor_galerkin(sy_node_v, y);
461 if ((ey_type[1] == CELL) || (bx_type[1] == CELL) || (bz_type[1] == CELL)) {
462 k_cell_v = compute_shape_factor_galerkin(sy_cell_v, y - 0.5_rt);
464 const amrex::Real (&sy_ex)[depos_order + 1 ] = ((ex_type[1] ==
NODE) ? sy_node : sy_cell );
465 const amrex::Real (&sy_ey)[depos_order + 1 - galerkin_interpolation] = ((ey_type[1] ==
NODE) ? sy_node_v : sy_cell_v);
466 const amrex::Real (&sy_ez)[depos_order + 1 ] = ((ez_type[1] ==
NODE) ? sy_node : sy_cell );
467 const amrex::Real (&sy_bx)[depos_order + 1 - galerkin_interpolation] = ((bx_type[1] ==
NODE) ? sy_node_v : sy_cell_v);
468 const amrex::Real (&sy_by)[depos_order + 1 ] = ((by_type[1] ==
NODE) ? sy_node : sy_cell );
469 const amrex::Real (&sy_bz)[depos_order + 1 - galerkin_interpolation] = ((bz_type[1] ==
NODE) ? sy_node_v : sy_cell_v);
470 int const k_ex = ((ex_type[1] ==
NODE) ? k_node : k_cell );
471 int const k_ey = ((ey_type[1] ==
NODE) ? k_node_v : k_cell_v);
472 int const k_ez = ((ez_type[1] ==
NODE) ? k_node : k_cell );
473 int const k_bx = ((bx_type[1] ==
NODE) ? k_node_v : k_cell_v);
474 int const k_by = ((by_type[1] ==
NODE) ? k_node : k_cell );
475 int const k_bz = ((bz_type[1] ==
NODE) ? k_node_v : k_cell_v);
479#if !defined(WARPX_DIM_RCYLINDER) && !defined(WARPX_DIM_RSPHERE)
481 const amrex::Real z = (zp-xyzmin.
z)*dinv.
z;
482 amrex::Real sz_node[depos_order + 1] = {0._rt};
483 amrex::Real sz_cell[depos_order + 1] = {0._rt};
484 amrex::Real sz_node_v[depos_order + 1 - galerkin_interpolation] = {0._rt};
485 amrex::Real sz_cell_v[depos_order + 1 - galerkin_interpolation] = {0._rt};
490 if ((ex_type[zdir] ==
NODE) || (ey_type[zdir] ==
NODE) || (bz_type[zdir] ==
NODE)) {
491 l_node = compute_shape_factor(sz_node, z);
493 if ((ex_type[zdir] == CELL) || (ey_type[zdir] == CELL) || (bz_type[zdir] == CELL)) {
494 l_cell = compute_shape_factor(sz_cell, z - 0.5_rt);
496 if ((ez_type[zdir] ==
NODE) || (bx_type[zdir] ==
NODE) || (by_type[zdir] ==
NODE)) {
497 l_node_v = compute_shape_factor_galerkin(sz_node_v, z);
499 if ((ez_type[zdir] == CELL) || (bx_type[zdir] == CELL) || (by_type[zdir] == CELL)) {
500 l_cell_v = compute_shape_factor_galerkin(sz_cell_v, z - 0.5_rt);
502 const amrex::Real (&sz_ex)[depos_order + 1 ] = ((ex_type[zdir] ==
NODE) ? sz_node : sz_cell );
503 const amrex::Real (&sz_ey)[depos_order + 1 ] = ((ey_type[zdir] ==
NODE) ? sz_node : sz_cell );
504 const amrex::Real (&sz_ez)[depos_order + 1 - galerkin_interpolation] = ((ez_type[zdir] ==
NODE) ? sz_node_v : sz_cell_v);
505 const amrex::Real (&sz_bx)[depos_order + 1 - galerkin_interpolation] = ((bx_type[zdir] ==
NODE) ? sz_node_v : sz_cell_v);
506 const amrex::Real (&sz_by)[depos_order + 1 - galerkin_interpolation] = ((by_type[zdir] ==
NODE) ? sz_node_v : sz_cell_v);
507 const amrex::Real (&sz_bz)[depos_order + 1 ] = ((bz_type[zdir] ==
NODE) ? sz_node : sz_cell );
508 int const l_ex = ((ex_type[zdir] ==
NODE) ? l_node : l_cell );
509 int const l_ey = ((ey_type[zdir] ==
NODE) ? l_node : l_cell );
510 int const l_ez = ((ez_type[zdir] ==
NODE) ? l_node_v : l_cell_v);
511 int const l_bx = ((bx_type[zdir] ==
NODE) ? l_node_v : l_cell_v);
512 int const l_by = ((by_type[zdir] ==
NODE) ? l_node_v : l_cell_v);
513 int const l_bz = ((bz_type[zdir] ==
NODE) ? l_node : l_cell );
521#if defined(WARPX_DIM_1D_Z)
525 for (
int iz=0; iz<=depos_order; iz++){
527 ey_arr(lo.
x+l_ey+iz, 0, 0, 0);
529 ex_arr(lo.
x+l_ex+iz, 0, 0, 0);
531 bz_arr(lo.
x+l_bz+iz, 0, 0, 0);
537 for (
int iz=0; iz<=depos_order-galerkin_interpolation; iz++){
539 ez_arr(lo.
x+l_ez+iz, 0, 0, 0);
541 bx_arr(lo.
x+l_bx+iz, 0, 0, 0);
543 by_arr(lo.
x+l_by+iz, 0, 0, 0);
546#elif defined(WARPX_DIM_XZ)
548 for (
int iz=0; iz<=depos_order; iz++){
549 for (
int ix=0; ix<=depos_order; ix++){
550 Eyp += sx_ey[ix]*sz_ey[iz]*
551 ey_arr(lo.
x+j_ey+ix, lo.
y+l_ey+iz, 0, 0);
556 for (
int iz=0; iz<=depos_order; iz++){
557 for (
int ix=0; ix<=depos_order-galerkin_interpolation; ix++){
558 Exp += sx_ex[ix]*sz_ex[iz]*
559 ex_arr(lo.
x+j_ex+ix, lo.
y+l_ex+iz, 0, 0);
560 Bzp += sx_bz[ix]*sz_bz[iz]*
561 bz_arr(lo.
x+j_bz+ix, lo.
y+l_bz+iz, 0, 0);
566 for (
int iz=0; iz<=depos_order-galerkin_interpolation; iz++){
567 for (
int ix=0; ix<=depos_order; ix++){
568 Ezp += sx_ez[ix]*sz_ez[iz]*
569 ez_arr(lo.
x+j_ez+ix, lo.
y+l_ez+iz, 0, 0);
570 Bxp += sx_bx[ix]*sz_bx[iz]*
571 bx_arr(lo.
x+j_bx+ix, lo.
y+l_bx+iz, 0, 0);
575 for (
int iz=0; iz<=depos_order-galerkin_interpolation; iz++){
576 for (
int ix=0; ix<=depos_order-galerkin_interpolation; ix++){
577 Byp += sx_by[ix]*sz_by[iz]*
578 by_arr(lo.
x+j_by+ix, lo.
y+l_by+iz, 0, 0);
582#elif defined(WARPX_DIM_RZ)
584 amrex::ParticleReal Erp = 0.;
585 amrex::ParticleReal Ethetap = 0.;
586 amrex::ParticleReal Brp = 0.;
587 amrex::ParticleReal Bthetap = 0.;
590 for (
int iz=0; iz<=depos_order; iz++){
591 for (
int ix=0; ix<=depos_order; ix++){
592 Ethetap += sx_ey[ix]*sz_ey[iz]*
593 ey_arr(lo.
x+j_ey+ix, lo.
y+l_ey+iz, 0, 0);
598 for (
int iz=0; iz<=depos_order; iz++){
599 for (
int ix=0; ix<=depos_order-galerkin_interpolation; ix++){
600 Erp += sx_ex[ix]*sz_ex[iz]*
601 ex_arr(lo.
x+j_ex+ix, lo.
y+l_ex+iz, 0, 0);
602 Bzp += sx_bz[ix]*sz_bz[iz]*
603 bz_arr(lo.
x+j_bz+ix, lo.
y+l_bz+iz, 0, 0);
608 for (
int iz=0; iz<=depos_order-galerkin_interpolation; iz++){
609 for (
int ix=0; ix<=depos_order; ix++){
610 Ezp += sx_ez[ix]*sz_ez[iz]*
611 ez_arr(lo.
x+j_ez+ix, lo.
y+l_ez+iz, 0, 0);
612 Brp += sx_bx[ix]*sz_bx[iz]*
613 bx_arr(lo.
x+j_bx+ix, lo.
y+l_bx+iz, 0, 0);
617 for (
int iz=0; iz<=depos_order-galerkin_interpolation; iz++){
618 for (
int ix=0; ix<=depos_order-galerkin_interpolation; ix++){
619 Bthetap += sx_by[ix]*sz_by[iz]*
620 by_arr(lo.
x+j_by+ix, lo.
y+l_by+iz, 0, 0);
624 amrex::Real costheta;
625 amrex::Real sintheta;
636 for (
int imode=1 ; imode < n_rz_azimuthal_modes ; imode++) {
639 for (
int iz=0; iz<=depos_order; iz++){
640 for (
int ix=0; ix<=depos_order; ix++){
641 const amrex::Real dEy = (+ ey_arr(lo.
x+j_ey+ix, lo.
y+l_ey+iz, 0, 2*imode-1)*xy.
real()
642 - ey_arr(lo.
x+j_ey+ix, lo.
y+l_ey+iz, 0, 2*imode)*xy.
imag());
643 Ethetap += sx_ey[ix]*sz_ey[iz]*dEy;
648 for (
int iz=0; iz<=depos_order; iz++){
649 for (
int ix=0; ix<=depos_order-galerkin_interpolation; ix++){
650 const amrex::Real dEx = (+ ex_arr(lo.
x+j_ex+ix, lo.
y+l_ex+iz, 0, 2*imode-1)*xy.
real()
651 - ex_arr(lo.
x+j_ex+ix, lo.
y+l_ex+iz, 0, 2*imode)*xy.
imag());
652 Erp += sx_ex[ix]*sz_ex[iz]*dEx;
653 const amrex::Real dBz = (+ bz_arr(lo.
x+j_bz+ix, lo.
y+l_bz+iz, 0, 2*imode-1)*xy.
real()
654 - bz_arr(lo.
x+j_bz+ix, lo.
y+l_bz+iz, 0, 2*imode)*xy.
imag());
655 Bzp += sx_bz[ix]*sz_bz[iz]*dBz;
660 for (
int iz=0; iz<=depos_order-galerkin_interpolation; iz++){
661 for (
int ix=0; ix<=depos_order; ix++){
662 const amrex::Real dEz = (+ ez_arr(lo.
x+j_ez+ix, lo.
y+l_ez+iz, 0, 2*imode-1)*xy.
real()
663 - ez_arr(lo.
x+j_ez+ix, lo.
y+l_ez+iz, 0, 2*imode)*xy.
imag());
664 Ezp += sx_ez[ix]*sz_ez[iz]*dEz;
665 const amrex::Real dBx = (+ bx_arr(lo.
x+j_bx+ix, lo.
y+l_bx+iz, 0, 2*imode-1)*xy.
real()
666 - bx_arr(lo.
x+j_bx+ix, lo.
y+l_bx+iz, 0, 2*imode)*xy.
imag());
667 Brp += sx_bx[ix]*sz_bx[iz]*dBx;
671 for (
int iz=0; iz<=depos_order-galerkin_interpolation; iz++){
672 for (
int ix=0; ix<=depos_order-galerkin_interpolation; ix++){
673 const amrex::Real dBy = (+ by_arr(lo.
x+j_by+ix, lo.
y+l_by+iz, 0, 2*imode-1)*xy.
real()
674 - by_arr(lo.
x+j_by+ix, lo.
y+l_by+iz, 0, 2*imode)*xy.
imag());
675 Bthetap += sx_by[ix]*sz_by[iz]*dBy;
682 Exp += costheta*Erp - sintheta*Ethetap;
683 Eyp += costheta*Ethetap + sintheta*Erp;
684 Bxp += costheta*Brp - sintheta*Bthetap;
685 Byp += costheta*Bthetap + sintheta*Brp;
687#elif defined(WARPX_DIM_RCYLINDER)
689 amrex::ParticleReal Erp = 0.;
690 amrex::ParticleReal Ethetap = 0.;
691 amrex::ParticleReal Brp = 0.;
692 amrex::ParticleReal Bthetap = 0.;
695 for (
int ix=0; ix<=depos_order; ix++){
696 Ethetap += sx_ey[ix]*ey_arr(lo.
x+j_ey+ix, 0, 0, 0);
700 for (
int ix=0; ix<=depos_order-galerkin_interpolation; ix++){
701 Erp += sx_ex[ix]*ex_arr(lo.
x+j_ex+ix, 0, 0, 0);
702 Bzp += sx_bz[ix]*bz_arr(lo.
x+j_bz+ix, 0, 0, 0);
706 for (
int ix=0; ix<=depos_order; ix++){
707 Ezp += sx_ez[ix]*ez_arr(lo.
x+j_ez+ix, 0, 0, 0);
708 Brp += sx_bx[ix]*bx_arr(lo.
x+j_bx+ix, 0, 0, 0);
711 for (
int ix=0; ix<=depos_order-galerkin_interpolation; ix++){
712 Bthetap += sx_by[ix]*by_arr(lo.
x+j_by+ix, 0, 0, 0);
715 amrex::Real
const costheta = (rp > 0. ? xp/rp : 1.);
716 amrex::Real
const sintheta = (rp > 0. ? yp/rp : 0.);
719 Exp += costheta*Erp - sintheta*Ethetap;
720 Eyp += costheta*Ethetap + sintheta*Erp;
721 Bxp += costheta*Brp - sintheta*Bthetap;
722 Byp += costheta*Bthetap + sintheta*Brp;
724#elif defined(WARPX_DIM_RSPHERE)
726 amrex::ParticleReal Erp = 0.;
727 amrex::ParticleReal Ethetap = 0.;
728 amrex::ParticleReal Ephip = 0.;
729 amrex::ParticleReal Brp = 0.;
730 amrex::ParticleReal Bthetap = 0.;
731 amrex::ParticleReal Bphip = 0.;
734 for (
int ix=0; ix<=depos_order; ix++){
735 Ethetap += sx_ey[ix]*ey_arr(lo.
x+j_ey+ix, 0, 0, 0);
739 for (
int ix=0; ix<=depos_order-galerkin_interpolation; ix++){
740 Erp += sx_ex[ix]*ex_arr(lo.
x+j_ex+ix, 0, 0, 0);
741 Bphip += sx_bz[ix]*bz_arr(lo.
x+j_bz+ix, 0, 0, 0);
745 for (
int ix=0; ix<=depos_order; ix++){
746 Ephip += sx_ez[ix]*ez_arr(lo.
x+j_ez+ix, 0, 0, 0);
747 Brp += sx_bx[ix]*bx_arr(lo.
x+j_bx+ix, 0, 0, 0);
750 for (
int ix=0; ix<=depos_order-galerkin_interpolation; ix++){
751 Bthetap += sx_by[ix]*by_arr(lo.
x+j_by+ix, 0, 0, 0);
754 const amrex::Real rpxy = std::sqrt(xp*xp + yp*yp);
755 amrex::Real
const costheta = (rpxy > 0. ? xp/rpxy : 1.);
756 amrex::Real
const sintheta = (rpxy > 0. ? yp/rpxy : 0.);
757 amrex::Real
const cosphi = (rp > 0. ? rpxy/rp : 1.);
758 amrex::Real
const sinphi = (rp > 0. ? zp/rp : 0.);
761 Exp += costheta*cosphi*Erp - sintheta*Ethetap - costheta*sinphi*Ephip;
762 Eyp += sintheta*cosphi*Erp + costheta*Ethetap - sintheta*sinphi*Ephip;
763 Ezp += sinphi*Erp + cosphi*Ephip;
764 Bxp += costheta*cosphi*Brp - sintheta*Bthetap - costheta*sinphi*Bphip;
765 Byp += sintheta*cosphi*Brp + costheta*Bthetap - sintheta*sinphi*Bphip;
766 Bzp += sinphi*Brp + cosphi*Bphip;
770 for (
int iz=0; iz<=depos_order; iz++){
771 for (
int iy=0; iy<=depos_order; iy++){
772 for (
int ix=0; ix<= depos_order - galerkin_interpolation; ix++){
773 Exp += sx_ex[ix]*sy_ex[iy]*sz_ex[iz]*
774 ex_arr(lo.
x+j_ex+ix, lo.
y+k_ex+iy, lo.
z+l_ex+iz);
779 for (
int iz=0; iz<=depos_order; iz++){
780 for (
int iy=0; iy<= depos_order - galerkin_interpolation; iy++){
781 for (
int ix=0; ix<=depos_order; ix++){
782 Eyp += sx_ey[ix]*sy_ey[iy]*sz_ey[iz]*
783 ey_arr(lo.
x+j_ey+ix, lo.
y+k_ey+iy, lo.
z+l_ey+iz);
788 for (
int iz=0; iz<= depos_order - galerkin_interpolation; iz++){
789 for (
int iy=0; iy<=depos_order; iy++){
790 for (
int ix=0; ix<=depos_order; ix++){
791 Ezp += sx_ez[ix]*sy_ez[iy]*sz_ez[iz]*
792 ez_arr(lo.
x+j_ez+ix, lo.
y+k_ez+iy, lo.
z+l_ez+iz);
797 for (
int iz=0; iz<=depos_order; iz++){
798 for (
int iy=0; iy<= depos_order - galerkin_interpolation; iy++){
799 for (
int ix=0; ix<= depos_order - galerkin_interpolation; ix++){
800 Bzp += sx_bz[ix]*sy_bz[iy]*sz_bz[iz]*
801 bz_arr(lo.
x+j_bz+ix, lo.
y+k_bz+iy, lo.
z+l_bz+iz);
806 for (
int iz=0; iz<= depos_order - galerkin_interpolation; iz++){
807 for (
int iy=0; iy<=depos_order; iy++){
808 for (
int ix=0; ix<= depos_order - galerkin_interpolation; ix++){
809 Byp += sx_by[ix]*sy_by[iy]*sz_by[iz]*
810 by_arr(lo.
x+j_by+ix, lo.
y+k_by+iy, lo.
z+l_by+iz);
815 for (
int iz=0; iz<= depos_order - galerkin_interpolation; iz++){
816 for (
int iy=0; iy<= depos_order - galerkin_interpolation; iy++){
817 for (
int ix=0; ix<=depos_order; ix++){
818 Bxp += sx_bx[ix]*sy_bx[iy]*sz_bx[iz]*
819 bx_arr(lo.
x+j_bx+ix, lo.
y+k_bx+iy, lo.
z+l_bx+iz);
847 [[maybe_unused]]
const amrex::ParticleReal xp_n,
848 [[maybe_unused]]
const amrex::ParticleReal yp_n,
849 [[maybe_unused]]
const amrex::ParticleReal zp_n,
850 [[maybe_unused]]
const amrex::ParticleReal xp_nph,
851 [[maybe_unused]]
const amrex::ParticleReal yp_nph,
852 [[maybe_unused]]
const amrex::ParticleReal zp_nph,
853 amrex::ParticleReal& Exp,
854 amrex::ParticleReal& Eyp,
855 amrex::ParticleReal& Ezp,
856 amrex::ParticleReal& Bxp,
857 amrex::ParticleReal& Byp,
858 amrex::ParticleReal& Bzp,
874 const int n_rz_azimuthal_modes)
876 using namespace amrex;
877#if !defined(WARPX_DIM_RZ)
881#if (AMREX_SPACEDIM > 1)
882 Real
constexpr one_third = 1.0_rt / 3.0_rt;
883 Real
constexpr one_sixth = 1.0_rt / 6.0_rt;
886#if !defined(WARPX_DIM_1D_Z)
887 const ParticleReal xp_np1 = 2._prt*xp_nph - xp_n;
889#if defined(WARPX_DIM_3D) || defined(WARPX_DIM_RZ) || defined(WARPX_DIM_RCYLINDER) || defined(WARPX_DIM_RSPHERE)
890 const ParticleReal yp_np1 = 2._prt*yp_nph - yp_n;
892#if !defined(WARPX_DIM_RCYLINDER)
893 const ParticleReal zp_np1 = 2._prt*zp_nph - zp_n;
897#if defined(WARPX_DIM_RZ) || defined(WARPX_DIM_RCYLINDER)
898 amrex::Real
const xp_new = xp_np1;
899 amrex::Real
const yp_new = yp_np1;
900 amrex::Real
const xp_old = xp_n;
901 amrex::Real
const yp_old = yp_n;
902 amrex::Real
const rp_new = std::sqrt(xp_new*xp_new + yp_new*yp_new);
903 amrex::Real
const rp_old = std::sqrt(xp_old*xp_old + yp_old*yp_old);
905 double const x_new = (rp_new - xyzmin.
x)*dinv.
x;
906 double const x_old = (rp_old - xyzmin.
x)*dinv.
x;
907#elif defined(WARPX_DIM_RSPHERE)
908 amrex::Real
const xp_new = xp_np1;
909 amrex::Real
const yp_new = yp_np1;
910 amrex::Real
const zp_new = zp_np1;
911 amrex::Real
const xp_old = xp_n;
912 amrex::Real
const yp_old = yp_n;
913 amrex::Real
const zp_old = zp_n;
914 amrex::Real
const rp_new = std::sqrt(xp_new*xp_new + yp_new*yp_new + zp_new*zp_new);
915 amrex::Real
const rp_old = std::sqrt(xp_old*xp_old + yp_old*yp_old + zp_old*zp_old);
918 double const x_new = (rp_new - xyzmin.
x)*dinv.
x;
919 double const x_old = (rp_old - xyzmin.
x)*dinv.
x;
921#if !defined(WARPX_DIM_1D_Z)
923 double const x_new = (xp_np1 - xyzmin.
x)*dinv.
x;
924 double const x_old = (xp_n - xyzmin.
x)*dinv.
x;
927#if defined(WARPX_DIM_3D)
929 double const y_new = (yp_np1 - xyzmin.
y)*dinv.
y;
930 double const y_old = (yp_n - xyzmin.
y)*dinv.
y;
932#if !defined(WARPX_DIM_RCYLINDER) && !defined(WARPX_DIM_RSPHERE)
934 double const z_new = (zp_np1 - xyzmin.
z)*dinv.
z;
935 double const z_old = (zp_n - xyzmin.
z)*dinv.
z;
943#if !defined(WARPX_DIM_1D_Z)
944 double sx_E_new[depos_order + 3] = {0.};
945 double sx_E_old[depos_order + 3] = {0.};
947#if defined(WARPX_DIM_3D)
949 double sy_E_new[depos_order + 3] = {0.};
950 double sy_E_old[depos_order + 3] = {0.};
952#if !defined(WARPX_DIM_RCYLINDER) && !defined(WARPX_DIM_RSPHERE)
954 double sz_E_new[depos_order + 3] = {0.};
955 double sz_E_old[depos_order + 3] = {0.};
958#if defined(WARPX_DIM_3D)
959 double sx_B_new[depos_order + 3] = {0.};
960 double sx_B_old[depos_order + 3] = {0.};
961 double sy_B_new[depos_order + 3] = {0.};
962 double sy_B_old[depos_order + 3] = {0.};
963 double sz_B_new[depos_order + 3] = {0.};
964 double sz_B_old[depos_order + 3] = {0.};
967#if defined(WARPX_DIM_XZ) || defined(WARPX_DIM_RZ)
970 double sx_By_new[depos_order + 2] = {0.};
971 double sx_By_old[depos_order + 2] = {0.};
972 double sz_By_new[depos_order + 2] = {0.};
973 double sz_By_old[depos_order + 2] = {0.};
982#if !defined(WARPX_DIM_1D_Z)
983 const int i_E_new = compute_shape_factor(sx_E_new+1, x_new);
984 const int i_E_old = compute_shifted_shape_factor(sx_E_old, x_old, i_E_new);
986#if defined(WARPX_DIM_3D)
987 const int j_E_new = compute_shape_factor(sy_E_new+1, y_new);
988 const int j_E_old = compute_shifted_shape_factor(sy_E_old, y_old, j_E_new);
990#if !defined(WARPX_DIM_RCYLINDER) && !defined(WARPX_DIM_RSPHERE)
991 const int k_E_new = compute_shape_factor(sz_E_new+1, z_new);
992 const int k_E_old = compute_shifted_shape_factor(sz_E_old, z_old, k_E_new);
995#if defined(WARPX_DIM_3D)
996 const int i_B_new = compute_shape_factor(sx_B_new+1, x_new - 0.5_rt);
997 const int i_B_old = compute_shifted_shape_factor(sx_B_old, x_old - 0.5_rt, i_B_new);
998 const int j_B_new = compute_shape_factor(sy_B_new+1, y_new - 0.5_rt);
999 const int j_B_old = compute_shifted_shape_factor(sy_B_old, y_old - 0.5_rt, j_B_new);
1000 const int k_B_new = compute_shape_factor(sz_B_new+1, z_new - 0.5_rt);
1001 const int k_B_old = compute_shifted_shape_factor(sz_B_old, z_old - 0.5_rt, k_B_new);
1005#if !defined(WARPX_DIM_1D_Z)
1006 int dil_E = 1, diu_E = 1;
1007 if (i_E_old < i_E_new) { dil_E = 0; }
1008 if (i_E_old > i_E_new) { diu_E = 0; }
1010#if defined(WARPX_DIM_3D)
1011 int djl_E = 1, dju_E = 1;
1012 if (j_E_old < j_E_new) { djl_E = 0; }
1013 if (j_E_old > j_E_new) { dju_E = 0; }
1015#if !defined(WARPX_DIM_RCYLINDER) && !defined(WARPX_DIM_RSPHERE)
1016 int dkl_E = 1, dku_E = 1;
1017 if (k_E_old < k_E_new) { dkl_E = 0; }
1018 if (k_E_old > k_E_new) { dku_E = 0; }
1021#if defined(WARPX_DIM_3D)
1022 int dil_B = 1, diu_B = 1;
1023 if (i_B_old < i_B_new) { dil_B = 0; }
1024 if (i_B_old > i_B_new) { diu_B = 0; }
1025 int djl_B = 1, dju_B = 1;
1026 if (j_B_old < j_B_new) { djl_B = 0; }
1027 if (j_B_old > j_B_new) { dju_B = 0; }
1028 int dkl_B = 1, dku_B = 1;
1029 if (k_B_old < k_B_new) { dkl_B = 0; }
1030 if (k_B_old > k_B_new) { dku_B = 0; }
1033#if defined(WARPX_DIM_XZ) || defined(WARPX_DIM_RZ)
1036 const int i_By_new = compute_shape_factor_By(sx_By_new+1, x_new - 0.5_rt);
1037 const int i_By_old = compute_shifted_shape_factor_By(sx_By_old, x_old - 0.5_rt, i_By_new);
1038 const int k_By_new = compute_shape_factor_By(sz_By_new+1, z_new - 0.5_rt);
1039 const int k_By_old = compute_shifted_shape_factor_By(sz_By_old, z_old - 0.5_rt, k_By_new);
1040 int dil_By = 1, diu_By = 1;
1041 if (i_By_old < i_By_new) { dil_By = 0; }
1042 if (i_By_old > i_By_new) { diu_By = 0; }
1043 int dkl_By = 1, dku_By = 1;
1044 if (k_By_old < k_By_new) { dkl_By = 0; }
1045 if (k_By_old > k_By_new) { dku_By = 0; }
1048#if defined(WARPX_DIM_3D)
1050 for (
int k=dkl_E; k<=depos_order+2-dku_E; k++) {
1051 for (
int j=djl_E; j<=depos_order+2-dju_E; j++) {
1052 const amrex::Real sdzjk = one_third*(sy_E_new[j]*sz_E_new[k] + sy_E_old[j]*sz_E_old[k])
1053 +one_sixth*(sy_E_new[j]*sz_E_old[k] + sy_E_old[j]*sz_E_new[k]);
1054 amrex::Real sdxi = 0._rt;
1055 for (
int i=dil_E; i<=depos_order+1-diu_E; i++) {
1056 sdxi += (sx_E_old[i] - sx_E_new[i]);
1057 auto sdxiov =
static_cast<amrex::Real
>((x_new - x_old) == 0. ? 1. : sdxi/(x_new - x_old));
1058 Exp += Ex_arr(lo.
x+i_E_new-1+i, lo.
y+j_E_new-1+j, lo.
z+k_E_new-1+k)*sdxiov*sdzjk;
1062 for (
int k=dkl_E; k<=depos_order+2-dku_E; k++) {
1063 for (
int i=dil_E; i<=depos_order+2-diu_E; i++) {
1064 const amrex::Real sdyik = one_third*(sx_E_new[i]*sz_E_new[k] + sx_E_old[i]*sz_E_old[k])
1065 +one_sixth*(sx_E_new[i]*sz_E_old[k] + sx_E_old[i]*sz_E_new[k]);
1066 amrex::Real sdyj = 0._rt;
1067 for (
int j=djl_E; j<=depos_order+1-dju_E; j++) {
1068 sdyj += (sy_E_old[j] - sy_E_new[j]);
1069 auto sdyjov =
static_cast<amrex::Real
>((y_new - y_old) == 0. ? 1. : sdyj/(y_new - y_old));
1070 Eyp += Ey_arr(lo.
x+i_E_new-1+i, lo.
y+j_E_new-1+j, lo.
z+k_E_new-1+k)*sdyjov*sdyik;
1074 for (
int j=djl_E; j<=depos_order+2-dju_E; j++) {
1075 for (
int i=dil_E; i<=depos_order+2-diu_E; i++) {
1076 const amrex::Real sdzij = one_third*(sx_E_new[i]*sy_E_new[j] + sx_E_old[i]*sy_E_old[j])
1077 +one_sixth*(sx_E_new[i]*sy_E_old[j] + sx_E_old[i]*sy_E_new[j]);
1078 amrex::Real sdzk = 0._rt;
1079 for (
int k=dkl_E; k<=depos_order+1-dku_E; k++) {
1080 sdzk += (sz_E_old[k] - sz_E_new[k]);
1081 auto sdzkov =
static_cast<amrex::Real
>((z_new - z_old) == 0. ? 1. : sdzk/(z_new - z_old));
1082 Ezp += Ez_arr(lo.
x+i_E_new-1+i, lo.
y+j_E_new-1+j, lo.
z+k_E_new-1+k)*sdzkov*sdzij;
1086 for (
int k=dkl_B; k<=depos_order+2-dku_B; k++) {
1087 for (
int j=djl_B; j<=depos_order+2-dju_B; j++) {
1088 const amrex::Real sdzjk = one_third*(sy_B_new[j]*sz_B_new[k] + sy_B_old[j]*sz_B_old[k])
1089 +one_sixth*(sy_B_new[j]*sz_B_old[k] + sy_B_old[j]*sz_B_new[k]);
1090 amrex::Real sdxi = 0._rt;
1091 for (
int i=dil_B; i<=depos_order+1-diu_B; i++) {
1092 sdxi += (sx_B_old[i] - sx_B_new[i]);
1093 auto sdxiov =
static_cast<amrex::Real
>((x_new - x_old) == 0. ? 1. : sdxi/(x_new - x_old));
1094 Bxp += Bx_arr(lo.
x+i_B_new-1+i, lo.
y+j_B_new-1+j, lo.
z+k_B_new-1+k)*sdxiov*sdzjk;
1098 for (
int k=dkl_B; k<=depos_order+2-dku_B; k++) {
1099 for (
int i=dil_B; i<=depos_order+2-diu_B; i++) {
1100 const amrex::Real sdyik = one_third*(sx_B_new[i]*sz_B_new[k] + sx_B_old[i]*sz_B_old[k])
1101 +one_sixth*(sx_B_new[i]*sz_B_old[k] + sx_B_old[i]*sz_B_new[k]);
1102 amrex::Real sdyj = 0._rt;
1103 for (
int j=djl_B; j<=depos_order+1-dju_B; j++) {
1104 sdyj += (sy_B_old[j] - sy_B_new[j]);
1105 auto sdyjov =
static_cast<amrex::Real
>((y_new - y_old) == 0. ? 1. : sdyj/(y_new - y_old));
1106 Byp += By_arr(lo.
x+i_B_new-1+i, lo.
y+j_B_new-1+j, lo.
z+k_B_new-1+k)*sdyjov*sdyik;
1110 for (
int j=djl_B; j<=depos_order+2-dju_B; j++) {
1111 for (
int i=dil_B; i<=depos_order+2-diu_B; i++) {
1112 const amrex::Real sdzij = one_third*(sx_B_new[i]*sy_B_new[j] + sx_B_old[i]*sy_B_old[j])
1113 +one_sixth*(sx_B_new[i]*sy_B_old[j] + sx_B_old[i]*sy_B_new[j]);
1114 amrex::Real sdzk = 0._rt;
1115 for (
int k=dkl_B; k<=depos_order+1-dku_B; k++) {
1116 sdzk += (sz_B_old[k] - sz_B_new[k]);
1117 auto sdzkov =
static_cast<amrex::Real
>((z_new - z_old) == 0. ? 1. : sdzk/(z_new - z_old));
1118 Bzp += Bz_arr(lo.
x+i_B_new-1+i, lo.
y+j_B_new-1+j, lo.
z+k_E_new-1+k)*sdzkov*sdzij;
1123#elif defined(WARPX_DIM_XZ) || defined(WARPX_DIM_RZ)
1125 for (
int k=dkl_E; k<=depos_order+2-dku_E; k++) {
1126 const amrex::Real sdzk = 0.5_rt*(sz_E_new[k] + sz_E_old[k]);
1127 amrex::Real sdxi = 0._rt;
1128 for (
int i=dil_E; i<=depos_order+1-diu_E; i++) {
1129 sdxi += (sx_E_old[i] - sx_E_new[i]);
1130 auto sdxiov =
static_cast<amrex::Real
>((x_new - x_old) == 0. ? 1. : sdxi/(x_new - x_old));
1131 Exp += Ex_arr(lo.
x+i_E_new-1+i, lo.
y+k_E_new-1+k, 0, 0)*sdxiov*sdzk;
1132 Bzp += Bz_arr(lo.
x+i_E_new-1+i, lo.
y+k_E_new-1+k, 0, 0)*sdxiov*sdzk;
1135 for (
int k=dkl_E; k<=depos_order+2-dku_E; k++) {
1136 for (
int i=dil_E; i<=depos_order+2-diu_E; i++) {
1138 one_third*(sx_E_new[i]*sz_E_new[k] + sx_E_old[i]*sz_E_old[k])
1139 +one_sixth*(sx_E_new[i]*sz_E_old[k] + sx_E_old[i]*sz_E_new[k]));
1140 Eyp += Ey_arr(lo.
x+i_E_new-1+i, lo.
y+k_E_new-1+k, 0, 0)*sdyj;
1143 for (
int i=dil_E; i<=depos_order+2-diu_E; i++) {
1144 const amrex::Real sdxi = 0.5_rt*(sx_E_new[i] + sx_E_old[i]);
1145 amrex::Real sdzk = 0._rt;
1146 for (
int k=dkl_E; k<=depos_order+1-dku_E; k++) {
1147 sdzk += (sz_E_old[k] - sz_E_new[k]);
1148 auto sdzkov =
static_cast<amrex::Real
>((z_new - z_old) == 0. ? 1. : sdzk/(z_new - z_old));
1149 Ezp += Ez_arr(lo.
x+i_E_new-1+i, lo.
y+k_E_new-1+k, 0, 0)*sdzkov*sdxi;
1150 Bxp += Bx_arr(lo.
x+i_E_new-1+i, lo.
y+k_E_new-1+k, 0, 0)*sdzkov*sdxi;
1153 for (
int k=dkl_By; k<=depos_order+1-dku_By; k++) {
1154 for (
int i=dil_By; i<=depos_order+1-diu_By; i++) {
1156 one_third*(sx_By_new[i]*sz_By_new[k] + sx_By_old[i]*sz_By_old[k])
1157 +one_sixth*(sx_By_new[i]*sz_By_old[k] + sx_By_old[i]*sz_By_new[k]));
1158 Byp += By_arr(lo.
x+i_By_new-1+i, lo.
y+k_By_new-1+k, 0, 0)*sdyj;
1163 const amrex::Real xp_mid = xp_nph;
1164 const amrex::Real yp_mid = yp_nph;
1165 const amrex::Real rp_mid = (rp_new + rp_old)/2._rt;
1166 const amrex::Real costheta_mid = (rp_mid > 0. ? xp_mid/rp_mid: 1._rt);
1167 const amrex::Real sintheta_mid = (rp_mid > 0. ? yp_mid/rp_mid: 0.);
1171 for (
int imode=1 ; imode < n_rz_azimuthal_modes ; imode++) {
1175 for (
int k=dkl_E; k<=depos_order+2-dku_E; k++) {
1176 const amrex::Real sdzk = 0.5_rt*(sz_E_new[k] + sz_E_old[k]);
1177 amrex::Real sdxi = 0._rt;
1178 for (
int i=dil_E; i<=depos_order+1-diu_E; i++) {
1179 sdxi += (sx_E_old[i] - sx_E_new[i]);
1180 auto sdxiov =
static_cast<amrex::Real
>((x_new - x_old) == 0. ? 1. : sdxi/(x_new - x_old));
1181 const amrex::Real dEx = (+ Ex_arr(lo.
x+i_E_new-1+i, lo.
y+k_E_new-1+k, 0, 2*imode-1)*xy_mid.
real()
1182 - Ex_arr(lo.
x+i_E_new-1+i, lo.
y+k_E_new-1+k, 0, 2*imode)*xy_mid.
imag());
1183 const amrex::Real dBz = (+ Bz_arr(lo.
x+i_E_new-1+i, lo.
y+k_E_new-1+k, 0, 2*imode-1)*xy_mid.
real()
1184 - Bz_arr(lo.
x+i_E_new-1+i, lo.
y+k_E_new-1+k, 0, 2*imode)*xy_mid.
imag());
1185 Exp += dEx*sdxiov*sdzk;
1186 Bzp += dBz*sdxiov*sdzk;
1190 for (
int k=dkl_E; k<=depos_order+2-dku_E; k++) {
1191 for (
int i=dil_E; i<=depos_order+2-diu_E; i++) {
1193 one_third*(sx_E_new[i]*sz_E_new[k] + sx_E_old[i]*sz_E_old[k])
1194 +one_sixth*(sx_E_new[i]*sz_E_old[k] + sx_E_old[i]*sz_E_new[k]));
1195 const amrex::Real dEy = (+ Ey_arr(lo.
x+i_E_new-1+i, lo.
y+k_E_new-1+k, 0, 2*imode-1)*xy_mid.
real()
1196 - Ey_arr(lo.
x+i_E_new-1+i, lo.
y+k_E_new-1+k, 0, 2*imode)*xy_mid.
imag());
1202 for (
int i=dil_E; i<=depos_order+2-diu_E; i++) {
1203 const amrex::Real sdxi = 0.5_rt*(sx_E_new[i] + sx_E_old[i]);
1204 amrex::Real sdzk = 0._rt;
1205 for (
int k=dkl_E; k<=depos_order+1-dku_E; k++) {
1206 sdzk += (sz_E_old[k] - sz_E_new[k]);
1207 auto sdzkov =
static_cast<amrex::Real
>((z_new - z_old) == 0. ? 1. : sdzk/(z_new - z_old));
1208 const amrex::Real dEz = (+ Ez_arr(lo.
x+i_E_new-1+i, lo.
y+k_E_new-1+k, 0, 2*imode-1)*xy_mid.
real()
1209 - Ez_arr(lo.
x+i_E_new-1+i, lo.
y+k_E_new-1+k, 0, 2*imode)*xy_mid.
imag());
1210 const amrex::Real dBx = (+ Bx_arr(lo.
x+i_E_new-1+i, lo.
y+k_E_new-1+k, 0, 2*imode-1)*xy_mid.
real()
1211 - Bx_arr(lo.
x+i_E_new-1+i, lo.
y+k_E_new-1+k, 0, 2*imode)*xy_mid.
imag());
1212 Ezp += dEz*sdzkov*sdxi;
1213 Bxp += dBx*sdzkov*sdxi;
1217 for (
int k=dkl_By; k<=depos_order+1-dku_By; k++) {
1218 for (
int i=dil_By; i<=depos_order+1-diu_By; i++) {
1220 one_third*(sx_By_new[i]*sz_By_new[k] + sx_By_old[i]*sz_By_old[k])
1221 +one_sixth*(sx_By_new[i]*sz_By_old[k] + sx_By_old[i]*sz_By_new[k]));
1222 const amrex::Real dBy = (+ By_arr(lo.
x+i_By_new-1+i, lo.
y+k_By_new-1+k, 0, 2*imode-1)*xy_mid.
real()
1223 - By_arr(lo.
x+i_By_new-1+i, lo.
y+k_By_new-1+k, 0, 2*imode)*xy_mid.
imag());
1227 xy_mid = xy_mid*xy_mid0;
1231 const amrex::Real Erp = Exp;
1232 const amrex::Real Ethp = Eyp;
1233 Exp = costheta_mid*Erp - sintheta_mid*Ethp;
1234 Eyp = costheta_mid*Ethp + sintheta_mid*Erp;
1236 const amrex::Real Brp = Bxp;
1237 const amrex::Real Bthp = Byp;
1238 Bxp = costheta_mid*Brp - sintheta_mid*Bthp;
1239 Byp = costheta_mid*Bthp + sintheta_mid*Brp;
1243#elif defined(WARPX_DIM_1D_Z)
1245 for (
int k=dkl_E; k<=depos_order+2-dku_E; k++) {
1246 amrex::Real
const sdzk = 0.5_rt*(sz_E_old[k] + sz_E_new[k]);
1247 Exp += Ex_arr(lo.
x+k_E_new-1+k, 0, 0, 0)*sdzk;
1248 Eyp += Ey_arr(lo.
x+k_E_new-1+k, 0, 0, 0)*sdzk;
1249 Bzp += Bz_arr(lo.
x+k_E_new-1+k, 0, 0, 0)*sdzk;
1251 amrex::Real sdzk = 0._rt;
1252 for (
int k=dkl_E; k<=depos_order+1-dku_E; k++) {
1253 sdzk += (sz_E_old[k] - sz_E_new[k]);
1254 auto sdzkov =
static_cast<amrex::Real
>((z_new - z_old) == 0. ? 1. : sdzk/(z_new - z_old));
1255 Bxp += Bx_arr(lo.
x+k_E_new-1+k, 0, 0, 0)*sdzkov;
1256 Byp += By_arr(lo.
x+k_E_new-1+k, 0, 0, 0)*sdzkov;
1257 Ezp += Ez_arr(lo.
x+k_E_new-1+k, 0, 0, 0)*sdzkov;
1260#elif defined(WARPX_DIM_RCYLINDER)
1262 const amrex::Real xp_mid = xp_nph;
1263 const amrex::Real yp_mid = yp_nph;
1264 const amrex::Real rp_mid = (rp_new + rp_old)*0.5_rt;
1265 const amrex::Real costheta_mid = (rp_mid > 0. ? xp_mid/rp_mid: 1._rt);
1266 const amrex::Real sintheta_mid = (rp_mid > 0. ? yp_mid/rp_mid: 0.);
1268 amrex::ParticleReal Erp = 0.;
1269 amrex::ParticleReal Ethetap = 0.;
1270 amrex::ParticleReal Brp = 0.;
1271 amrex::ParticleReal Bthetap = 0.;
1273 for (
int i=dil_E; i<=depos_order+2-diu_E; i++) {
1274 amrex::Real
const sdxi = 0.5_rt*(sx_E_old[i] + sx_E_new[i]);
1275 Brp += Bx_arr(lo.
x+i_E_new-1+i, 0, 0, 0)*sdxi;
1276 Ethetap += Ey_arr(lo.
x+i_E_new-1+i, 0, 0, 0)*sdxi;
1277 Ezp += Ez_arr(lo.
x+i_E_new-1+i, 0, 0, 0)*sdxi;
1279 amrex::Real sdxi = 0._rt;
1280 for (
int i=dil_E; i<=depos_order+1-diu_E; i++) {
1281 sdxi += (sx_E_old[i] - sx_E_new[i]);
1282 auto sdxiov =
static_cast<amrex::Real
>((x_new - x_old) == 0. ? 1. : sdxi/(x_new - x_old));
1283 Erp += Ex_arr(lo.
x+i_E_new-1+i, 0, 0, 0)*sdxiov;
1284 Bthetap += By_arr(lo.
x+i_E_new-1+i, 0, 0, 0)*sdxiov;
1285 Bzp += Bz_arr(lo.
x+i_E_new-1+i, 0, 0, 0)*sdxiov;
1289 Exp += costheta_mid*Erp - sintheta_mid*Ethetap;
1290 Eyp += costheta_mid*Ethetap + sintheta_mid*Erp;
1291 Bxp += costheta_mid*Brp - sintheta_mid*Bthetap;
1292 Byp += costheta_mid*Bthetap + sintheta_mid*Brp;
1294#elif defined(WARPX_DIM_RSPHERE)
1296 amrex::Real
const xp_mid = xp_nph;
1297 amrex::Real
const yp_mid = yp_nph;
1298 amrex::Real
const zp_mid = zp_nph;
1299 amrex::Real
const rpxy_mid = std::sqrt(xp_mid*xp_mid + yp_mid*yp_mid);
1300 amrex::Real
const rp_mid = (rp_new + rp_old)*0.5_rt;
1301 amrex::Real
const costheta_mid = (rpxy_mid > 0. ? xp_mid/rpxy_mid : 1._rt);
1302 amrex::Real
const sintheta_mid = (rpxy_mid > 0. ? yp_mid/rpxy_mid : 0._rt);
1303 amrex::Real
const cosphi_mid = (rp_mid > 0. ? rpxy_mid/rp_mid : 1._rt);
1304 amrex::Real
const sinphi_mid = (rp_mid > 0. ? zp_mid/rp_mid : 0._rt);
1306 amrex::ParticleReal Erp = 0.;
1307 amrex::ParticleReal Ethetap = 0.;
1308 amrex::ParticleReal Ephip = 0.;
1309 amrex::ParticleReal Brp = 0.;
1310 amrex::ParticleReal Bthetap = 0.;
1311 amrex::ParticleReal Bphip = 0.;
1313 for (
int i=dil_E; i<=depos_order+2-diu_E; i++) {
1314 amrex::Real
const sdxi = 0.5_rt*(sx_E_old[i] + sx_E_new[i]);
1315 Brp += Bx_arr(lo.
x+i_E_new-1+i, 0, 0, 0)*sdxi;
1316 Ethetap += Ey_arr(lo.
x+i_E_new-1+i, 0, 0, 0)*sdxi;
1317 Ephip += Ez_arr(lo.
x+i_E_new-1+i, 0, 0, 0)*sdxi;
1319 amrex::Real sdxi = 0._rt;
1320 for (
int i=dil_E; i<=depos_order+1-diu_E; i++) {
1321 sdxi += (sx_E_old[i] - sx_E_new[i]);
1322 auto sdxiov =
static_cast<amrex::Real
>((x_new - x_old) == 0. ? 1. : sdxi/(x_new - x_old));
1323 Erp += Ex_arr(lo.
x+i_E_new-1+i, 0, 0, 0)*sdxiov;
1324 Bthetap += By_arr(lo.
x+i_E_new-1+i, 0, 0, 0)*sdxiov;
1325 Bphip += Bz_arr(lo.
x+i_E_new-1+i, 0, 0, 0)*sdxiov;
1329 Exp += costheta_mid*cosphi_mid*Erp - sintheta_mid*Ethetap - costheta_mid*sinphi_mid*Ephip;
1330 Eyp += sintheta_mid*cosphi_mid*Erp + costheta_mid*Ethetap - sintheta_mid*sinphi_mid*Ephip;
1331 Ezp += sinphi_mid*Erp + cosphi_mid*Ephip;
1332 Bxp += costheta_mid*cosphi_mid*Brp - sintheta_mid*Bthetap - costheta_mid*sinphi_mid*Bphip;
1333 Byp += sintheta_mid*cosphi_mid*Brp + costheta_mid*Bthetap - sintheta_mid*sinphi_mid*Bphip;
1334 Bzp += sinphi_mid*Brp + cosphi_mid*Bphip;
1361 [[maybe_unused]]
const amrex::ParticleReal xp_n,
1362 [[maybe_unused]]
const amrex::ParticleReal yp_n,
1363 [[maybe_unused]]
const amrex::ParticleReal zp_n,
1364 [[maybe_unused]]
const amrex::ParticleReal xp_nph,
1365 [[maybe_unused]]
const amrex::ParticleReal yp_nph,
1366 [[maybe_unused]]
const amrex::ParticleReal zp_nph,
1367 amrex::ParticleReal& Exp,
1368 amrex::ParticleReal& Eyp,
1369 amrex::ParticleReal& Ezp,
1370 amrex::ParticleReal& Bxp,
1371 amrex::ParticleReal& Byp,
1372 amrex::ParticleReal& Bzp,
1388 const int n_rz_azimuthal_modes)
1390 using namespace amrex;
1391#if !defined(WARPX_DIM_RZ)
1395#if !defined(WARPX_DIM_1D_Z)
1396 const ParticleReal xp_np1 = 2._prt*xp_nph - xp_n;
1398#if defined(WARPX_DIM_3D) || defined(WARPX_DIM_RZ) || defined(WARPX_DIM_RCYLINDER) || defined(WARPX_DIM_RSPHERE)
1399 const ParticleReal yp_np1 = 2._prt*yp_nph - yp_n;
1401#if !defined(WARPX_DIM_RCYLINDER)
1402 const ParticleReal zp_np1 = 2._prt*zp_nph - zp_n;
1405#if (AMREX_SPACEDIM > 1)
1406 Real
constexpr one_third = 1.0_rt / 3.0_rt;
1407 Real
constexpr one_sixth = 1.0_rt / 6.0_rt;
1411#if defined(WARPX_DIM_RZ) || defined(WARPX_DIM_RCYLINDER)
1412 amrex::Real
const xp_new = xp_np1;
1413 amrex::Real
const yp_new = yp_np1;
1414 amrex::Real
const xp_old = xp_n;
1415 amrex::Real
const yp_old = yp_n;
1416 amrex::Real
const rp_new = std::sqrt(xp_new*xp_new + yp_new*yp_new);
1417 amrex::Real
const rp_old = std::sqrt(xp_old*xp_old + yp_old*yp_old);
1418 amrex::Real
const xp_mid = xp_nph;
1419 amrex::Real
const yp_mid = yp_nph;
1420 amrex::Real
const rp_mid = (rp_new + rp_old)*0.5_rt;
1421 amrex::Real
const costheta_mid = (rp_mid > 0. ? xp_mid/rp_mid: 1._rt);
1422 amrex::Real
const sintheta_mid = (rp_mid > 0. ? yp_mid/rp_mid: 0.);
1423#if defined(WARPX_DIM_RZ)
1428 double const x_new = (rp_new - xyzmin.
x)*dinv.
x;
1429 double const x_old = (rp_old - xyzmin.
x)*dinv.
x;
1430#elif defined(WARPX_DIM_RSPHERE)
1431 amrex::Real
const xp_new = xp_np1;
1432 amrex::Real
const yp_new = yp_np1;
1433 amrex::Real
const zp_new = zp_np1;
1434 amrex::Real
const xp_mid = xp_nph;
1435 amrex::Real
const yp_mid = yp_nph;
1436 amrex::Real
const zp_mid = zp_nph;
1437 amrex::Real
const xp_old = xp_n;
1438 amrex::Real
const yp_old = yp_n;
1439 amrex::Real
const zp_old = zp_n;
1440 amrex::Real
const rpxy_mid = std::sqrt(xp_mid*xp_mid + yp_mid*yp_mid);
1441 amrex::Real
const rp_new = std::sqrt(xp_new*xp_new + yp_new*yp_new + zp_new*zp_new);
1442 amrex::Real
const rp_old = std::sqrt(xp_old*xp_old + yp_old*yp_old + zp_old*zp_old);
1443 amrex::Real
const rp_mid = (rp_new + rp_old)*0.5_rt;
1445 amrex::Real
const costheta_mid = (rpxy_mid > 0. ? xp_mid/rpxy_mid : 1._rt);
1446 amrex::Real
const sintheta_mid = (rpxy_mid > 0. ? yp_mid/rpxy_mid : 0._rt);
1447 amrex::Real
const cosphi_mid = (rp_mid > 0. ? rpxy_mid/rp_mid : 1._rt);
1448 amrex::Real
const sinphi_mid = (rp_mid > 0. ? zp_mid/rp_mid : 0._rt);
1451 double const x_new = (rp_new - xyzmin.
x)*dinv.
x;
1452 double const x_old = (rp_old - xyzmin.
x)*dinv.
x;
1453#elif !defined(WARPX_DIM_1D_Z)
1455 double const x_new = (xp_np1 - xyzmin.
x)*dinv.
x;
1456 double const x_old = (xp_n - xyzmin.
x)*dinv.
x;
1458#if defined(WARPX_DIM_3D)
1460 double const y_new = (yp_np1 - xyzmin.
y)*dinv.
y;
1461 double const y_old = (yp_n - xyzmin.
y)*dinv.
y;
1463#if !defined(WARPX_DIM_RCYLINDER) && !defined(WARPX_DIM_RSPHERE)
1465 double const z_new = (zp_np1 - xyzmin.
z)*dinv.
z;
1466 double const z_old = (zp_n - xyzmin.
z)*dinv.
z;
1476 int num_segments = 1;
1478 if ( (depos_order % 2) == 0 ) {
shift = 0.5; }
1480#if defined(WARPX_DIM_3D)
1483 const auto i_old =
static_cast<int>(x_old-
shift);
1484 const auto i_new =
static_cast<int>(x_new-
shift);
1485 const int cell_crossings_x = std::abs(i_new-i_old);
1486 num_segments += cell_crossings_x;
1489 const auto j_old =
static_cast<int>(y_old-
shift);
1490 const auto j_new =
static_cast<int>(y_new-
shift);
1491 const int cell_crossings_y = std::abs(j_new-j_old);
1492 num_segments += cell_crossings_y;
1495 const auto k_old =
static_cast<int>(z_old-
shift);
1496 const auto k_new =
static_cast<int>(z_new-
shift);
1497 const int cell_crossings_z = std::abs(k_new-k_old);
1498 num_segments += cell_crossings_z;
1506 const double dxp = x_new - x_old;
1507 const double dyp = y_new - y_old;
1508 const double dzp = z_new - z_old;
1509 const auto dirX_sign =
static_cast<double>(dxp < 0. ? -1. : 1.);
1510 const auto dirY_sign =
static_cast<double>(dyp < 0. ? -1. : 1.);
1511 const auto dirZ_sign =
static_cast<double>(dzp < 0. ? -1. : 1.);
1512 double Xcell = 0., Ycell = 0., Zcell = 0.;
1513 if (num_segments > 1) {
1514 Xcell =
static_cast<double>(i_old) +
shift + 0.5*(1.-dirX_sign);
1515 Ycell =
static_cast<double>(j_old) +
shift + 0.5*(1.-dirY_sign);
1516 Zcell =
static_cast<double>(k_old) +
shift + 0.5*(1.-dirZ_sign);
1522 double dxp_seg, dyp_seg, dzp_seg;
1523 double x0_new, y0_new, z0_new;
1524 double x0_old = x_old;
1525 double y0_old = y_old;
1526 double z0_old = z_old;
1528 for (
int ns=0; ns<num_segments; ns++) {
1530 if (ns == num_segments-1) {
1535 dxp_seg = x0_new - x0_old;
1536 dyp_seg = y0_new - y0_old;
1537 dzp_seg = z0_new - z0_old;
1542 x0_new = Xcell + dirX_sign;
1543 y0_new = Ycell + dirY_sign;
1544 z0_new = Zcell + dirZ_sign;
1545 dxp_seg = x0_new - x0_old;
1546 dyp_seg = y0_new - y0_old;
1547 dzp_seg = z0_new - z0_old;
1549 if ( (dyp == 0. || std::abs(dxp_seg) < std::abs(dxp/dyp*dyp_seg))
1550 && (dzp == 0. || std::abs(dxp_seg) < std::abs(dxp/dzp*dzp_seg)) ) {
1552 dyp_seg = dyp/dxp*dxp_seg;
1553 dzp_seg = dzp/dxp*dxp_seg;
1554 y0_new = y0_old + dyp_seg;
1555 z0_new = z0_old + dzp_seg;
1557 else if (dzp == 0. || std::abs(dyp_seg) < std::abs(dyp/dzp*dzp_seg)) {
1559 dxp_seg = dxp/dyp*dyp_seg;
1560 dzp_seg = dzp/dyp*dyp_seg;
1561 x0_new = x0_old + dxp_seg;
1562 z0_new = z0_old + dzp_seg;
1566 dxp_seg = dxp/dzp*dzp_seg;
1567 dyp_seg = dyp/dzp*dzp_seg;
1568 x0_new = x0_old + dxp_seg;
1569 y0_new = y0_old + dyp_seg;
1575 const auto seg_factor_x =
static_cast<double>(dxp == 0. ? 1. : dxp_seg/dxp);
1576 const auto seg_factor_y =
static_cast<double>(dyp == 0. ? 1. : dyp_seg/dyp);
1577 const auto seg_factor_z =
static_cast<double>(dzp == 0. ? 1. : dzp_seg/dzp);
1580 double sx_cell[depos_order] = {0.};
1581 double sy_cell[depos_order] = {0.};
1582 double sz_cell[depos_order] = {0.};
1583 double const x0_bar = (x0_new + x0_old)/2.0;
1584 double const y0_bar = (y0_new + y0_old)/2.0;
1585 double const z0_bar = (z0_new + z0_old)/2.0;
1586 const int i0_cell = compute_shape_factor_cell( sx_cell, x0_bar-0.5 );
1587 const int j0_cell = compute_shape_factor_cell( sy_cell, y0_bar-0.5 );
1588 const int k0_cell = compute_shape_factor_cell( sz_cell, z0_bar-0.5 );
1590 if constexpr (depos_order >= 3) {
1592 double sx_old_cell[depos_order] = {0.};
1593 double sx_new_cell[depos_order] = {0.};
1594 double sy_old_cell[depos_order] = {0.};
1595 double sy_new_cell[depos_order] = {0.};
1596 double sz_old_cell[depos_order] = {0.};
1597 double sz_new_cell[depos_order] = {0.};
1598 const int i0_cell_2 = compute_shape_factors_cell( sx_old_cell, sx_new_cell, x0_old-0.5, x0_new-0.5 );
1599 const int j0_cell_2 = compute_shape_factors_cell( sy_old_cell, sy_new_cell, y0_old-0.5, y0_new-0.5 );
1600 const int k0_cell_2 = compute_shape_factors_cell( sz_old_cell, sz_new_cell, z0_old-0.5, z0_new-0.5 );
1602 for (
int m=0; m<depos_order; m++) {
1603 sx_cell[m] = (4.0*sx_cell[m] + sx_old_cell[m] + sx_new_cell[m])/6.0;
1604 sy_cell[m] = (4.0*sy_cell[m] + sy_old_cell[m] + sy_new_cell[m])/6.0;
1605 sz_cell[m] = (4.0*sz_cell[m] + sz_old_cell[m] + sz_new_cell[m])/6.0;
1610 double sx_old_node[depos_order+1] = {0.};
1611 double sx_new_node[depos_order+1] = {0.};
1612 double sy_old_node[depos_order+1] = {0.};
1613 double sy_new_node[depos_order+1] = {0.};
1614 double sz_old_node[depos_order+1] = {0.};
1615 double sz_new_node[depos_order+1] = {0.};
1616 const int i0_node = compute_shape_factors_node( sx_old_node, sx_new_node, x0_old, x0_new );
1617 const int j0_node = compute_shape_factors_node( sy_old_node, sy_new_node, y0_old, y0_new );
1618 const int k0_node = compute_shape_factors_node( sz_old_node, sz_new_node, z0_old, z0_new );
1622 for (
int i=0; i<=depos_order-1; i++) {
1623 for (
int j=0; j<=depos_order; j++) {
1624 for (
int k=0; k<=depos_order; k++) {
1625 weight = sx_cell[i]*( sy_old_node[j]*sz_old_node[k]*one_third
1626 + sy_old_node[j]*sz_new_node[k]*one_sixth
1627 + sy_new_node[j]*sz_old_node[k]*one_sixth
1628 + sy_new_node[j]*sz_new_node[k]*one_third )*seg_factor_x;
1629 Exp += Ex_arr(lo.
x+i0_cell+i, lo.
y+j0_node+j, lo.
z+k0_node+k)*weight;
1635 for (
int i=0; i<=depos_order; i++) {
1636 for (
int j=0; j<=depos_order-1; j++) {
1637 for (
int k=0; k<=depos_order; k++) {
1638 weight = sy_cell[j]*( sx_old_node[i]*sz_old_node[k]*one_third
1639 + sx_old_node[i]*sz_new_node[k]*one_sixth
1640 + sx_new_node[i]*sz_old_node[k]*one_sixth
1641 + sx_new_node[i]*sz_new_node[k]*one_third )*seg_factor_y;
1642 Eyp += Ey_arr(lo.
x+i0_node+i, lo.
y+j0_cell+j, lo.
z+k0_node+k)*weight;
1648 for (
int i=0; i<=depos_order; i++) {
1649 for (
int j=0; j<=depos_order; j++) {
1650 for (
int k=0; k<=depos_order-1; k++) {
1651 weight = sz_cell[k]*( sx_old_node[i]*sy_old_node[j]*one_third
1652 + sx_old_node[i]*sy_new_node[j]*one_sixth
1653 + sx_new_node[i]*sy_old_node[j]*one_sixth
1654 + sx_new_node[i]*sy_new_node[j]*one_third )*seg_factor_z;
1655 Ezp += Ez_arr(lo.
x+i0_node+i, lo.
y+j0_node+j, lo.
z+k0_cell+k)*weight;
1661 if (ns < num_segments-1) {
1669#elif defined(WARPX_DIM_XZ) || defined(WARPX_DIM_RZ)
1672 const auto i_old =
static_cast<int>(x_old-
shift);
1673 const auto i_new =
static_cast<int>(x_new-
shift);
1674 const int cell_crossings_x = std::abs(i_new-i_old);
1675 num_segments += cell_crossings_x;
1678 const auto k_old =
static_cast<int>(z_old-
shift);
1679 const auto k_new =
static_cast<int>(z_new-
shift);
1680 const int cell_crossings_z = std::abs(k_new-k_old);
1681 num_segments += cell_crossings_z;
1689 const double dxp = x_new - x_old;
1690 const double dzp = z_new - z_old;
1691 const auto dirX_sign =
static_cast<double>(dxp < 0. ? -1. : 1.);
1692 const auto dirZ_sign =
static_cast<double>(dzp < 0. ? -1. : 1.);
1693 double Xcell = 0., Zcell = 0.;
1694 if (num_segments > 1) {
1695 Xcell =
static_cast<double>(i_old) +
shift + 0.5*(1.-dirX_sign);
1696 Zcell =
static_cast<double>(k_old) +
shift + 0.5*(1.-dirZ_sign);
1702 double dxp_seg, dzp_seg;
1703 double x0_new, z0_new;
1704 double x0_old = x_old;
1705 double z0_old = z_old;
1707 for (
int ns=0; ns<num_segments; ns++) {
1709 if (ns == num_segments-1) {
1713 dxp_seg = x0_new - x0_old;
1714 dzp_seg = z0_new - z0_old;
1719 x0_new = Xcell + dirX_sign;
1720 z0_new = Zcell + dirZ_sign;
1721 dxp_seg = x0_new - x0_old;
1722 dzp_seg = z0_new - z0_old;
1724 if (dzp == 0. || std::abs(dxp_seg) < std::abs(dxp/dzp*dzp_seg)) {
1726 dzp_seg = dzp/dxp*dxp_seg;
1727 z0_new = z0_old + dzp_seg;
1731 dxp_seg = dxp/dzp*dzp_seg;
1732 x0_new = x0_old + dxp_seg;
1738 const auto seg_factor_x =
static_cast<double>(dxp == 0. ? 1. : dxp_seg/dxp);
1739 const auto seg_factor_z =
static_cast<double>(dzp == 0. ? 1. : dzp_seg/dzp);
1742 double sx_cell[depos_order] = {0.};
1743 double sz_cell[depos_order] = {0.};
1744 double const x0_bar = (x0_new + x0_old)/2.0;
1745 double const z0_bar = (z0_new + z0_old)/2.0;
1746 const int i0_cell = compute_shape_factor_cell(sx_cell, x0_bar-0.5);
1747 const int k0_cell = compute_shape_factor_cell(sz_cell, z0_bar-0.5);
1749 if constexpr (depos_order >= 3) {
1751 double sx_old_cell[depos_order] = {0.};
1752 double sx_new_cell[depos_order] = {0.};
1753 double sz_old_cell[depos_order] = {0.};
1754 double sz_new_cell[depos_order] = {0.};
1755 const int i0_cell_2 = compute_shape_factors_cell( sx_old_cell, sx_new_cell, x0_old-0.5, x0_new-0.5 );
1756 const int k0_cell_2 = compute_shape_factors_cell( sz_old_cell, sz_new_cell, z0_old-0.5, z0_new-0.5 );
1758 for (
int m=0; m<depos_order; m++) {
1759 sx_cell[m] = (4.0*sx_cell[m] + sx_old_cell[m] + sx_new_cell[m])/6.0;
1760 sz_cell[m] = (4.0*sz_cell[m] + sz_old_cell[m] + sz_new_cell[m])/6.0;
1765 double sx_old_node[depos_order+1] = {0.};
1766 double sx_new_node[depos_order+1] = {0.};
1767 double sz_old_node[depos_order+1] = {0.};
1768 double sz_new_node[depos_order+1] = {0.};
1769 const int i0_node = compute_shape_factors_node( sx_old_node, sx_new_node, x0_old, x0_new );
1770 const int k0_node = compute_shape_factors_node( sz_old_node, sz_new_node, z0_old, z0_new );
1774 for (
int i=0; i<=depos_order-1; i++) {
1775 for (
int k=0; k<=depos_order; k++) {
1776 weight = sx_cell[i]*(sz_old_node[k] + sz_new_node[k])/2.0_rt*seg_factor_x;
1777 Exp += Ex_arr(lo.
x+i0_cell+i, lo.
y+k0_node+k, 0, 0)*weight;
1778#if defined(WARPX_DIM_RZ)
1780 for (
int imode=1 ; imode < n_rz_azimuthal_modes ; imode++) {
1781 const auto dEx = (+ Ex_arr(lo.
x+i0_cell+i, lo.
y+k0_node+k, 0, 2*imode-1)*xy_mid.
real()
1782 - Ex_arr(lo.
x+i0_cell+i, lo.
y+k0_node+k, 0, 2*imode)*xy_mid.
imag());
1784 xy_mid = xy_mid*xy_mid0;
1791 const auto seg_factor_y = std::min(seg_factor_x,seg_factor_z);
1792 for (
int i=0; i<=depos_order; i++) {
1793 for (
int k=0; k<=depos_order; k++) {
1794 weight = ( sx_old_node[i]*sz_old_node[k]*one_third
1795 + sx_old_node[i]*sz_new_node[k]*one_sixth
1796 + sx_new_node[i]*sz_old_node[k]*one_sixth
1797 + sx_new_node[i]*sz_new_node[k]*one_third )*seg_factor_y;
1798 Eyp += Ey_arr(lo.
x+i0_node+i, lo.
y+k0_node+k, 0, 0)*weight;
1799#if defined(WARPX_DIM_RZ)
1801 for (
int imode=1 ; imode < n_rz_azimuthal_modes ; imode++) {
1802 const auto dEy = (+ Ey_arr(lo.
x+i0_node+i, lo.
y+k0_node+k, 0, 2*imode-1)*xy_mid.
real()
1803 - Ey_arr(lo.
x+i0_node+i, lo.
y+k0_node+k, 0, 2*imode)*xy_mid.
imag());
1805 xy_mid = xy_mid*xy_mid0;
1812 for (
int i=0; i<=depos_order; i++) {
1813 for (
int k=0; k<=depos_order-1; k++) {
1814 weight = sz_cell[k]*(sx_old_node[i] + sx_new_node[i])/2.0_rt*seg_factor_z;
1815 Ezp += Ez_arr(lo.
x+i0_node+i, lo.
y+k0_cell+k, 0, 0)*weight;
1816#if defined(WARPX_DIM_RZ)
1818 for (
int imode=1 ; imode < n_rz_azimuthal_modes ; imode++) {
1819 const auto dEz = (+ Ez_arr(lo.
x+i0_node+i, lo.
y+k0_cell+k, 0, 2*imode-1)*xy_mid.
real()
1820 - Ez_arr(lo.
x+i0_node+i, lo.
y+k0_cell+k, 0, 2*imode)*xy_mid.
imag());
1822 xy_mid = xy_mid*xy_mid0;
1829 if (ns < num_segments-1) {
1839 const amrex::Real Erp = Exp;
1840 const amrex::Real Ethp = Eyp;
1841 Exp = costheta_mid*Erp - sintheta_mid*Ethp;
1842 Eyp = costheta_mid*Ethp + sintheta_mid*Erp;
1846#elif defined(WARPX_DIM_1D_Z)
1849 const auto k_old =
static_cast<int>(z_old-
shift);
1850 const auto k_new =
static_cast<int>(z_new-
shift);
1851 const int cell_crossings_z = std::abs(k_new-k_old);
1852 num_segments += cell_crossings_z;
1859 double const dzp = z_new - z_old;
1860 const auto dirZ_sign =
static_cast<double>(dzp < 0. ? -1. : 1.);
1861 double Zcell =
static_cast<double>(k_old) +
shift + 0.5*(1.-dirZ_sign);
1868 double z0_old = z_old;
1870 for (
int ns=0; ns<num_segments; ns++) {
1872 if (ns == num_segments-1) {
1874 dzp_seg = z0_new - z0_old;
1877 Zcell = Zcell + dirZ_sign;
1879 dzp_seg = z0_new - z0_old;
1883 const auto seg_factor =
static_cast<double>(dzp == 0. ? 1. : dzp_seg/dzp);
1886 double sz_cell[depos_order] = {0.};
1887 double const z0_bar = (z0_new + z0_old)/2.0;
1888 const int k0_cell = compute_shape_factor_cell( sz_cell, z0_bar-0.5 );
1890 if constexpr (depos_order >= 3) {
1892 double sz_old_cell[depos_order] = {0.};
1893 double sz_new_cell[depos_order] = {0.};
1894 const int k0_cell_2 = compute_shape_factors_cell( sz_old_cell, sz_new_cell, z0_old-0.5, z0_new-0.5 );
1896 for (
int m=0; m<depos_order; m++) {
1897 sz_cell[m] = (4.0*sz_cell[m] + sz_old_cell[m] + sz_new_cell[m])/6.0;
1902 double sz_old_node[depos_order+1] = {0.};
1903 double sz_new_node[depos_order+1] = {0.};
1904 const int k0_node = compute_shape_factors_node( sz_old_node, sz_new_node, z0_old, z0_new );
1907 for (
int k=0; k<=depos_order; k++) {
1908 auto weight = 0.5_rt*(sz_old_node[k] + sz_new_node[k])*seg_factor;
1909 Exp += Ex_arr(lo.
x+k0_node+k, 0, 0)*weight;
1910 Eyp += Ey_arr(lo.
x+k0_node+k, 0, 0)*weight;
1914 for (
int k=0; k<=depos_order-1; k++) {
1915 auto weight = sz_cell[k]*seg_factor;
1916 Ezp += Ez_arr(lo.
x+k0_cell+k, 0, 0)*weight;
1920 if (ns < num_segments-1) {
1926#elif defined(WARPX_DIM_RCYLINDER) || defined(WARPX_DIM_RSPHERE)
1928 amrex::ParticleReal Erp = 0.;
1929 amrex::ParticleReal Ethetap = 0.;
1931 amrex::ParticleReal E3p = 0.;
1934 const auto i_old =
static_cast<int>(x_old-
shift);
1935 const auto i_new =
static_cast<int>(x_new-
shift);
1936 const int cell_crossings_x = std::abs(i_new-i_old);
1937 num_segments += cell_crossings_x;
1944 double const dxp = x_new - x_old;
1945 const auto dirX_sign =
static_cast<double>(dxp < 0. ? -1. : 1.);
1946 double Xcell =
static_cast<double>(i_old) +
shift + 0.5*(1.-dirX_sign);
1953 double x0_old = x_old;
1955 for (
int ns=0; ns<num_segments; ns++) {
1957 if (ns == num_segments-1) {
1959 dxp_seg = x0_new - x0_old;
1962 Xcell = Xcell + dirX_sign;
1964 dxp_seg = x0_new - x0_old;
1968 const auto seg_factor =
static_cast<double>(dxp == 0. ? 1. : dxp_seg/dxp);
1971 double sx_cell[depos_order] = {0.};
1972 double const x0_bar = (x0_new + x0_old)/2.0;
1973 const int i0_cell = compute_shape_factor_cell( sx_cell, x0_bar-0.5 );
1975 if constexpr (depos_order >= 3) {
1977 double sx_old_cell[depos_order] = {0.};
1978 double sx_new_cell[depos_order] = {0.};
1979 const int i0_cell_2 = compute_shape_factors_cell( sx_old_cell, sx_new_cell, x0_old-0.5, x0_new-0.5 );
1981 for (
int m=0; m<depos_order; m++) {
1982 sx_cell[m] = (4.0*sx_cell[m] + sx_old_cell[m] + sx_new_cell[m])/6.0;
1987 double sx_old_node[depos_order+1] = {0.};
1988 double sx_new_node[depos_order+1] = {0.};
1989 const int i0_node = compute_shape_factors_node( sx_old_node, sx_new_node, x0_old, x0_new );
1992 for (
int i=0; i<=depos_order; i++) {
1993 auto weight = 0.5_rt*(sx_old_node[i] + sx_new_node[i])*seg_factor;
1994 Ethetap += Ey_arr(lo.
x+i0_node+i, 0, 0)*weight;
1995 E3p += Ez_arr(lo.
x+i0_node+i, 0, 0)*weight;
1999 for (
int i=0; i<=depos_order-1; i++) {
2000 auto weight = sx_cell[i]*seg_factor;
2001 Erp += Ex_arr(lo.
x+i0_cell+i, 0, 0)*weight;
2005 if (ns < num_segments-1) {
2011#if defined(WARPX_DIM_RCYLINDER)
2013 Exp += costheta_mid*Erp - sintheta_mid*Ethetap;
2014 Eyp += costheta_mid*Ethetap + sintheta_mid*Erp;
2017#elif defined(WARPX_DIM_RSPHERE)
2020 Exp += costheta_mid*cosphi_mid*Erp - sintheta_mid*Ethetap - costheta_mid*sinphi_mid*E3p;
2021 Eyp += sintheta_mid*cosphi_mid*Erp + costheta_mid*Ethetap - sintheta_mid*sinphi_mid*E3p;
2022 Ezp += sinphi_mid*Erp + cosphi_mid*E3p;
2028 const int depos_order_perp = 1;
2029 const int depos_order_para = 1;
2031 xp_nph, yp_nph, zp_nph,
2033 Bx_arr, By_arr, Bz_arr,
2034 Bx_type, By_type, Bz_type,
2035 dinv, xyzmin, lo, n_rz_azimuthal_modes );
2058 const amrex::ParticleReal yp,
2059 const amrex::ParticleReal zp,
2060 amrex::ParticleReal& Exp,
2061 amrex::ParticleReal& Eyp,
2062 amrex::ParticleReal& Ezp,
2063 amrex::ParticleReal& Bxp,
2064 amrex::ParticleReal& Byp,
2065 amrex::ParticleReal& Bzp,
2081 const int n_rz_azimuthal_modes,
2083 const bool galerkin_interpolation)
2085 if (galerkin_interpolation) {
2087 doGatherShapeN<1,1>(xp, yp, zp, Exp, Eyp, Ezp, Bxp, Byp, Bzp,
2088 ex_arr, ey_arr, ez_arr, bx_arr, by_arr, bz_arr,
2089 ex_type, ey_type, ez_type, bx_type, by_type, bz_type,
2090 dinv, xyzmin, lo, n_rz_azimuthal_modes);
2091 }
else if (nox == 2) {
2092 doGatherShapeN<2,1>(xp, yp, zp, Exp, Eyp, Ezp, Bxp, Byp, Bzp,
2093 ex_arr, ey_arr, ez_arr, bx_arr, by_arr, bz_arr,
2094 ex_type, ey_type, ez_type, bx_type, by_type, bz_type,
2095 dinv, xyzmin, lo, n_rz_azimuthal_modes);
2096 }
else if (nox == 3) {
2097 doGatherShapeN<3,1>(xp, yp, zp, Exp, Eyp, Ezp, Bxp, Byp, Bzp,
2098 ex_arr, ey_arr, ez_arr, bx_arr, by_arr, bz_arr,
2099 ex_type, ey_type, ez_type, bx_type, by_type, bz_type,
2100 dinv, xyzmin, lo, n_rz_azimuthal_modes);
2101 }
else if (nox == 4) {
2102 doGatherShapeN<4,1>(xp, yp, zp, Exp, Eyp, Ezp, Bxp, Byp, Bzp,
2103 ex_arr, ey_arr, ez_arr, bx_arr, by_arr, bz_arr,
2104 ex_type, ey_type, ez_type, bx_type, by_type, bz_type,
2105 dinv, xyzmin, lo, n_rz_azimuthal_modes);
2109 doGatherShapeN<1,0>(xp, yp, zp, Exp, Eyp, Ezp, Bxp, Byp, Bzp,
2110 ex_arr, ey_arr, ez_arr, bx_arr, by_arr, bz_arr,
2111 ex_type, ey_type, ez_type, bx_type, by_type, bz_type,
2112 dinv, xyzmin, lo, n_rz_azimuthal_modes);
2113 }
else if (nox == 2) {
2114 doGatherShapeN<2,0>(xp, yp, zp, Exp, Eyp, Ezp, Bxp, Byp, Bzp,
2115 ex_arr, ey_arr, ez_arr, bx_arr, by_arr, bz_arr,
2116 ex_type, ey_type, ez_type, bx_type, by_type, bz_type,
2117 dinv, xyzmin, lo, n_rz_azimuthal_modes);
2118 }
else if (nox == 3) {
2119 doGatherShapeN<3,0>(xp, yp, zp, Exp, Eyp, Ezp, Bxp, Byp, Bzp,
2120 ex_arr, ey_arr, ez_arr, bx_arr, by_arr, bz_arr,
2121 ex_type, ey_type, ez_type, bx_type, by_type, bz_type,
2122 dinv, xyzmin, lo, n_rz_azimuthal_modes);
2123 }
else if (nox == 4) {
2124 doGatherShapeN<4,0>(xp, yp, zp, Exp, Eyp, Ezp, Bxp, Byp, Bzp,
2125 ex_arr, ey_arr, ez_arr, bx_arr, by_arr, bz_arr,
2126 ex_type, ey_type, ez_type, bx_type, by_type, bz_type,
2127 dinv, xyzmin, lo, n_rz_azimuthal_modes);
2153 const amrex::ParticleReal xp_n,
2154 const amrex::ParticleReal yp_n,
2155 const amrex::ParticleReal zp_n,
2156 const amrex::ParticleReal xp_nph,
2157 const amrex::ParticleReal yp_nph,
2158 const amrex::ParticleReal zp_nph,
2159 amrex::ParticleReal& Exp,
2160 amrex::ParticleReal& Eyp,
2161 amrex::ParticleReal& Ezp,
2162 amrex::ParticleReal& Bxp,
2163 amrex::ParticleReal& Byp,
2164 amrex::ParticleReal& Bzp,
2180 const int n_rz_azimuthal_modes,
2187 Exp, Eyp, Ezp, Bxp, Byp, Bzp,
2188 ex_arr, ey_arr, ez_arr, bx_arr, by_arr, bz_arr,
2189 ex_type, ey_type, ez_type, bx_type, by_type, bz_type,
2190 dinv, xyzmin, lo, n_rz_azimuthal_modes);
2191 }
else if (nox == 2) {
2193 Exp, Eyp, Ezp, Bxp, Byp, Bzp,
2194 ex_arr, ey_arr, ez_arr, bx_arr, by_arr, bz_arr,
2195 ex_type, ey_type, ez_type, bx_type, by_type, bz_type,
2196 dinv, xyzmin, lo, n_rz_azimuthal_modes);
2197 }
else if (nox == 3) {
2199 Exp, Eyp, Ezp, Bxp, Byp, Bzp,
2200 ex_arr, ey_arr, ez_arr, bx_arr, by_arr, bz_arr,
2201 ex_type, ey_type, ez_type, bx_type, by_type, bz_type,
2202 dinv, xyzmin, lo, n_rz_azimuthal_modes);
2203 }
else if (nox == 4) {
2205 Exp, Eyp, Ezp, Bxp, Byp, Bzp,
2206 ex_arr, ey_arr, ez_arr, bx_arr, by_arr, bz_arr,
2207 ex_type, ey_type, ez_type, bx_type, by_type, bz_type,
2208 dinv, xyzmin, lo, n_rz_azimuthal_modes);
2214 Exp, Eyp, Ezp, Bxp, Byp, Bzp,
2215 ex_arr, ey_arr, ez_arr, bx_arr, by_arr, bz_arr,
2216 ex_type, ey_type, ez_type, bx_type, by_type, bz_type,
2217 dinv, xyzmin, lo, n_rz_azimuthal_modes);
2218 }
else if (nox == 2) {
2220 Exp, Eyp, Ezp, Bxp, Byp, Bzp,
2221 ex_arr, ey_arr, ez_arr, bx_arr, by_arr, bz_arr,
2222 ex_type, ey_type, ez_type, bx_type, by_type, bz_type,
2223 dinv, xyzmin, lo, n_rz_azimuthal_modes);
2224 }
else if (nox == 3) {
2226 Exp, Eyp, Ezp, Bxp, Byp, Bzp,
2227 ex_arr, ey_arr, ez_arr, bx_arr, by_arr, bz_arr,
2228 ex_type, ey_type, ez_type, bx_type, by_type, bz_type,
2229 dinv, xyzmin, lo, n_rz_azimuthal_modes);
2230 }
else if (nox == 4) {
2232 Exp, Eyp, Ezp, Bxp, Byp, Bzp,
2233 ex_arr, ey_arr, ez_arr, bx_arr, by_arr, bz_arr,
2234 ex_type, ey_type, ez_type, bx_type, by_type, bz_type,
2235 dinv, xyzmin, lo, n_rz_azimuthal_modes);
2240 doGatherShapeN<1,0>(xp_nph, yp_nph, zp_nph, Exp, Eyp, Ezp, Bxp, Byp, Bzp,
2241 ex_arr, ey_arr, ez_arr, bx_arr, by_arr, bz_arr,
2242 ex_type, ey_type, ez_type, bx_type, by_type, bz_type,
2243 dinv, xyzmin, lo, n_rz_azimuthal_modes);
2244 }
else if (nox == 2) {
2245 doGatherShapeN<2,0>(xp_nph, yp_nph, zp_nph, Exp, Eyp, Ezp, Bxp, Byp, Bzp,
2246 ex_arr, ey_arr, ez_arr, bx_arr, by_arr, bz_arr,
2247 ex_type, ey_type, ez_type, bx_type, by_type, bz_type,
2248 dinv, xyzmin, lo, n_rz_azimuthal_modes);
2249 }
else if (nox == 3) {
2250 doGatherShapeN<3,0>(xp_nph, yp_nph, zp_nph, Exp, Eyp, Ezp, Bxp, Byp, Bzp,
2251 ex_arr, ey_arr, ez_arr, bx_arr, by_arr, bz_arr,
2252 ex_type, ey_type, ez_type, bx_type, by_type, bz_type,
2253 dinv, xyzmin, lo, n_rz_azimuthal_modes);
2254 }
else if (nox == 4) {
2255 doGatherShapeN<4,0>(xp_nph, yp_nph, zp_nph, Exp, Eyp, Ezp, Bxp, Byp, Bzp,
2256 ex_arr, ey_arr, ez_arr, bx_arr, by_arr, bz_arr,
2257 ex_type, ey_type, ez_type, bx_type, by_type, bz_type,
2258 dinv, xyzmin, lo, n_rz_azimuthal_modes);