13#include "../offload.h"
21 real* binmin,
real* binmax,
size_t* nbin) {
40 for(
int i = HIST_ALLDIM-1; i >= 0; i--) {
44 for(
int k = 0; k < dimensions; k++) {
45 if(coordinates[k] == data->
axes[i].
name) {
48 data->
axes[i].
n = nbin[k];
49 data->
nbin *= nbin[k];
52 if(i < HIST_ALLDIM-1) {
54 if( i < HIST_ALLDIM-2) {
76 data->
axes[0:data->dimensions], data->
bins[0:data->ns],
92 GPU_PARALLEL_LOOP_ALL_LEVELS
93 for(
int i = 0; i < p_f->
n_mrk; i++) {
104 + p_f->
p_z[i] * p_f->
B_z[i])
105 / sqrt( p_f->
B_r[i] * p_f->
B_r[i]
107 + p_f->
B_z[i] * p_f->
B_z[i]);
112 + p_f->
p_z[i] * p_f->
p_z[i]
115 axis = &hist->
axes[15];
119 axis = &hist->
axes[14];
123 axis = &hist->
axes[13];
124 size_t nptor = axis->
n;
127 axis = &hist->
axes[12];
128 size_t nmu = axis->
n;
131 axis = &hist->
axes[11];
132 size_t nxi = axis->
n;
135 axis = &hist->
axes[10];
136 size_t nekin = axis->
n;
139 axis = &hist->
axes[9];
142 axis = &hist->
axes[8];
146 axis = &hist->
axes[7];
149 axis = &hist->
axes[6];
152 axis = &hist->
axes[5];
155 axis = &hist->
axes[4];
158 axis = &hist->
axes[3];
161 axis = &hist->
axes[2];
164 axis = &hist->
axes[1];
167 axis = &hist->
axes[0];
172 index = i0*n[0] + i1*n[1] + i2*n[2] + i3*n[3] + i4*n[4]
173 + i5*n[5] + i6*n[6] + i7*n[7] + i8*n[8] + i9*n[9]
174 + i10*n[10] + i11*n[11] + i12*n[12] + i13*n[13] + i14*n[14]
181 index[i] = i0*n[0] + i1*n[1] + i2*n[2] + i3*n[3] + i4*n[4]
182 + i5*n[5] + i6*n[6] + i7*n[7] + i8*n[8] + i9*n[9]
183 + i10*n[10] + i11*n[11] + i12*n[12] + i13*n[13] + i14*n[14]
185 weight[i] = p_f->
weight[i];
189 for(
int i = 0; i < p_f->
n_mrk; i++) {
190 if(p_f->
running[i] && index[i] >= 0 && index[i] < hist->
nbin) {
192 hist->
bins[index[i]] += weight[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.
void hist_update_fo(histogram *hist, particle_simd_fo *p_f, particle_simd_fo *p_i)
Update the histogram in the particle picture.
void hist_offload(histogram *data)
Offload the data to the accelerator.
int hist_init(histogram *data, int dimensions, hist_coordinate *coordinates, real *binmin, real *binmax, size_t *nbin)
Initialize the histogram object.
void hist_free(histogram *data)
Free allocated resources.
void hist_update_gc(histogram *hist, particle_simd_gc *p_f, particle_simd_gc *p_i)
Update the histogram in the GC picture.
hist_coordinate
Quantities that can be used as histogram axis coordinates.
real fmod(real x, real y)
Compute the modulus of two real numbers.
#define math_bin_index(x, nx, xmin, xmax)
Find the bin index on a uniform grid.
Header file for particle.c.
Coordinate axis for the histogram.
hist_axis axes[HIST_ALLDIM]
size_t strides[HIST_ALLDIM-1]
Struct representing NSIMD particle markers.
Struct representing NSIMD guiding center markers.