Changed Population Container -> more precice calculation of time in cells.
This commit is contained in:
@@ -42,7 +42,8 @@ void Simulation::init_pop_arrays() {
|
||||
for (int i = 0; i<number_pop_species; i++) {
|
||||
pop_species[i] = all_species[i];
|
||||
population = populations->find(pop_species[i]);
|
||||
pop_array_lengths[i] = population->get_array_length();
|
||||
|
||||
pop_array_lengths[i] = population->access_container()->data_size;
|
||||
global_cum_time_s[i] = new double[pop_array_lengths[i]];
|
||||
global_offset[i] = new double[pop_array_lengths[i]];
|
||||
for (int j = 0; j<pop_array_lengths[i]; j++) {
|
||||
@@ -180,14 +181,14 @@ void Simulation::sync_cpus() {
|
||||
|
||||
void Simulation::sync_populations() {
|
||||
Population_Manager *populations = looper.get_populations();
|
||||
Population_Base *population;
|
||||
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++) {
|
||||
population = populations->find(pop_species[i]);
|
||||
container = populations->find(pop_species[i])->access_container();
|
||||
array_length = pop_array_lengths[i];
|
||||
if (array_length == 0) {
|
||||
continue;
|
||||
@@ -198,8 +199,8 @@ void Simulation::sync_populations() {
|
||||
local_delta_offset = new double[array_length];
|
||||
|
||||
for (int j = 0; j<array_length; j++) {
|
||||
local_delta_cumulated_time_s[j] = population->get_cumulated_time_s_array()[j] - global_cum_time_s[i][j];
|
||||
local_delta_offset[j] = population->get_offset_array()[j] - global_offset[i][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);
|
||||
@@ -208,8 +209,8 @@ void Simulation::sync_populations() {
|
||||
for (int j = 0; j<pop_array_lengths[i]; j++) {
|
||||
global_cum_time_s[i][j] += global_delta_cumulated_time_s[j];
|
||||
global_offset[i][j] += global_delta_offset[j];
|
||||
population->get_cumulated_time_s_array()[j] = global_cum_time_s[i][j];
|
||||
population->get_offset_array()[j] = global_offset[i][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;
|
||||
|
||||
Reference in New Issue
Block a user