Readded density reduction by interaction for test
This commit is contained in:
@@ -195,7 +195,9 @@ void Simulation::sync_populations() { // Sync new densities for each species and
|
||||
Population_Manager *populations = looper.get_populations();
|
||||
Population_Container *container;
|
||||
double *global_delta_cumulated_time_s;
|
||||
double *global_delta_offset;
|
||||
double *local_delta_cumulated_time_s;
|
||||
double *local_delta_offset;
|
||||
int array_length;
|
||||
for (int i = 0; i<number_pop_species; i++) {
|
||||
container = populations->find(pop_species[i])->access_container();
|
||||
@@ -204,20 +206,28 @@ void Simulation::sync_populations() { // Sync new densities for each species and
|
||||
continue;
|
||||
}
|
||||
global_delta_cumulated_time_s = new double[array_length];
|
||||
global_delta_offset = new double[array_length];
|
||||
local_delta_cumulated_time_s = new double[array_length];
|
||||
local_delta_offset = new double[array_length];
|
||||
|
||||
for (int j = 0; j<array_length; j++) {
|
||||
local_delta_cumulated_time_s[j] = container->cum_times_s[j] - global_cum_time_s[i][j];
|
||||
local_delta_offset[j] = container->offsets[j] - global_offset[i][j];
|
||||
}
|
||||
|
||||
MPI_Allreduce(local_delta_cumulated_time_s, global_delta_cumulated_time_s, array_length, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
|
||||
MPI_Allreduce(local_delta_offset, global_delta_offset, array_length, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
|
||||
|
||||
for (int j = 0; j<array_length; j++) {
|
||||
global_cum_time_s[i][j] += global_delta_cumulated_time_s[j];
|
||||
global_offset[i][j] += global_delta_offset[j];
|
||||
container->cum_times_s[j] = global_cum_time_s[i][j];
|
||||
container->offsets[j] = global_offset[i][j];
|
||||
}
|
||||
delete[] global_delta_cumulated_time_s;
|
||||
delete[] global_delta_offset;
|
||||
delete[] local_delta_cumulated_time_s;
|
||||
delete[] local_delta_offset;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user