From eae7c05ee014087e6773ab14af9d17061fc22287 Mon Sep 17 00:00:00 2001 From: Andreas Gattringer <gattringera@a772-cvl-ws23.biodiv.univie.ac.at> Date: Wed, 28 Jun 2023 14:55:24 +0200 Subject: [PATCH] butterflies: rename temporary variable --- src/cats/threading/threading-helpers.c | 2 +- src/cats/threading/threading.h | 2 +- src/modules/butterflies/butterflies_actions.c | 6 +++--- src/modules/butterflies/butterflies_dispersal.c | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/cats/threading/threading-helpers.c b/src/cats/threading/threading-helpers.c index d800900..cec0929 100644 --- a/src/cats/threading/threading-helpers.c +++ b/src/cats/threading/threading-helpers.c @@ -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); diff --git a/src/cats/threading/threading.h b/src/cats/threading/threading.h index c025c78..b701601 100644 --- a/src/cats/threading/threading.h +++ b/src/cats/threading/threading.h @@ -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; diff --git a/src/modules/butterflies/butterflies_actions.c b/src/modules/butterflies/butterflies_actions.c index 795eed9..cd3b954 100644 --- a/src/modules/butterflies/butterflies_actions.c +++ b/src/modules/butterflies/butterflies_actions.c @@ -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); } diff --git a/src/modules/butterflies/butterflies_dispersal.c b/src/modules/butterflies/butterflies_dispersal.c index 6cd1034..ec65d61 100644 --- a/src/modules/butterflies/butterflies_dispersal.c +++ b/src/modules/butterflies/butterflies_dispersal.c @@ -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 -- GitLab