Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cats
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
BDC
cats
Commits
6afe1cb0
Commit
6afe1cb0
authored
1 year ago
by
Andreas Gattringer
Browse files
Options
Downloads
Patches
Plain Diff
butterflies: use correct suitability threshold
parent
63212176
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/modules/butterflies/butterflies_generations.c
+2
-3
2 additions, 3 deletions
src/modules/butterflies/butterflies_generations.c
src/modules/butterflies/butterflies_populations.c
+4
-2
4 additions, 2 deletions
src/modules/butterflies/butterflies_populations.c
with
6 additions
and
5 deletions
src/modules/butterflies/butterflies_generations.c
+
2
−
3
View file @
6afe1cb0
...
...
@@ -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
.
0
f
;
data
->
generations
[
row
][
col
]
=
0
.
0
f
;
set_population_ignore_cc
(
grid
,
row
,
col
,
0
);
continue
;
}
...
...
This diff is collapsed.
Click to expand it.
src/modules/butterflies/butterflies_populations.c
+
4
−
2
View file @
6afe1cb0
...
...
@@ -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
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment