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

butterflies: renamed debug variables and improved rw debug output

parent 81e4eb78
No related branches found
No related tags found
No related merge requests found
......@@ -98,7 +98,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_adults_present = 0;
ts->rw_debug_cells_with_adults = 0;
for (cats_dt_coord row = start_row; row < end_row; row++) {
for (cats_dt_coord col = start_col; col < end_col; col++) {
......@@ -122,9 +122,9 @@ 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_adults_present = 0;
ts->temp1 = 0;
ts->temp2 = 0;
ts->rw_debug_cells_with_adults = 0;
ts->rw_debug_random_walks = 0;
ts->rw_debug_deposits = 0;
for (cats_dt_coord row = start_row; row < end_row; row++) {
......@@ -138,7 +138,10 @@ void butterflies_area_dispersal(struct cats_grid *grid, struct cats_thread_info
butterflies_cell_dispersal(grid, ts, row, col, false);
}
}
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);
if (ts->rw_debug_cells_with_adults) {
printf("thread %d: %ld cells with adults, %ld random walks, %ld deposits\n",
ts->id, ts->rw_debug_cells_with_adults, ts->rw_debug_random_walks, ts->rw_debug_deposits);
}
}
......
......@@ -91,7 +91,7 @@ static void inline single_random_walk(struct cats_thread_info *ts, struct cats_g
eggs_left -= eggs_to_deposit;
data->eggs[row][col] += (float) eggs_to_deposit;
ts->temp2++;
ts->rw_debug_deposits++;
if (debug_rw) {
fprintf(module_conf->debug_rw_file, "%d,%d,%d,%d,%d,%d,%d\n", rw_num, row, col, step + 1,
module_conf->animal_dispersal_max_radius - step - 1, eggs_to_deposit, eggs_left);
......@@ -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_adults_present++;
ts->rw_debug_cells_with_adults++;
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
......@@ -230,7 +230,7 @@ butterflies_cell_dispersal(struct cats_grid *grid, struct cats_thread_info *ts,
single_random_walk(ts, grid, row, col, eggs_to_disperse_per_female, egg_fraction_step, rw_number);
ts->temp1++;
ts->rw_debug_random_walks++;
}
if (debug_rw) {
fflush(module_conf->debug_rw_file);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment