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

butterflies: use carrying capacity for now

parent 05664285
No related branches found
No related tags found
No related merge requests found
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "butterflies_inline.h" #include "butterflies_inline.h"
#include "inline_population.h" #include "inline_population.h"
#include "inline.h" #include "inline.h"
#include "populations/population.h"
cats_dt_rates bf_egg_to_adult_survival_rate(cats_dt_rates adults_per_female, cats_dt_rates max_eggs) cats_dt_rates bf_egg_to_adult_survival_rate(cats_dt_rates adults_per_female, cats_dt_rates max_eggs)
...@@ -47,7 +48,7 @@ void bf_cell_maturation(struct cats_grid *grid, struct cats_thread_info *ts, cat ...@@ -47,7 +48,7 @@ void bf_cell_maturation(struct cats_grid *grid, struct cats_thread_info *ts, cat
} }
//int orig_eggs = data->eggs[row][col]; //int orig_eggs = data->eggs[row][col];
// the number of generations per cell is usually not an integer value // the number of generations per cell is usually not an integer value
// the non-integer part of the number of generations is used in the generation which is // the non-integer part of the number of generations is used in the generation which is
// one greater than the integer part of the number of generations // one greater than the integer part of the number of generations
...@@ -72,7 +73,7 @@ void bf_cell_maturation(struct cats_grid *grid, struct cats_thread_info *ts, cat ...@@ -72,7 +73,7 @@ void bf_cell_maturation(struct cats_grid *grid, struct cats_thread_info *ts, cat
assert(this_generation_fraction <= 1.0); assert(this_generation_fraction <= 1.0);
} }
cats_dt_population max_cc = (cats_dt_population) grid->param.carrying_capacity.max_rate; //cats_dt_population max_cc = (cats_dt_population) grid->param.carrying_capacity.max_rate;
float eggs = this_generation_fraction * data->eggs[row][col]; float eggs = this_generation_fraction * data->eggs[row][col];
if (eggs > data->eggs[row][col]) { if (eggs > data->eggs[row][col]) {
...@@ -95,16 +96,18 @@ void bf_cell_maturation(struct cats_grid *grid, struct cats_thread_info *ts, cat ...@@ -95,16 +96,18 @@ void bf_cell_maturation(struct cats_grid *grid, struct cats_thread_info *ts, cat
cats_dt_rates survival = bf_egg_to_adult_survival_rate(adults_per_female, max_eggs); cats_dt_rates survival = bf_egg_to_adult_survival_rate(adults_per_female, max_eggs);
cats_dt_population adults = poisson(ts->rng, eggs * survival); cats_dt_population adults = poisson(ts->rng, eggs * survival);
assert(adults >= 0); assert(adults >= 0);
cats_dt_environment suit = get_suitability(grid, row, col); //cats_dt_environment suit = get_suitability(grid, row, col);
//printf("ABCD,%d,%d,%0.3f\n", (int) orig_eggs, adults, suit); //printf("ABCD,%d,%d,%0.3f\n", (int) orig_eggs, adults, suit);
set_population_ignore_cc(grid, row, col, adults);
set_population(grid, row, col, adults);
/*
if (adults > max_cc * 10) { if (adults > max_cc * 10) {
log_message(LOG_ERROR, "row %d col %d: number of adults %d exceeds %d time smaximum carrying capacity %d (maturation %Lf, eggs %f, max adults per f %Lf), suit %f, OT %Lf, survival %Lf", row, col, adults, 10, max_cc, log_message(LOG_ERROR, "row %d col %d: number of adults %d exceeds %d time smaximum carrying capacity %d (maturation %Lf, eggs %f, max adults per f %Lf), suit %f, OT %Lf, survival %Lf", row, col, adults, 10, max_cc,
survival, eggs, module_conf->adults_per_female.max_rate, suit, grid->param.OT, survival); survival, eggs, module_conf->adults_per_female.max_rate, suit, grid->param.OT, survival);
exit_cats(EXIT_FAILURE); 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