119 int mpi_rank,
int mpi_size,
int mpi_root) {
121 const int n_real = 32;
127 if(mpi_rank == mpi_root) {
131 for(
int j = 0; j < n; j++) {
135 for(
int i = 1; i < mpi_size; i++) {
139 realdata = malloc(n_real * n *
sizeof(realdata));
141 intdata = malloc(n_int * n *
sizeof(intdata));
143 errdata = malloc(n_err * n *
sizeof(intdata));
146 MPI_COMM_WORLD, MPI_STATUS_IGNORE);
148 MPI_COMM_WORLD, MPI_STATUS_IGNORE);
150 MPI_COMM_WORLD, MPI_STATUS_IGNORE);
152 for(
int j = 0; j < n; j++) {
153 ps_all[start_index+j].
r = realdata[0*n+j];
154 ps_all[start_index+j].
phi = realdata[1*n+j];
155 ps_all[start_index+j].
z = realdata[2*n+j];
156 ps_all[start_index+j].
ppar = realdata[3*n+j];
157 ps_all[start_index+j].
mu = realdata[4*n+j];
158 ps_all[start_index+j].
zeta = realdata[5*n+j];
159 ps_all[start_index+j].
rprt = realdata[6*n+j];
160 ps_all[start_index+j].
phiprt = realdata[7*n+j];
161 ps_all[start_index+j].
zprt = realdata[8*n+j];
162 ps_all[start_index+j].
p_r = realdata[9*n+j];
163 ps_all[start_index+j].
p_phi = realdata[10*n+j];
164 ps_all[start_index+j].
p_z = realdata[11*n+j];
165 ps_all[start_index+j].
mass = realdata[12*n+j];
166 ps_all[start_index+j].
charge = realdata[13*n+j];
167 ps_all[start_index+j].
anum = intdata[0*n+j];
168 ps_all[start_index+j].
znum = intdata[1*n+j];
169 ps_all[start_index+j].
weight = realdata[14*n+j];
170 ps_all[start_index+j].
time = realdata[15*n+j];
171 ps_all[start_index+j].
cputime = realdata[16*n+j];
172 ps_all[start_index+j].
rho = realdata[17*n+j];
173 ps_all[start_index+j].
theta = realdata[18*n+j];
174 ps_all[start_index+j].
id = intdata[2*n+j];
175 ps_all[start_index+j].
endcond = intdata[3*n+j];
176 ps_all[start_index+j].
walltile = intdata[4*n+j];
177 ps_all[start_index+j].
B_r = realdata[19*n+j];
178 ps_all[start_index+j].
B_phi = realdata[20*n+j];
179 ps_all[start_index+j].
B_z = realdata[21*n+j];
180 ps_all[start_index+j].
B_r_dr = realdata[22*n+j];
181 ps_all[start_index+j].
B_phi_dr = realdata[23*n+j];
182 ps_all[start_index+j].
B_z_dr = realdata[24*n+j];
183 ps_all[start_index+j].
B_r_dphi = realdata[25*n+j];
184 ps_all[start_index+j].
B_phi_dphi = realdata[26*n+j];
185 ps_all[start_index+j].
B_z_dphi = realdata[27*n+j];
186 ps_all[start_index+j].
B_r_dz = realdata[28*n+j];
187 ps_all[start_index+j].
B_phi_dz = realdata[29*n+j];
188 ps_all[start_index+j].
B_z_dz = realdata[30*n+j];
189 ps_all[start_index+j].
mileage = realdata[31*n+j];
190 ps_all[start_index+j].
err = errdata[j];
204 realdata = malloc(n_real * n *
sizeof(realdata));
206 intdata = malloc(n_int * n *
sizeof(intdata));
208 errdata = malloc(n_err * n *
sizeof(intdata));
210 for(
int j = 0; j < n; j++) {
211 realdata[0*n+j] = ps[j].
r;
212 realdata[1*n+j] = ps[j].
phi;
213 realdata[2*n+j] = ps[j].
z;
214 realdata[3*n+j] = ps[j].
ppar;
215 realdata[4*n+j] = ps[j].
mu;
216 realdata[5*n+j] = ps[j].
zeta;
217 realdata[6*n+j] = ps[j].
rprt;
218 realdata[7*n+j] = ps[j].
phiprt;
219 realdata[8*n+j] = ps[j].
zprt;
220 realdata[9*n+j] = ps[j].
p_r;
221 realdata[10*n+j] = ps[j].
p_phi;
222 realdata[11*n+j] = ps[j].
p_z;
223 realdata[12*n+j] = ps[j].
mass;
224 realdata[13*n+j] = ps[j].
charge;
225 intdata[0*n+j] = ps[j].
anum;
226 intdata[1*n+j] = ps[j].
znum;
227 realdata[14*n+j] = ps[j].
weight;
228 realdata[15*n+j] = ps[j].
time;
229 realdata[16*n+j] = ps[j].
cputime;
230 realdata[17*n+j] = ps[j].
rho;
231 realdata[18*n+j] = ps[j].
theta;
232 intdata[2*n+j] = ps[j].
id;
233 intdata[3*n+j] = ps[j].
endcond;
235 realdata[19*n+j] = ps[j].
B_r;
236 realdata[20*n+j] = ps[j].
B_phi;
237 realdata[21*n+j] = ps[j].
B_z;
238 realdata[22*n+j] = ps[j].
B_r_dr;
240 realdata[24*n+j] = ps[j].
B_z_dr;
244 realdata[28*n+j] = ps[j].
B_r_dz;
246 realdata[30*n+j] = ps[j].
B_z_dz;
247 realdata[31*n+j] = ps[j].
mileage;
248 errdata[j] = ps[j].
err;
251 MPI_Send(realdata, n_real*n,
mpi_type_real, 0, 0, MPI_COMM_WORLD);
271 for(
int j = 0; j < n; j++) {
296 int mpi_rank,
int mpi_size,
int mpi_root) {
301 if(mpi_rank == mpi_root) {
302 MPI_Reduce(MPI_IN_PLACE, offload_array,
306 MPI_Reduce(offload_array, offload_array,
313 if(mpi_rank == mpi_root) {
314 for(
int i = 1; i < mpi_size; i++) {
323 MPI_COMM_WORLD, MPI_STATUS_IGNORE);
343 if(mpi_rank == mpi_root) {
344 for(
int i = 1; i < mpi_size; i++) {
348 for(
int j = 0; j < nfield; j++) {
353 MPI_COMM_WORLD, MPI_STATUS_IGNORE);
361 for(
int j = 0; j < nfield; j++) {
void mpi_gather_diag(diag_offload_data *data, real *offload_array, int ntotal, int mpi_rank, int mpi_size, int mpi_root)
Gather all diagnostics to the root process.
void mpi_gather_particlestate(particle_state *ps, particle_state **ps_gather, int *n_gather, int n_tot, int mpi_rank, int mpi_size, int mpi_root)
Gather all particle states to the root process.
Header file for particle.c.
General representation of a marker.