Skip to content
Snippets Groups Projects
Commit eae7c05e authored by Andreas Gattringer's avatar Andreas Gattringer
Browse files

butterflies: rename temporary variable

parent d92bc441
No related branches found
No related tags found
No related merge requests found
......@@ -50,7 +50,7 @@ initialize_thread(struct cats_thread_info *thread, struct cats_grid *grid, struc
zero_statistics_stats(&thread->stats[i]);
}
thread->temp = 0;
thread->temp_adults_present = 0;
thread->temp1 = 0;
thread->temp2 = 0;
thread->seed = get_random_seed(false);
......
......@@ -50,7 +50,7 @@ struct cats_thread_info {
struct cats_configuration *conf;
gsl_rng *rng;
unsigned int rng_seed;
int64_t temp;
int64_t temp_adults_present;
int64_t temp1;
int64_t temp2;
char *rng_state_buffer;
......
......@@ -97,7 +97,7 @@ void grid_butterflies_maturation(struct cats_grid *grid, struct cats_thread_info
const cats_dt_coord start_col = ts->area.start_col;
const cats_dt_coord end_col = ts->area.end_col;
ts->temp = 0;
ts->temp_adults_present = 0;
for (cats_dt_coord row = start_row; row < end_row; row++) {
for (cats_dt_coord col = start_col; col < end_col; col++) {
......@@ -121,7 +121,7 @@ void butterflies_area_dispersal(struct cats_grid *grid, struct cats_thread_info
const cats_dt_coord start_col = ts->area.start_col;
const cats_dt_coord end_col = ts->area.end_col;
ts->temp = 0;
ts->temp_adults_present = 0;
ts->temp1 = 0;
ts->temp2 = 0;
......@@ -137,7 +137,7 @@ void butterflies_area_dispersal(struct cats_grid *grid, struct cats_thread_info
butterflies_cell_dispersal(grid, ts, row, col, false);
}
}
if (ts->temp) printf("thread %d: %ld random walks (%ld cells) avg %f\n", ts->id, ts->temp, ts->temp1, (float) ts->temp / (float) ts->temp1);
if (ts->temp_adults_present) printf("thread %d: %ld random walks (%ld cells) avg %f\n", ts->id, ts->temp_adults_present, ts->temp1, (float) ts->temp_adults_present / (float) ts->temp1);
}
......
......@@ -119,7 +119,7 @@ butterflies_cell_dispersal(struct cats_grid *grid, struct cats_thread_info *ts,
// total adults: the number of adults that became adult in this cell, possibly exceeding the carrying capacity (thanks to poisson processes)
const cats_dt_population total_adults = get_adult_population(grid, row, col);
if (total_adults == 0) return;
ts->temp++;
ts->temp_adults_present++;
struct conf_data_butterflies *module_conf = CATS_MODULE_DATA;
// total females: how many of the total adults are female, as drawn from a binomial distribution with p = 0.5
// can be safely cast, because gsl_ran_binomial will return a number <= total_adults
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment