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
ebf2c31f
Commit
ebf2c31f
authored
Aug 30, 2016
by
Matthieu Schaller
Browse files
Only relink parts and gparts when we actually have parts and gparts
parent
b0a9dbfa
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/cell.c
View file @
ebf2c31f
...
...
@@ -580,7 +580,7 @@ void cell_split(struct cell *c, ptrdiff_t parts_offset) {
}
/* Re-link the gparts. */
part_relink_gparts
(
parts
,
count
,
parts_offset
);
if
(
count
>
0
&&
gcount
>
0
)
part_relink_gparts
(
parts
,
count
,
parts_offset
);
#ifdef SWIFT_DEBUG_CHECKS
/* Verify that _all_ the parts have been assigned to a cell. */
...
...
@@ -675,7 +675,8 @@ void cell_split(struct cell *c, ptrdiff_t parts_offset) {
}
/* Re-link the parts. */
part_relink_parts
(
gparts
,
gcount
,
parts
-
parts_offset
);
if
(
count
>
0
&&
gcount
>
0
)
part_relink_parts
(
gparts
,
gcount
,
parts
-
parts_offset
);
}
/**
...
...
src/engine.c
View file @
ebf2c31f
...
...
@@ -2936,7 +2936,8 @@ void engine_split(struct engine *e, struct partition *initial_partition) {
s
->
xparts
=
xparts_new
;
/* Re-link the gparts. */
part_relink_gparts
(
s
->
parts
,
s
->
nr_parts
,
0
);
if
(
s
->
nr_parts
>
0
&&
s
->
nr_gparts
>
0
)
part_relink_gparts
(
s
->
parts
,
s
->
nr_parts
,
0
);
/* Re-allocate the local gparts. */
if
(
e
->
verbose
)
...
...
@@ -2952,7 +2953,8 @@ void engine_split(struct engine *e, struct partition *initial_partition) {
s
->
gparts
=
gparts_new
;
/* Re-link the parts. */
part_relink_parts
(
s
->
gparts
,
s
->
nr_gparts
,
s
->
parts
);
if
(
s
->
nr_parts
>
0
&&
s
->
nr_gparts
>
0
)
part_relink_parts
(
s
->
gparts
,
s
->
nr_gparts
,
s
->
parts
);
#ifdef SWIFT_DEBUG_CHECKS
...
...
src/space.c
View file @
ebf2c31f
...
...
@@ -565,7 +565,7 @@ void space_rebuild(struct space *s, double cell_max, int verbose) {
space_parts_sort
(
s
,
ind
,
nr_parts
,
0
,
s
->
nr_cells
-
1
,
verbose
);
/* Re-link the gparts. */
part_relink_gparts
(
s
->
parts
,
nr_parts
,
0
);
if
(
nr_parts
>
0
&&
nr_gparts
>
0
)
part_relink_gparts
(
s
->
parts
,
nr_parts
,
0
);
#ifdef SWIFT_DEBUG_CHECKS
/* Verify space_sort_struct. */
...
...
@@ -613,7 +613,8 @@ void space_rebuild(struct space *s, double cell_max, int verbose) {
space_gparts_sort
(
s
,
gind
,
nr_gparts
,
0
,
s
->
nr_cells
-
1
,
verbose
);
/* Re-link the parts. */
part_relink_parts
(
s
->
gparts
,
nr_gparts
,
s
->
parts
);
if
(
nr_parts
>
0
&&
nr_gparts
>
0
)
part_relink_parts
(
s
->
gparts
,
nr_gparts
,
s
->
parts
);
/* We no longer need the indices as of here. */
free
(
gind
);
...
...
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