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
72095038
Commit
72095038
authored
1 year ago
by
Andreas Gattringer
Browse files
Options
Downloads
Patches
Plain Diff
butterflies: renamed debug variables and improved rw debug output
parent
81e4eb78
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_actions.c
+8
-5
8 additions, 5 deletions
src/modules/butterflies/butterflies_actions.c
src/modules/butterflies/butterflies_dispersal.c
+3
-3
3 additions, 3 deletions
src/modules/butterflies/butterflies_dispersal.c
with
11 additions
and
8 deletions
src/modules/butterflies/butterflies_actions.c
+
8
−
5
View file @
72095038
...
...
@@ -98,7 +98,7 @@ void grid_butterflies_maturation(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
;
ts
->
temp_adults_present
=
0
;
ts
->
rw_debug_cells_with_adults
=
0
;
for
(
cats_dt_coord
row
=
start_row
;
row
<
end_row
;
row
++
)
{
for
(
cats_dt_coord
col
=
start_col
;
col
<
end_col
;
col
++
)
{
...
...
@@ -122,9 +122,9 @@ void butterflies_area_dispersal(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
;
ts
->
temp_adults_present
=
0
;
ts
->
temp1
=
0
;
ts
->
temp2
=
0
;
ts
->
rw_debug_cells_with_adults
=
0
;
ts
->
rw_debug_random_walks
=
0
;
ts
->
rw_debug_deposits
=
0
;
for
(
cats_dt_coord
row
=
start_row
;
row
<
end_row
;
row
++
)
{
...
...
@@ -138,7 +138,10 @@ void butterflies_area_dispersal(struct cats_grid *grid, struct cats_thread_info
butterflies_cell_dispersal
(
grid
,
ts
,
row
,
col
,
false
);
}
}
if
(
ts
->
temp_adults_present
)
printf
(
"thread %d: %ld random walks (%ld cells) avg %f
\n
"
,
ts
->
id
,
ts
->
temp_adults_present
,
ts
->
temp1
,
(
float
)
ts
->
temp_adults_present
/
(
float
)
ts
->
temp1
);
if
(
ts
->
rw_debug_cells_with_adults
)
{
printf
(
"thread %d: %ld cells with adults, %ld random walks, %ld deposits
\n
"
,
ts
->
id
,
ts
->
rw_debug_cells_with_adults
,
ts
->
rw_debug_random_walks
,
ts
->
rw_debug_deposits
);
}
}
...
...
This diff is collapsed.
Click to expand it.
src/modules/butterflies/butterflies_dispersal.c
+
3
−
3
View file @
72095038
...
...
@@ -91,7 +91,7 @@ static void inline single_random_walk(struct cats_thread_info *ts, struct cats_g
eggs_left
-=
eggs_to_deposit
;
data
->
eggs
[
row
][
col
]
+=
(
float
)
eggs_to_deposit
;
ts
->
temp2
++
;
ts
->
rw_debug_deposits
++
;
if
(
debug_rw
)
{
fprintf
(
module_conf
->
debug_rw_file
,
"%d,%d,%d,%d,%d,%d,%d
\n
"
,
rw_num
,
row
,
col
,
step
+
1
,
module_conf
->
animal_dispersal_max_radius
-
step
-
1
,
eggs_to_deposit
,
eggs_left
);
...
...
@@ -119,7 +119,7 @@ butterflies_cell_dispersal(struct cats_grid *grid, struct cats_thread_info *ts,
// total adults: the number of adults that became adult in this cell, possibly exceeding the carrying capacity (thanks to poisson processes)
const
cats_dt_population
total_adults
=
get_adult_population
(
grid
,
row
,
col
);
if
(
total_adults
==
0
)
return
;
ts
->
temp_adults_present
++
;
ts
->
rw_debug_cells_with_adults
++
;
struct
conf_data_butterflies
*
module_conf
=
CATS_MODULE_DATA
;
// total females: how many of the total adults are female, as drawn from a binomial distribution with p = 0.5
// can be safely cast, because gsl_ran_binomial will return a number <= total_adults
...
...
@@ -230,7 +230,7 @@ butterflies_cell_dispersal(struct cats_grid *grid, struct cats_thread_info *ts,
single_random_walk
(
ts
,
grid
,
row
,
col
,
eggs_to_disperse_per_female
,
egg_fraction_step
,
rw_number
);
ts
->
temp1
++
;
ts
->
rw_debug_random_walks
++
;
}
if
(
debug_rw
)
{
fflush
(
module_conf
->
debug_rw_file
);
...
...
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