18 int i_pz,
int i_time,
int i_q,
size_t step_7,
19 size_t step_6,
size_t step_5,
size_t step_4,
20 size_t step_3,
size_t step_2,
size_t step_1) {
21 return (
size_t)(i_rho) * step_7
22 + (
size_t)(i_theta) * step_6
23 + (
size_t)(i_phi) * step_5
24 + (
size_t)(i_pr) * step_4
25 + (
size_t)(i_pphi) * step_3
26 + (
size_t)(i_pz) * step_2
27 + (
size_t)(i_time) * step_1
35 offload_data->
n_rho = 0;
41 offload_data->
n_phi = 0;
44 offload_data->
n_pr = 0;
50 offload_data->
n_pz = 0;
60 real* offload_array) {
73 dist_data->
n_pr = offload_data->
n_pr;
81 dist_data->
n_pz = offload_data->
n_pz;
89 dist_data->
n_q = offload_data->
n_q;
93 size_t n_q = (size_t)(dist_data->
n_q);
94 size_t n_time = (size_t)(dist_data->
n_time);
95 size_t n_pz = (size_t)(dist_data->
n_pz);
96 size_t n_pphi = (size_t)(dist_data->
n_pphi);
97 size_t n_pr = (size_t)(dist_data->
n_pr);
98 size_t n_phi = (size_t)(dist_data->
n_phi);
99 size_t n_theta = (size_t)(dist_data->
n_theta);
100 dist_data->
step_7 = n_q * n_time * n_pz * n_pphi * n_pr * n_phi * n_theta;
101 dist_data->
step_6 = n_q * n_time * n_pz * n_pphi * n_pr * n_phi;
102 dist_data->
step_5 = n_q * n_time * n_pz * n_pphi * n_pr;
103 dist_data->
step_4 = n_q * n_time * n_pz * n_pphi;
104 dist_data->
step_3 = n_q * n_time * n_pz;
105 dist_data->
step_2 = n_q * n_time;
108 dist_data->
histogram = &offload_array[0];
125 GPU_PARALLEL_LOOP_ALL_LEVELS
126 for(
int i = 0; i < p_f->
n_mrk; i++) {
129 int i_rho = floor((p_f->
rho[i] - dist->
min_rho)
136 int i_phi = floor((phi - dist->
min_phi)
143 int i_theta = floor((theta - dist->
min_theta)
147 int i_pr = floor((p_f->
p_r[i] - dist->
min_pr)
154 int i_pz = floor((p_f->
p_z[i] - dist->
min_pz)
163 if(i_rho >= 0 && i_rho <= dist->n_rho - 1 &&
164 i_theta >=0 && i_theta <= dist->n_theta -1 &&
165 i_phi >=0 && i_phi <= dist->n_phi - 1 &&
166 i_pr >= 0 && i_pr <= dist->n_pr - 1 &&
167 i_pphi >= 0 && i_pphi <= dist->n_pphi - 1 &&
168 i_pz >= 0 && i_pz <= dist->n_pz - 1 &&
169 i_time >= 0 && i_time <= dist->n_time - 1 &&
170 i_q >= 0 && i_q <= dist->n_q - 1 ) {
173 i_rho, i_theta, i_phi, i_pr, i_pphi, i_pz,
213 for(
int i = 0; i <
NSIMD; i++) {
214 if(p_f->running[i]) {
217 real B_dB[12] = {p_f->B_r[i],
230 p_f->phi[i], p_f->ppar[i],
231 p_f->mu[i], p_f->zeta[i],
234 i_rho[i] = floor((p_f->rho[i] - dist->
min_rho)
241 i_phi[i] = floor((phi[i] - dist->
min_phi)
248 i_theta[i] = floor((theta[i] - dist->
min_theta)
252 i_pr[i] = floor((pr - dist->
min_pr)
255 i_pphi[i] = floor((pphi - dist->
min_pphi)
259 i_pz[i] = floor((pz - dist->
min_pz)
262 i_time[i] = floor((p_f->time[i] - dist->
min_time)
268 if(i_rho[i] >= 0 && i_rho[i] <= dist->
n_rho - 1 &&
269 i_theta[i] >= 0 && i_theta[i] <= dist->
n_theta -1 &&
270 i_phi[i] >= 0 && i_phi[i] <= dist->
n_phi - 1 &&
271 i_pr[i] >= 0 && i_pr[i] <= dist->
n_pr - 1 &&
272 i_pphi[i] >= 0 && i_pphi[i] <= dist->
n_pphi - 1 &&
273 i_pz[i] >= 0 && i_pz[i] <= dist->
n_pz - 1 &&
274 i_time[i] >= 0 && i_time[i] <= dist->
n_time - 1 &&
275 i_q[i] >= 0 && i_q[i] <= dist->
n_q - 1 ) {
277 weight[i] = p_f->weight[i] * (p_f->time[i] - p_i->time[i]);
285 for(
int i = 0; i <
NSIMD; i++) {
286 if(p_f->running[i] && ok[i]) {
288 i_rho[i], i_theta[i], i_phi[i], i_pr[i], i_pphi[i], i_pz[i],
Main header file for ASCOT5.
#define NSIMD
Number of particles simulated simultaneously in a particle group operations.
Header file containing physical and mathematical constants.
#define CONST_E
Elementary charge [C]
void dist_rho6D_update_gc(dist_rho6D_data *dist, particle_simd_gc *p_f, particle_simd_gc *p_i)
Update the histogram from guiding-center particles.
size_t dist_rho6D_index(int i_rho, int i_theta, int i_phi, 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.
void dist_rho6D_free_offload(dist_rho6D_offload_data *offload_data)
Frees the offload data.
void dist_rho6D_init(dist_rho6D_data *dist_data, dist_rho6D_offload_data *offload_data, real *offload_array)
Initializes distribution from offload data.
void dist_rho6D_update_fo(dist_rho6D_data *dist, particle_simd_fo *p_f, particle_simd_fo *p_i)
Update the histogram from full-orbit particles.
Header file for dist_rho6D.c.
real fmod(real x, real y)
Compute the modulus of two real numbers.
Methods to evaluate elementary physical quantities.
Histogram parameters on target.
Histogram parameters that will be offloaded to target.
Struct representing NSIMD particle markers.
Struct representing NSIMD guiding center markers.