From 0c0e7cb7e08abcee050f74c3d804bea7de6b5502 Mon Sep 17 00:00:00 2001 From: Andreas Gattringer <andreas.gattringer@univie.ac.at> Date: Sat, 24 Jun 2023 10:45:40 +0200 Subject: [PATCH] butterflies: simply grid pre-processing --- .../butterflies/butterflies_generations.c | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/src/modules/butterflies/butterflies_generations.c b/src/modules/butterflies/butterflies_generations.c index 8252f0c..54a6b5d 100644 --- a/src/modules/butterflies/butterflies_generations.c +++ b/src/modules/butterflies/butterflies_generations.c @@ -21,18 +21,28 @@ void bf_area_generation_update(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; - cats_dt_rates ot = grid->param.OT; - bool hybrid = grid->param.parametrization == PARAM_HYBRID; + const cats_dt_rates ot = grid->param.OT; for (cats_dt_coord row = start_row; row < end_row; row++) { for (cats_dt_coord col = start_col; col < end_col; col++) { - bool suitability_to_low = false; - if (hybrid && get_suitability(grid, row, col) < ot) suitability_to_low = true; - if (cell_excluded_by_overlay(conf, row, col) - || ! (data->info_layer[row][col] & BF_CELL_VALID_DISPERSAL_TARGET) - || suitability_to_low == true) { + if (get_suitability(grid, row, col) < ot) + { + data->eggs[row][col] = 0.0f; + data->generations[row][col] = 0.0f; + set_population_ignore_cc(grid, row, col, 0); + continue; + } + + if (cell_excluded_by_overlay(conf, row, col)) { + data->eggs[row][col] = 0.0f; + data->generations[row][col] = 0.0f; + set_population_ignore_cc(grid, row, col, 0); + continue; + } + + if ( ! (data->info_layer[row][col] & BF_CELL_VALID_DISPERSAL_TARGET)){ data->eggs[row][col] = 0.0f; data->generations[row][col] = 0.0f; set_population_ignore_cc(grid, row, col, 0); -- GitLab