59 real* offload_array) {
60 dist_data->
n_r = offload_data->
n_r;
68 dist_data->
n_z = offload_data->
n_z;
72 dist_data->
n_pr = offload_data->
n_pr;
80 dist_data->
n_pz = offload_data->
n_pz;
88 dist_data->
n_q = offload_data->
n_q;
92 size_t n_q = (size_t)(dist_data->
n_q);
93 size_t n_time = (size_t)(dist_data->
n_time);
94 size_t n_pz = (size_t)(dist_data->
n_pz);
95 size_t n_pphi = (size_t)(dist_data->
n_pphi);
96 size_t n_pr = (size_t)(dist_data->
n_pr);
97 size_t n_z = (size_t)(dist_data->
n_z);
98 size_t n_phi = (size_t)(dist_data->
n_phi);
99 dist_data->
step_7 = n_q * n_time * n_pz * n_pphi * n_pr * n_z * n_phi;
100 dist_data->
step_6 = n_q * n_time * n_pz * n_pphi * n_pr * n_z;
101 dist_data->
step_5 = n_q * n_time * n_pz * n_pphi * n_pr;
102 dist_data->
step_4 = n_q * n_time * n_pz * n_pphi;
103 dist_data->
step_3 = n_q * n_time * n_pz;
104 dist_data->
step_2 = n_q * n_time;
107 dist_data->
histogram = &offload_array[0];
124 GPU_PARALLEL_LOOP_ALL_LEVELS
125 for(
int i = 0; i < p_f->
n_mrk; i++) {
128 int i_r = floor((p_f->
r[i] - dist->
min_r)
135 int i_phi = floor((phi - dist->
min_phi)
138 int i_z = floor((p_f->
z[i] - dist->
min_z)
141 int i_pr = floor((p_f->
p_r[i] - dist->
min_pr)
147 int i_pz = floor((p_f->
p_z[i] - dist->
min_pz)
156 if(i_r >= 0 && i_r <= dist->n_r - 1 &&
157 i_phi >= 0 && i_phi <= dist->n_phi - 1 &&
158 i_z >= 0 && i_z <= dist->n_z - 1 &&
159 i_pr >= 0 && i_pr <= dist->n_pr - 1 &&
160 i_pphi >= 0 && i_pphi <= dist->n_pphi - 1 &&
161 i_pz >= 0 && i_pz <= dist->n_pz - 1 &&
162 i_time >= 0 && i_time <= dist->n_time - 1 &&
163 i_q >= 0 && i_q <= dist->n_q - 1 ) {
166 i_r, i_phi, i_z, i_pr, i_pphi, i_pz,
204 for(
int i = 0; i <
NSIMD; i++) {
205 if(p_f->running[i]) {
209 p_f->B_r[i], p_f->B_r_dr[i], p_f->B_r_dphi[i], p_f->B_r_dz[i],
210 p_f->B_phi[i], p_f->B_phi_dr[i], p_f->B_phi_dphi[i],
212 p_f->B_z[i], p_f->B_z_dr[i], p_f->B_z_dphi[i], p_f->B_z_dz[i]};
214 p_f->phi[i], p_f->ppar[i],
215 p_f->mu[i], p_f->zeta[i],
218 i_r[i] = floor((p_f->r[i] - dist->
min_r)
225 i_phi[i] = floor((phi[i] - dist->
min_phi)
228 i_z[i] = floor((p_f->z[i] - dist->
min_z)
231 i_pr[i] = floor((pr - dist->
min_pr)
234 i_pphi[i] = floor((pphi - dist->
min_pphi)
237 i_pz[i] = floor((pz - dist->
min_pz)
240 i_time[i] = floor((p_f->time[i] - dist->
min_time)
246 if(i_r[i] >= 0 && i_r[i] <= dist->
n_r - 1 &&
247 i_phi[i] >= 0 && i_phi[i] <= dist->
n_phi - 1 &&
248 i_z[i] >= 0 && i_z[i] <= dist->
n_z - 1 &&
249 i_pr[i] >= 0 && i_pr[i] <= dist->
n_pr - 1 &&
250 i_pphi[i] >= 0 && i_pphi[i] <= dist->
n_pphi - 1 &&
251 i_pz[i] >= 0 && i_pz[i] <= dist->
n_pz - 1 &&
252 i_time[i] >= 0 && i_time[i] <= dist->
n_time - 1 &&
253 i_q[i] >= 0 && i_q[i] <= dist->
n_q - 1 ) {
255 weight[i] = p_f->weight[i] * (p_f->time[i] - p_i->time[i]);
263 for(
int i = 0; i <
NSIMD; i++) {
264 if(p_f->running[i] && ok[i]) {
266 i_r[i], i_phi[i], i_z[i], i_pr[i], i_pphi[i], i_pz[i],
void dist_6D_update_fo(dist_6D_data *dist, particle_simd_fo *p_f, particle_simd_fo *p_i)
Update the histogram from full-orbit particles.
void dist_6D_init(dist_6D_data *dist_data, dist_6D_offload_data *offload_data, real *offload_array)
Initializes distribution from offload data.
void dist_6D_update_gc(dist_6D_data *dist, particle_simd_gc *p_f, particle_simd_gc *p_i)
Update the histogram from guiding-center particles.
size_t dist_6D_index(int i_r, int i_phi, int i_z, int i_pr, int i_pphi, int i_pz, int i_time, int i_q, size_t step_7, size_t step_6, size_t step_5, size_t step_4, size_t step_3, size_t step_2, size_t step_1)
Internal function calculating the index in the histogram array.
Struct representing NSIMD particle markers.
Struct representing NSIMD guiding center markers.