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
35673704
Commit
35673704
authored
Apr 14, 2016
by
Peter W. Draper
Browse files
Don't attempt to reference dest[0] when there are no SPH parts
parent
eec0c68b
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/engine.c
View file @
35673704
...
...
@@ -232,27 +232,29 @@ void engine_redistribute(struct engine *e) {
space_parts_sort
(
s
,
dest
,
s
->
nr_parts
,
0
,
nr_nodes
-
1
,
e
->
verbose
);
/* We need to re-link the gpart partners of parts. */
int
current_dest
=
dest
[
0
];
size_t
count_this_dest
=
0
;
for
(
size_t
k
=
0
;
k
<
s
->
nr_parts
;
++
k
)
{
if
(
s
->
parts
[
k
].
gpart
!=
NULL
)
{
if
(
s
->
nr_parts
>
0
)
{
int
current_dest
=
dest
[
0
];
size_t
count_this_dest
=
0
;
for
(
size_t
k
=
0
;
k
<
s
->
nr_parts
;
++
k
)
{
if
(
s
->
parts
[
k
].
gpart
!=
NULL
)
{
/* As the addresses will be invalidated by the communications, we will */
/* instead store the absolute index from the start of the sub-array */
/* of particles to be sent to a given node. */
/* Recall that gparts without partners have a negative id. */
/* We will restore the pointers on the receiving node later on. */
if
(
dest
[
k
]
!=
current_dest
)
{
current_dest
=
dest
[
k
];
count_this_dest
=
0
;
}
/* As the addresses will be invalidated by the communications, we will */
/* instead store the absolute index from the start of the sub-array */
/* of particles to be sent to a given node. */
/* Recall that gparts without partners have a negative id. */
/* We will restore the pointers on the receiving node later on. */
if
(
dest
[
k
]
!=
current_dest
)
{
current_dest
=
dest
[
k
];
count_this_dest
=
0
;
}
/* Debug */
/* if(s->parts[k].gpart->id < 0) */
/*
error("Trying to link a partnerless gpart !"); */
/* Debug */
/* if(s->parts[k].gpart->id < 0) */
/*
error("Trying to link a partnerless gpart !"); */
s
->
parts
[
k
].
gpart
->
id
=
count_this_dest
;
count_this_dest
++
;
s
->
parts
[
k
].
gpart
->
id
=
count_this_dest
;
count_this_dest
++
;
}
}
}
...
...
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