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

butterflies: use correct suitability threshold

parent 63212176
No related branches found
No related tags found
No related merge requests found
......@@ -22,7 +22,7 @@ void bf_area_generation_update(struct cats_grid *grid, struct cats_thread_info *
const cats_dt_coord end_col = ts->area.end_col;
struct statistics *stats = &ts->stats[grid->id];
const cats_dt_rates ot = grid->param.OT;
const cats_dt_rates suit_ts = module_conf->butterfly_generations.suitability_cutoff;
const int64_t egg_cells_id = module_conf->stat_ids[BF_CELLS_WITH_EGGS];
const int64_t egg_cells_removed_id = module_conf->stat_ids[BF_CELLS_WITH_EGGS];
......@@ -32,13 +32,12 @@ void bf_area_generation_update(struct cats_grid *grid, struct cats_thread_info *
for (cats_dt_coord row = start_row; row < end_row; row++) {
for (cats_dt_coord col = start_col; col < end_col; col++) {
if (get_suitability(grid, row, col) < ot)
if (get_suitability(grid, row, col) < suit_ts)
{
if (data->eggs[row][col] > 0) cells_with_eggs_removed += 1;
data->eggs[row][col] = 0.0f;
data->generations[row][col] = 0.0f;
set_population_ignore_cc(grid, row, col, 0);
continue;
}
......
......@@ -107,6 +107,7 @@ void bf_cell_maturation(struct cats_grid *grid, struct cats_thread_info *ts, cat
const int module_id = CATS_MODULE_ID;
struct grid_data_butterflies *data = grid->grid_modules[module_id].module_data;
if (data->eggs[row][col] == 0) return;
if (data->eggs[row][col] < 0) {
log_message(LOG_ERROR, "Number of eggs < 0: row %d col %d: %f", row, col, data->eggs[row][col]);
......@@ -156,8 +157,9 @@ void bf_cell_maturation(struct cats_grid *grid, struct cats_thread_info *ts, cat
cats_dt_environment suit = get_suitability(grid, row, col);
cats_dt_rates reproduction_rate = calculate_rate(&module_conf->reproduction_rate, NAN, &grid->param,
grid, row, col, NULL);
if (suit < grid->param.OT && reproduction_rate > 0) {
log_message(LOG_ERROR, "Suitability %f under OT %Lf, but adults per female = %Lf", suit, grid->param.OT,
cats_dt_rates suit_ts = module_conf->reproduction_rate.suitability_cutoff;
if (suit_ts < grid->param.OT && reproduction_rate > 0) {
log_message(LOG_ERROR, "Suitability %f under threshold %Lf, but adults per female = %Lf", suit, suit_ts,
reproduction_rate);
exit_cats(EXIT_FAILURE);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment