62 real* offload_array) {
87 dist_data->
n_q = offload_data->
n_q;
91 size_t n_q = (size_t)(dist_data->
n_q);
92 size_t n_time = (size_t)(dist_data->
n_time);
93 size_t n_pperp = (size_t)(dist_data->
n_pperp);
94 size_t n_ppara = (size_t)(dist_data->
n_ppara);
95 size_t n_phi = (size_t)(dist_data->
n_phi);
96 size_t n_theta = (size_t)(dist_data->
n_theta);
97 dist_data->
step_6 = n_q * n_time * n_pperp * n_ppara * n_phi * n_theta;
98 dist_data->
step_5 = n_q * n_time * n_pperp * n_ppara * n_phi;
99 dist_data->
step_4 = n_q * n_time * n_pperp * n_ppara;
100 dist_data->
step_3 = n_q * n_time * n_pperp;
101 dist_data->
step_2 = n_q * n_time;
104 dist_data->
histogram = &offload_array[0];
121 GPU_PARALLEL_LOOP_ALL_LEVELS
122 for(
int i = 0; i < p_f->
n_mrk; i++) {
125 int i_rho = floor((p_f->
rho[i] - dist->
min_rho)
132 int i_phi = floor((phi - dist->
min_phi)
139 int i_theta = floor((theta - dist->
min_theta)
145 + p_f->
p_z[i] * p_f->
B_z[i])
146 / sqrt( p_f->
B_r[i] * p_f->
B_r[i]
148 + p_f->
B_z[i] * p_f->
B_z[i]);
149 int i_ppara = floor((ppara - dist->
min_ppara)
156 + p_f->
p_z[i] * p_f->
p_z[i]
158 int i_pperp = floor((pperp - dist->
min_pperp)
168 if(i_rho >= 0 && i_rho <= dist->n_rho - 1 &&
169 i_phi >= 0 && i_phi <= dist->n_phi - 1 &&
170 i_theta >= 0 && i_theta <= dist->n_theta - 1 &&
171 i_ppara >= 0 && i_ppara <= dist->n_ppara - 1 &&
172 i_pperp >= 0 && i_pperp <= dist->n_pperp - 1 &&
173 i_time >= 0 && i_time <= dist->n_time - 1 &&
174 i_q >= 0 && i_q <= dist->n_q - 1 ) {
177 i_rho, i_theta, i_phi, i_ppara, i_pperp,
216 for(
int i = 0; i <
NSIMD; i++) {
217 if(p_f->running[i]) {
219 i_rho[i] = floor((p_f->rho[i] - dist->
min_rho)
226 i_phi[i] = floor((phi[i] - dist->
min_phi)
233 i_theta[i] = floor((theta[i] - dist->
min_theta)
237 i_ppara[i] = floor((p_f->ppar[i] - dist->
min_ppara)
240 pperp[i] = sqrt(2 * sqrt( p_f->B_r[i] * p_f->B_r[i]
241 + p_f->B_phi[i] * p_f->B_phi[i]
242 + p_f->B_z[i] * p_f->B_z[i] )
243 * p_f->mu[i] * p_f->mass[i]);
244 i_pperp[i] = floor((pperp[i] - dist->
min_pperp)
248 i_time[i] = floor((p_f->time[i] - dist->
min_time)
254 if(i_rho[i] >= 0 && i_rho[i] <= dist->
n_rho - 1 &&
255 i_phi[i] >= 0 && i_phi[i] <= dist->
n_phi - 1 &&
256 i_theta[i] >= 0 && i_theta[i] <= dist->
n_theta - 1 &&
257 i_ppara[i] >= 0 && i_ppara[i] <= dist->
n_ppara - 1 &&
258 i_pperp[i] >= 0 && i_pperp[i] <= dist->
n_pperp - 1 &&
259 i_time[i] >= 0 && i_time[i] <= dist->
n_time - 1 &&
260 i_q[i] >= 0 && i_q[i] <= dist->
n_q - 1 ) {
262 weight[i] = p_f->weight[i] * (p_f->time[i] - p_i->time[i]);
270 for(
int i = 0; i <
NSIMD; i++) {
271 if(p_f->running[i] && ok[i]) {
273 i_rho[i], i_theta[i], i_phi[i], i_ppara[i], i_pperp[i],
void dist_rho5D_update_gc(dist_rho5D_data *dist, particle_simd_gc *p_f, particle_simd_gc *p_i)
Update the histogram from guiding center markers.
void dist_rho5D_init(dist_rho5D_data *dist_data, dist_rho5D_offload_data *offload_data, real *offload_array)
Initializes distribution from offload data.
size_t dist_rho5D_index(int i_rho, int i_theta, int i_phi, int i_ppara, int i_pperp, int i_time, int i_q, 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.
void dist_rho5D_update_fo(dist_rho5D_data *dist, particle_simd_fo *p_f, particle_simd_fo *p_i)
Update the histogram from full-orbit particles.
Header file for particle.c.
Struct representing NSIMD particle markers.
Struct representing NSIMD guiding center markers.