Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SWIFT
SWIFTsim
Commits
4feef166
Commit
4feef166
authored
Nov 13, 2018
by
Matthieu Schaller
Browse files
Added counter of total number of particles in the cells not just counter of the real ones.
parent
48f5ecb7
Changes
6
Hide whitespace changes
Inline
Side-by-side
src/cell.c
View file @
4feef166
...
...
@@ -967,6 +967,7 @@ void cell_split(struct cell *c, ptrdiff_t parts_offset, ptrdiff_t sparts_offset,
/* Store the counts and offsets. */
for
(
int
k
=
0
;
k
<
8
;
k
++
)
{
c
->
progeny
[
k
]
->
hydro
.
count
=
bucket_count
[
k
];
c
->
progeny
[
k
]
->
hydro
.
count_total
=
c
->
progeny
[
k
]
->
hydro
.
count
;
c
->
progeny
[
k
]
->
hydro
.
parts
=
&
c
->
hydro
.
parts
[
bucket_offset
[
k
]];
c
->
progeny
[
k
]
->
hydro
.
xparts
=
&
c
->
hydro
.
xparts
[
bucket_offset
[
k
]];
}
...
...
@@ -1084,6 +1085,7 @@ void cell_split(struct cell *c, ptrdiff_t parts_offset, ptrdiff_t sparts_offset,
/* Store the counts and offsets. */
for
(
int
k
=
0
;
k
<
8
;
k
++
)
{
c
->
progeny
[
k
]
->
stars
.
count
=
bucket_count
[
k
];
c
->
progeny
[
k
]
->
stars
.
count_total
=
c
->
progeny
[
k
]
->
stars
.
count
;
c
->
progeny
[
k
]
->
stars
.
parts
=
&
c
->
stars
.
parts
[
bucket_offset
[
k
]];
}
...
...
@@ -1146,6 +1148,7 @@ void cell_split(struct cell *c, ptrdiff_t parts_offset, ptrdiff_t sparts_offset,
/* Store the counts and offsets. */
for
(
int
k
=
0
;
k
<
8
;
k
++
)
{
c
->
progeny
[
k
]
->
grav
.
count
=
bucket_count
[
k
];
c
->
progeny
[
k
]
->
grav
.
count_total
=
c
->
progeny
[
k
]
->
grav
.
count
;
c
->
progeny
[
k
]
->
grav
.
parts
=
&
c
->
grav
.
parts
[
bucket_offset
[
k
]];
}
}
...
...
@@ -3645,7 +3648,22 @@ void cell_check_timesteps(struct cell *c) {
#endif
}
void
cell_add_spart
(
const
struct
engine
*
e
,
struct
cell
*
c
)
{}
void
cell_add_spart
(
const
struct
engine
*
e
,
struct
cell
*
c
)
{
if
(
c
->
nodeID
!=
engine_rank
)
error
(
"Adding spart on a foreign node"
);
/* Get the top-level this leaf cell is in */
struct
cell
*
top
=
c
;
while
(
top
->
parent
!=
NULL
)
top
=
top
->
parent
;
#ifdef SWIFT_DEBUG_CHECKS
if
(
top
->
depth
!=
0
)
error
(
"Cell-linking issue"
);
#endif
/* Are there any extra particles left? */
if
(
top
->
stars
.
count
==
top
->
stars
.
count_total
)
error
(
"We ran out of star particles!"
);
}
/**
* @brief "Remove" a gas particle from the calculation.
...
...
src/cell.h
View file @
4feef166
...
...
@@ -312,6 +312,9 @@ struct cell {
/*! Nr of #part in this cell. */
int
count
;
/*! Nr of #part this cell can hold after addition of new #part. */
int
count_total
;
/*! Number of #part updated in this cell. */
int
updated
;
...
...
@@ -339,7 +342,7 @@ struct cell {
/*! Do any of this cell's sub-cells need to be sorted? */
char
do_sub_sort
;
#ifdef SWIFT_DEBUG_CHECKS
#ifdef SWIFT_DEBUG_CHECKS
/*! Last (integer) time the cell's sort arrays were updated. */
integertime_t
ti_sort
;
...
...
@@ -416,6 +419,9 @@ struct cell {
/*! Nr of #gpart in this cell. */
int
count
;
/*! Nr of #gpart this cell can hold after addition of new #gpart. */
int
count_total
;
/*! Number of #gpart updated in this cell. */
int
updated
;
...
...
@@ -659,6 +665,7 @@ void cell_activate_sorts(struct cell *c, int sid, struct scheduler *s);
void
cell_clear_drift_flags
(
struct
cell
*
c
,
void
*
data
);
void
cell_set_super_mapper
(
void
*
map_data
,
int
num_elements
,
void
*
extra_data
);
int
cell_has_tasks
(
struct
cell
*
c
);
void
cell_add_spart
(
const
struct
engine
*
e
,
struct
cell
*
c
);
void
cell_remove_part
(
const
struct
engine
*
e
,
struct
cell
*
c
,
struct
part
*
p
,
struct
xpart
*
xp
);
void
cell_remove_gpart
(
const
struct
engine
*
e
,
struct
cell
*
c
,
...
...
src/runner.c
View file @
4feef166
...
...
@@ -525,6 +525,7 @@ void runner_do_star_formation(struct runner *r, struct cell *c, int timer) {
if
(
rho
>
1.5e7
&&
e
->
step
>
2
)
{
message
(
"Removing particle id=%lld rho=%e"
,
p
->
id
,
rho
);
cell_convert_part_to_gpart
(
e
,
c
,
p
,
xp
);
cell_add_spart
(
e
,
c
);
}
}
}
...
...
src/space.c
View file @
4feef166
...
...
@@ -194,12 +194,15 @@ void space_rebuild_recycle_mapper(void *map_data, int num_elements,
c
->
stars
.
dx_max_part
=
0
.
f
;
c
->
hydro
.
sorted
=
0
;
c
->
hydro
.
count
=
0
;
c
->
hydro
.
count_total
=
0
;
c
->
hydro
.
updated
=
0
;
c
->
hydro
.
inhibited
=
0
;
c
->
grav
.
count
=
0
;
c
->
grav
.
count_total
=
0
;
c
->
grav
.
updated
=
0
;
c
->
grav
.
inhibited
=
0
;
c
->
stars
.
count
=
0
;
c
->
stars
.
count_total
=
0
;
c
->
stars
.
updated
=
0
;
c
->
stars
.
inhibited
=
0
;
c
->
grav
.
init
=
NULL
;
...
...
@@ -1522,10 +1525,15 @@ void space_rebuild(struct space *s, int repartitioned, int verbose) {
c
->
hydro
.
xparts
=
xfinger
;
c
->
grav
.
parts
=
gfinger
;
c
->
stars
.
parts
=
sfinger
;
finger
=
&
finger
[
c
->
hydro
.
count
+
space_extra_parts
];
xfinger
=
&
xfinger
[
c
->
hydro
.
count
+
space_extra_parts
];
gfinger
=
&
gfinger
[
c
->
grav
.
count
+
space_extra_gparts
];
sfinger
=
&
sfinger
[
c
->
stars
.
count
+
space_extra_sparts
];
c
->
hydro
.
count_total
=
c
->
hydro
.
count
+
space_extra_parts
;
c
->
grav
.
count_total
=
c
->
grav
.
count
+
space_extra_gparts
;
c
->
stars
.
count_total
=
c
->
stars
.
count
+
space_extra_sparts
;
finger
=
&
finger
[
c
->
hydro
.
count_total
];
xfinger
=
&
xfinger
[
c
->
hydro
.
count_total
];
gfinger
=
&
gfinger
[
c
->
grav
.
count_total
];
sfinger
=
&
sfinger
[
c
->
stars
.
count_total
];
/* Add this cell to the list of local cells */
s
->
local_cells_top
[
s
->
nr_local_cells
]
=
k
;
...
...
@@ -2616,6 +2624,9 @@ void space_split_recursive(struct space *s, struct cell *c,
cp
->
hydro
.
count
=
0
;
cp
->
grav
.
count
=
0
;
cp
->
stars
.
count
=
0
;
cp
->
hydro
.
count_total
=
0
;
cp
->
grav
.
count_total
=
0
;
cp
->
stars
.
count_total
=
0
;
cp
->
hydro
.
ti_old_part
=
c
->
hydro
.
ti_old_part
;
cp
->
grav
.
ti_old_part
=
c
->
grav
.
ti_old_part
;
cp
->
grav
.
ti_old_multipole
=
c
->
grav
.
ti_old_multipole
;
...
...
@@ -2821,6 +2832,8 @@ void space_split_recursive(struct space *s, struct cell *c,
/* parts: Get dt_min/dt_max and h_max. */
for
(
int
k
=
0
;
k
<
count
;
k
++
)
{
#ifdef SWIFT_DEBUG_CHECKS
if
(
parts
[
k
].
time_bin
==
time_bin_not_created
)
error
(
"Extra particle present in space_split()"
);
if
(
parts
[
k
].
time_bin
==
time_bin_inhibited
)
error
(
"Inhibited particle present in space_split()"
);
#endif
...
...
@@ -2839,6 +2852,8 @@ void space_split_recursive(struct space *s, struct cell *c,
/* gparts: Get dt_min/dt_max. */
for
(
int
k
=
0
;
k
<
gcount
;
k
++
)
{
#ifdef SWIFT_DEBUG_CHECKS
if
(
gparts
[
k
].
time_bin
==
time_bin_not_created
)
error
(
"Extra g-particle present in space_split()"
);
if
(
gparts
[
k
].
time_bin
==
time_bin_inhibited
)
error
(
"Inhibited g-particle present in space_split()"
);
#endif
...
...
@@ -2849,6 +2864,8 @@ void space_split_recursive(struct space *s, struct cell *c,
/* sparts: Get dt_min/dt_max */
for
(
int
k
=
0
;
k
<
scount
;
k
++
)
{
#ifdef SWIFT_DEBUG_CHECKS
if
(
sparts
[
k
].
time_bin
==
time_bin_not_created
)
error
(
"Extra s-particle present in space_split()"
);
if
(
sparts
[
k
].
time_bin
==
time_bin_inhibited
)
error
(
"Inhibited s-particle present in space_split()"
);
#endif
...
...
src/space.h
View file @
4feef166
...
...
@@ -44,8 +44,8 @@ struct cosmology;
#define space_cellallocchunk 1000
#define space_splitsize_default 400
#define space_maxsize_default 8000000
#define space_extra_parts_default
1
0
#define space_extra_gparts_default
3
0
#define space_extra_parts_default 0
#define space_extra_gparts_default 0
#define space_extra_sparts_default 20
#define space_expected_max_nr_strays_default 100
#define space_subsize_pair_hydro_default 256000000
...
...
src/task.c
View file @
4feef166
...
...
@@ -384,6 +384,7 @@ void task_unlock(struct task *t) {
cell_unlocktree
(
ci
);
cell_sunlocktree
(
ci
);
cell_gunlocktree
(
ci
);
break
;
default:
break
;
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment