From 3ff8279c44ceaba8fc6246c0c8d9c11ad37eec7f Mon Sep 17 00:00:00 2001 From: Andreas Gattringer <gattringera@a772-cvl-ws23.biodiv.univie.ac.at> Date: Wed, 28 Jun 2023 13:30:32 +0200 Subject: [PATCH] butterflies: print egg counts after overlay update --- src/modules/butterflies/butterflies_overlays.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/modules/butterflies/butterflies_overlays.c b/src/modules/butterflies/butterflies_overlays.c index 4e36332..2f218bb 100644 --- a/src/modules/butterflies/butterflies_overlays.c +++ b/src/modules/butterflies/butterflies_overlays.c @@ -63,7 +63,22 @@ enum action_status bf_grid_overlay_update(const struct cats_configuration *conf, } } } + + int64_t cells_with_eggs = 0; + double total_eggs = 0; + for (cats_dt_coord row = 0; row < rows; row++) { + for (cats_dt_coord col = 0; col < cols; col++) { + float eggs = data->eggs[row][col]; + if (eggs > 0) { + cells_with_eggs += 1; + total_eggs += eggs; + } + + } + } + log_message(LOG_INFO, "Overlay update: %ld excluded, %ld habitat ok, %ld resource ok, %ld habitat + resource ok", cells_excluded, cells_habitat_ok, cells_resource_ok, cells_habitat_and_resource_ok); + log_message(LOG_INFO, "Overlay update %ld cells with eggs, total %f eggs, average %f eggs per cell", cells_with_eggs, total_eggs, total_eggs/(float) cells_with_eggs); return ACTION_RUN; } -- GitLab